[Release]adding npc giving +12 item

06/12/2009 01:34 olokorrmelo#16
its the same ID but All edit I Maked in the source didn't worked =/
06/12/2009 02:51 BlooD-BoY#17
Quote:
Originally Posted by olokorrmelo View Post
its the same ID but All edit I Maked in the source didn't worked =/
*ahem* rebuild the *solution each time you edit or add something >.<
06/24/2009 03:05 dextercsar#18
For what reason the npc name is Conductres?
Who i can change it?
Uff i am find the answer is simple the name of the npc are alowed in tqnpc if you want the name of npc copy the subtype id on the selected npc and change
In this case 280 is Conducttres but 9110 is mine Supervisor.
07/04/2009 07:06 Jay1029#19
Okay, I pasted the first code correctly. But where do i paste the second code? ^^ this-> public static void AddItem(int itemid, int bless, int dura, int enchant, int plus, int position, int soc1, int soc2, int color, ClientSocket CSocket)
{
Struct.ItemInfo Item = new Struct.ItemInfo();
if (dura == 255)
{
Item.Dura = Item.MaxDura;
}
else
{
Item.Dura = dura;
}
Item.Bless = bless;
Item.Enchant = enchant;
Item.ItemID = itemid;
Item.Plus = plus;
Item.Position = position;
Item.Soc1 = soc1;
Item.Soc2 = soc2;
Item.Color = color;
Item.UID = Nano.Rand.Next(1, 9999999);
bool created = Database.Database.NewItem(Item, CSocket);
while (!created)
{
Item.UID = Nano.Rand.Next(1, 9999999);
created = Database.Database.NewItem(Item, CSocket);
}

CSocket.Client.Inventory.Add(Item.UID, Item);
CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, Item.Bless, Item.Enchant, Item.Soc1, Item.Soc2, Item.Dura, Item.MaxDura, Item.Position, Item.Color));
}
08/09/2009 00:54 de_marvin#20
My first C# coding hope it won't give you any bugs else tell me.

I made CPAdmin and Milionaire Lee, i'm sorry if they are allready posted.

