Not allowing to put items in the skillbar

Put your bugs you find in osRose here

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Not allowing to put items in the skillbar

Postby hoegarden31 on Thu Sep 11, 2014 2:25 pm

Hello,

I'm putting this here so I can get some help.
I see that there is this code :

  1. // move skill to function keys
  2. bool CWorldServer::pakMoveSkill ( CPlayer* thisclient, CPacket* P )
  3. {
  4.     BYTE slotid = GETBYTE((*P), 0x0 );
  5.     WORD itemid = GETWORD((*P), 0x1 );
  6.     if(slotid>47) return true;
  7.     thisclient->quickbar[slotid] = itemid;
  8.     BEGINPACKET( pak, 0x7aa );
  9.     ADDBYTE( pak, slotid );
  10.     ADDWORD( pak, itemid );
  11.     thisclient->client->SendPacket( &pak );
  12.     return true;
  13. }


Does someone know if it is possible to get the type of that itemid ? So that i can tell that only skills can be added.
Those itemid's are not very useful since there isn't a specific range for skills and items.
But that is the idea :)
Thanks in advance for helping.
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Re: Not allowing to put items in the skillbar

Postby PurpleYouko on Thu Sep 11, 2014 7:13 pm

There's no way to get the itemtype for the itemid in that code.
It isn't actually an item so it has no type. It's the skill id from LIST_SKILLS.STB.
It should have been called skillid in the code rather than itemid.
The value in the code comes in from a packet that is generated at the client. It is a WORD value meaning that it is contained in 2 bytes of data starting at position 1 in the packet. Position 0 holds a BYTE of information telling us the slotid (the position in the quickbar.)

I'm not sure what you mean by the "itemid" not being very useful.
It represents the skillid (the row number of the skill in LIST_SKILLS.STB)
I can't see in what way that isn't useful.
It's not ambiguous. It can only mean one thing.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Not allowing to put items in the skillbar

Postby hoegarden31 on Thu Sep 11, 2014 10:05 pm

the "itemid" isn't usefull for me because if you drag an item to the skill bar it gets different numbers.
Those numbers are mixed with the skill id's.
So example :

You drag skill 1 to the skillbar and you get itemid 1342.
You drag an other skill and that one has itemid 1002.
You drag a weapon the the skillbar and you get 1243.

So it doesn't help me so that i can make an if where i can exclude all the "itemid" of the items and only allowing skills.

I'm looking for this solution because on the server there are people who mix CG parts with cart parts.
So i am just looking for an easy way to limit what players can add to the skillbar.
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Re: Not allowing to put items in the skillbar

Postby PurpleYouko on Fri Sep 12, 2014 4:10 pm

Hmm there is something weird going on with this.

Just tested it on my KT client.
The numbers coming back have absolutely no relationship to the actual item id at all.
What seems to be happening is that the client has assigned an arbitrary value to every item and skill that you own and when you drag an item or skill into the quick bar it is that unique ID number that is sent.
The server doesn't use these numbers for any reason whatsoever. It simply echoes it back to the client.

I gave my character 3 wooden swords then put them into positions 24, 25 and 26 on my hot bar (the 4th bar)
the packets I got back for each one were...

07aa: 18 81 04
07aa: 19 21 04
07aa: 1a a1 01
Lava Burst skill into slot 0b (11) gave this
07aa: 0b a3 05
(Lava Burst skill is 1176 in the STB)

All 3 were identical wooden swords. item 8001 in conventional numbering.
As you can see, these numbers bear no resemblance to that at all.
I even tried putting the swords in different inventory slots first but they always come back with the same id numbers no matter where they were in inventory.

Conclusion: The numbers returned here have zero relevance to the server and zero meaning other than being an index number used by the client.

Looked in the client code and found this after a bit of digging. m_wHotICON is the value that we receive as a WORD in the packet eventually.
It seems that it might actually contain a type and a slot number but in a very weird way. Split into 5 bytes and 11 bytes. :?
  1.  
  2. union tagHotICON {
  3.     struct {
  4.         unsigned short  m_cType         : 5;    // 0~31
  5.         unsigned short  m_nSlotNo       : 11;   // 0~2047
  6.     } ;
  7.     WORD    m_wHotICON;
  8. } ;


let's try breaking up my packets in this way to see if they make any sense

07aa: 18 81 04
0x0481 = 1000000100000001 in binary.
first 5 bytes are 10000 which is 16 in decimal
next 11 bytes are 00100000001 which is 257 in decimal

07aa: 19 21 04
0x0421 = 0010000100000001 in binary
first 5 bytes are 00100 which is 4 in decimal
next 11 bytes are 00100000001 which is 257 in decimal

07aa: 1a a1 01
0x011a = 1010000100000001 in binary
first 5 bytes are 10100 which is 20 in decimal
next 11 bytes are 00100000001 which is 257 in decimal

(NOTE: All 3 were placed into different slots in the hotbar)

A bit of further digging in the client code came up with this
  1. hotICON.m_cType = INV_ICON;
  2.     hotICON.m_nSlotNo = pItemIcon->GetIndex();
  3.  
  4.     if( hotICON.m_nSlotNo < INVENTORY_ITEM_INDEX_0 || hotICON.m_nSlotNo > INVENTORY_ITEM_INDEX_LAST  )
  5.     {
  6.         assert( 0 && "Invalid Inventory Index @CTCmdDragInven2QuickBar::Exec" );
  7.         return true;
  8.     }

so it would appear that m_cType is the ICON number and m_nSlotNo is some kind of index number.
I've been unable to trace this index number back to where it originates so far. Tracing stuff in this code is a little like diving into Alice's magic rabbit hole. It just leads into a series of nested function calls that appear to go around in circles without ever reaching the bottom.

Either way, there isn't a damn thing we can do about it unfortunately other than rewrite the client.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Not allowing to put items in the skillbar

Postby hoegarden31 on Fri Sep 12, 2014 4:58 pm

Thanks for looking that up xD
Well guess I can't change that for now then...
Guess i will have to make a check somewhere else to see if players don't cheat xD
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 4 guests