Page 1 of 1

.set_uo_expansion and sendStats packet hook

Posted: Sat Mar 31, 2007 1:55 am
by OldnGrey
This is a problem I am having with the sendStats packethook 1.0 written by MuadDib. It's in the 097 distro. I am using 097 rc2.

It all works fine if .set_uo_expansion for the player is "T2A", but if I set it to "AOS" or "ML" the HandleExtended function doesn't like it.

In this function are the lines:
var packet_mode := packet.GetInt8(42);
case(packet_mode)
0: return 0;
1: chk := 1;
3: return 0; // In case we messed up, do nothing
4: return 0; // In case we messed up, do nothing
default: return 0;
endcase
Setting set_uo_expansion to AOS or ML sets the packet_mode to 4 using a v4 client and so the function exits early.

Not being anywhere near competent in packethooks I have no clue why 4 was tested to be a bad value and exit the script. According to the statusbar packet info 0x11, this packet can legitimately have 3 or 4 or 5. Is there a reason this thought to be an error to exit the script?

Posted: Sat Mar 31, 2007 3:56 am
by MuadDib
At the time that was made, 3 and 4 was never used by the core, that is why. Now it is. They are now sent by the core for the higher expansions, so that check can probably be removed (Haven't looked at the code in ages :) )

Posted: Sat Mar 31, 2007 5:20 am
by OldnGrey
Yep, enabling 4 works fine as far as I can tell.
I also enabled 3, 4, 5 to cover all the eventualities.

So Tekproxy has another fix to put in!

Posted: Sat Mar 31, 2007 5:53 am
by tekproxy
Yes indeedy. I'll get around to that later today I have to go to work on this saturday. I made some other mods to it so it would correctly send other stats like resistances. I'd have to dig around for a while.

Keep 'em comin guys. It keeps me busy while I can't code. :-D

Posted: Sat Mar 31, 2007 6:51 am
by MuadDib
Keep em coming eh............


Should implement a packet hook with dbl click, that disables it via a cfg setting for the cmd level. Low level staff should be walking ghosts :D

Same for pickup packet...

Mwuahahaha :x

Posted: Sat Mar 31, 2007 12:45 pm
by MontuZ
MuadDib wrote:Keep em coming eh............


Should implement a packet hook with dbl click, that disables it via a cfg setting for the cmd level. Low level staff should be walking ghosts :D

Same for pickup packet...

Mwuahahaha :x
Agreed. :evil:

Dropping, trading, lol same packet for those last three though.

Posted: Sat Mar 31, 2007 4:48 pm
by tekproxy
How about fixing the bug mentioned in the code, here:

Code: Select all

// These SHOULD be 1 lower for position, and using 16 not 8, but it does it wrong with core >:(
// Tithing should be a 32, position 84 also. SetInt16 will not pad the packet correctly is why.
// Instead of SetInt16(70, 5) making it 0005, it makes it 0500 if I remember right. BOOOOO
And while you're at it, fix all the other bugs too. Thanks. ;)

[edit]Added the fix OldnGrey suggested, didn't remove the check just yet. Added in sending resistances and added a little more code to make adding luck and tithing just a tad easier. Muad is so nice for commenting his code so much.[/edit]

Posted: Sat Mar 31, 2007 8:52 pm
by MuadDib
Those are on my list with 098 actually.

Also tek, your note in the SVN log about resistances. That's up to you, if the distro actually uses the different resistances, then it should be showable in the packet :)