Page 1 of 2

Saving/Loading Client Hotbar

Posted: Thu Aug 28, 2014 2:35 pm
by Londo
I was able to decode hotbar operations that might be useful for this project.
Client's hotbar changes are sent to server with F_CLIENT_DATA. Server will receive hotbar command, hotbar's slot index, and abilityID. Two commands that we are interested are add ability to hotbar and remove ability from hotbar.

(I'll post sending user's hotbar layout to user later today)
(Also, ignore client_data untill client tells server S_WORLD_SENT, which happens after UI has finished loading)

static public void F_CLIENT_DATA(BaseClient client, PacketIn packet)
{
ushort slotIndex = packet.GetUint16(); //60 possible slots
ushort unk1 = packet.GetUint16R();
ushort abilityEntry = packet.GetUint16R(); //abilityID, ex: Flee is 245)
ushort cmd = packet.GetUint16R(); //00 clear ability, 01 set ability
ushort unk2 = packet.GetUint16R(); //some sort of seq, maybe mouseXY?

if(cmd == 0) //remove ability from hotbar
{
//for current user update database, set hotbar's slot index to 0 indicating no ability slotted for this slot
}
else if(cmd == 1 && slotIndex <=260) //slotIndex above 260 might be morales/tactics/gear show/hide, haven't
//checked them yet
{
//update database, set slotindex to abilityID
}
}

Re: Saving/Loading Client Hotbar

Posted: Thu Aug 28, 2014 2:42 pm
by Aceboltz
The londo strikes again! xD

Re: Saving/Loading Client Hotbar

Posted: Thu Aug 28, 2014 4:45 pm
by respect1994
Good work Londo :) you're awesome

Re: Saving/Loading Client Hotbar

Posted: Thu Aug 28, 2014 5:00 pm
by Londo
Here is operation to set clients Hotbar. Server needs to send setting for every slot on hotbar regardless if its empty. Settings include other information that I havent looked at yet, but here is how 60 slots of hotbar are populated.

//Add this operation to Player class. Also create table "ClientData" in the database to hold PlayerID, SlotIndex, and
//AbilityID.
//Call this operation on player Init.

public void SendHotbar()
{
PacketOut Out = new PacketOut((byte)Opcodes.F_CLIENT_DATA);
Out.WriteUInt16(0); //unknown
Out.WriteUInt16(1024); //size of data to come
Out.WriteByte(0);//unknown

//skip to hotbar porition, first 24 bytes control something else (maybe morales, or gear show/hide)
Out.Fill(0, 24);

//Hotbar slot information starts offset 32
int pos = (int)Out.Position;
Out.Fill(0,1024); //finished packet needs to be 1032 bytes
Out.Position = pos;

for (int slotIndex = 24; slotIndex < 264; slotIndex += 4) //from slot 1 to slot 60, write out either 0 for empty or abilityID
{
//Check database/cache for what ability is in current slotIndex
Out.WriteUInt16R(Hotbar[slotIndex].AbilityEntry); //write 0 if slot is empty, otherwise abilityID
Out.WriteUInt16R(Hotbar[slotIndex].AbilityEntry > 0 ? 1 : 0); //write 1 to show ability, 0 to show nothing
}

cclient.SendPacket(Out);
}

Re: Saving/Loading Client Hotbar

Posted: Thu Aug 28, 2014 5:09 pm
by Grolar
Good work Londo. That will make life much easier for everyone playing. :) thank you.

Re: Saving/Loading Client Hotbar

Posted: Fri Aug 29, 2014 7:12 am
by Kragg
Good work! Much appriciated!

Re: Saving/Loading Client Hotbar

Posted: Fri Aug 29, 2014 2:43 pm
by MaxHayman
Implemented :D Thanks very much for this Londo :D

Re: Saving/Loading Client Hotbar

Posted: Fri Aug 29, 2014 2:54 pm
by Hammertime
For us non coding, code-less, and clueless players...what does this mean? Is it part of our end to repair a file or something?

Re: Saving/Loading Client Hotbar

Posted: Fri Aug 29, 2014 3:24 pm
by Azagaar
I'm a non coder, but I guess this means, that you won't have to slot every single time all the skills into hotbars, like it was up to now (the server will remember, where on your hotbar each skill is). Right now each time you log in, you only have the basic 2 skills + run.

Good work BTW :)

Re: Saving/Loading Client Hotbar

Posted: Fri Aug 29, 2014 4:23 pm
by DarkStar82
Hammertime wrote:For us non coding, code-less, and clueless players...what does this mean? Is it part of our end to repair a file or something?
same question here does it mean that we have to edit file and past the code, or it will be implemented in some other patch??