Ethereal npc bug

05/14/2011 14:30 HerpDerpNigga#1
can someone tell me whats wrong with this npc,when I put 5 tortoise gems in the boxes it says i need 5 tortoise gems to make my item -3,but when I click Upgrade the tortoise gems wont remove / dissapear,and my - damage can be upgraded to infinity and I can get -99999.

note: i want it to remove the tortoise gems when I click Upgrade and the max - damage I want it to -7 max,i don't want it to go past -7. thanks

here is the npc: tell me what to remove / add

Code:
#region Ethereal
                case 35015:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("Heya! I'm the master of blessing gears, I can bless any of your ");
                                    dialog.Text("gears, except talismans and garments, and for that i'll charge ");
                                    dialog.Text("only some super TortoiseGems.");
                                    dialog.Link("Let's begin!", 1);
                                    dialog.Link("Let me think.", 255);
                                    dialog.Avatar(104);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    GeneralData oven = new GeneralData(true);
                                    oven.UID = client.Entity.UID;
                                    oven.ID = 126;
                                    oven.dwParam = 426;
                                    oven.wParam1 = client.Entity.X;
                                    oven.wParam2 = client.Entity.Y;
                                    oven.Send(client);
                                    break;
                                }
                            default:
                                {
                                    IConquerItem Item = client.Equipment.TryGetItem(npcRequest.OptionID);
                                    if (Item != null)
                                    {
                                        if (Item.ID > 0)
                                        {
                                            byte nUmber = 0;
                                            switch (Item.Bless)
                                            {
                                                case 0: nUmber = 5; break;
                                                case 1: nUmber = 1; break;
                                                case 3: nUmber = 3; break;
                                                case 5: nUmber = 5; break;
                                                default: nUmber = 0; break;
                                            }

                                            if (nUmber == 0)
                                            {
                                                dialog.Text("I can't upgrade this gear bless, sorry.");
                                                dialog.Link("I see, thanks.", 255);
                                                dialog.Avatar(104);
                                                dialog.Send();
                                                return;
                                            }

                                            if (!client.Agreed)
                                            {
                                                dialog.Text("Your item will need some super tortoises to get better, ");
                                                dialog.Text("I'll charge some " + nUmber + " super tortoises. Are you ready?");
                                                dialog.Link("Wow, good deal!", npcRequest.OptionID);
                                                dialog.Link("Let me think.", 255);
                                                dialog.Avatar(104);
                                                dialog.Send();
                                                client.Agreed = true;
                                                return;
                                            }

                                            if (client.Inventory.Contains(700073, nUmber))
                                            {
                                                client.Entity.ClientStats.AppendRemove(Item);
                                                client.Inventory.Remove(700073, nUmber);
                                                Item.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                                //if (Item.Bless < 7)
                                                if (Item.Bless == 0) Item.Bless = 1;
                                                else Item.Bless += 2;
                                                Item.Send(client);
                                                Item.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                                ConquerItemTable.UpdateItem(Item, client);
                                                client.Entity.ClientStats.AppendAddition(Item);
                                                client.Agreed = false;
                                            }
                                            else
                                            {
                                                dialog.Text("You don't have " + nUmber + " super tortoise gems!");
                                                dialog.Link("I'll be right back!", 255);
                                                dialog.Avatar(104);
                                                dialog.Send();
                                            }
                                        }
                                        else
                                        {
                                            dialog.Text("Please wear your gear first!");
                                            dialog.Link("I'll be right back!", 255);
                                            dialog.Avatar(104);
                                            dialog.Send();
                                        }
                                    }
                                    else
                                    {
                                        dialog.Text("Please wear your gear first!");
                                        dialog.Link("I'll be right back!", 255);
                                        dialog.Avatar(104);
                                        dialog.Send();
                                    }
                                    break;
                                }
                        }
                        break;
                    }
                #endregion
05/14/2011 14:36 pro4never#2
//if (Item.Bless < 7)

it's commented out and not doing anything extra so I'd just do

if(Item.Bless > 6)
return;

Personally the whole thing isn't that well coded (IE: why are you switching based on bless to pull a number... and then switching based on the number pulled lol)


IE...

switch(item.Bless)
{
case 0:
if(client.Inventory.Contains(700073, 5))
item.Bless = 1;
break;
case 1:
if(client.Inventory.Contains(700073,1))
item.Bless = 3;
break;
case 3:
if(client.Inventory.Contains(700073, 3))
item.bless = 5;
break;
case 5:
if(Client.Inventory.Contains(700073, 5))
item.bless = 7;
break;
}

That's all you'd need to do for the entire cost/modification stuff... add in the actual removal code and perhaps some nice output so the client knows what has happened but yah...
05/14/2011 15:15 HerpDerpNigga#3
didn't worked,still the same thing
look this is how i put the codes

