ExpPot - The real way.

10/25/2008 15:52 _Emme_#1
Okay,here I am going to release ExpPot. Should work fine,no bugs whatsoever.

Follow this guide and you got exppot on your newbie server!:)


First, in character.cs

Quote:
public uint EPotXP = 0;
public uint EPotXP2 = 0;
public bool EPotRate = false;
public bool EPot = false;
public Timer EPotTimer = new Timer();

Now,search for void TimerElapsed


Under that {, put this:

Quote:
if (EPotRate == true)
{
EPotXP2 -= 1;
}
//--This code stops exppot time--
if (EPotXP2 <= 0)
{
if (EPotRate)
{
EPotRate = false;
EPotXP = 0;
EPotXP2 = 0;
MyClient.SendPacket(General.MyPackets.Vital(UID, 19, EPotXP));
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
World.UpdateSpawn(this);
}
}



Now, search for public void RemoveItem, and under that void, add this:


Quote:
public void EPotTimer_Elapsed(object sender, ElapsedEventArgs e)
{
EPot = false;
MyClient.SendPacket(General.MyPackets.SendMsg(MyCl ient.MessageId, "SYSTEM", Name, "Your exppot is over, please buy a new one to refill!", e2000));
}

Now,we need to code so you actually get doubleexp. Search for public bool AddExp, and replace from public bool AddExp to bool Leveled = false , with this:


Quote:
public bool AddExp(ulong Amount, bool CountMisc)
{
Ready = false;
if (RBCount < 1)
Amount /= 3;
if (CountMisc && !EPot)
Exp += (ulong)(Amount * DataBase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));
else if (EPot)
Exp += (ulong)((Amount * DataBase.ExpRate * AddExpPc * (Convert.ToDouble(Potency) / 100 + 1))*2);

else
if(EPot)
{
Exp *= 2;
}

Exp += Amount;
if (EPotRate == true)
Exp += (ulong)((double)Amount * (double)DataBase.ExpRate * (double)AddExpPc * (Convert.ToDouble(Potency) / 100 + 1));

bool Leveled = false;


Now,lets get to the part to add the actual item ExpPot:

Search for else if (ItemParts[0] == "723700"), and under the code for that item ( expball ) , add this:



Quote:
else if (ItemParts[0] == "723017")//ExpPot
{
if (!EPotRate)
{
EPotXP = 3600;
EPotXP2= EPotXP * 2;
EPotRate = true;
MyClient.SendPacket(General.MyPackets.Vital(UID, 19, EPotXP));
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
World.UpdateSpawn(this);
RemoveItem(ItemUID);
}
else
{
MyClient.SendPacket(General.MyPackets.SendMsg(MyCl ient.MessageId, "SYSTEM", Name, "You still have doubleexp. Its a waste to use another one!", 2005));




}
}


I think thats it,not really sure. Just post here if you get any error/bugs with it.

Also,this doubleexp get you a few errors on your server,ofcourse I know how to fix them ( LOL? ) , but dunno if its worth,not really big ones:

*When you have doubleexp, expball gives double exp
* Same with all the other stuffs that gives you directly exp and not an expball.

Added two features at the end of this thread!


PRESS THANKS FOR GOD SAKE AND ILL KEEP RELEASING!!
10/25/2008 15:56 Eternal46#2
Never tried but thanks for the effort.
10/25/2008 16:01 _Emme_#3
Thank you to:)

Later today I will release an very simple but awesome OfflineTG code.
10/25/2008 16:24 BlooD-BoY#4
yeah...its a very easy and simple code...but the prob. is that when you dc..the timer will keep running O.O
10/25/2008 16:30 _Emme_#5
Ofcourse it will,thats the CO way? Or you can just do so it saves the time when you logout, and start it again when you login,not really that hard.
10/25/2008 17:23 XxArcherMasterxX#6
nice, added to my all in 1 thread
10/30/2008 13:10 Bottingpunk#7
Ty emme. just one problem with this public Timer EPotTimer = new Timer();

Error 1 'Timer' is an ambiguous reference between 'System.Timers.Timer' and 'System.Threading.Timer' C:\Documents and Settings\Owner\Desktop\ShadowCO\COServerProject\Ch aracter.cs 135 16 COServerProject
10/30/2008 14:20 tanelipe#8
public System.Timers.Timer EPotTimer = new System.Timers.Timer();
10/30/2008 22:15 felipeboladao#9
help me

error

Error 1 'Timer' is an ambiguous reference between 'System.Timers.Timer' and 'System.Threading.Timer' D:\Desktop\UltimateCo\Character.cs 92 16 COServerProject

sulutions??
10/30/2008 22:20 Bottingpunk#10
Quote:
Originally Posted by felipeboladao View Post
help me

error

