diff --git a/common/emu_constants.h b/common/emu_constants.h index 9e8450105..0c762ffb8 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -793,16 +793,21 @@ namespace BookType { } namespace PetButton { - constexpr int Sit = 0; - constexpr int Stop = 1; - constexpr int Regroup = 2; - constexpr int Follow = 3; - constexpr int Guard = 4; - constexpr int Taunt = 5; - constexpr int Hold = 6; - constexpr int GreaterHold = 7; - constexpr int Focus = 8; - constexpr int SpellHold = 9; + constexpr uint8 Sit = 0; + constexpr uint8 Stop = 1; + constexpr uint8 Regroup = 2; + constexpr uint8 Follow = 3; + constexpr uint8 Guard = 4; + constexpr uint8 Taunt = 5; + constexpr uint8 Hold = 6; + constexpr uint8 GreaterHold = 7; + constexpr uint8 Focus = 8; + constexpr uint8 SpellHold = 9; +} + +namespace PetButtonState { + constexpr uint8 Off = 0; + constexpr uint8 On = 1; } namespace PetCommand { diff --git a/zone/attack.cpp b/zone/attack.cpp index e3b72c1c6..d19d05b6a 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4117,7 +4117,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons SetPetOrder(GetPreviousPetOrder()); } // fix GUI sit button to be unpressed and stop sitting regen - owner->CastToClient()->SetPetCommandState(PetButton::Sit, 0); + owner->CastToClient()->SetPetCommandState(PetButton::Sit, PetButtonState::Off); SetAppearance(eaStanding); } } @@ -4152,7 +4152,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons } // fix GUI sit button to be unpressed and stop sitting regen - CastToClient()->SetPetCommandState(PetButton::Sit, 0); + CastToClient()->SetPetCommandState(PetButton::Sit, PetButtonState::Off); pet->SetAppearance(eaStanding); } diff --git a/zone/client.cpp b/zone/client.cpp index 6e4af1026..2fa767d09 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6415,17 +6415,17 @@ void Client::SuspendMinion(int value) // TODO: These pet command states need to be synced ... // Will just fix them for now if (m_ClientVersionBit & EQ::versions::maskUFAndLater) { - SetPetCommandState(PetButton::Sit, 0); - SetPetCommandState(PetButton::Stop, 0); - SetPetCommandState(PetButton::Regroup, 0); - SetPetCommandState(PetButton::Follow, 1); - SetPetCommandState(PetButton::Guard, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); + SetPetCommandState(PetButton::Regroup, PetButtonState::Off); + SetPetCommandState(PetButton::Follow, PetButtonState::On); + SetPetCommandState(PetButton::Guard, PetButtonState::Off); // Taunt saved on client side for logging on with pet // In our db for when we zone. - SetPetCommandState(PetButton::Hold, 0); - SetPetCommandState(PetButton::GreaterHold, 0); - SetPetCommandState(PetButton::Focus, 0); - SetPetCommandState(PetButton::SpellHold, 0); + SetPetCommandState(PetButton::Hold, PetButtonState::Off); + SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off); + SetPetCommandState(PetButton::Focus, PetButtonState::Off); + SetPetCommandState(PetButton::SpellHold, PetButtonState::Off); } } else @@ -9450,12 +9450,15 @@ void Client::ProcessAggroMeter() } } -void Client::SetPetCommandState(int button, int state) +void Client::SetPetCommandState(uint8 button, uint8 state) { auto app = new EQApplicationPacket(OP_PetCommandState, sizeof(PetCommandState_Struct)); - auto pcs = (PetCommandState_Struct *)app->pBuffer; - pcs->button_id = button; - pcs->state = state; + + auto s = (PetCommandState_Struct*) app->pBuffer; + + s->button_id = button; + s->state = state; + FastQueuePacket(&app); } diff --git a/zone/client.h b/zone/client.h index 8bf808b1d..256cdb967 100644 --- a/zone/client.h +++ b/zone/client.h @@ -523,7 +523,7 @@ public: inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } void ReloadExpansionProfileSetting(); - void SetPetCommandState(int button, int state); + void SetPetCommandState(uint8 button, uint8 state); bool AutoAttackEnabled() const { return auto_attack; } bool AutoFireEnabled() const { return auto_fire; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 43f577bec..70ead88e2 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -955,17 +955,17 @@ void Client::CompleteConnect() // TODO: load these states // We at least will set them to the correct state for now if (m_ClientVersionBit & EQ::versions::maskUFAndLater && GetPet()) { - SetPetCommandState(PetButton::Sit, 0); - SetPetCommandState(PetButton::Stop, 0); - SetPetCommandState(PetButton::Regroup, 0); - SetPetCommandState(PetButton::Follow, 1); - SetPetCommandState(PetButton::Guard, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); + SetPetCommandState(PetButton::Regroup, PetButtonState::Off); + SetPetCommandState(PetButton::Follow, PetButtonState::On); + SetPetCommandState(PetButton::Guard, PetButtonState::Off); // Taunt saved on client side for logging on with pet // In our db for when we zone. - SetPetCommandState(PetButton::Hold, 0); - SetPetCommandState(PetButton::GreaterHold, 0); - SetPetCommandState(PetButton::Focus, 0); - SetPetCommandState(PetButton::SpellHold, 0); + SetPetCommandState(PetButton::Hold, PetButtonState::Off); + SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off); + SetPetCommandState(PetButton::Focus, PetButtonState::Off); + SetPetCommandState(PetButton::SpellHold, PetButtonState::Off); } database.LoadAuras(this); // this ends up spawning them so probably safer to load this later (here) @@ -11170,15 +11170,15 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } if (pet->IsPetRegroup()) { pet->SetPetRegroup(false); - SetPetCommandState(PetButton::Regroup, 0); + SetPetCommandState(PetButton::Regroup, PetButtonState::Off); } - SetPetCommandState(PetButton::Sit, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); if (pet->GetPetOrder() == PetOrder::Sit || pet->GetPetOrder() == PetOrder::Feign) { pet->SetPetOrder(pet->GetPreviousPetOrder()); @@ -11240,15 +11240,15 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } if (pet->IsPetRegroup()) { pet->SetPetRegroup(false); - SetPetCommandState(PetButton::Regroup, 0); + SetPetCommandState(PetButton::Regroup, PetButtonState::Off); } - SetPetCommandState(PetButton::Sit, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); if (pet->GetPetOrder() == PetOrder::Sit || pet->GetPetOrder() == PetOrder::Feign) { pet->SetPetOrder(pet->GetPreviousPetOrder()); @@ -11278,7 +11278,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } break; @@ -11335,7 +11335,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) parse->EventMob(EVENT_PET_COMMAND, CastToMob(), pet, f, s->command); pet->SetFeigned(false); - SetPetCommandState(PetButton::Sit, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); pet->SetAppearance(eaStanding); pet->SayString(this, Chat::PetResponse, PET_GUARDINGLIFE); pet->SetPetOrder(PetOrder::Guard); @@ -11347,7 +11347,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } break; @@ -11367,12 +11367,12 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) pet->SetFeigned(false); pet->SayString(this, Chat::PetResponse, PET_FOLLOWING); pet->SetPetOrder(PetOrder::Follow); - SetPetCommandState(PetButton::Sit, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); pet->SetAppearance(eaStanding); if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } break; @@ -11440,12 +11440,12 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) pet->SetFeigned(false); pet->SayString(this, Chat::PetResponse, PET_GUARDME_STRING); pet->SetPetOrder(PetOrder::Follow); - SetPetCommandState(PetButton::Sit, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); pet->SetAppearance(eaStanding); if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } break; @@ -11491,7 +11491,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) pet->SetFeigned(false); pet->SayString(this, Chat::PetResponse, PET_SIT_STRING); - SetPetCommandState(PetButton ::Sit, 0); + SetPetCommandState(PetButton::Sit, PetButtonState::Off); pet->SetPetOrder(pet->GetPreviousPetOrder()); pet->SetAppearance(eaStanding); break; @@ -11510,7 +11510,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) pet->SetFeigned(false); pet->SayString(this, Chat::PetResponse, PET_SIT_STRING); - SetPetCommandState(PetButton::Sit, 1); + SetPetCommandState(PetButton::Sit, PetButtonState::On); pet->SetPetOrder(PetOrder::Sit); pet->SetRunAnimSpeed(0); @@ -11554,7 +11554,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } pet->SetGHeld(false); - SetPetCommandState(PetButton::GreaterHold, 0); + SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off); break; } case PetCommand::HoldOn: { @@ -11581,7 +11581,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) pet->SetHeld(true); pet->SetGHeld(false); - SetPetCommandState(PetButton::GreaterHold, 0); + SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off); break; } case PetCommand::HoldOff: { @@ -11633,7 +11633,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } pet->SetHeld(false); - SetPetCommandState(PetButton::Hold, 0); + SetPetCommandState(PetButton::Hold, PetButtonState::Off); break; } case PetCommand::GreaterHoldOn: { @@ -11657,7 +11657,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) pet->SetGHeld(true); pet->SetHeld(false); - SetPetCommandState(PetButton::Hold, 0); + SetPetCommandState(PetButton::Hold, PetButtonState::Off); break; } case PetCommand::GreaterHoldOff: { @@ -11862,7 +11862,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetRegroup()) { pet->SetPetRegroup(false); - SetPetCommandState(PetButton::Regroup, 0); + SetPetCommandState(PetButton::Regroup, PetButtonState::Off); } } @@ -11888,7 +11888,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetRegroup()) { pet->SetPetRegroup(false); - SetPetCommandState(PetButton::Regroup, 0); + SetPetCommandState(PetButton::Regroup, PetButtonState::Off); } break; @@ -11931,7 +11931,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } } @@ -11955,7 +11955,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (pet->IsPetStop()) { pet->SetPetStop(false); - SetPetCommandState(PetButton::Stop, 0); + SetPetCommandState(PetButton::Stop, PetButtonState::Off); } break; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 7872c143b..71b3b2024 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -809,10 +809,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove // stand and follow on charm. if (caster->IsClient()) { Client *cpet = caster->CastToClient(); - cpet->SetPetCommandState(PetButton::Sit,0); - cpet->SetPetCommandState(PetButton::Follow, 1); - cpet->SetPetCommandState(PetButton::Guard, 0); - cpet->SetPetCommandState(PetButton::Stop, 0); + cpet->SetPetCommandState(PetButton::Sit, PetButtonState::Off); + cpet->SetPetCommandState(PetButton::Follow, PetButtonState::On); + cpet->SetPetCommandState(PetButton::Guard, PetButtonState::Off); + cpet->SetPetCommandState(PetButton::Stop, PetButtonState::Off); } SetPetType(PetType::Charmed); @@ -1308,18 +1308,18 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (IsClient() && pet) { auto c = CastToClient(); if (c->ClientVersionBit() & EQ::versions::maskUFAndLater) { - c->SetPetCommandState(PetButton::Sit, 0); - c->SetPetCommandState(PetButton::Stop, 0); - c->SetPetCommandState(PetButton::Regroup, 0); - c->SetPetCommandState(PetButton::Follow, 1); - c->SetPetCommandState(PetButton::Guard, 0); + c->SetPetCommandState(PetButton::Sit, PetButtonState::Off); + c->SetPetCommandState(PetButton::Stop, PetButtonState::Off); + c->SetPetCommandState(PetButton::Regroup, PetButtonState::Off); + c->SetPetCommandState(PetButton::Follow, PetButtonState::On); + c->SetPetCommandState(PetButton::Guard, PetButtonState::Off); // Creating pet from spell - taunt always false // If suspended pet - that will be restore there // If logging in, client will send toggle - c->SetPetCommandState(PetButton::Hold, 0); - c->SetPetCommandState(PetButton::GreaterHold, 0); - c->SetPetCommandState(PetButton::Focus, 0); - c->SetPetCommandState(PetButton::SpellHold, 0); + c->SetPetCommandState(PetButton::Hold, PetButtonState::Off); + c->SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off); + c->SetPetCommandState(PetButton::Focus, PetButtonState::Off); + c->SetPetCommandState(PetButton::SpellHold, PetButtonState::Off); } } }