how would i change the max lvl and is there a way i could make GMs and PMs do more dmg?
its a 5165 server
its a 5165 server
[B]Level <=[/B]
private byte _level;
const byte MaxLevel = 137;
public byte Level {
get {
return _level;
}
set {
_level = (byte)(value > MaxLevel ? MaxLevel : value);
}
}
private ulong _experience;
public ulong Experience {
get {
return _experience;
}
set {
_experience = (ulong)(Level >= MaxLevel ? 0 : value);
}
}
He would only have one issue, incorrect packets.Quote:
I wouldn't recommend trying to go above level 255, as the Client does (or should) read the level as a byte from the packet. Going over 255 would likely cause a whole load of errors in the client; crash the client; or corrupt the heap inside the client's memory space. It is not a good idea.
byte ushort (2 bytes) ushort (2 bytes)
ushort (2 bytes) ^- sharing an offset -v ushort (2 bytes) ushort (2 bytes)
0 ushort 1[1 - 8] 1 ushort 1[9 - 16] 2 0 3 0 4 0
0 ushort 1[1 - 8] 1 ushort 2[1 - 8] 2 ushort 2[9 - 16] 3 0 4 0
0 ushort 1[1 - 8] 1 ushort 2[1 - 8] 2 ushort 2[9 - 16] 3 ushort 3[1 - 8] 4 ushort 3[9 - 16]
Basically explained what I said in a way that people can actually understand it.. shame on you. xDQuote:
He would only have one issue, incorrect packets.
Let's say you have a packet like this:
He's only supposed to give the byte a value.Code:byte ushort (2 bytes) ushort (2 bytes)
However he gives it an ushort value.
The new packet is:
Notice: The last byte in the new packet is not the byte storing the value. It's the remaining byte from the packet. (Will make sense later.)Code:ushort (2 bytes) ^- sharing an offset -v ushort (2 bytes) ushort (2 bytes)
Now what if we give the last 2 ushorts values as well.
Let's look into the bits.
A byte consist of 8 bits.
An ushort is 2 bytes, so that's 16 bits shared between the 2 bytes is stored at.
So right now it's:
Then if we add a value to the next ushort, which starts at offset 1, this will happen:Code:0 ushort 1[1 - 8] 1 ushort 1[9 - 16] 2 0 3 0 4 0
And let's add the last values:Code:0 ushort 1[1 - 8] 1 ushort 2[1 - 8] 2 ushort 2[9 - 16] 3 0 4 0
Conclusion the last 8 bits of the first ushort is overwritten by the bits of the ushort starting at its offsets.Code:0 ushort 1[1 - 8] 1 ushort 2[1 - 8] 2 ushort 2[9 - 16] 3 ushort 3[1 - 8] 4 ushort 3[9 - 16]
So here is what will happen:OR
- Client will crash, because of invalid packet.
- He'll get a completely invalid value.