CPAdmin
Code:
                case 2071://CPAdmin
                    {
                        if (LinkBack == 0)
                        {
                            Text("Hello! I am the CP Admin, here you can trade your DragonBalls for CPs.", CSocket);
                            Text("Remember, you can exchange a DragonBall for 215 CPs, or exchange a", CSocket);
                            Text("DragonBall Scroll for 2150 CPs.", CSocket);
                            Link("Exchange a DBScroll", 1, CSocket);
                            Link("Exchange a DragonBall", 2, CSocket);
                            Link("I have nothing!", 255, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 1) //DBScroll
                        {
                            bool ContainItem = false;
                            foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
                            {
                                if (Item.ItemID == 720028) //DBScroll
                                {
                                    CSocket.Client.Inventory.Remove(Item.UID);//Remove
                                    CSocket.Send(ConquerPacket.ItemUsage(Item.UID, 255, Struct.ItemUsage.RemoveItem));
                                    Database.Database.DeleteItem(Item.UID);

                                    ContainItem = true;
                                    break;
                                }
                            }
                            if (ContainItem)
                            {                
                                CSocket.Client.CPs += 2150;//Add
                                CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.CPs, Struct.StatusTypes.InvCPoints));
                                Text("Here you go, 2150 CPs. Spend them well!", CSocket);
                                Link("I will, thanks!", 255, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Where is your DBScroll?", CSocket);
                                Link("Sorry, I have none.", 255, CSocket);
                                End(CSocket);
                            }

                        }
                        else if (LinkBack == 2) //DragonBall
                        {
                            bool ContainItem = false;
                            foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
                            {
                                if (Item.ItemID == 1088000) //DragonBall
                                {
                                    CSocket.Client.Inventory.Remove(Item.UID);//Remove
                                    CSocket.Send(ConquerPacket.ItemUsage(Item.UID, 255, Struct.ItemUsage.RemoveItem));
                                    Database.Database.DeleteItem(Item.UID);

                                    ContainItem = true;
                                    break;
                                }
                            }
                            if (ContainItem)
                            {
                                CSocket.Client.CPs += 215;//Add
                                CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.CPs, Struct.StatusTypes.InvCPoints));
                                Text("Here you go, 215 CPs. Spend them well!", CSocket);
                                Link("I will, thanks!", 255, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("You don't have any DragonBalls. Come Back when you get one.", CSocket);
                                Link("Sure, I will.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        break;
                    }
Put this part in the "Handlers/NpcTalk.cs" file

Milionaire Lee
Code:
                case 5004://Milionaire Lee (Meteors -> MeteorScroll / DragonBalls -> DBScroll)
                    {
                        if (LinkBack == 0)
                        {
                            Text("Hunting meteors and dagonballs is an exciting thing.", CSocket);
                            Text("However, they also pile up in your inventories.", CSocket);
                            Link("Agreed. How do you deal with it?", 1, CSocket);
                            Link("I am poor and do not have the problem.", 255, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 1)
                        {
                            Text("I can pack dragonballs and meteors for you. Give me 10 meteors or 10", CSocket);
                            Text("dragonballs. I will make it to a MeteorScroll or a DBScroll that occupies", CSocket);
                            Text("only one slot. Just right click on it, it will return 10 meteors or 10", CSocket);
                            Text("dragonballs again.", CSocket);
                            Link("Cool. Please pack my meteors.", 2, CSocket);
                            Link("Cool. Please pack my dragonballs.", 3, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 2)
                        {
                            int[] ContainItems = new int[10];
                            int Counter = 0; 
                            foreach (Struct.ItemInfo InvItem in CSocket.Client.Inventory.Values)
                            {
                                if (InvItem.ItemID == 1088001) //Meteor
                                {
                                    ContainItems[Counter] = InvItem.UID;
                                    Counter++;
                                    if (Counter == 10)
                                    {
                                        foreach (int UID in ContainItems)
                                        {
                                            CSocket.Client.Inventory.Remove(UID);//Remove
                                            CSocket.Send(ConquerPacket.ItemUsage(UID, 255, Struct.ItemUsage.RemoveItem));
                                            Database.Database.DeleteItem(UID);
                                        }

                                        Struct.ItemInfo Item = new Struct.ItemInfo();//MeteorScroll
                                        Item.Bless = 0;
                                        Item.Enchant = 0;
                                        Item.ItemID = 720027;
                                        Item.Plus = 0;
                                        Item.Position = 0;
                                        Item.Soc1 = 0;
                                        Item.Soc2 = 0;
                                        Item.Color = 0;
                                        Item.UID = Nano.Rand.Next(1, 9999999);
                                        bool created = Database.Database.NewItem(Item, CSocket);
                                        while (!created)
                                        {
                                            Item.UID = Nano.Rand.Next(1, 9999999);
                                            created = Database.Database.NewItem(Item, CSocket);
                                        }

                                        CSocket.Client.Inventory.Add(Item.UID, Item);
                                        CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, Item.Bless, Item.Enchant, Item.Soc1, Item.Soc2, Item.Dura, Item.MaxDura, Item.Position, Item.Color));
                                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Your meteors have been packed successfully.", Struct.ChatType.Top));
                                        break;
                                    }
                                }                               
                            }
                            if (Counter < 10)
                            {
                                Text("Sorry, you don't have 10 meteors.", CSocket);
                                Link("OK, I know.", 255, CSocket);
                                End(CSocket);
                            }                           
                        }
                        else if (LinkBack == 3)
                        {
                            int[] ContainItems = new int[10];
                            int Counter = 0;
                            foreach (Struct.ItemInfo ItemInv in CSocket.Client.Inventory.Values)
                            {
                                if (ItemInv.ItemID == 1088000) //DragonBall
                                {
                                    ContainItems[Counter] = ItemInv.UID;
                                    Counter++;
                                    if (Counter == 10)
                                    {
                                        foreach (int UID in ContainItems)
                                        {
                                            CSocket.Client.Inventory.Remove(UID);//Remove
                                            CSocket.Send(ConquerPacket.ItemUsage(UID, 255, Struct.ItemUsage.RemoveItem));
                                            Database.Database.DeleteItem(UID);
                                        }

                                        Struct.ItemInfo Item = new Struct.ItemInfo();//DBScroll
                                        Item.Bless = 0;
                                        Item.Enchant = 0;
                                        Item.ItemID = 720028;
                                        Item.Plus = 0;
                                        Item.Position = 0;
                                        Item.Soc1 = 0;
                                        Item.Soc2 = 0;
                                        Item.Color = 0;
                                        Item.UID = Nano.Rand.Next(1, 9999999);
                                        bool created = Database.Database.NewItem(Item, CSocket);
                                        while (!created)
                                        {
                                            Item.UID = Nano.Rand.Next(1, 9999999);
                                            created = Database.Database.NewItem(Item, CSocket);
                                        }

                                        CSocket.Client.Inventory.Add(Item.UID, Item);
                                        CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, Item.Bless, Item.Enchant, Item.Soc1, Item.Soc2, Item.Dura, Item.MaxDura, Item.Position, Item.Color));
                                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Your dragonballs have been packed successfully.", Struct.ChatType.Top));
                                        break;
                                    }
                                }
                            }
                            if (Counter < 10)
                            {
                                Text("Sorry, you don't have 10 dragonballs.", CSocket);
                                Link("OK, I know.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        break;
                    }
Put this part in the "Handlers/NpcTalk.cs" file.

Code:
case 720027://MeteorScoll
                    {
                        if (CSocket.Client.Inventory.Count <= 30)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                Struct.ItemInfo ItemScroll = new Struct.ItemInfo();//Meteor
                                ItemScroll.Bless = 0;
                                ItemScroll.Enchant = 0;
                                ItemScroll.ItemID = 1088001;
                                ItemScroll.Plus = 0;
                                ItemScroll.Position = 0;
                                ItemScroll.Soc1 = 0;
                                ItemScroll.Soc2 = 0;
                                ItemScroll.Color = 0;
                                ItemScroll.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(ItemScroll, CSocket);
                                while (!created)
                                {
                                    ItemScroll.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(ItemScroll, CSocket);
                                }

                                CSocket.Client.Inventory.Add(ItemScroll.UID, ItemScroll);
                                CSocket.Send(ConquerPacket.ItemInfo(ItemScroll.UID, ItemScroll.ItemID, ItemScroll.Plus, ItemScroll.Bless, ItemScroll.Enchant, ItemScroll.Soc1, ItemScroll.Soc2, ItemScroll.Dura, ItemScroll.MaxDura, ItemScroll.Position, ItemScroll.Color));
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You opened the MeteorScroll and get 10 Meteors.", Struct.ChatType.Top));
                            }
                        }
                        else
                        {
                            Delete = false;
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Your inventory is full.", Struct.ChatType.Top));
                        }
                        break;
                    }
                case 720028://DBScoll
                    {
                        if (CSocket.Client.Inventory.Count <= 30)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                Struct.ItemInfo ItemScroll = new Struct.ItemInfo();//DragonBall
                                ItemScroll.Bless = 0;
                                ItemScroll.Enchant = 0;
                                ItemScroll.ItemID = 1088000;
                                ItemScroll.Plus = 0;
                                ItemScroll.Position = 0;
                                ItemScroll.Soc1 = 0;
                                ItemScroll.Soc2 = 0;
                                ItemScroll.Color = 0;
                                ItemScroll.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(ItemScroll, CSocket);
                                while (!created)
                                {
                                    ItemScroll.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(ItemScroll, CSocket);
                                }

                                CSocket.Client.Inventory.Add(ItemScroll.UID, ItemScroll);
                                CSocket.Send(ConquerPacket.ItemInfo(ItemScroll.UID, ItemScroll.ItemID, ItemScroll.Plus, ItemScroll.Bless, ItemScroll.Enchant, ItemScroll.Soc1, ItemScroll.Soc2, ItemScroll.Dura, ItemScroll.MaxDura, ItemScroll.Position, ItemScroll.Color));
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You opened the DBScroll and get 10 DragonBalls.", Struct.ChatType.Top));
                            }
                        }
                        else
                        {
                            Delete = false;
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Your inventory is full.", Struct.ChatType.Top));
                        }
                        break;
                    }
Then add this in the "Handlers/UseItem.cs" file to make the MeteorScroll/DBScroll working.

Please thank if you used it, so i know my work is not done for nothing.

de_marvin