Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 22:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]Random NPCs for -impulse-'s source

Discussion on [Release]Random NPCs for -impulse-'s source within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
CIRASH's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 259
Received Thanks: 73
[Release]Random NPCs for -impulse-'s source

Hello, I will share with you a few NPCs I made for -impulse-'s source.

First is the SurgeonMiracle NPC to change size/gender for one dragonball.

In Dialogs.cs

Code:
                #region SurgeonMiracle
                case 111812:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("Do you want to have your size changed so that you can become much more");
                                    dialog.Text(" adorable? Now here is a precious chance for you.");
                                    dialog.Option("I want to change my size.", 1);
                                    dialog.Option("I want to change my gender.", 2);
                                    dialog.Option("I don't want to change.", 255);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    dialog.Text("If you pay me one dragonball, I can have your size changed. You will become");
                                    dialog.Text("more attractive and start a fresh life. By the way, to avoid some unexpected");
                                    dialog.Text("things, make sure you are not in any disguise form.");
                                    dialog.Option("Here is a dragonball.", 3);
                                    dialog.Option("I have no dragonball.", 255);
                                    dialog.Send();
                                    break;
                                }
                            case 2:
                                {
                                    dialog.Text("If you pay me one dragonball, I can have your gender changed. You will become");
                                    dialog.Text("more attractive and start a fresh life. By the way, to avoid some unexpected");
                                    dialog.Text("things, make sure you are not in any disguise form.");
                                    dialog.Option("Here is a dragonball.", 4);
                                    dialog.Option("I have no dragonball.", 255);
                                    dialog.Send();
                                    break;
                                }
                            case 3:
                                {
                                    if (client.Inventory.Contains(1088000, 1))
                                    {
                                        client.Inventory.Remove(1088000, 1);
                                        client.Equipment.Remove(9);
                                        int Model = (int)client.Entity.Body % 10;
                                        switch (Model)
                                        {
                                            case 2:
                                            case 4:
                                                client.Entity.Body--;
                                                break;
                                            case 1:
                                            case 3:
                                                client.Entity.Body++;
                                                break;
                                        }
                                        client.Send(new Message("Your size has been changed.", System.Drawing.Color.BurlyWood, Message.TopLeft));
                                        EntityTable.SaveEntity(client);
                                        client.Inventory.Remove(1088000, 1);
                                        client.Equipment.Remove(9);
                                        break;
                                    }
                                    else
                                    {
                                        dialog.Text("Sorry, there is no dragonball in your inventory. I can't have your size changed.");
                                        dialog.Option("Ok, Sorry.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 4:
                                {
                                    if (client.Inventory.Contains(1088000, 1))
                                    {
                                        client.Inventory.Remove(1088000, 1);
                                        client.Equipment.Remove(9);
                                        int Model = (int)client.Entity.Body % 10;
                                        switch (Model)
                                        {
                                            case 3:
                                            case 4:
                                                client.Entity.Body -= 2;
                                                break;
                                            case 1:
                                            case 2:
                                                client.Entity.Body += 2;
                                                break;
                                        }
                                        client.Send(new Message("Your gender has been changed.", System.Drawing.Color.BurlyWood, Message.TopLeft));
                                        EntityTable.SaveEntity(client);
                                        break;
                                    }
                                    else
                                    {
                                        dialog.Text("Sorry, there is no dragonball in your inventory. I can't have your size changed.");
                                        dialog.Option("Ok, Sorry.", 255);
                                        dialog.Send();
                                    }
                                }
                                break;
                        }
                        break;
                    }
                #endregion
Next up is the CPAdmin NPC

In Dialogs.cs

Code:
                #region CPAdmin
                case 111816:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("Greetings, here you can exchange either a Dragonball or a DragonScroll for cps. ");
                                    dialog.Text("One Dragonball will get you 215 cps and a DragonScroll will get you 2150. ");
                                    dialog.Text("What would you like to trade? Or would you rather not?");
                                    dialog.Option("Dragonball", 1);
                                    dialog.Option("DragonScroll", 2);
                                    dialog.Option("I'll just leave", 255);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    lock (client.Inventory)
                                    {
                                        if (client.Inventory.Contains(1088000, 1))
                                        {
                                            client.Inventory.Remove(1088000, 1);
                                            client.Entity.ConquerPoints += 215;
                                        }
                                        else
                                        {
                                            dialog.Text("You do not have a Dragonball");
                                            dialog.Send();
                                        }
                                        break;
                                    }
                                }
                            case 2:
                                {
                                    lock (client.Inventory)
                                    {
                                        if (client.Inventory.Contains(721511, 1))
                                        {
                                            client.Inventory.Remove(721511, 1);
                                            client.Entity.ConquerPoints += 2150;
                                        }
                                        else
                                        {
                                            dialog.Text("You do not have a DragonPack");
                                            dialog.Send();
                                        }
                                        break;
                                    }
                                }
                        }
                        break;
                    }
                #endregion