Code:
                #region Ethereal
                case 35015:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("Heya! I'm the master of blessing gears, I can bless any of your ");
                                    dialog.Text("gears, except talismans and garments, and for that i'll charge ");
                                    dialog.Text("only some super TortoiseGems.");
                                    dialog.Link("Let's begin!", 1);
                                    dialog.Link("Let me think.", 255);
                                    dialog.Avatar(104);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    GeneralData oven = new GeneralData(true);
                                    oven.UID = client.Entity.UID;
                                    oven.ID = 126;
                                    oven.dwParam = 426;
                                    oven.wParam1 = client.Entity.X;
                                    oven.wParam2 = client.Entity.Y;
                                    oven.Send(client);
                                    break;
                                }
                            default:
                                {
                                    IConquerItem Item = client.Equipment.TryGetItem(npcRequest.OptionID);
                                    if (Item != null)
                                    {
                                        [COLOR="Red"]if (Item.Bless < 7)[/COLOR]
                                        if (Item.ID > 0)
                                        {
                                            byte nUmber = 0;
                                            switch (Item.Bless)
                                            [COLOR="#ff0000"]{
                                                case 0:
                                                    if (client.Inventory.Contains(700073, 5))
                                                        Item.Bless = 1;
                                                    break;
                                                case 1:
                                                    if (client.Inventory.Contains(700073, 1))
                                                        Item.Bless = 3;
                                                    break;
                                                case 3:
                                                    if (client.Inventory.Contains(700073, 3))
                                                        Item.Bless = 5;
                                                    break;
                                                case 5:
                                                    if (client.Inventory.Contains(700073, 5))
                                                        Item.Bless = 7;
                                                    break;
                                            }[/COLOR]

                                            if (nUmber == 0)
                                            {
                                                dialog.Text("I can't upgrade this gear bless, sorry.");
                                                dialog.Link("I see, thanks.", 255);
                                                dialog.Avatar(104);
                                                dialog.Send();
                                                return;
                                            }

                                            if (!client.Agreed)
                                            {
                                                dialog.Text("Your item will need some super tortoises to get better, ");
                                                dialog.Text("I'll charge some " + nUmber + " super tortoises. Are you ready?");
                                                dialog.Link("Wow, good deal!", npcRequest.OptionID);
                                                dialog.Link("Let me think.", 255);
                                                dialog.Avatar(104);
                                                dialog.Send();
                                                client.Agreed = true;
                                                return;
                                            }

                                            if (client.Inventory.Contains(700073, nUmber))
                                            {
                                                client.Entity.ClientStats.AppendRemove(Item);
                                                client.Inventory.Remove(700073, nUmber);
                                                Item.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                                //if (Item.Bless < 7)
                                                if (Item.Bless == 0) Item.Bless = 1;
                                                else Item.Bless += 2;
                                                Item.Send(client);
                                                Item.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                                ConquerItemTable.UpdateItem(Item, client);
                                                client.Entity.ClientStats.AppendAddition(Item);
                                                client.Agreed = false;
                                            }
                                            else
                                            {
                                                dialog.Text("You don't have " + nUmber + " super tortoise gems!");
                                                dialog.Link("I'll be right back!", 255);
                                                dialog.Avatar(104);
                                                dialog.Send();
                                            }
                                        }
                                        else
                                        {
                                            dialog.Text("Please wear your gear first!");
                                            dialog.Link("I'll be right back!", 255);
                                            dialog.Avatar(104);
                                            dialog.Send();
                                        }
                                    }
                                    else
                                    {
                                        dialog.Text("Please wear your gear first!");
                                        dialog.Link("I'll be right back!", 255);
                                        dialog.Avatar(104);
                                        dialog.Send();
                                    }
                                    break;
                                }
                        }
                        break;
                    }
                #endregion
05/14/2011 15:48 marlyandedsel#4
you have touch the dialog.cs in 12tails source right? I tell you try to look at the Packethandler.cs you will see on that ...
05/14/2011 16:23 pro4never#5
You're doing it wrong. What I was saying was just theory on how to re-write the entire npc.


The way he wrote it is just fine but personally I don't see why he splits things up so much.

The actual modifications are going on further in the actual script.
05/14/2011 18:15 12tails#6
did you check the packethandler??
tkx....

Code:
switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("Heya! I'm the master of blessing gears, I can bless any of your ");
                                    dialog.Text("gears, except talismans and garments, and for that i'll charge ");
                                    dialog.Text("only some super TortoiseGems.");
                                    dialog.Link("Let's begin!", 1);
                                    dialog.Link("Let me think.", 255);
                                    dialog.Avatar(104);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    GeneralData oven = new GeneralData(true);
                                    oven.UID = client.Entity.UID;
                                    oven.ID = 126;
                                    oven.dwParam = 426;
                                    oven.wParam1 = client.Entity.X;
                                    oven.wParam2 = client.Entity.Y;
                                    oven.Send(client);
                                    break;
                                }
i guess the linkback is sending it to a gui .... why are you trying to use the default??
05/14/2011 18:24 marlyandedsel#7
yes the link back sending to a gui.... thats why I tell him to check packethandler... because I that problem tooo I just put the condition if (Item.Bless < 7 ) but I know there is a good correction for that... because to take dmg -7 we should take 14 tortois but it only take 5 in mine.... 12tails/leo do you have fix for that please....
09/26/2013 12:37 Max-PaYne#8
Thank Man