Recent Topics

Ads

Saving/Loading Client Hotbar

Talk about the development of the emulator and related services.
Check out new and upcoming features to be implemented onto the server.
Forum rules
Before posting on this forum, be sure to read the Terms of Use
Londo
Posts: 217

Saving/Loading Client Hotbar

Post#1 » Thu Aug 28, 2014 2:35 pm

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
}
}
Last edited by Londo on Thu Aug 28, 2014 5:15 pm, edited 5 times in total.

Ads
Aceboltz
Posts: 254

Re: Saving/Loading Client Hotbar

Post#2 » Thu Aug 28, 2014 2:42 pm

The londo strikes again! xD

User avatar
respect1994
Posts: 158

Re: Saving/Loading Client Hotbar

Post#3 » Thu Aug 28, 2014 4:45 pm

Good work Londo :) you're awesome
SkullCrasher - choppa
Varus - magus
Ragarock - bright wizard

Londo
Posts: 217

Re: Saving/Loading Client Hotbar

Post#4 » Thu Aug 28, 2014 5:00 pm

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);
}
Last edited by Londo on Thu Aug 28, 2014 5:16 pm, edited 5 times in total.

User avatar
Grolar
Posts: 511

Re: Saving/Loading Client Hotbar

Post#5 » Thu Aug 28, 2014 5:09 pm

Good work Londo. That will make life much easier for everyone playing. :) thank you.
THUMP - "MEDIOCRE!!" ...Who's laughing now?

Image

User avatar
Kragg
Posts: 1771

Re: Saving/Loading Client Hotbar

Post#6 » Fri Aug 29, 2014 7:12 am

Good work! Much appriciated!
Image
Sergeant-Major Drengk Burloksson, RR 85 Sniper
Hulfdan Irongrip, RR 81 Ironbreaker
Rordin Brightrune, RR 70 Runepriest
Proud Founder of the 3rd Bitterstone Thunderers

User avatar
MaxHayman
Management
Posts: 1029
Contact:

Re: Saving/Loading Client Hotbar

Post#7 » Fri Aug 29, 2014 2:43 pm

Implemented :D Thanks very much for this Londo :D
Max Hayman

User avatar
Hammertime
Posts: 42

Re: Saving/Loading Client Hotbar

Post#8 » Fri Aug 29, 2014 2:54 pm

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?

Ads
Azagaar
Posts: 88

Re: Saving/Loading Client Hotbar

Post#9 » Fri Aug 29, 2014 3:24 pm

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 :)

DarkStar82
Posts: 12

Re: Saving/Loading Client Hotbar

Post#10 » Fri Aug 29, 2014 4:23 pm

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??
Order
WH - Andrevv
WL - Ajantis
KoBS - Edwemar

Who is online

Users browsing this forum: No registered users and 2 guests