From 7bcfaf60ab89fee489bea279a513f45df531279e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 7 May 2015 18:34:19 -0400 Subject: [PATCH] Save PlayerState server side We now send the PlayerState in the spawn struct to allow clients to see other bard animations with instrument to be played if they zone in after the bard equipped the instrument OP_WeaponEquip2 and OP_WeaponUnequip2 renamed to OP_PlayerStateAdd and OP_PlayerStateRemove Still needs work: Get AI controlled mobs sending the correct PlayerStates. (stunned, attacking, etc) --- common/emu_oplist.h | 4 +-- common/eq_packet_structs.h | 8 ++++- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/rof2_structs.h | 2 +- common/patches/rof_structs.h | 2 +- common/patches/sod.cpp | 2 +- common/patches/sod_structs.h | 2 +- common/patches/sof.cpp | 1 + common/patches/sof_structs.h | 3 +- common/patches/titanium.cpp | 2 +- common/patches/titanium_structs.h | 2 +- common/patches/uf.cpp | 2 +- common/patches/uf_structs.h | 2 +- utils/patches/patch_RoF.conf | 4 +-- utils/patches/patch_RoF2.conf | 4 +-- utils/patches/patch_SoD.conf | 4 +-- utils/patches/patch_SoF.conf | 4 +-- utils/patches/patch_Titanium.conf | 4 +-- utils/patches/patch_UF.conf | 4 +-- zone/client.cpp | 30 +++++++++--------- zone/client_packet.cpp | 52 +++++++++++++++++-------------- zone/client_packet.h | 4 +-- zone/lua_packet.cpp | 6 ++-- zone/mob.cpp | 26 +++++++++------- zone/mob.h | 5 +++ 26 files changed, 101 insertions(+), 82 deletions(-) diff --git a/common/emu_oplist.h b/common/emu_oplist.h index 62978655a..c51e4b600 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -364,6 +364,8 @@ N(OP_PetitionUnCheckout), N(OP_PetitionUpdate), N(OP_PickPocket), N(OP_PlayerProfile), +N(OP_PlayerStateAdd), +N(OP_PlayerStateRemove), N(OP_PlayEverquestRequest), N(OP_PlayEverquestResponse), N(OP_PlayMP3), @@ -519,8 +521,6 @@ N(OP_VetRewardsAvaliable), N(OP_VoiceMacroIn), N(OP_VoiceMacroOut), N(OP_WeaponEquip1), -N(OP_WeaponEquip2), -N(OP_WeaponUnequip2), N(OP_WearChange), N(OP_Weather), N(OP_Weblink), diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 980fcc419..ac6528860 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -273,7 +273,8 @@ struct Spawn_Struct { /*0146*/ uint8 beard; // Beard style (not totally, sure but maybe!) /*0147*/ uint8 unknown0147[4]; /*0151*/ uint8 level; // Spawn Level -/*0152*/ uint8 unknown0259[4]; // ***Placeholder +// None = 0, Open = 1, WeaponSheathed = 2, Aggressive = 4, ForcedAggressive = 8, InstrumentEquipped = 16, Stunned = 32, PrimaryWeaponEquipped = 64, SecondaryWeaponEquipped = 128 +/*0152*/ uint32 PlayerState; // Controls animation stuff /*0156*/ uint8 beardcolor; // Beard color /*0157*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) /*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner @@ -366,6 +367,11 @@ union }; +struct PlayerState_Struct { +/*00*/ uint32 spawn_id; +/*04*/ uint32 state; +}; + /* ** New Spawn ** Length: 176 Bytes diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index da9ed18f9..bfb47492a 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3990,7 +3990,7 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->petOwnerId); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown13 - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown14 - Stance 64 = normal 4 = aggressive 40 = stun/mezzed + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->PlayerState); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown15 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown16 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown17 diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 2041a3c3a..da9fa311a 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4140,7 +4140,7 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->petOwnerId); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown13 - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown14 - Stance 64 = normal 4 = aggressive 40 = stun/mezzed + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->PlayerState); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown15 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown16 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown17 diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 92ff47fda..4aac9e7de 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -416,7 +416,7 @@ struct Spawn_Struct /*0000*/ uint8 unknown12; /*0000*/ uint32 petOwnerId; /*0000*/ uint8 unknown13; -/*0000*/ uint32 unknown14; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed +/*0000*/ uint32 PlayerState; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed /*0000*/ uint32 unknown15; /*0000*/ uint32 unknown16; /*0000*/ uint32 unknown17; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 55c86a557..8fcfdb21d 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -410,7 +410,7 @@ struct Spawn_Struct /*0000*/ uint8 unknown12; /*0000*/ uint32 petOwnerId; /*0000*/ uint8 unknown13; -/*0000*/ uint32 unknown14; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed +/*0000*/ uint32 PlayerState; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed /*0000*/ uint32 unknown15; /*0000*/ uint32 unknown16; /*0000*/ uint32 unknown17; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 8e5656b4b..a4765939d 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2737,7 +2737,7 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown12 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->petOwnerId); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown13 - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown14 - Stance 64 = normal 4 = aggressive 40 = stun/mezzed + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->PlayerState); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown15 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown16 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown17 diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 024814bfd..584318a71 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -286,7 +286,7 @@ struct Spawn_Struct /*0000*/ uint8 unknown12; /*0000*/ uint32 petOwnerId; /*0000*/ uint8 unknown13; -/*0000*/ uint32 unknown14; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed +/*0000*/ uint32 PlayerState; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed /*0000*/ uint32 unknown15; /*0000*/ uint32 unknown16; /*0000*/ uint32 unknown17; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 1cd5ee7ed..186515b3b 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2088,6 +2088,7 @@ namespace SoF eq->runspeed = emu->runspeed; eq->light = emu->light; eq->level = emu->level; + eq->PlayerState = emu->PlayerState; eq->lfg = emu->lfg; eq->hairstyle = emu->hairstyle; eq->haircolor = emu->haircolor; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 4dd0e7d80..23404e051 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -241,7 +241,8 @@ struct Spawn_Struct { /*0506*/ uint8 light; // Spawn's lightsource /*0507*/ uint8 unknown0507[4]; /*0511*/ uint8 level; // Spawn Level -/*0512*/ uint8 unknown0512[16]; +/*0512*/ uint32 PlayerState; +/*0516*/ uint8 unknown0516[12]; /*0528*/ uint8 lfg; /*0529*/ uint8 unknown0529[4]; /*0533*/ uint8 hairstyle; // Sets the style of hair diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index beb338431..e23202c87 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1549,7 +1549,7 @@ namespace Titanium eq->beardcolor = emu->beardcolor; // eq->unknown0147[4] = emu->unknown0147[4]; eq->level = emu->level; - // eq->unknown0259[4] = emu->unknown0259[4]; + eq->PlayerState = emu->PlayerState; eq->beard = emu->beard; strcpy(eq->suffix, emu->suffix); eq->petOwnerId = emu->petOwnerId; diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 53bcb38da..89a3634fd 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -212,7 +212,7 @@ struct Spawn_Struct { /*0146*/ uint8 beardcolor; // Beard color /*0147*/ uint8 unknown0147[4]; /*0151*/ uint8 level; // Spawn Level -/*0152*/ uint8 unknown0259[4]; // ***Placeholder +/*0152*/ uint32 PlayerState; // PlayerState controls some animation stuff /*0156*/ uint8 beard; // Beard style /*0157*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) /*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 4fbc7b6b8..58131bd35 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -3005,7 +3005,7 @@ namespace UF VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown12 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->petOwnerId); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown13 - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown14 - Stance 64 = normal 4 = aggressive 40 = stun/mezzed + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->PlayerState); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown15 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown16 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown17 diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 49fb9a155..66cc58d1d 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -286,7 +286,7 @@ struct Spawn_Struct /*0000*/ uint8 unknown12; /*0000*/ uint32 petOwnerId; /*0000*/ uint8 unknown13; -/*0000*/ uint32 unknown14; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed +/*0000*/ uint32 PlayerState; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed /*0000*/ uint32 unknown15; /*0000*/ uint32 unknown16; /*0000*/ uint32 unknown17; diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index d144b040e..02d7c9bb8 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -269,8 +269,8 @@ OP_RequestDuel=0x1ea9 OP_MobRename=0x5040 OP_AugmentItem=0x1627 # Was 0x37cb OP_WeaponEquip1=0x35c3 -OP_WeaponEquip2=0x012f # Was 0x6022 -OP_WeaponUnequip2=0x1076 # Was 0x0110 +OP_PlayerStateAdd=0x012f # Was 0x6022 +OP_PlayerStateRemove=0x1076 # Was 0x0110 OP_ApplyPoison=0x1499 OP_Save=0x2e6f OP_TestBuff=0x046e # Was 0x3772 diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 0cc0c69d0..312f725fe 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -268,8 +268,8 @@ OP_RequestDuel=0x3af1 OP_MobRename=0x2c57 OP_AugmentItem=0x661b OP_WeaponEquip1=0x34a7 -OP_WeaponEquip2=0x559a -OP_WeaponUnequip2=0x2d25 +OP_PlayerStateAdd=0x559a +OP_PlayerStateRemove=0x2d25 OP_ApplyPoison=0x31e6 OP_Save=0x4a39 OP_TestBuff=0x7cb8 diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index a5dee668c..2f01ef89b 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -266,8 +266,8 @@ OP_RequestDuel=0x79e0 # C OP_MobRename=0x0a1d # C OP_AugmentItem=0x0370 # C OP_WeaponEquip1=0x719e # C -OP_WeaponEquip2=0x7b6e # C -OP_WeaponUnequip2=0x19a8 # C +OP_PlayerStateAdd=0x7b6e # C +OP_PlayerStateRemove=0x19a8 # C OP_ApplyPoison=0x405b # C OP_Save=0x5c85 # C OP_TestBuff=0x5fc7 # C diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 80aee8bdc..9c58b5684 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -262,8 +262,8 @@ OP_RequestDuel=0x3A2B #Xinu 02/22/09 OP_MobRename=0x6be5 #Trevius 01/16/09 OP_AugmentItem=0x172A #Trevius 03/14/09 OP_WeaponEquip1=0x7260 #Trevius 02/27/09 -OP_WeaponEquip2=0x5C2F #Trevius 02/27/09 -OP_WeaponUnequip2=0x6213 #Trevius 02/27/09 +OP_PlayerStateAdd=0x5C2F #Trevius 02/27/09 +OP_PlayerStateRemove=0x6213 #Trevius 02/27/09 OP_ApplyPoison=0x4543 #WildcardX 03/6/09 OP_Save=0x72F2 #Trevius 03/15/09 OP_TestBuff=0x07BF #/testbuff diff --git a/utils/patches/patch_Titanium.conf b/utils/patches/patch_Titanium.conf index 2660738de..99ef322a0 100644 --- a/utils/patches/patch_Titanium.conf +++ b/utils/patches/patch_Titanium.conf @@ -534,8 +534,8 @@ OP_PVPLeaderBoardDetailsRequest=0x06a2 OP_PVPLeaderBoardDetailsReply=0x246a OP_PickLockSuccess=0x40E7 OP_WeaponEquip1=0x6c5e -OP_WeaponEquip2=0x63da -OP_WeaponUnequip2=0x381d +OP_PlayerStateAdd=0x63da +OP_PlayerStateRemove=0x381d OP_VoiceMacroIn=0x2866 # Client to Server OP_VoiceMacroOut=0x2ec6 # Server to Client OP_CameraEffect=0x0937 # Correct diff --git a/utils/patches/patch_UF.conf b/utils/patches/patch_UF.conf index 09c6a8252..cbe57e399 100644 --- a/utils/patches/patch_UF.conf +++ b/utils/patches/patch_UF.conf @@ -272,8 +272,8 @@ OP_RequestDuel=0x6cfe # C OP_MobRename=0x0507 # C OP_AugmentItem=0x7c87 # C OP_WeaponEquip1=0x4572 # C -OP_WeaponEquip2=0x399b # C -OP_WeaponUnequip2=0x416b # C +OP_PlayerStateAdd=0x399b # C +OP_PlayerStateRemove=0x416b # C OP_ApplyPoison=0x5cd3 # C OP_Save=0x6618 # C OP_TestBuff=0x3415 # C diff --git a/zone/client.cpp b/zone/client.cpp index cd96ed29b..c31de64fa 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2540,12 +2540,12 @@ void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 bool Client::BindWound(Mob* bindmob, bool start, bool fail){ EQApplicationPacket* outapp = 0; - if(!fail) + if(!fail) { outapp = new EQApplicationPacket(OP_Bind_Wound, sizeof(BindWound_Struct)); BindWound_Struct* bind_out = (BindWound_Struct*) outapp->pBuffer; // Start bind - if(!bindwound_timer.Enabled()) + if(!bindwound_timer.Enabled()) { //make sure we actually have a bandage... and consume it. int16 bslot = m_inv.HasItemByUse(ItemTypeBandage, 1, invWhereWorn|invWherePersonal); @@ -2592,9 +2592,9 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){ ; // Binding self } } - } + } else if (bindwound_timer.Check()) // Did the timer finish? - { + { // finish bind // disable complete timer bindwound_timer.Disable(); @@ -5709,8 +5709,8 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { else if (inst && inst->GetOrnamentationIcon()) { insr->itemicons[L] = inst->GetOrnamentationIcon(); - } - else + } + else { insr->itemicons[L] = item->Icon; } @@ -7612,7 +7612,7 @@ void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, ui // Find out starting faction for this faction // It needs to be used to adj max and min personal // The range is still the same, 1200-3000(4200), but adjusted for base - database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(), + database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(), faction_id[i]); // Adjust the amount you can go up or down so the resulting range @@ -7653,7 +7653,7 @@ void Client::SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class // Find out starting faction for this faction // It needs to be used to adj max and min personal // The range is still the same, 1200-3000(4200), but adjusted for base - database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(), + database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(), faction_id); // Adjust the amount you can go up or down so the resulting range @@ -7839,14 +7839,14 @@ void Client::SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 faction_ char name[50]; int32 faction_value; - // If we're dropping from MAX or raising from MIN or repairing, + // If we're dropping from MAX or raising from MIN or repairing, // we should base the message on the new updated value so we don't show // a min MAX message // // If we're changing any other place, we use the value before the // hit. For example, if we go from 1199 to 1200 which is the MAX // we still want to say faction got better this time around. - + if ( (faction_before_hit >= this_faction_max) || (faction_before_hit <= this_faction_min)) faction_value = totalvalue; @@ -8382,10 +8382,10 @@ std::string Client::TextLink::GenerateLink() m_Link.clear(); m_LinkBody.clear(); m_LinkText.clear(); - + generate_body(); generate_text(); - + if ((m_LinkBody.length() == EmuConstants::TEXT_LINK_BODY_LENGTH) && (m_LinkText.length() > 0)) { m_Link.push_back(0x12); m_Link.append(m_LinkBody); @@ -8424,7 +8424,7 @@ void Client::TextLink::generate_body() { /* Current server mask: EQClientRoF2 - + RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X" (56) RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55) SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50) @@ -8432,7 +8432,7 @@ void Client::TextLink::generate_body() */ memset(&m_LinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); - + const Item_Struct* item_data = nullptr; switch (m_LinkType) { @@ -8479,7 +8479,7 @@ void Client::TextLink::generate_body() default: break; } - + if (m_ProxyItemID != NOT_USED) { m_LinkBodyStruct.item_id = m_ProxyItemID; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 4424d1f47..690185744 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -305,6 +305,8 @@ void MapOpcodes() ConnectedOpcodes[OP_PetitionRefresh] = &Client::Handle_OP_PetitionRefresh; ConnectedOpcodes[OP_PetitionResolve] = &Client::Handle_OP_PetitionResolve; ConnectedOpcodes[OP_PetitionUnCheckout] = &Client::Handle_OP_PetitionUnCheckout; + ConnectedOpcodes[OP_PlayerStateAdd] = &Client::Handle_OP_PlayerStateAdd; + ConnectedOpcodes[OP_PlayerStateRemove] = &Client::Handle_OP_PlayerStateRemove; ConnectedOpcodes[OP_PickPocket] = &Client::Handle_OP_PickPocket; ConnectedOpcodes[OP_PopupResponse] = &Client::Handle_OP_PopupResponse; ConnectedOpcodes[OP_PotionBelt] = &Client::Handle_OP_PotionBelt; @@ -381,8 +383,6 @@ void MapOpcodes() ConnectedOpcodes[OP_VetClaimRequest] = &Client::Handle_OP_VetClaimRequest; ConnectedOpcodes[OP_VoiceMacroIn] = &Client::Handle_OP_VoiceMacroIn; ConnectedOpcodes[OP_WearChange] = &Client::Handle_OP_WearChange; - ConnectedOpcodes[OP_WeaponEquip2] = &Client::Handle_OP_WeaponEquip2; - ConnectedOpcodes[OP_WeaponUnequip2] = &Client::Handle_OP_WeaponUnequip2; ConnectedOpcodes[OP_WhoAllRequest] = &Client::Handle_OP_WhoAllRequest; ConnectedOpcodes[OP_WorldUnknown001] = &Client::Handle_OP_Ignore; ConnectedOpcodes[OP_XTargetAutoAddHaters] = &Client::Handle_OP_XTargetAutoAddHaters; @@ -10325,6 +10325,32 @@ void Client::Handle_OP_PetitionUnCheckout(const EQApplicationPacket *app) return; } +void Client::Handle_OP_PlayerStateAdd(const EQApplicationPacket *app) +{ + if (app->size != sizeof(PlayerState_Struct)) { + std::cout << "Wrong size: OP_PlayerStateAdd, size=" << app->size << ", expected " << sizeof(PlayerState_Struct) << std::endl; + return; + } + + PlayerState_Struct *ps = (PlayerState_Struct *)app->pBuffer; + AddPlayerState(ps->state); + + entity_list.QueueClients(this, app, false); +} + +void Client::Handle_OP_PlayerStateRemove(const EQApplicationPacket *app) +{ + if (app->size != sizeof(PlayerState_Struct)) { + std::cout << "Wrong size: OP_PlayerStateRemove, size=" << app->size << ", expected " << sizeof(PlayerState_Struct) << std::endl; + return; + } + PlayerState_Struct *ps = (PlayerState_Struct *)app->pBuffer; + RemovePlayerState(ps->state); + + // We should probably save it server side, but for now this works + entity_list.QueueClients(this, app, false); +} + void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) @@ -13891,28 +13917,6 @@ void Client::Handle_OP_WearChange(const EQApplicationPacket *app) return; } -void Client::Handle_OP_WeaponEquip2(const EQApplicationPacket *app) -{ - if (app->size != 8) { - std::cout << "Wrong size: OP_WeaponEquip2, size=" << app->size << ", expected " << 8 << std::endl; - return; - } - - // We should probably save it server side, but for now this works - entity_list.QueueClients(this, app, false); -} - -void Client::Handle_OP_WeaponUnequip2(const EQApplicationPacket *app) -{ - if (app->size != 8) { - std::cout << "Wrong size: OP_WeaponUnequip2, size=" << app->size << ", expected " << 8 << std::endl; - return; - } - - // We should probably save it server side, but for now this works - entity_list.QueueClients(this, app, false); -} - void Client::Handle_OP_WhoAllRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Who_All_Struct)) { diff --git a/zone/client_packet.h b/zone/client_packet.h index 0f09cf574..1a9591f4c 100644 --- a/zone/client_packet.h +++ b/zone/client_packet.h @@ -218,6 +218,8 @@ void Handle_OP_PetitionRefresh(const EQApplicationPacket *app); void Handle_OP_PetitionResolve(const EQApplicationPacket *app); void Handle_OP_PetitionUnCheckout(const EQApplicationPacket *app); + void Handle_OP_PlayerStateAdd(const EQApplicationPacket *app); + void Handle_OP_PlayerStateRemove(const EQApplicationPacket *app); void Handle_OP_PickPocket(const EQApplicationPacket *app); void Handle_OP_PopupResponse(const EQApplicationPacket *app); void Handle_OP_PotionBelt(const EQApplicationPacket *app); @@ -288,8 +290,6 @@ void Handle_OP_VetClaimRequest(const EQApplicationPacket *app); void Handle_OP_VoiceMacroIn(const EQApplicationPacket *app); void Handle_OP_WearChange(const EQApplicationPacket *app); - void Handle_OP_WeaponEquip2(const EQApplicationPacket *app); - void Handle_OP_WeaponUnequip2(const EQApplicationPacket *app); void Handle_OP_WhoAllRequest(const EQApplicationPacket *app); void Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app); void Handle_OP_XTargetRequest(const EQApplicationPacket *app); diff --git a/zone/lua_packet.cpp b/zone/lua_packet.cpp index e16a85c6d..1eef7220d 100644 --- a/zone/lua_packet.cpp +++ b/zone/lua_packet.cpp @@ -18,7 +18,7 @@ Lua_Packet::Lua_Packet(int opcode, int size, bool raw) { if(raw) { SetLuaPtrData(new EQApplicationPacket(OP_Unknown, size)); owned_ = true; - + EQApplicationPacket *self = reinterpret_cast(d_); self->SetOpcodeBypass(opcode); } else { @@ -692,8 +692,8 @@ luabind::scope lua_register_packet_opcodes() { luabind::value("VetClaimRequest", static_cast(OP_VetClaimRequest)), luabind::value("VetClaimReply", static_cast(OP_VetClaimReply)), luabind::value("WeaponEquip1", static_cast(OP_WeaponEquip1)), - luabind::value("WeaponEquip2", static_cast(OP_WeaponEquip2)), - luabind::value("WeaponUnequip2", static_cast(OP_WeaponUnequip2)), + luabind::value("PlayerStateAdd", static_cast(OP_PlayerStateAdd)), + luabind::value("PlayerStateRemove", static_cast(OP_PlayerStateRemove)), luabind::value("WorldLogout", static_cast(OP_WorldLogout)), luabind::value("SessionReady", static_cast(OP_SessionReady)), luabind::value("Login", static_cast(OP_Login)), diff --git a/zone/mob.cpp b/zone/mob.cpp index 0659110cd..1c4c2a01e 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -148,6 +148,7 @@ Mob::Mob(const char* in_name, size = in_size; base_size = size; runspeed = in_runspeed; + PlayerState = 0; // sanity check @@ -160,7 +161,7 @@ Mob::Mob(const char* in_name, m_Light.Level.Spell = m_Light.Type.Spell = 0; m_Light.Type.Active = m_Light.Type.Innate; m_Light.Level.Active = m_Light.Level.Innate; - + texture = in_texture; helmtexture = in_helmtexture; armtexture = in_armtexture; @@ -739,7 +740,7 @@ void Mob::CreateSpawnPacket(EQApplicationPacket* app, Mob* ForWho) { NewSpawn_Struct* ns = (NewSpawn_Struct*)app->pBuffer; FillSpawnStruct(ns, ForWho); - if(strlen(ns->spawn.lastName) == 0) + if(strlen(ns->spawn.lastName) == 0) { switch(ns->spawn.class_) { @@ -915,6 +916,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.class_ = class_; ns->spawn.gender = gender; ns->spawn.level = level; + ns->spawn.PlayerState = PlayerState; ns->spawn.deity = deity; ns->spawn.animation = 0; ns->spawn.findable = findable?1:0; @@ -2566,10 +2568,10 @@ void Mob::SendArmorAppearance(Client *one_client) if (!IsClient()) { const Item_Struct *item; - for (int i=0; i< 7 ; ++i) + for (int i=0; i< 7 ; ++i) { item=database.GetItem(GetEquipment(i)); - if (item != 0) + if (item != 0) { SendWearChange(i,one_client); } @@ -2597,7 +2599,7 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client) else { one_client->QueuePacket(outapp, false, Client::CLIENT_CONNECTED); - } + } safe_delete(outapp); } @@ -2724,7 +2726,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const const Item_Struct *item; item = database.GetItem(GetEquipment(material_slot)); int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); - + if (item != 0 && invslot != INVALID_INDEX) { if (IsClient()) @@ -2982,10 +2984,10 @@ uint32 Mob::GetLevelHP(uint8 tlevel) } int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime) { - + int32 cast_reducer = 0; cast_reducer += GetFocusEffect(focusSpellHaste, spell_id); - + if (level >= 60 && casttime > 1000) { casttime = casttime / 2; @@ -3599,7 +3601,7 @@ int16 Mob::GetSkillDmgTaken(const SkillUseTypes skill_used) // All skill dmg mod + Skill specific skilldmg_mod += itembonuses.SkillDmgTaken[HIGHEST_SKILL+1] + spellbonuses.SkillDmgTaken[HIGHEST_SKILL+1] + itembonuses.SkillDmgTaken[skill_used] + spellbonuses.SkillDmgTaken[skill_used]; - + skilldmg_mod += SkillDmgTaken_Mod[skill_used] + SkillDmgTaken_Mod[HIGHEST_SKILL+1]; @@ -5317,7 +5319,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) if (slot < 4){ if (id == "components") { return spells[spell_id].components[slot];} - else if (id == "component_counts") { return spells[spell_id].component_counts[slot];} + else if (id == "component_counts") { return spells[spell_id].component_counts[slot];} else if (id == "NoexpendReagent") {return spells[spell_id].NoexpendReagent[slot];} } @@ -5395,7 +5397,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) else if (id == "max_dist") {return static_cast(spells[spell_id].max_dist); } else if (id == "min_range") {return static_cast(spells[spell_id].min_range); } else if (id == "DamageShieldType") {return spells[spell_id].DamageShieldType; } - + return stat; } @@ -5415,7 +5417,7 @@ bool Mob::CanClassEquipItem(uint32 item_id) int bitmask = 1; bitmask = bitmask << (GetClass() - 1); - + if(!(itm->Classes & bitmask)) return false; else diff --git a/zone/mob.h b/zone/mob.h index 1d41f4098..fc5e1d8e0 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1026,6 +1026,11 @@ protected: uint32 follow_dist; bool no_target_hotkey; + uint32 PlayerState; + uint32 GetPlayerState() { return PlayerState; } + void AddPlayerState(uint32 new_state) { PlayerState |= new_state; } + void RemovePlayerState(uint32 old_state) { PlayerState &= ~old_state; } + uint8 gender; uint16 race; uint8 base_gender;