This commit is contained in:
Kinglykrab
2025-08-15 15:20:09 -04:00
parent 26bb3e269a
commit 57f569f3fa
6 changed files with 79 additions and 71 deletions
+15 -10
View File
@@ -793,16 +793,21 @@ namespace BookType {
} }
namespace PetButton { namespace PetButton {
constexpr int Sit = 0; constexpr uint8 Sit = 0;
constexpr int Stop = 1; constexpr uint8 Stop = 1;
constexpr int Regroup = 2; constexpr uint8 Regroup = 2;
constexpr int Follow = 3; constexpr uint8 Follow = 3;
constexpr int Guard = 4; constexpr uint8 Guard = 4;
constexpr int Taunt = 5; constexpr uint8 Taunt = 5;
constexpr int Hold = 6; constexpr uint8 Hold = 6;
constexpr int GreaterHold = 7; constexpr uint8 GreaterHold = 7;
constexpr int Focus = 8; constexpr uint8 Focus = 8;
constexpr int SpellHold = 9; constexpr uint8 SpellHold = 9;
}
namespace PetButtonState {
constexpr uint8 Off = 0;
constexpr uint8 On = 1;
} }
namespace PetCommand { namespace PetCommand {
+2 -2
View File
@@ -4117,7 +4117,7 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
SetPetOrder(GetPreviousPetOrder()); SetPetOrder(GetPreviousPetOrder());
} }
// fix GUI sit button to be unpressed and stop sitting regen // 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); 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 // 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); pet->SetAppearance(eaStanding);
} }
+16 -13
View File
@@ -6415,17 +6415,17 @@ void Client::SuspendMinion(int value)
// TODO: These pet command states need to be synced ... // TODO: These pet command states need to be synced ...
// Will just fix them for now // Will just fix them for now
if (m_ClientVersionBit & EQ::versions::maskUFAndLater) { if (m_ClientVersionBit & EQ::versions::maskUFAndLater) {
SetPetCommandState(PetButton::Sit, 0); SetPetCommandState(PetButton::Sit, PetButtonState::Off);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
SetPetCommandState(PetButton::Regroup, 0); SetPetCommandState(PetButton::Regroup, PetButtonState::Off);
SetPetCommandState(PetButton::Follow, 1); SetPetCommandState(PetButton::Follow, PetButtonState::On);
SetPetCommandState(PetButton::Guard, 0); SetPetCommandState(PetButton::Guard, PetButtonState::Off);
// Taunt saved on client side for logging on with pet // Taunt saved on client side for logging on with pet
// In our db for when we zone. // In our db for when we zone.
SetPetCommandState(PetButton::Hold, 0); SetPetCommandState(PetButton::Hold, PetButtonState::Off);
SetPetCommandState(PetButton::GreaterHold, 0); SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off);
SetPetCommandState(PetButton::Focus, 0); SetPetCommandState(PetButton::Focus, PetButtonState::Off);
SetPetCommandState(PetButton::SpellHold, 0); SetPetCommandState(PetButton::SpellHold, PetButtonState::Off);
} }
} }
else 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 app = new EQApplicationPacket(OP_PetCommandState, sizeof(PetCommandState_Struct));
auto pcs = (PetCommandState_Struct *)app->pBuffer;
pcs->button_id = button; auto s = (PetCommandState_Struct*) app->pBuffer;
pcs->state = state;
s->button_id = button;
s->state = state;
FastQueuePacket(&app); FastQueuePacket(&app);
} }
+1 -1
View File
@@ -523,7 +523,7 @@ public:
inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; }
void ReloadExpansionProfileSetting(); void ReloadExpansionProfileSetting();
void SetPetCommandState(int button, int state); void SetPetCommandState(uint8 button, uint8 state);
bool AutoAttackEnabled() const { return auto_attack; } bool AutoAttackEnabled() const { return auto_attack; }
bool AutoFireEnabled() const { return auto_fire; } bool AutoFireEnabled() const { return auto_fire; }
+32 -32
View File
@@ -955,17 +955,17 @@ void Client::CompleteConnect()
// TODO: load these states // TODO: load these states
// We at least will set them to the correct state for now // We at least will set them to the correct state for now
if (m_ClientVersionBit & EQ::versions::maskUFAndLater && GetPet()) { if (m_ClientVersionBit & EQ::versions::maskUFAndLater && GetPet()) {
SetPetCommandState(PetButton::Sit, 0); SetPetCommandState(PetButton::Sit, PetButtonState::Off);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
SetPetCommandState(PetButton::Regroup, 0); SetPetCommandState(PetButton::Regroup, PetButtonState::Off);
SetPetCommandState(PetButton::Follow, 1); SetPetCommandState(PetButton::Follow, PetButtonState::On);
SetPetCommandState(PetButton::Guard, 0); SetPetCommandState(PetButton::Guard, PetButtonState::Off);
// Taunt saved on client side for logging on with pet // Taunt saved on client side for logging on with pet
// In our db for when we zone. // In our db for when we zone.
SetPetCommandState(PetButton::Hold, 0); SetPetCommandState(PetButton::Hold, PetButtonState::Off);
SetPetCommandState(PetButton::GreaterHold, 0); SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off);
SetPetCommandState(PetButton::Focus, 0); SetPetCommandState(PetButton::Focus, PetButtonState::Off);
SetPetCommandState(PetButton::SpellHold, 0); SetPetCommandState(PetButton::SpellHold, PetButtonState::Off);
} }
database.LoadAuras(this); // this ends up spawning them so probably safer to load this later (here) 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()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); pet->SetPetStop(false);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
if (pet->IsPetRegroup()) { if (pet->IsPetRegroup()) {
pet->SetPetRegroup(false); 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) { if (pet->GetPetOrder() == PetOrder::Sit || pet->GetPetOrder() == PetOrder::Feign) {
pet->SetPetOrder(pet->GetPreviousPetOrder()); pet->SetPetOrder(pet->GetPreviousPetOrder());
@@ -11240,15 +11240,15 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (pet->IsPetStop()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); pet->SetPetStop(false);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
if (pet->IsPetRegroup()) { if (pet->IsPetRegroup()) {
pet->SetPetRegroup(false); 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) { if (pet->GetPetOrder() == PetOrder::Sit || pet->GetPetOrder() == PetOrder::Feign) {
pet->SetPetOrder(pet->GetPreviousPetOrder()); pet->SetPetOrder(pet->GetPreviousPetOrder());
@@ -11278,7 +11278,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (pet->IsPetStop()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); pet->SetPetStop(false);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
break; break;
@@ -11335,7 +11335,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
parse->EventMob(EVENT_PET_COMMAND, CastToMob(), pet, f, s->command); parse->EventMob(EVENT_PET_COMMAND, CastToMob(), pet, f, s->command);
pet->SetFeigned(false); pet->SetFeigned(false);
SetPetCommandState(PetButton::Sit, 0); SetPetCommandState(PetButton::Sit, PetButtonState::Off);
pet->SetAppearance(eaStanding); pet->SetAppearance(eaStanding);
pet->SayString(this, Chat::PetResponse, PET_GUARDINGLIFE); pet->SayString(this, Chat::PetResponse, PET_GUARDINGLIFE);
pet->SetPetOrder(PetOrder::Guard); pet->SetPetOrder(PetOrder::Guard);
@@ -11347,7 +11347,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (pet->IsPetStop()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); pet->SetPetStop(false);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
break; break;
@@ -11367,12 +11367,12 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
pet->SetFeigned(false); pet->SetFeigned(false);
pet->SayString(this, Chat::PetResponse, PET_FOLLOWING); pet->SayString(this, Chat::PetResponse, PET_FOLLOWING);
pet->SetPetOrder(PetOrder::Follow); pet->SetPetOrder(PetOrder::Follow);
SetPetCommandState(PetButton::Sit, 0); SetPetCommandState(PetButton::Sit, PetButtonState::Off);
pet->SetAppearance(eaStanding); pet->SetAppearance(eaStanding);
if (pet->IsPetStop()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); pet->SetPetStop(false);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
break; break;
@@ -11440,12 +11440,12 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
pet->SetFeigned(false); pet->SetFeigned(false);
pet->SayString(this, Chat::PetResponse, PET_GUARDME_STRING); pet->SayString(this, Chat::PetResponse, PET_GUARDME_STRING);
pet->SetPetOrder(PetOrder::Follow); pet->SetPetOrder(PetOrder::Follow);
SetPetCommandState(PetButton::Sit, 0); SetPetCommandState(PetButton::Sit, PetButtonState::Off);
pet->SetAppearance(eaStanding); pet->SetAppearance(eaStanding);
if (pet->IsPetStop()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); pet->SetPetStop(false);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
break; break;
@@ -11491,7 +11491,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
pet->SetFeigned(false); pet->SetFeigned(false);
pet->SayString(this, Chat::PetResponse, PET_SIT_STRING); pet->SayString(this, Chat::PetResponse, PET_SIT_STRING);
SetPetCommandState(PetButton ::Sit, 0); SetPetCommandState(PetButton::Sit, PetButtonState::Off);
pet->SetPetOrder(pet->GetPreviousPetOrder()); pet->SetPetOrder(pet->GetPreviousPetOrder());
pet->SetAppearance(eaStanding); pet->SetAppearance(eaStanding);
break; break;
@@ -11510,7 +11510,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
pet->SetFeigned(false); pet->SetFeigned(false);
pet->SayString(this, Chat::PetResponse, PET_SIT_STRING); pet->SayString(this, Chat::PetResponse, PET_SIT_STRING);
SetPetCommandState(PetButton::Sit, 1); SetPetCommandState(PetButton::Sit, PetButtonState::On);
pet->SetPetOrder(PetOrder::Sit); pet->SetPetOrder(PetOrder::Sit);
pet->SetRunAnimSpeed(0); pet->SetRunAnimSpeed(0);
@@ -11554,7 +11554,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
} }
pet->SetGHeld(false); pet->SetGHeld(false);
SetPetCommandState(PetButton::GreaterHold, 0); SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off);
break; break;
} }
case PetCommand::HoldOn: { case PetCommand::HoldOn: {
@@ -11581,7 +11581,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
pet->SetHeld(true); pet->SetHeld(true);
pet->SetGHeld(false); pet->SetGHeld(false);
SetPetCommandState(PetButton::GreaterHold, 0); SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off);
break; break;
} }
case PetCommand::HoldOff: { case PetCommand::HoldOff: {
@@ -11633,7 +11633,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
} }
pet->SetHeld(false); pet->SetHeld(false);
SetPetCommandState(PetButton::Hold, 0); SetPetCommandState(PetButton::Hold, PetButtonState::Off);
break; break;
} }
case PetCommand::GreaterHoldOn: { case PetCommand::GreaterHoldOn: {
@@ -11657,7 +11657,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
pet->SetGHeld(true); pet->SetGHeld(true);
pet->SetHeld(false); pet->SetHeld(false);
SetPetCommandState(PetButton::Hold, 0); SetPetCommandState(PetButton::Hold, PetButtonState::Off);
break; break;
} }
case PetCommand::GreaterHoldOff: { case PetCommand::GreaterHoldOff: {
@@ -11862,7 +11862,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (pet->IsPetRegroup()) { if (pet->IsPetRegroup()) {
pet->SetPetRegroup(false); 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()) { if (pet->IsPetRegroup()) {
pet->SetPetRegroup(false); pet->SetPetRegroup(false);
SetPetCommandState(PetButton::Regroup, 0); SetPetCommandState(PetButton::Regroup, PetButtonState::Off);
} }
break; break;
@@ -11931,7 +11931,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
if (pet->IsPetStop()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); 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()) { if (pet->IsPetStop()) {
pet->SetPetStop(false); pet->SetPetStop(false);
SetPetCommandState(PetButton::Stop, 0); SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
break; break;
+13 -13
View File
@@ -809,10 +809,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
// stand and follow on charm. // stand and follow on charm.
if (caster->IsClient()) { if (caster->IsClient()) {
Client *cpet = caster->CastToClient(); Client *cpet = caster->CastToClient();
cpet->SetPetCommandState(PetButton::Sit,0); cpet->SetPetCommandState(PetButton::Sit, PetButtonState::Off);
cpet->SetPetCommandState(PetButton::Follow, 1); cpet->SetPetCommandState(PetButton::Follow, PetButtonState::On);
cpet->SetPetCommandState(PetButton::Guard, 0); cpet->SetPetCommandState(PetButton::Guard, PetButtonState::Off);
cpet->SetPetCommandState(PetButton::Stop, 0); cpet->SetPetCommandState(PetButton::Stop, PetButtonState::Off);
} }
SetPetType(PetType::Charmed); SetPetType(PetType::Charmed);
@@ -1308,18 +1308,18 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
if (IsClient() && pet) { if (IsClient() && pet) {
auto c = CastToClient(); auto c = CastToClient();
if (c->ClientVersionBit() & EQ::versions::maskUFAndLater) { if (c->ClientVersionBit() & EQ::versions::maskUFAndLater) {
c->SetPetCommandState(PetButton::Sit, 0); c->SetPetCommandState(PetButton::Sit, PetButtonState::Off);
c->SetPetCommandState(PetButton::Stop, 0); c->SetPetCommandState(PetButton::Stop, PetButtonState::Off);
c->SetPetCommandState(PetButton::Regroup, 0); c->SetPetCommandState(PetButton::Regroup, PetButtonState::Off);
c->SetPetCommandState(PetButton::Follow, 1); c->SetPetCommandState(PetButton::Follow, PetButtonState::On);
c->SetPetCommandState(PetButton::Guard, 0); c->SetPetCommandState(PetButton::Guard, PetButtonState::Off);
// Creating pet from spell - taunt always false // Creating pet from spell - taunt always false
// If suspended pet - that will be restore there // If suspended pet - that will be restore there
// If logging in, client will send toggle // If logging in, client will send toggle
c->SetPetCommandState(PetButton::Hold, 0); c->SetPetCommandState(PetButton::Hold, PetButtonState::Off);
c->SetPetCommandState(PetButton::GreaterHold, 0); c->SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off);
c->SetPetCommandState(PetButton::Focus, 0); c->SetPetCommandState(PetButton::Focus, PetButtonState::Off);
c->SetPetCommandState(PetButton::SpellHold, 0); c->SetPetCommandState(PetButton::SpellHold, PetButtonState::Off);
} }
} }
} }