Here is the armor/headgear tinter.

In Dialogs.cs

Code:
                #region Tinter
                case 11191:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("I can dye your armor or your headgear. Care to get started?");
                                    dialog.Option("Armor", 1);
                                    dialog.Option("Headgear", 2);
                                    dialog.Option("I'll just leave", 255);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    dialog.Text("What color armor would like sir?");
                                    dialog.Option("White", 4);
                                    dialog.Option("Purple", 5);
                                    dialog.Option("Orange", 6);
                                    dialog.Option("Light Blue", 7);
                                    dialog.Option("Blue", 8);
                                    dialog.Option("Red", 9);
                                    dialog.Option("Yellow", 10);
                                    dialog.Send();
                                    break;
                                }
                            case 4:
                                {
                                    IConquerItem armor = client.Equipment.TryGetItem(3);
                                    if (armor != null && armor.ID != 0)
                                    {
                                        armor.Color = Conquer_Online_Server.Game.Enums.Color.White;
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        armor.Send(client);
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 5:
                                {
                                    IConquerItem armor = client.Equipment.TryGetItem(3);
                                    if (armor != null && armor.ID != 0)
                                    {
                                        armor.Color = Conquer_Online_Server.Game.Enums.Color.Purple;
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        armor.Send(client);
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 6:
                                {
                                    IConquerItem armor = client.Equipment.TryGetItem(3);
                                    if (armor != null && armor.ID != 0)
                                    {
                                        armor.Color = Conquer_Online_Server.Game.Enums.Color.Orange;
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        armor.Send(client);
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 7:
                                {
                                    IConquerItem armor = client.Equipment.TryGetItem(3);
                                    if (armor != null && armor.ID != 0)
                                    {
                                        armor.Color = Conquer_Online_Server.Game.Enums.Color.LightBlue;
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        armor.Send(client);
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 8:
                                {
                                    IConquerItem armor = client.Equipment.TryGetItem(3);
                                    if (armor != null && armor.ID != 0)
                                    {
                                        armor.Color = Conquer_Online_Server.Game.Enums.Color.Blue;
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        armor.Send(client);
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 9:
                                {
                                    IConquerItem armor = client.Equipment.TryGetItem(3);
                                    if (armor != null && armor.ID != 0)
                                    {
                                        armor.Color = Conquer_Online_Server.Game.Enums.Color.Red;
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        armor.Send(client);
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 10:
                                {
                                    IConquerItem armor = client.Equipment.TryGetItem(3);
                                    if (armor != null && armor.ID != 0)
                                    {
                                        armor.Color = Conquer_Online_Server.Game.Enums.Color.Yellow;
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        armor.Send(client);
                                        armor.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 2:
                                {
                                    dialog.Text("What color armor would like sir?");
                                    dialog.Option("White", 11);
                                    dialog.Option("Purple", 12);
                                    dialog.Option("Orange", 13);
                                    dialog.Option("Light Blue", 14);
                                    dialog.Option("Blue", 15);
                                    dialog.Option("Red", 16);
                                    dialog.Option("Yellow", 17);
                                    dialog.Send();
                                    break;
                                }
                            case 11:
                                {
                                    IConquerItem headgear = client.Equipment.TryGetItem(1);
                                    if (headgear != null && headgear.ID != 0)
                                    {
                                        headgear.Color = Conquer_Online_Server.Game.Enums.Color.White;
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        headgear.Send(client);
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 12:
                                {
                                    IConquerItem headgear = client.Equipment.TryGetItem(1);
                                    if (headgear != null && headgear.ID != 0)
                                    {
                                        headgear.Color = Conquer_Online_Server.Game.Enums.Color.Purple;
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        headgear.Send(client);
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 13:
                                {
                                    IConquerItem headgear = client.Equipment.TryGetItem(1);
                                    if (headgear != null && headgear.ID != 0)
                                    {
                                        headgear.Color = Conquer_Online_Server.Game.Enums.Color.Orange;
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        headgear.Send(client);
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 14:
                                {
                                    IConquerItem headgear = client.Equipment.TryGetItem(1);
                                    if (headgear != null && headgear.ID != 0)
                                    {
                                        headgear.Color = Conquer_Online_Server.Game.Enums.Color.LightBlue;
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        headgear.Send(client);
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 15:
                                {
                                    IConquerItem headgear = client.Equipment.TryGetItem(1);
                                    if (headgear != null && headgear.ID != 0)
                                    {
                                        headgear.Color = Conquer_Online_Server.Game.Enums.Color.Blue;
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        headgear.Send(client);
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 16:
                                {
                                    IConquerItem headgear = client.Equipment.TryGetItem(1);
                                    if (headgear != null && headgear.ID != 0)
                                    {
                                        headgear.Color = Conquer_Online_Server.Game.Enums.Color.Red;
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        headgear.Send(client);
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                            case 17:
                                {
                                    IConquerItem headgear = client.Equipment.TryGetItem(1);
                                    if (headgear != null && headgear.ID != 0)
                                    {
                                        headgear.Color = Conquer_Online_Server.Game.Enums.Color.Yellow;
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Update;
                                        headgear.Send(client);
                                        headgear.Mode = Conquer_Online_Server.Game.Enums.ItemMode.Default;
                                    }
                                    else
                                    {
                                        dialog.Text("Your not wearing any armor right now. Therefore, I can't do anything.");
                                        dialog.Option("Ah alright.", 255);
                                        dialog.Send();
                                    }
                                    break;
                                }
                        }
                        break;
                    }
                #endregion
Now, here is an npc to give super +12 double sdg -7 255 enchant items

it uses the helpdesk npc in tc

In Dialogs.cs above

Code:
public static ISkill LearnableSpell(ushort spellid)
put this

Code:
        public static IConquerItem AwardItem(uint itemid, GameState Client)
        {
            IConquerItem item = new ConquerItem(true);
            item.ID = itemid;
            item.Bless = 7;
            item.Color = (Conquer_Online_Server.Game.Enums.Color)Kernel.Random.Next(4, 8);
            item.Enchant = 255;
            item.UID = ConquerItem.ItemUID.Next;
            item.Plus = 12;
            item.SocketOne = (Enums.Gem)13;
            item.SocketTwo = (Enums.Gem)13;
            ConquerItemInformation iteminfos = new ConquerItemInformation(item.ID, item.Plus);
            item.Durability = item.MaximDurability = iteminfos.BaseInformation.Durability;
            Client.Inventory.Add(item, Enums.ItemUse.Add);
            EntityTable.SaveEntity(Client);
            return item;
        }
Then with the other NPCs add

Code:
                #region HelpDesk
                case 12111:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("What free item would you like?");
                                    dialog.Option("BuriedBlade", 1);
                                    dialog.Option("Blizzard", 2);
                                    dialog.Option("Thunder", 3);
                                    dialog.Option("MagicCoronet", 4);
                                    dialog.Option("CrystalEarrings", 5);
                                    dialog.Option("Tornado", 6);
                                    dialog.Option("KingsClub", 7);
                                    dialog.Option("KingofSword", 8);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(410339, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                            case 2:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(160249, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                            case 3:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(150249, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                            case 4:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(118109, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                            case 5:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(117099, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                            case 6:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(120249, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                            case 7:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(480339, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                            case 8:
                                {
                                    if (client.Inventory.Count < 40)
                                    {
                                        AwardItem(420339, client);
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(Constants.FullInventory);
                                        break;
                                    }
                                }
                        }
                        break;
                    }
                #endregion
MillionaireLee

Code:
                #region MillionaireLee
                case 111811:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("Hello, I can take your meteors and dragonballs and pack them for you. ");
                                    dialog.Text("Did I mention my services are free?");
                                    dialog.Option("Pack my meteors.", 1);
                                    dialog.Option("Pack my dragonballs.", 2);
                                    dialog.Option("I'd rather leave", 255);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    lock (client.Inventory)
                                    {
                                        if (client.Inventory.Contains(1088001, 10))
                                        {
                                            client.Inventory.Remove(1088001, 10);
                                            client.Inventory.Add(720027, Enums.ItemEffect.None);
                                            client.Send(new Message("Your meteors have successfully been packed.", System.Drawing.Color.Blue, Message.TopLeft));
                                        }
                                        else
                                        {
                                            dialog.Text("You do not have enough meteors for this.");
                                            dialog.Option("Okay, sorry sir", 255);
                                            dialog.Send();
                                        }
                                    }
                                    break;
                                }
                            case 2:
                                {
                                    lock (client.Inventory)
                                    {
                                        if (client.Inventory.Contains(1088000, 10))
                                        {
                                            client.Inventory.Remove(1088000, 10);
                                            client.Inventory.Add(720028, Enums.ItemEffect.None);
                                            client.Send(new Message("Your dragonballs have successfully been packed.", System.Drawing.Color.Blue, Message.TopLeft));
                                        }
                                        else
                                        {
                                            dialog.Text("You do not have enough dragonballs for this.");
                                            dialog.Option("Okay, sorry sir", 255);
                                            dialog.Send();
                                        }
                                    }
                                    break;
                                }
                        }
                        break;
                    }
                #endregion
I hope you like them. Good day.

EDIT: Added garment unequip for SurgeonMiracle and added MillionaireLee.
CIRASH is offline  
Thanks
6 Users
Old 05/12/2010, 05:11   #2
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Very nice.
This will show people how to make npc's for the source.
+k
Arcо is offline  
Old 05/12/2010, 11:08   #3
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
public static IConquerItem AwardItem(uint itemid, GameState Client)
{
IConquerItem item = new ConquerItem(true);
item.ID = itemid;
item.Bless = 7;
item.Color = (Conquer_Online_Server.Game.Enums.Color)Kernel.Ran dom.Next(4, 8);
item.Enchant = 255;
//item.UID = ConquerItem.ItemUID.Next;
item.Plus = 12;
item.SocketOne = (Enums.Gem)13;
item.SocketTwo = (Enums.Gem)13;
ConquerItemInformation iteminfos = new ConquerItemInformation(item.ID, item.Plus);
item.Durability = item.MaximDurability = iteminfos.BaseInformation.Durability;
Client.Inventory.Add(item, Enums.ItemUse.CreateAndAdd);
//EntityTable.SaveEntity(Client);
return item;
}
-impulse- is offline  
Thanks
2 Users
Old 05/12/2010, 16:07   #4
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
goodjobbb! :]
xScott is offline  
Old 05/12/2010, 17:19   #5
 
BlueFlame11's Avatar
 
elite*gold: 0
Join Date: Apr 2010
Posts: 116
Received Thanks: 12
This is awesome
Now i can understand how to code them in right
BlueFlame11 is offline  
Old 05/12/2010, 20:48   #6
 
CIRASH's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 259
Received Thanks: 73
Quote:
Originally Posted by -impulse- View Post
public static IConquerItem AwardItem(uint itemid, GameState Client)
{
IConquerItem item = new ConquerItem(true);
item.ID = itemid;
item.Bless = 7;
item.Color = (Conquer_Online_Server.Game.Enums.Color)Kernel.Ran dom.Next(4, 8);
item.Enchant = 255;
//item.UID = ConquerItem.ItemUID.Next;
item.Plus = 12;
item.SocketOne = (Enums.Gem)13;
item.SocketTwo = (Enums.Gem)13;
ConquerItemInformation iteminfos = new ConquerItemInformation(item.ID, item.Plus);
item.Durability = item.MaximDurability = iteminfos.BaseInformation.Durability;
Client.Inventory.Add(item, Enums.ItemUse.CreateAndAdd);
//EntityTable.SaveEntity(Client);
return item;
}
I wasn't sure if I needed create and add because add itself worked fine.

EDIT: Thread Updated.
CIRASH is offline  
Old 05/13/2010, 00:35   #7
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
blehh I suppose I should have read this first seeing as I just coded some very similar stuff... and didn't notice alot of the functions I coded were already added into the source apparently.

Great reference material for people looking to learn to code. I assume doing the client.entity.conquerpoints +=/-= will update database? I'm so used to CoEmu that I was writing up functions for saving everything and updating stuff as i went through :P

Here's my version.... not that anyone needs it with yours being alot cleaner looking and presumably working perfectly.

All my functions are placed directly above
Code:
public static void GetDialog(NpcRequest npcRequest, GameState client)
but I suppose they could be anywhere.

PHP Code:
public static bool ChangeCPs(int amountGameState client)
        {
            if (
client.Entity.ConquerPoints amount 0)//DO NOT ALLOW NEGATIVE CP
            
{
                
client.Entity.ConquerPoints += (uint)amount;
                
EntityTable.SaveEntity(client);
                return 
true;
            }
            else
            {
                
ErrorMsg("You do not have enough CPs"client);
                return 
false;
            }
        }
        public static 
bool ChangeGold(int amountGameState client)
        {
            if (
client.Entity.Money amount 0)//remove money, DO NOT ALLOW NEGATIVE SILVER
            
{
                
client.Entity.Money += (uint)amount;
                
EntityTable.SaveEntity(client);
                return 
true;
            }
            else
            {
                
ErrorMsg("You do not have enough gold"client);
                return 
false;
            }
        }

public static 
void ErrorMsg(string errorGameState client)
        {
            
Dialogs dialog = new Dialogs();
            
dialog.Client client;
            
dialog.Replies = new List<NpcReply>();
            if (
error.Length 100)
            {
                
dialog.Text(error);
                
dialog.Option("Sorry..."255);
                
dialog.Send();
            }
            else
            {
                
Console.WriteLine("You have entered an ErrorMsg greater than 100 characters in your NPC Dialogs!");
                
Console.WriteLine("Problem string: " error);
            }
        } 
Then changed the save entity to cover money and CP's (as by default it doesn't). I was gonna add a separate database function to update just money/cp but I never got around to it.

annddd my lil script for Cp Admin

PHP Code:

case 111816//CP admin
                    
{
                        switch (
npcRequest.OptionID)
                        {
                            case 
0:
                                {
                                    
dialog.Text("I'm looking to buy DragonBalls. Do you have any?");
                                    
dialog.Option("DragonBall (215Cp)"1);
                                    
dialog.Option("DBScroll (2150Cp)"2);
                                    
dialog.Option("I'm saving them."255);
                                    
dialog.Send();
                                    break;
                                }

                            case 
1:
                                {
                                    if (
client.Inventory.Contains(10880001))//db id
                                    
{
                                        
client.Inventory.Remove(1088000,1);
                                        
dialog.Text("Please check your inventory, I have added 215 CPs");
                                        
dialog.Option("I have more"0);
                                        
dialog.Option("Thanks"255);
                                        
dialog.Send();
                                        
ChangeCPs(215client);
                                    }
                                    else
                                        
ErrorMsg("You don't have a DragonBall in your inventory!"client);
                                    break;
                                }

                            case 
2:
                                {
                                    if (
client.Inventory.Contains(7200281))//dbscroll id
                                    
{
                                        
dialog.Text("Please check your inventory, I have added 2150 CPs");
                                        
dialog.Option("I have more"0);
                                        
dialog.Option("Thanks"255);
                                        
dialog.Send();
                                        
ChangeCPs(2150client);
                                    }
                                    else
                                        
ErrorMsg("You don't have a DBScroll in your inventory!"client);
                                    break;
                                }
                        }

                        break;
            } 

Anyways, yours is probably quite a bit better but figured that I may as well throw mine out there as well. Kinda pissed at myself for not having noticed that alot of what I wanted was already in the source but ah well... next time I'll know :P
pro4never is offline  
Thanks
1 User
Old 05/13/2010, 01:12   #8
 
CIRASH's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 259
Received Thanks: 73
hmm tbh im not sure if it will save. I'll have to update entitysave as well. thanks for the heads up. And I like the functions it makes it a little more user friendly. instead of typing out client.Inventory.ConquerPoints and such.
CIRASH is offline  
Thanks
1 User
Old 05/23/2013, 19:54   #9
 
brandonpiano's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 9
Received Thanks: 8
Sorry for bumping, but can I ask you where in the Dialogs.cs I have to add this?

Please don't close this for bumping, its just a question because I wanna start adding NPC, but I need to know where. Thanks in advance.
brandonpiano is offline  
Old 05/23/2013, 20:31   #10
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
Open your source. Dialog.cs is a file.
Super Aids is offline  
Old 05/23/2013, 23:56   #11
 
brandonpiano's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 9
Received Thanks: 8
Ofcource I know that, if I add it @ the bottom it doesn't work? o.0
Can you explain me where I have to add it? (Impulses source)
brandonpiano is offline  
Old 05/24/2013, 01:53   #12
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
Quote:
Originally Posted by brandonpiano View Post
Ofcource I know that, if I add it @ the bottom it doesn't work? o.0
Can you explain me where I have to add it? (Impulses source)
as far as i remember it called dialogs.cs or most likely npcs.cs
you should add it "@" where ever it's possible to add it
if it's looping for all npcs no matter the map then add it anywhere if it's looping throw maps (to save cpu cycles) then add it on the right map section which would actually be a case for a switch on map id

but trust me , you don't need to add npcs as much as you need to learn some programming

for whoever care about those codes i would like to point out some stuff

at first npc
at trinity the "client.Inventory.Remove" is a bool method which you can use instead of "client.Inventory.Contains" , so you loop once trying to remove the item and if it doesn't exist it will return false , saving cpu cycles
you may also switch on the body mesh without having one more variable
you may also notice that it takes the db twice

at the second npc
you should not lock the inventory everytime you are on an npc doin something , you should lock it while removing/adding something , aka on the event not on every npc
go for it is offline  
Thanks
1 User
Old 05/24/2013, 03:50   #13
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
To be honest you shouldn't use the remove method as a contains method, because there is times where you don't want to remove it, but still want to know if the item is there.
Super Aids is offline  
Old 05/24/2013, 04:25   #14
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 327
Quote:
Originally Posted by Super Aids View Post
To be honest you shouldn't use the remove method as a contains method, because there is times where you don't want to remove it, but still want to know if the item is there.
i didn't say you always should use the removing method unless you are actually removing and just don't check as the removing method is bool which will do the check

at nextco i've had overloaded the removing method too much ex. removeIRONORES , removeGoldOres, RemoveMeteorsAndTears, removeOnlyBounded , RemoveOnlyunBounded, RemoveAny , removeStack , pla pla pla
and all those bool overloaded methods was having a bool parameter to actually just check or check and remove (duno if it's smart or i was lazy to redo them all to be contains methods)
go for it is offline  
Old 05/24/2013, 19:06   #15
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
Why not just a removeByItemType then use an enum for itemtype?
Super Aids is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[HELP] Impulse Source
07/29/2010 - CO2 Private Server - 0 Replies
Hey guys I have been at this for the last two days, Someone told me to take the way the Portals are loaded and use that to Spawn Mobs. First please don't flame I am trying and probably got it very very wrong. Ok my problem is I have made the Sql Files and added all the mobs to it. I do not know how to make the source read the Sql files and make them appear on the client screen. Like I said I have been at this for days and can't figure it out. Many guides have been read and alot of googling...
[Release]NPCs for Coemu V2 source
06/26/2009 - CO2 PServer Guides & Releases - 2 Replies
Post here the Npcs for Coemu Source, thanks for you contribution... case 104839: // BoxerLi PC- TG teleporter { if (LinkBack == 0) { Text("If you are level 20 or above, you may train ub the training ground. Would you like me to teleport you there for 1000 silver.", CSocket); Link("Yes, please.", 1, CSocket); Link("No Thanks.", 255, CSocket);



All times are GMT +2. The time now is 22:41.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.