Help with Packets

05/03/2009 00:51 Pete1990#1
Ok here is a small problem when i use Expballs i cant get it to update ur level only if you dc i know its packet i tryed alot but they wont work
else if (ItemParts[0] == "723700")
{
if (Level < 100 && EPotRate == false)
AddExp((ulong)(1295000 + Level * 100000), false);
else if (Level < 110 && EPotRate == false)
AddExp((ulong)(1395000 + Level * 160000), false);
else if (Level < 115 && EPotRate == false)
AddExp((ulong)(1595000 + Level * 200000), false);
else if (Level < 120 && EPotRate == false)
AddExp((ulong)(1795000 + Level * 260000), false);
else if (Level < 125 && EPotRate == false)
AddExp((ulong)(2095000 + Level * 300000), false);
else if (Level < 130 && EPotRate == false)
AddExp((ulong)(2395000 + Level * 360000), false);
//below is rates with exppot usage.
else if (Level < 100 && EPotRate == true)
AddExp((ulong)(129500 + Level * 15000), false);
else if (Level < 110 && EPotRate == true)
AddExp((ulong)(139500 + Level * 24000), false);
else if (Level < 115 && EPotRate == true)
AddExp((ulong)(159500 + Level * 30000), false);
else if (Level < 120 && EPotRate == true)
AddExp((ulong)(179500 + Level * 39000), false);
else if (Level < 125 && EPotRate == true)
AddExp((ulong)(209500 + Level * 45000), false);
else if (Level < 130 && EPotRate == true)
AddExp((ulong)(239500 + Level * 54000), false);
World.UpdateSpawn(this);
RemoveItem(ItemUID);
05/03/2009 01:48 Qonquer#2
To change level, packet type is as follows.

Code:
final short PACKET_STATUS = 0x2721;
final int TYPE_LEVEL = 0xC;

packet structStatusPacket ( int playerID, int[] type, long[] val ) {
   short len = ( 12*(short)type.length ) + 12;
   packet p = new packet( len );
   p.addShort ( len );
   p.addShort ( PACKET_STATUS );
   p.addInt ( playerID );
   p.addInt ( type.length );
   for ( int i = 0; i < type.length; i++ ) {
      p.addInt ( type[i] );
      p.addLong ( val[i] );
   }
   return p;
}
So to construct a level change packet to level 120:
int[] type = { TYPE_LEVEL };
int[] level = { 120 };
packet p=structStatusPacket ( playerID, type, level );


This probably isn't the language you are using, but you should be able to extrapolate the required info, my code is pretty readable.
05/03/2009 05:44 PeTe Ninja#3
my expball looks like this

Code:
else if (ItemParts[0] == "723700") // ExpBall
            {
                if (Level < 100 && EPotRate == false)
                    AddExp((ulong)(1295000 + Level * 100000), false);
                else if (Level < 110 && EPotRate == false)
                    AddExp((ulong)(1395000 + Level * 160000), false);
                else if (Level < 115 && EPotRate == false)
                    AddExp((ulong)(1595000 + Level * 200000), false);
                else if (Level < 120 && EPotRate == false)
                    AddExp((ulong)(1795000 + Level * 260000), false);
                else if (Level < 125 && EPotRate == false)
                    AddExp((ulong)(2095000 + Level * 300000), false);
                else if (Level < 130 && EPotRate == false)
                    AddExp((ulong)(2395000 + Level * 360000), false);
                //below is rates with exppot usage.
                else if (Level < 100 && EPotRate == true)
                    AddExp((ulong)(129500 + Level * 24000), false);
                else if (Level < 110 && EPotRate == true)
                    AddExp((ulong)(139500 + Level * 30000), false);
                else if (Level < 115 && EPotRate == true)
                    AddExp((ulong)(159500 + Level * 39000), false);
                else if (Level < 120 && EPotRate == true)
                    AddExp((ulong)(179500 + Level * 51000), false);
                else if (Level < 125 && EPotRate == true)
                    AddExp((ulong)(209500 + Level * 66000), false);
                else if (Level < 130 && EPotRate == true)
                    AddExp((ulong)(239500 + Level * 84000), false);

                RemoveItem(ItemUID);
            }
05/03/2009 05:58 Pete1990#4
Quote:
Originally Posted by PeTe Ninja View Post
my expball looks like this

Code:
else if (ItemParts[0] == "723700") // ExpBall
            {
                if (Level < 100 && EPotRate == false)
                    AddExp((ulong)(1295000 + Level * 100000), false);
                else if (Level < 110 && EPotRate == false)
                    AddExp((ulong)(1395000 + Level * 160000), false);
                else if (Level < 115 && EPotRate == false)
                    AddExp((ulong)(1595000 + Level * 200000), false);
                else if (Level < 120 && EPotRate == false)
                    AddExp((ulong)(1795000 + Level * 260000), false);
                else if (Level < 125 && EPotRate == false)
                    AddExp((ulong)(2095000 + Level * 300000), false);
                else if (Level < 130 && EPotRate == false)
                    AddExp((ulong)(2395000 + Level * 360000), false);
                //below is rates with exppot usage.
                else if (Level < 100 && EPotRate == true)
                    AddExp((ulong)(129500 + Level * 24000), false);
                else if (Level < 110 && EPotRate == true)
                    AddExp((ulong)(139500 + Level * 30000), false);
                else if (Level < 115 && EPotRate == true)
                    AddExp((ulong)(159500 + Level * 39000), false);
                else if (Level < 120 && EPotRate == true)
                    AddExp((ulong)(179500 + Level * 51000), false);
                else if (Level < 125 && EPotRate == true)
                    AddExp((ulong)(209500 + Level * 66000), false);
                else if (Level < 130 && EPotRate == true)
                    AddExp((ulong)(239500 + Level * 84000), false);

                RemoveItem(ItemUID);
            }
Yea same as mine but the problem im having is its a packet error where its not updating your leveling intll you log ou and back on
05/03/2009 06:23 PeTe Ninja#5
guys i would like to remind you i just found out that he is using a partially converted to ini source..could that be the problem
05/03/2009 07:14 Qonquer#6
I hate to say it but, DAMN? Your level display problem will be because you are not sending the status packet to display the correct level in the player's status window. And damn, that is very very sloppy code.

Expballs give 600,000*level*0.4 exp roughly (yes i know it's not exactly that). Just add that onto current experience then do a loop to take away each next level boundry, add 1 to level until you get a negative, absolute that, make it the current exp and you're done, 3 or 4 lines of code. Like what the hell?
05/03/2009 07:31 kinshi88#7
Quote:
Originally Posted by Qonquer View Post
I hate to say it but, DAMN? Your level display problem will be because you are not sending the status packet to display the correct level in the player's status window. And damn, that is very very sloppy code.

Expballs give 600,000*level*0.4 exp roughly (yes i know it's not exactly that). Just add that onto current experience then do a loop to take away each next level boundry, add 1 to level until you get a negative, absolute that, make it the current exp and you're done, 3 or 4 lines of code. Like what the hell?
Damn man, I've been trying to work out that formula forever lol
05/03/2009 07:41 Qonquer#8
actually, no, that's not right... lol...
QO uses a table to look them up, but I worked it out roughly by noticing an expball gave you 50 times the amount of exp at level 125 than it does at level 1. Which gives a step of 0.4 so it should be
600,000 * (1 + ((level-1)*0.4))
At least that's the formula I use on the quiz show on QO, i figured it doesnt need to be spot on and as long as ppl get exp for answering a question, they're happy.