Register for your free account! | Forgot your password?

You last visited: Today at 09:57

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

Advertisement



Some Help ?

Discussion on Some Help ? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
PuN|SheR's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Exclamation Some Help ?

Hello!

I Don't Wanna Be Leecher and ask gimme this gimme this but I Have One Question, and I Hope you will help me.. Its about my Pserver... I Would Like To Add Some NPC Which will give super +12 items 2sct with super gems.. But as i can see, on my Character.cs , only its declared additem as (ITEMID,Plus) CODE:

Code:
public void[B] AddItem[/B]([I]uint ID, byte Plus[/I])
this is what i got into characters.cs :
Quote:
public void AddItem(uint ID, byte Plus)
{
Item I = new Item();
I.Plus = Plus;
I.ID = ID;
I.UID = (uint)Rnd.Next(10000000);
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;

if (I.UID == 0)
{
I.UID = (uint)Rnd.Next(10000000);
}

Inventory.Add(I);
MyClient.AddSend(Packets.AddItem(I, 0));
}

So I Know How To Make a NPC Which Gives Super Items +12 but no clue how should I Public AddItem(uint ID,byte Plus,byte soc1,byte soc2) cause I'm not that good "Coder" !
Here is the NPC Code For +12 Items
Code:

Code:
#region MyNpc7
case 412345:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("Hello, Welcome To Your God ! I Will Give You Free Items If You Are 70lvl +"));
                                        GC.AddSend(Packets.NPCLink("Cool let me in.", 1));
                                        GC.AddSend(Packets.NPCLink("Haa Ok Then", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    if (Control == 1)
                                    {
                                        GC.AddSend(Packets.NPCSay("I can gift you with some gear of specified profesion"));
                                        GC.AddSend(Packets.NPCLink("FireTao L70 pack", 2));
                                        GC.AddSend(Packets.NPCLink("WaterTao L70 pack", 3));
                                        GC.AddSend(Packets.NPCLink("Warrior L70 pack", 4));
                                        GC.AddSend(Packets.NPCLink("Trojan L70 pack", 5));
                                        GC.AddSend(Packets.NPCLink("Archer L70 pack", 6));
                                        GC.AddSend(Packets.NPCLink("Ninja L70 pack", 7));
                                        GC.AddSend(Packets.NPCLink("Weps pack L70", 8));
                                        GC.AddSend(Packets.NPCLink("No, thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(15));
                                        GC.AddSend(Packets.NPCFinish());
                                    }

                                    else if (GC.MyChar.Level <= 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("Welcome To My Seller But ur not lvl 70 yet!"));
                                        GC.AddSend(Packets.NPCLink("Damn.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }

                                    if (Control == 2)
                                    {


                                        GC.MyChar.AddItem(134069, 12); //Robe
                                        GC.MyChar.AddItem(117069, 12); //Earring
                                        GC.MyChar.AddItem(152129, 12); //brac
                                        GC.MyChar.AddItem(121129, 12); //Bag
                                        GC.MyChar.AddItem(160139, 12); //boots
                                        GC.MyChar.AddItem(202009, 12); //Star
                                        GC.MyChar.AddItem(201009, 12); //Fan
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());

                                    }
                                    if (Control == 3)
                                    {
                                        GC.MyChar.AddItem(134069, 12); //Robe
                                        GC.MyChar.AddItem(117069, 12); //Earring
                                        GC.MyChar.AddItem(152129, 12); //brac
                                        GC.MyChar.AddItem(121129, 12); //Bag
                                        GC.MyChar.AddItem(160139, 12); //boots
                                        GC.MyChar.AddItem(202009, 12); //Star
                                        GC.MyChar.AddItem(201009, 12); //Fan
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }

                                    if (Control == 4)
                                    {
                                        GC.MyChar.AddItem(131069, 12); //Robe
                                        GC.MyChar.AddItem(117069, 12); //Earring
                                        GC.MyChar.AddItem(120129, 12); //Neck
                                        GC.MyChar.AddItem(150139, 12); //Ring
                                        GC.MyChar.AddItem(160139, 12); //boots
                                        GC.MyChar.AddItem(202009, 12); //Star
                                        GC.MyChar.AddItem(201009, 12); //Fan
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 5)
                                    {
                                        GC.MyChar.AddItem(130069, 12); //Robe
                                        GC.MyChar.AddItem(117069, 12); //Earring
                                        GC.MyChar.AddItem(120129, 12); //Neck
                                        GC.MyChar.AddItem(150139, 12); //Ring
                                        GC.MyChar.AddItem(160139, 12); //boots
                                        GC.MyChar.AddItem(202009, 12); //Star
                                        GC.MyChar.AddItem(201009, 12); //Fan
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 6)
                                    {
                                        GC.MyChar.AddItem(133049, 12); //Robe
                                        GC.MyChar.AddItem(117069, 12); //Earring
                                        GC.MyChar.AddItem(120129, 12); //Neck
                                        GC.MyChar.AddItem(150139, 12); //Ring
                                        GC.MyChar.AddItem(160139, 12); //boots
                                        GC.MyChar.AddItem(202009, 12); //Star
                                        GC.MyChar.AddItem(201009, 12); //Fan
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 7)
                                    {
                                        GC.MyChar.AddItem(135069, 12); //Robe
                                        GC.MyChar.AddItem(112069, 12); //Earring
                                        GC.MyChar.AddItem(120129, 12); //Neck
                                        GC.MyChar.AddItem(150139, 12); //Ring
                                        GC.MyChar.AddItem(160139, 12); //boots
                                        GC.MyChar.AddItem(202009, 12); //Star
                                        GC.MyChar.AddItem(201009, 12); //Fan
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());

                                    }
                                    else if (Control == 8)
                                    {
                                        GC.MyChar.AddItem(421139, 12); //BS
                                        GC.MyChar.AddItem(420139, 12); //S
                                        GC.MyChar.AddItem(410139, 12); //B
                                        GC.MyChar.AddItem(480139, 12); //C
                                        GC.MyChar.AddItem(561139, 12); //W
                                        GC.MyChar.AddItem(560139, 12); //SP
                                        GC.MyChar.AddItem(601139, 12); //k
                                        GC.MyChar.AddItem(500129, 12); //Bo
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());

                                    }

                                    break;
                                }
                            #endregion
So AnyONe Knows How To Do This?

Sorry For Bothering you
PuN|SheR is offline  
Old 12/05/2010, 22:36   #2
 
bone-you's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 1,491
Received Thanks: 536
Make a new function that does what you want, or modify existing function to support your params.
bone-you is offline  
Old 12/05/2010, 22:42   #3
 
PuN|SheR's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Quote:
Originally Posted by bone-you View Post
Make a new function that does what you want, or modify existing function to support your params.
Yea,Thats what im talkin' in my thread.. I Could'nt do that,could you give me some example how should new function look? Cause i guess im not that good at C# , must to read some more tuts...
PuN|SheR is offline  
Old 12/05/2010, 23:48   #4
 
.Beatz's Avatar
 
elite*gold: 0
Join Date: May 2006
Posts: 1,190
Received Thanks: 516
I.Socket = Socket;
I.Socket2 = Socket2;


Something along the lines of that, I dont know how your source is set up to handle the sockets so that is just a guess, but you can work of that.
Code:
public void AddItem(uint ID, byte Plus, byte Bless, byte Enchant, bool Free, byte Socket)
        {
            ItemType I = new ItemType();
            I.Plus = Plus;
            I.ID = ID;
            I.Bless = Bless;
            I.FreeItem = Free;
            I.Enchant = Enchant;
            I.UID = (uint)Rnd.Next(10000000);
            I.MaxDur = I.DBInfo.Durability;
            I.CurDur = I.MaxDur;
            I.Socket = I.Socket;

            if (I.UID == 0)
            {
                I.UID = (uint)Rnd.Next(10000000);
            }

            Inventory.Add(I);
            Client.Send(ConquerPacket.AddItem(I, 0));
        }
btw cant remember if its a byte or w/e so that will do for now lol
.Beatz is offline  
Old 12/06/2010, 00:01   #5
 
PuN|SheR's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
My Source is kinda different.. Cant Make it like it needs.... Im gooonna attach it here,writing from my notebook so sorry if i make some grammar mistakes !
Attached Files
File Type: rar Character.rar (22.4 KB, 1 views)
PuN|SheR is offline  
Old 12/06/2010, 01:06   #6
 
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 370
Code:
public void AddItem(uint ID, byte Plus, byte Bless, byte Enchant, byte Soc1, byte Soc2)
{
Item I = new Item();
I.Plus = Plus;
I.ID = ID;
I.Bless = Bless;
I.Enchant = Enchant;
I.Soc1 = (Item.Gem)Soc1;
I.Soc2 = (Item.Gem)Soc2;
I.UID = (uint)Rnd.Next(10000000);
I.MaxDur = I.DBInfo.Durability;
I.CurDur = I.MaxDur;

if (I.UID == 0)
{
I.UID = (uint)Rnd.Next(10000000);
}

Inventory.Add(I);
MyClient.AddSend(Packets.AddItem(I, 0));
}
Syst3m_W1z4rd is offline  
Thanks
1 User
Old 12/06/2010, 09:32   #7
 
PuN|SheR's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Oh Thanks Alot.. Btw, someone have ID's from AllGems?

EDIT:

Can someone help me about something? I wanna make, on each killed birdman player who killed the birdman get 50cp's , and for Turtledoves 25cps.. Can someone tell me how ?
PuN|SheR is offline  
Old 12/06/2010, 10:27   #8
 
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 370
Right click Item.Gem.
And click Go to defination.

Then you have all the ids
Syst3m_W1z4rd is offline  
Old 12/06/2010, 10:49   #9
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
For cps from monster just go to where final monster death is (should be something like kill( or w/e) and run your calculation on how you want to award cp. Personally I prefer random chance + difference in player/mob levels but if you want just standard rate across a certain mob you could do something like..

switch(Monster.Name)
{
case "Birdmen":
Client.Cps+= 50;
break;
default:
Client.Cps += 10;
break;
}

or w/e you wanted.
pro4never is offline  
Old 12/06/2010, 11:38   #10
 
PuN|SheR's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Quote:
Originally Posted by pro4never View Post
For cps from monster just go to where final monster death is (should be something like kill( or w/e) and run your calculation on how you want to award cp. Personally I prefer random chance + difference in player/mob levels but if you want just standard rate across a certain mob you could do something like..

switch(Monster.Name)
{
case "Birdmen":
Client.Cps+= 50;
break;
default:
Client.Cps += 10;
break;
}

or w/e you wanted.
Oh.. It should be something like this,but my source is kinda different... With If(MyMath.Sucess) or w/e ! Should i upload my source?
PuN|SheR is offline  
Old 12/06/2010, 11:51   #11
 
bone-you's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 1,491
Received Thanks: 536
Quote:
Originally Posted by pro4never View Post
For cps from monster just go to where final monster death is (should be something like kill( or w/e) and run your calculation on how you want to award cp. Personally I prefer random chance + difference in player/mob levels but if you want just standard rate across a certain mob you could do something like..

switch(Monster.Name)
{
case "Birdmen":
Client.Cps+= 50;
break;
default:
Client.Cps += 10;
break;
}

or w/e you wanted.
BAD. Do it by id, not by strings. Little things like that is why most servers nowadays can't handle more than 10 people. Each action someone takes invokes like 100000 memory operations and 500 functions.
bone-you is offline  
Old 12/06/2010, 12:40   #12
 
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 370
Quote:
Originally Posted by bone-you View Post
BAD. Do it by id, not by strings. Little things like that is why most servers nowadays can't handle more than 10 people. Each action someone takes invokes like 100000 memory operations and 500 functions.
like?
Code:
switch(Monster.ID)
{
    case 0001:
    Client.Cps+= 50;
    break;
    
    default: 
    Client.Cps += 10;
    break;
}
Syst3m_W1z4rd is offline  
Old 12/06/2010, 14:02   #13
 
bone-you's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 1,491
Received Thanks: 536
Quote:
Originally Posted by 1337 H4X0R View Post
like?
Code:
switch(Monster.ID)
{
    case 0001:
    Client.Cps+= 50;
    break;
    
    default: 
    Client.Cps += 10;
    break;
}
Must better. Indexes are far faster than string lookups.

Integers are just (does x = y). String lookups are (string compare x and y). Imagine that in a switch with tons of cases.
bone-you is offline  
Old 12/06/2010, 15:29   #14
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
I remember reading a long time ago about this topic just to clarify it all, strings are nearly ten times slower than indexes. So yeah, use them as little as possible =p
_Emme_ is offline  
Old 12/06/2010, 18:45   #15
 
PuN|SheR's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
Let Me Upload you the MOB.CS ,and someone who will have time, would change something in it! If you need something else exsept mob.cs , just REPLY! I Can't make it work :S
Uploaded Mob.cs and Character.cs ! Please modify them if you have some time

Edit: Bone-You, and Emme Coder, You're right, reading indexes is faster than reading strings
Attached Files
File Type: rar Mob.rar (5.3 KB, 0 views)
File Type: rar Character.rar (22.5 KB, 0 views)
PuN|SheR is offline  
Reply




All times are GMT +1. The time now is 09:58.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.