Error 1 'Timer' is an ambiguous reference between 'System.Timers.Timer' and 'System.Threading.Timer' D:\Desktop\UltimateCo\Character.cs 92 16 COServerProject

sulutions??
heyyy dumb dumb the guy ^^^ a post said how to do it public System.Timers.Timer EPotTimer = new System.Timers.Timer(); instead of that line and btw ty moderator for ur help. Now i just gotta figure out why i got like an error saying Blessed isn't in the current dictionary thing lol
10/30/2008 22:23 Kiyono#11
Quote:
Originally Posted by Bottingpunk View Post
heyyy dumb dumb the guy ^^^ a post said how to do it public System.Timers.Timer EPotTimer = new System.Timers.Timer(); instead of that line and btw ty moderator for ur help. Now i just gotta figure out why i got like an error saying Blessed isn't in the current dictionary thing lol
the word "blessed" is not even in this code -_-
10/30/2008 22:52 Bottingpunk#12
no durr but i was meaning once i changed that thing then it was saying blah blah blah Blessing isn't in the current dictionary. Bless from the heaven blessing thing but i think i figured it out but ill go onto the right place but well okay i made it like this public bool Blessed = true; or should it be null or somthing else but going onto right place and asking
11/02/2008 17:03 _Emme_#13
Okay,here are some features I'd like to give you,about exppot.

The first is, when exppot runs out,it brings up an NPC chat and ask you if you want to automaticlly use a new exppot,for a fee of 27 CPs.

The other one is, unlike ConquerOnline( TQ ), you can join two exppots into one,lets say you have 37 minutes left on your exppot,you can use a new one and get a total time of 1 hour and 37 minutes.

First one:

Search for //--This code stops exppot time-- , and above that , add:

Code:
                if (EPotXP == 8)
            {
                if (EPotRate)
                {
                    MyClient.CurrentNPC = 63421;
                    MyClient.SendPacket(General.MyPackets.NPCSay("Your exppot has ended,and you now have normal Exp."));
                    MyClient.SendPacket(General.MyPackets.NPCSay("Would you like to use 27 CPs to active a new ExpPot?"));
                    MyClient.SendPacket(General.MyPackets.NPCLink("Yeah,why not", 1));
                    MyClient.SendPacket(General.MyPackets.NPCLink("No, thank you", 255));
                    MyClient.SendPacket(General.MyPackets.NPCSetFace(30));
                    MyClient.SendPacket(General.MyPackets.NPCFinish());
                }
            }
Now, search for :
if (CurrentNPC == 44)

Above it , add :

Code:
            if (CurrentNPC == 63421)
                            {
                             if (Control == 1)
                             {
                                if (MyChar.CPs >= 27)
                                {
                                    MyChar.EPotXP = 3600;
                                    MyChar.EPotXP2 = MyChar.EPotXP * 2;
                                    MyChar.EPotRate = true;
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 19, MyChar.EPotXP));
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
                                    World.UpdateSpawn(MyChar);
                                    MyChar.CPs -= 27;
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
                                }
else
                                    {
                                        SendPacket(General.MyPackets.NPCSay("You do not have 27 CPs"));
                                       
                                        SendPacket(General.MyPackets.NPCLink("Ah shit, sorry!", 255));
                                        SendPacket(General.MyPackets.NPCSetFace(30));
                                        SendPacket(General.MyPackets.NPCFinish());
                                    }
                             }
                            }



Feature 2:

Search for :

Code:
                else if (ItemParts[0] == "723017")
            {
                    
                    EPotXP = 3600;
                    EPotXP2 = EPotXP * 2;
                    EPotRate = true;
                    MyClient.SendPacket(General.MyPackets.Vital(UID, 19, EPotXP));
                    MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
                    World.UpdateSpawn(this);
                    RemoveItem(ItemUID);
              }
Replace with:

Code:
                else if (ItemParts[0] == "723017")
            {
                    uint TotDblExp = EPotXP += 3600;
                    EPotXP = TotDblExp;
                    EPotXP2 = EPotXP * 2;
                    EPotRate = true;
                    MyClient.SendPacket(General.MyPackets.Vital(UID, 19, EPotXP));
                    MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
                    World.UpdateSpawn(this);
                    RemoveItem(ItemUID);
              }
There ya go, enjoy! ;)

Emme
11/02/2008 17:15 Kiyono#14
Nice now make it that the pot won't disappear at logout (TQ's CO "pauses" the timer untill you login)
11/06/2008 11:27 Incariuz#15
Nice code, had an issue with this line on 2 sections.

Quote:
MyClient.SendPacket(General.MyPackets.SendMsg(MyCl ient.MessageId, "SYSTEM", Name, "Your exppot is over, please buy a new one to refill!", e2000));
But I simply removed, the message isn't needed anyway. Other then that, works great.