mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
[Pets] Add Pet Constants and Methods (#4987)
* [Pets] Add Pet Constants and Methods * Remove GetID * GetPetTypeName() * Cleanup
This commit is contained in:
parent
207ee2daa0
commit
a4e47d9180
@ -451,3 +451,23 @@ bool LDoNTheme::IsValid(uint32 theme_id)
|
||||
{
|
||||
return ldon_theme_names.find(theme_id) != ldon_theme_names.end();
|
||||
}
|
||||
|
||||
std::string PetCommand::GetName(uint8 pet_command)
|
||||
{
|
||||
return IsValid(pet_command) ? pet_commands[pet_command] : "UNKNOWN PET COMMAND";
|
||||
}
|
||||
|
||||
bool PetCommand::IsValid(uint8 pet_command)
|
||||
{
|
||||
return pet_commands.find(pet_command) != pet_commands.end();
|
||||
}
|
||||
|
||||
std::string PetType::GetName(uint8 pet_type)
|
||||
{
|
||||
return IsValid(pet_type) ? pet_types[pet_type] : "UNKNOWN PET TYPE";
|
||||
}
|
||||
|
||||
bool PetType::IsValid(uint8 pet_type)
|
||||
{
|
||||
return pet_types.find(pet_type) != pet_types.end();
|
||||
}
|
||||
|
||||
@ -792,4 +792,131 @@ namespace BookType {
|
||||
constexpr uint8 ItemInfo = 2;
|
||||
}
|
||||
|
||||
namespace PetButton {
|
||||
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 {
|
||||
constexpr uint8 HealthReport = 0; // /pet health or Pet Window
|
||||
constexpr uint8 Leader = 1; // /pet leader or Pet Window
|
||||
constexpr uint8 Attack = 2; // /pet attack or Pet Window
|
||||
constexpr uint8 QAttack = 3; // /pet qattack or Pet Window
|
||||
constexpr uint8 FollowMe = 4; // /pet follow or Pet Window
|
||||
constexpr uint8 GuardHere = 5; // /pet guard or Pet Window
|
||||
constexpr uint8 Sit = 6; // /pet sit or Pet Window
|
||||
constexpr uint8 SitDown = 7; // /pet sit on
|
||||
constexpr uint8 StandUp = 8; // /pet sit off
|
||||
constexpr uint8 Stop = 9; // /pet stop or Pet Window - Not implemented
|
||||
constexpr uint8 StopOn = 10; // /pet stop on - Not implemented
|
||||
constexpr uint8 StopOff = 11; // /pet stop off - Not implemented
|
||||
constexpr uint8 Taunt = 12; // /pet taunt or Pet Window
|
||||
constexpr uint8 TauntOn = 13; // /pet taunt on
|
||||
constexpr uint8 TauntOff = 14; // /pet taunt off
|
||||
constexpr uint8 Hold = 15; // /pet hold or Pet Window, won't add to hate list unless attacking
|
||||
constexpr uint8 HoldOn = 16; // /pet hold on
|
||||
constexpr uint8 HoldOff = 17; // /pet hold off
|
||||
constexpr uint8 GreaterHold = 18; // /pet ghold, will never add to hate list unless told to
|
||||
constexpr uint8 GreaterHoldOn = 19; // /pet ghold on
|
||||
constexpr uint8 GreaterHoldOff = 20; // /pet ghold off
|
||||
constexpr uint8 SpellHold = 21; // /pet no cast or /pet spellhold or Pet Window
|
||||
constexpr uint8 SpellHoldOn = 22; // /pet spellhold on
|
||||
constexpr uint8 SpellHoldOff = 23; // /pet spellhold off
|
||||
constexpr uint8 Focus = 24; // /pet focus or Pet Window
|
||||
constexpr uint8 FocusOn = 25; // /pet focus on
|
||||
constexpr uint8 FocusOff = 26; // /pet focus off
|
||||
constexpr uint8 Feign = 27; // /pet feign
|
||||
constexpr uint8 BackOff = 28; // /pet back off
|
||||
constexpr uint8 GetLost = 29; // /pet get lost
|
||||
constexpr uint8 GuardMe = 30; // Same as /pet follow, but different message in older clients
|
||||
constexpr uint8 Regroup = 31; // /pet regroup, acts like classic hold
|
||||
constexpr uint8 RegroupOn = 32; // /pet regroup on
|
||||
constexpr uint8 RegroupOff = 33; // /pet regroup off
|
||||
constexpr uint8 Max = 34;
|
||||
|
||||
static std::map<uint8, std::string> pet_commands = {
|
||||
{ PetCommand::HealthReport, "Health Report" },
|
||||
{ PetCommand::Leader, "Leader" },
|
||||
{ PetCommand::Attack, "Attack" },
|
||||
{ PetCommand::QAttack, "QAttack" },
|
||||
{ PetCommand::FollowMe, "Follow Me" },
|
||||
{ PetCommand::GuardHere, "Guard Here" },
|
||||
{ PetCommand::Sit, "Sit" },
|
||||
{ PetCommand::SitDown, "Sit Down" },
|
||||
{ PetCommand::StandUp, "Stand Up" },
|
||||
{ PetCommand::Stop, "Stop" },
|
||||
{ PetCommand::StopOn, "Stop On" },
|
||||
{ PetCommand::StopOff, "Stop Off" },
|
||||
{ PetCommand::Taunt, "Taunt" },
|
||||
{ PetCommand::TauntOn, "Taunt On" },
|
||||
{ PetCommand::TauntOff, "Taunt Off" },
|
||||
{ PetCommand::Hold, "Hold" },
|
||||
{ PetCommand::HoldOn, "Hold On" },
|
||||
{ PetCommand::HoldOff, "Hold Off" },
|
||||
{ PetCommand::GreaterHold, "Greater Hold" },
|
||||
{ PetCommand::GreaterHoldOn, "Greater Hold On" },
|
||||
{ PetCommand::GreaterHoldOff, "Greater Hold Off" },
|
||||
{ PetCommand::SpellHold, "Spell Hold" },
|
||||
{ PetCommand::SpellHoldOn, "Spell Hold On" },
|
||||
{ PetCommand::SpellHoldOff, "Spell Hold Off" },
|
||||
{ PetCommand::Focus, "Focus" },
|
||||
{ PetCommand::FocusOn, "Focus On" },
|
||||
{ PetCommand::FocusOff, "Focus Off" },
|
||||
{ PetCommand::Feign, "Feign" },
|
||||
{ PetCommand::BackOff, "Back Off" },
|
||||
{ PetCommand::GetLost, "Get Lost" },
|
||||
{ PetCommand::GuardMe, "Guard Me" },
|
||||
{ PetCommand::Regroup, "Regroup" },
|
||||
{ PetCommand::RegroupOn, "Regroup On" },
|
||||
{ PetCommand::RegroupOff, "Regroup Off" },
|
||||
{ PetCommand::Max, "Max" }
|
||||
};
|
||||
|
||||
std::string GetName(uint8 pet_command);
|
||||
bool IsValid(uint8 pet_command);
|
||||
}
|
||||
|
||||
namespace PetOrder {
|
||||
constexpr uint8 Follow = 0;
|
||||
constexpr uint8 Sit = 1;
|
||||
constexpr uint8 Guard = 2;
|
||||
constexpr uint8 Feign = 3;
|
||||
}
|
||||
|
||||
namespace PetType {
|
||||
constexpr uint8 Familiar = 0;
|
||||
constexpr uint8 Animation = 1;
|
||||
constexpr uint8 Normal = 2;
|
||||
constexpr uint8 Charmed = 3;
|
||||
constexpr uint8 Follow = 4;
|
||||
constexpr uint8 TargetLock = 5;
|
||||
constexpr uint8 None = 255;
|
||||
|
||||
static std::map<uint8, std::string> pet_types = {
|
||||
{ PetType::Familiar, "Familiar" },
|
||||
{ PetType::Animation, "Animation" },
|
||||
{ PetType::Normal, "Normal" },
|
||||
{ PetType::Charmed, "Charmed" },
|
||||
{ PetType::Follow, "Follow" },
|
||||
{ PetType::TargetLock, "Target Lock" },
|
||||
{ PetType::None, "None" }
|
||||
};
|
||||
|
||||
std::string GetName(uint8 pet_type);
|
||||
bool IsValid(uint8 pet_type);
|
||||
}
|
||||
|
||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||
|
||||
@ -4113,11 +4113,11 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
if (IsPet()) {
|
||||
Mob *owner = GetOwner();
|
||||
if (owner && owner->IsClient()) {
|
||||
if (GetPetOrder() == SPO_Sit) {
|
||||
if (GetPetOrder() == PetOrder::Sit) {
|
||||
SetPetOrder(GetPreviousPetOrder());
|
||||
}
|
||||
// fix GUI sit button to be unpressed and stop sitting regen
|
||||
owner->CastToClient()->SetPetCommandState(PET_BUTTON_SIT, 0);
|
||||
owner->CastToClient()->SetPetCommandState(PetButton::Sit, PetButtonState::Off);
|
||||
SetAppearance(eaStanding);
|
||||
}
|
||||
}
|
||||
@ -4147,12 +4147,12 @@ void Mob::CommonDamage(Mob* attacker, int64 &damage, const uint16 spell_id, cons
|
||||
if (IsClient() && !pet->IsPetStop()) {
|
||||
// if pet was sitting his new mode is previous setting of
|
||||
// follow or guard after the battle (live verified)
|
||||
if (pet->GetPetOrder() == SPO_Sit) {
|
||||
if (pet->GetPetOrder() == PetOrder::Sit) {
|
||||
pet->SetPetOrder(pet->GetPreviousPetOrder());
|
||||
}
|
||||
|
||||
// fix GUI sit button to be unpressed and stop sitting regen
|
||||
CastToClient()->SetPetCommandState(PET_BUTTON_SIT, 0);
|
||||
CastToClient()->SetPetCommandState(PetButton::Sit, PetButtonState::Off);
|
||||
pet->SetAppearance(eaStanding);
|
||||
}
|
||||
|
||||
|
||||
@ -1549,7 +1549,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
|
||||
break;
|
||||
|
||||
case SE_AddPetCommand:
|
||||
if (base_value && limit_value < PET_MAXCOMMANDS)
|
||||
if (base_value && limit_value < PetCommand::Max)
|
||||
newbon->PetCommands[limit_value] = true;
|
||||
break;
|
||||
|
||||
@ -1557,7 +1557,7 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
|
||||
if (newbon->FeignedMinionChance < base_value) {
|
||||
newbon->FeignedMinionChance = base_value;
|
||||
}
|
||||
newbon->PetCommands[PET_FEIGN] = true;
|
||||
newbon->PetCommands[PetCommand::Feign] = true;
|
||||
break;
|
||||
|
||||
case SE_AdditionalAura:
|
||||
|
||||
24
zone/bot.cpp
24
zone/bot.cpp
@ -99,7 +99,7 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
|
||||
SetPullingFlag(false);
|
||||
SetReturningFlag(false);
|
||||
SetIsUsingItemClick(false);
|
||||
m_previous_pet_order = SPO_Guard;
|
||||
m_previous_pet_order = PetOrder::Guard;
|
||||
|
||||
rest_timer.Disable();
|
||||
m_ping_timer.Disable();
|
||||
@ -232,7 +232,7 @@ Bot::Bot(
|
||||
SetPullingFlag(false);
|
||||
SetReturningFlag(false);
|
||||
SetIsUsingItemClick(false);
|
||||
m_previous_pet_order = SPO_Guard;
|
||||
m_previous_pet_order = PetOrder::Guard;
|
||||
|
||||
rest_timer.Disable();
|
||||
m_ping_timer.Disable();
|
||||
@ -2313,7 +2313,7 @@ void Bot::AI_Process()
|
||||
bot_owner->SetBotPulling(false);
|
||||
|
||||
if (GetPet()) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(true);
|
||||
}
|
||||
|
||||
@ -2569,7 +2569,7 @@ void Bot::DoOutOfCombatChecks(Client* bot_owner, Mob* follow_mob, float leash_di
|
||||
bot_owner->SetBotPulling(false);
|
||||
|
||||
if (GetPet()) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(true);
|
||||
}
|
||||
}
|
||||
@ -3198,7 +3198,7 @@ bool Bot::IsValidTarget(
|
||||
bot_owner->SetBotPulling(false);
|
||||
|
||||
if (GetPet()) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(true);
|
||||
}
|
||||
}
|
||||
@ -3233,7 +3233,7 @@ Mob* Bot::GetBotTarget(Client* bot_owner)
|
||||
bot_owner->SetBotPulling(false);
|
||||
|
||||
if (GetPet()) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(true);
|
||||
}
|
||||
}
|
||||
@ -3269,7 +3269,7 @@ bool Bot::ReturningFlagChecks(Client* bot_owner, Mob* leash_owner, float fm_dist
|
||||
bot_owner->SetBotPulling(false);
|
||||
|
||||
if (GetPet()) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(true);
|
||||
|
||||
if (HasControllablePet(BotAnimEmpathy::BackOff)) {
|
||||
@ -3313,7 +3313,7 @@ bool Bot::PullingFlagChecks(Client* bot_owner) {
|
||||
bot_owner->SetBotPulling(false);
|
||||
|
||||
if (GetPet()) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(true);
|
||||
}
|
||||
|
||||
@ -3494,7 +3494,7 @@ Client* Bot::SetLeashOwner(Client* bot_owner, Group* bot_group, Raid* raid, uint
|
||||
|
||||
void Bot::SetOwnerTarget(Client* bot_owner) {
|
||||
if (GetPet() && (PULLING_BOT || RETURNING_BOT)) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
}
|
||||
|
||||
SetAttackFlag(false);
|
||||
@ -3533,7 +3533,7 @@ void Bot::BotPullerProcess(Client* bot_owner, Raid* raid) {
|
||||
bot_owner->SetBotPulling(false);
|
||||
|
||||
if (GetPet()) {
|
||||
GetPet()->SetPetOrder(SPO_Follow);
|
||||
GetPet()->SetPetOrder(PetOrder::Follow);
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(true);
|
||||
}
|
||||
|
||||
@ -3562,7 +3562,7 @@ void Bot::BotPullerProcess(Client* bot_owner, Raid* raid) {
|
||||
if (HasControllablePet(BotAnimEmpathy::Guard)) {
|
||||
m_previous_pet_order = GetPet()->GetPetOrder();
|
||||
GetPet()->CastToNPC()->SaveGuardSpot(GetPosition());
|
||||
GetPet()->SetPetOrder(SPO_Guard);
|
||||
GetPet()->SetPetOrder(PetOrder::Guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13456,6 +13456,6 @@ bool Bot::HasControllablePet(uint8 ranks_required) {
|
||||
}
|
||||
|
||||
return GetClass() != Class::Enchanter ||
|
||||
GetPet()->GetPetType() != petAnimation ||
|
||||
GetPet()->GetPetType() != PetType::Animation ||
|
||||
GetAA(aaAnimationEmpathy) >= ranks_required;
|
||||
}
|
||||
|
||||
@ -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(PET_BUTTON_SIT, 0);
|
||||
SetPetCommandState(PET_BUTTON_STOP, 0);
|
||||
SetPetCommandState(PET_BUTTON_REGROUP, 0);
|
||||
SetPetCommandState(PET_BUTTON_FOLLOW, 1);
|
||||
SetPetCommandState(PET_BUTTON_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(PET_BUTTON_HOLD, 0);
|
||||
SetPetCommandState(PET_BUTTON_GHOLD, 0);
|
||||
SetPetCommandState(PET_BUTTON_FOCUS, 0);
|
||||
SetPetCommandState(PET_BUTTON_SPELLHOLD, 0);
|
||||
SetPetCommandState(PetButton::Hold, PetButtonState::Off);
|
||||
SetPetCommandState(PetButton::GreaterHold, PetButtonState::Off);
|
||||
SetPetCommandState(PetButton::Focus, PetButtonState::Off);
|
||||
SetPetCommandState(PetButton::SpellHold, PetButtonState::Off);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -6906,9 +6906,9 @@ void Client::CheckLDoNHail(NPC* n)
|
||||
|
||||
auto pet = GetPet();
|
||||
if (pet) {
|
||||
if (pet->GetPetType() == petCharmed) {
|
||||
if (pet->GetPetType() == PetType::Charmed) {
|
||||
pet->BuffFadeByEffect(SE_Charm);
|
||||
} else if (pet->GetPetType() == petNPCFollow) {
|
||||
} else if (pet->GetPetType() == PetType::Follow) {
|
||||
pet->SetOwnerID(0);
|
||||
} else {
|
||||
pet->Depop();
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -524,7 +524,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; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/emu_constants.h"
|
||||
|
||||
#include <cereal/cereal.hpp>
|
||||
|
||||
@ -45,55 +46,6 @@ namespace Archetype {
|
||||
//Maximum distance from a zone point if zone was specified
|
||||
#define ZONEPOINT_ZONE_RANGE 40000.0f
|
||||
|
||||
// Defines based on the RoF2 Client
|
||||
#define PET_HEALTHREPORT 0 // 0x00 - /pet health or Pet Window
|
||||
#define PET_LEADER 1 // 0x01 - /pet leader or Pet Window
|
||||
#define PET_ATTACK 2 // 0x02 - /pet attack or Pet Window
|
||||
#define PET_QATTACK 3 // 0x03 - /pet qattack or Pet Window
|
||||
#define PET_FOLLOWME 4 // 0x04 - /pet follow or Pet Window
|
||||
#define PET_GUARDHERE 5 // 0x05 - /pet guard or Pet Window
|
||||
#define PET_SIT 6 // 0x06 - /pet sit or Pet Window
|
||||
#define PET_SITDOWN 7 // 0x07 - /pet sit on
|
||||
#define PET_STANDUP 8 // 0x08 - /pet sit off
|
||||
#define PET_STOP 9 // 0x09 - /pet stop or Pet Window - Not implemented
|
||||
#define PET_STOP_ON 10 // 0x0a - /pet stop on - Not implemented
|
||||
#define PET_STOP_OFF 11 // 0x0b - /pet stop off - Not implemented
|
||||
#define PET_TAUNT 12 // 0x0c - /pet taunt or Pet Window
|
||||
#define PET_TAUNT_ON 13 // 0x0d - /pet taunt on
|
||||
#define PET_TAUNT_OFF 14 // 0x0e - /pet taunt off
|
||||
#define PET_HOLD 15 // 0x0f - /pet hold or Pet Window, won't add to hate list unless attacking
|
||||
#define PET_HOLD_ON 16 // 0x10 - /pet hold on
|
||||
#define PET_HOLD_OFF 17 // 0x11 - /pet hold off
|
||||
#define PET_GHOLD 18 // 0x12 - /pet ghold, will never add to hate list unless told to
|
||||
#define PET_GHOLD_ON 19 // 0x13 - /pet ghold on
|
||||
#define PET_GHOLD_OFF 20 // 0x14 - /pet ghold off
|
||||
#define PET_SPELLHOLD 21 // 0x15 - /pet no cast or /pet spellhold or Pet Window
|
||||
#define PET_SPELLHOLD_ON 22 // 0x16 - /pet spellhold on
|
||||
#define PET_SPELLHOLD_OFF 23 // 0x17 - /pet spellhold off
|
||||
#define PET_FOCUS 24 // 0x18 - /pet focus or Pet Window
|
||||
#define PET_FOCUS_ON 25 // 0x19 - /pet focus on
|
||||
#define PET_FOCUS_OFF 26 // 0x1a - /pet focus off
|
||||
#define PET_FEIGN 27 // 0x1b - /pet feign
|
||||
#define PET_BACKOFF 28 // 0x1c - /pet back off
|
||||
#define PET_GETLOST 29 // 0x1d - /pet get lost
|
||||
#define PET_GUARDME 30 // 0x1e - Same as /pet follow, but different message in older clients - define not from client /pet target in modern clients but doesn't send packet
|
||||
#define PET_REGROUP 31 // 0x1f - /pet regroup, acts like classic hold. Stops attack and moves back to guard/you but doesn't clear hate list
|
||||
#define PET_REGROUP_ON 32 // 0x20 - /pet regroup on, turns on regroup
|
||||
#define PET_REGROUP_OFF 33 // 0x21 - /pet regroup off, turns off regroup
|
||||
#define PET_MAXCOMMANDS PET_REGROUP_OFF + 1
|
||||
|
||||
// can change the state of these buttons with a packet
|
||||
#define PET_BUTTON_SIT 0
|
||||
#define PET_BUTTON_STOP 1
|
||||
#define PET_BUTTON_REGROUP 2
|
||||
#define PET_BUTTON_FOLLOW 3
|
||||
#define PET_BUTTON_GUARD 4
|
||||
#define PET_BUTTON_TAUNT 5
|
||||
#define PET_BUTTON_HOLD 6
|
||||
#define PET_BUTTON_GHOLD 7
|
||||
#define PET_BUTTON_FOCUS 8
|
||||
#define PET_BUTTON_SPELLHOLD 9
|
||||
|
||||
#define AURA_HARDCAP 2
|
||||
#define WEAPON_STANCE_TYPE_MAX 2
|
||||
|
||||
@ -617,7 +569,7 @@ struct StatBonuses {
|
||||
uint8 TradeSkillMastery; // Allow number of tradeskills to exceed 200 skill.
|
||||
int16 NoBreakAESneak; // Percent value
|
||||
int16 FeignedCastOnChance; // Percent Value
|
||||
bool PetCommands[PET_MAXCOMMANDS]; // SPA 267
|
||||
bool PetCommands[PetCommand::Max]; // SPA 267
|
||||
int FeignedMinionChance; // SPA 281 base1 = chance, just like normal FD
|
||||
int GrantForage; // affects max skill of forage as well as granting non-forage classes forage
|
||||
int aura_slots;
|
||||
@ -781,16 +733,6 @@ enum {
|
||||
GridRandomPath
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
petFamiliar, //only listens to /pet get lost
|
||||
petAnimation, //does not listen to any commands
|
||||
petOther,
|
||||
petCharmed,
|
||||
petNPCFollow,
|
||||
petTargetLock, //remain active as long something is on the hatelist. Don't listen to any commands
|
||||
petNone = 0xFF // not a pet
|
||||
} PetType;
|
||||
|
||||
typedef enum {
|
||||
SingleTarget, // causes effect to spell_target
|
||||
AETarget, // causes effect in aerange of target + target
|
||||
|
||||
@ -207,6 +207,7 @@ const char* QuestEventSubroutines[_LargestEventID] = {
|
||||
"EVENT_AA_LOSS",
|
||||
"EVENT_SPELL_BLOCKED",
|
||||
"EVENT_READ_ITEM",
|
||||
"EVENT_PET_COMMAND",
|
||||
|
||||
// Add new events before these or Lua crashes
|
||||
"EVENT_SPELL_EFFECT_BOT",
|
||||
@ -2532,6 +2533,12 @@ void PerlembParser::ExportEventVariables(
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_PET_COMMAND: {
|
||||
ExportVar(package_name.c_str(), "pet_command", extra_data);
|
||||
ExportVar(package_name.c_str(), "pet_command_name", data);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6039,6 +6039,16 @@ perl::array Perl__get_timers(Mob* m)
|
||||
return a;
|
||||
}
|
||||
|
||||
std::string Perl__get_pet_command_name(uint8 pet_command)
|
||||
{
|
||||
return PetCommand::GetName(pet_command);
|
||||
}
|
||||
|
||||
std::string Perl__get_pet_type_name(uint8 pet_type)
|
||||
{
|
||||
return PetType::GetName(pet_type);
|
||||
}
|
||||
|
||||
void perl_register_quest()
|
||||
{
|
||||
perl::interpreter perl(PERL_GET_THX);
|
||||
@ -6729,6 +6739,8 @@ void perl_register_quest()
|
||||
package.add("getgroupidbycharid", &Perl__getgroupidbycharid);
|
||||
package.add("getinventoryslotname", &Perl__getinventoryslotname);
|
||||
package.add("get_paused_timers", &Perl__get_paused_timers);
|
||||
package.add("get_pet_command_name", &Perl__get_pet_command_name);
|
||||
package.add("get_pet_type_name", &Perl__get_pet_type_name);
|
||||
package.add("getraididbycharid", &Perl__getraididbycharid);
|
||||
package.add("get_race_bitmask", &Perl__get_race_bitmask);
|
||||
package.add("get_recipe_component_item_ids", &Perl__GetRecipeComponentItemIDs);
|
||||
|
||||
@ -145,6 +145,7 @@ typedef enum {
|
||||
EVENT_AA_LOSS,
|
||||
EVENT_SPELL_BLOCKED,
|
||||
EVENT_READ_ITEM,
|
||||
EVENT_PET_COMMAND,
|
||||
|
||||
// Add new events before these or Lua crashes
|
||||
EVENT_SPELL_EFFECT_BOT,
|
||||
|
||||
@ -5701,6 +5701,16 @@ luabind::object lua_get_timers(lua_State* L, Mob* m) {
|
||||
return t;
|
||||
}
|
||||
|
||||
std::string lua_get_pet_command_name(uint8 pet_command)
|
||||
{
|
||||
return PetCommand::GetName(pet_command);
|
||||
}
|
||||
|
||||
std::string lua_get_pet_type_name(uint8 pet_type)
|
||||
{
|
||||
return PetType::GetName(pet_type);
|
||||
}
|
||||
|
||||
#define LuaCreateNPCParse(name, c_type, default_value) do { \
|
||||
cur = table[#name]; \
|
||||
if(luabind::type(cur) != LUA_TNIL) { \
|
||||
@ -6514,6 +6524,8 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("handin", &lua_handin),
|
||||
luabind::def("get_paused_timers", &lua_get_paused_timers),
|
||||
luabind::def("get_timers", &lua_get_timers),
|
||||
luabind::def("get_pet_command_name", &lua_get_pet_command_name),
|
||||
luabind::def("get_pet_type_name", &lua_get_pet_type_name),
|
||||
/*
|
||||
Cross Zone
|
||||
*/
|
||||
@ -6979,7 +6991,8 @@ luabind::scope lua_register_events() {
|
||||
luabind::value("entity_variable_set", static_cast<int>(EVENT_ENTITY_VARIABLE_SET)),
|
||||
luabind::value("entity_variable_update", static_cast<int>(EVENT_ENTITY_VARIABLE_UPDATE)),
|
||||
luabind::value("aa_loss", static_cast<int>(EVENT_AA_LOSS)),
|
||||
luabind::value("read", static_cast<int>(EVENT_READ_ITEM))
|
||||
luabind::value("read", static_cast<int>(EVENT_READ_ITEM)),
|
||||
luabind::value("pet_command", static_cast<int>(EVENT_PET_COMMAND))
|
||||
)];
|
||||
}
|
||||
|
||||
|
||||
@ -1241,12 +1241,12 @@ float Lua_Mob::GetAssistRange() {
|
||||
return self->GetAssistRange();
|
||||
}
|
||||
|
||||
void Lua_Mob::SetPetOrder(int order) {
|
||||
void Lua_Mob::SetPetOrder(uint8 pet_order) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetPetOrder(static_cast<Mob::eStandingPetOrder>(order));
|
||||
self->SetPetOrder(pet_order);
|
||||
}
|
||||
|
||||
int Lua_Mob::GetPetOrder() {
|
||||
uint8 Lua_Mob::GetPetOrder() {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetPetOrder();
|
||||
}
|
||||
@ -3512,6 +3512,24 @@ luabind::object Lua_Mob::GetTimers(lua_State* L) {
|
||||
return t;
|
||||
}
|
||||
|
||||
uint8 Lua_Mob::GetPetType()
|
||||
{
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetPetType();
|
||||
}
|
||||
|
||||
std::string Lua_Mob::GetPetTypeName()
|
||||
{
|
||||
Lua_Safe_Call_String();
|
||||
return PetType::GetName(self->GetPetType());
|
||||
}
|
||||
|
||||
void Lua_Mob::SetPetType(uint8 pet_type)
|
||||
{
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetPetType(pet_type);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_mob() {
|
||||
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
|
||||
.def(luabind::constructor<>())
|
||||
@ -3854,7 +3872,9 @@ luabind::scope lua_register_mob() {
|
||||
.def("GetPR", &Lua_Mob::GetPR)
|
||||
.def("GetPausedTimers", &Lua_Mob::GetPausedTimers)
|
||||
.def("GetPet", &Lua_Mob::GetPet)
|
||||
.def("GetPetOrder", (int(Lua_Mob::*)(void))&Lua_Mob::GetPetOrder)
|
||||
.def("GetPetOrder", (uint8(Lua_Mob::*)(void))&Lua_Mob::GetPetOrder)
|
||||
.def("GetPetType", &Lua_Mob::GetPetType)
|
||||
.def("GetPetTypeName", &Lua_Mob::GetPetTypeName)
|
||||
.def("GetPhR", &Lua_Mob::GetPhR)
|
||||
.def("GetRace", &Lua_Mob::GetRace)
|
||||
.def("GetRaceName", &Lua_Mob::GetRaceName)
|
||||
@ -4049,7 +4069,8 @@ luabind::scope lua_register_mob() {
|
||||
.def("SetMana", &Lua_Mob::SetMana)
|
||||
.def("SetOOCRegen", (void(Lua_Mob::*)(int64))&Lua_Mob::SetOOCRegen)
|
||||
.def("SetPet", &Lua_Mob::SetPet)
|
||||
.def("SetPetOrder", (void(Lua_Mob::*)(int))&Lua_Mob::SetPetOrder)
|
||||
.def("SetPetOrder", (void(Lua_Mob::*)(uint8))&Lua_Mob::SetPetOrder)
|
||||
.def("SetPetType", &Lua_Mob::SetPetType)
|
||||
.def("SetPseudoRoot", (void(Lua_Mob::*)(bool))&Lua_Mob::SetPseudoRoot)
|
||||
.def("SetRace", (void(Lua_Mob::*)(uint16))&Lua_Mob::SetRace)
|
||||
.def("SetRunning", (void(Lua_Mob::*)(bool))&Lua_Mob::SetRunning)
|
||||
|
||||
@ -280,8 +280,8 @@ public:
|
||||
bool IsAIControlled();
|
||||
float GetAggroRange();
|
||||
float GetAssistRange();
|
||||
void SetPetOrder(int order);
|
||||
int GetPetOrder();
|
||||
void SetPetOrder(uint8 pet_order);
|
||||
uint8 GetPetOrder();
|
||||
bool IsRoamer();
|
||||
bool IsRooted();
|
||||
bool IsEngaged();
|
||||
@ -614,6 +614,9 @@ public:
|
||||
void BuffFadeSongs();
|
||||
luabind::object GetPausedTimers(lua_State* L);
|
||||
luabind::object GetTimers(lua_State* L);
|
||||
uint8 GetPetType();
|
||||
std::string GetPetTypeName();
|
||||
void SetPetType(uint8 pet_type);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -188,7 +188,8 @@ const char *LuaEvents[_LargestEventID] = {
|
||||
"event_entity_variable_update",
|
||||
"event_aa_loss",
|
||||
"event_spell_blocked",
|
||||
"event_read_item"
|
||||
"event_read_item",
|
||||
"event_pet_command"
|
||||
};
|
||||
|
||||
extern Zone *zone;
|
||||
@ -264,6 +265,7 @@ LuaParser::LuaParser() {
|
||||
NPCArgumentDispatch[EVENT_ENTITY_VARIABLE_SET] = handle_npc_entity_variable;
|
||||
NPCArgumentDispatch[EVENT_ENTITY_VARIABLE_UPDATE] = handle_npc_entity_variable;
|
||||
NPCArgumentDispatch[EVENT_SPELL_BLOCKED] = handle_npc_spell_blocked;
|
||||
NPCArgumentDispatch[EVENT_PET_COMMAND] = handle_npc_pet_command;
|
||||
|
||||
PlayerArgumentDispatch[EVENT_SAY] = handle_player_say;
|
||||
PlayerArgumentDispatch[EVENT_ENVIRONMENTAL_DAMAGE] = handle_player_environmental_damage;
|
||||
@ -355,6 +357,7 @@ LuaParser::LuaParser() {
|
||||
PlayerArgumentDispatch[EVENT_SPELL_BLOCKED] = handle_player_spell_blocked;
|
||||
PlayerArgumentDispatch[EVENT_READ_ITEM] = handle_player_read_item;
|
||||
PlayerArgumentDispatch[EVENT_CONNECT] = handle_player_connect;
|
||||
PlayerArgumentDispatch[EVENT_PET_COMMAND] = handle_player_pet_command;
|
||||
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
|
||||
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;
|
||||
|
||||
@ -668,6 +668,23 @@ void handle_npc_spell_blocked(
|
||||
lua_setfield(L, -2, "cast_spell");
|
||||
}
|
||||
|
||||
void handle_npc_pet_command(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
NPC* npc,
|
||||
Mob *init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
)
|
||||
{
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "pet_command");
|
||||
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "pet_command_name");
|
||||
}
|
||||
|
||||
// Player
|
||||
void handle_player_say(
|
||||
QuestInterface *parse,
|
||||
@ -1829,6 +1846,22 @@ void handle_player_connect(
|
||||
lua_setfield(L, -2, "is_first_login");
|
||||
}
|
||||
|
||||
void handle_player_pet_command(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
)
|
||||
{
|
||||
lua_pushinteger(L, extra_data);
|
||||
lua_setfield(L, -2, "pet_command");
|
||||
|
||||
lua_pushstring(L, data.c_str());
|
||||
lua_setfield(L, -2, "pet_command_name");
|
||||
}
|
||||
|
||||
// Item
|
||||
void handle_item_click(
|
||||
QuestInterface *parse,
|
||||
|
||||
@ -262,6 +262,16 @@ void handle_npc_spell_blocked(
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
void handle_npc_pet_command(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
NPC* npc,
|
||||
Mob *init,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
// Player
|
||||
void handle_player_say(
|
||||
QuestInterface *parse,
|
||||
@ -875,6 +885,15 @@ void handle_player_connect(
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
void handle_player_pet_command(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
// Item
|
||||
void handle_item_click(
|
||||
QuestInterface *parse,
|
||||
|
||||
22
zone/mob.cpp
22
zone/mob.cpp
@ -392,7 +392,7 @@ Mob::Mob(
|
||||
spellbonuses.AssistRange = -1;
|
||||
SetPetID(0);
|
||||
SetOwnerID(0);
|
||||
SetPetType(petNone); // default to not a pet
|
||||
SetPetType(PetType::None); // default to not a pet
|
||||
SetPetPower(0);
|
||||
held = false;
|
||||
gheld = false;
|
||||
@ -454,8 +454,8 @@ Mob::Mob(
|
||||
weaponstance.itembonus_buff_spell_id = 0;
|
||||
weaponstance.aabonus_buff_spell_id = 0;
|
||||
|
||||
pStandingPetOrder = SPO_Follow;
|
||||
m_previous_pet_order = SPO_Follow;
|
||||
m_pet_order = PetOrder::Follow;
|
||||
m_previous_pet_order = PetOrder::Follow;
|
||||
pseudo_rooted = false;
|
||||
|
||||
nobuff_invisible = 0;
|
||||
@ -623,7 +623,7 @@ bool Mob::HasAnInvisibilityEffect() {
|
||||
|
||||
void Mob::BreakCharmPetIfConditionsMet() {
|
||||
auto pet = GetPet();
|
||||
if (pet && pet->GetPetType() == petCharmed && HasAnInvisibilityEffect()) {
|
||||
if (pet && pet->GetPetType() == PetType::Charmed && HasAnInvisibilityEffect()) {
|
||||
if (RuleB(Pets, LivelikeBreakCharmOnInvis) || IsInvisible(pet)) {
|
||||
pet->BuffFadeByEffect(SE_Charm);
|
||||
}
|
||||
@ -655,14 +655,14 @@ void Mob::CalcInvisibleLevel()
|
||||
BreakCharmPetIfConditionsMet();
|
||||
}
|
||||
|
||||
void Mob::SetPetOrder(eStandingPetOrder i) {
|
||||
if (i == SPO_Sit || i == SPO_FeignDeath) {
|
||||
if (pStandingPetOrder == SPO_Follow || pStandingPetOrder == SPO_Guard) {
|
||||
m_previous_pet_order = pStandingPetOrder;
|
||||
void Mob::SetPetOrder(uint8 pet_order) {
|
||||
if (pet_order == PetOrder::Sit || pet_order == PetOrder::Feign) {
|
||||
if (m_pet_order == PetOrder::Follow || m_pet_order == PetOrder::Guard) {
|
||||
m_previous_pet_order = m_pet_order;
|
||||
}
|
||||
}
|
||||
|
||||
pStandingPetOrder = i;
|
||||
m_pet_order = pet_order;
|
||||
}
|
||||
|
||||
void Mob::SetInvisible(uint8 state, bool set_on_bonus_calc) {
|
||||
@ -4567,8 +4567,8 @@ void Mob::SetOwnerID(uint16 new_owner_id) {
|
||||
if (
|
||||
!ownerid &&
|
||||
IsNPC() &&
|
||||
GetPetType() != petCharmed &&
|
||||
GetPetType() != petNone
|
||||
GetPetType() != PetType::Charmed &&
|
||||
GetPetType() != PetType::None
|
||||
) {
|
||||
Depop();
|
||||
}
|
||||
|
||||
27
zone/mob.h
27
zone/mob.h
@ -98,7 +98,6 @@ class Mob : public Entity {
|
||||
public:
|
||||
enum CLIENT_CONN_STATUS { CLIENT_CONNECTING, CLIENT_CONNECTED, CLIENT_LINKDEAD,
|
||||
CLIENT_KICKED, DISCONNECTED, CLIENT_ERROR, CLIENT_CONNECTINGALL };
|
||||
enum eStandingPetOrder { SPO_Follow, SPO_Sit, SPO_Guard, SPO_FeignDeath };
|
||||
|
||||
struct MobSpecialAbility {
|
||||
MobSpecialAbility() {
|
||||
@ -601,7 +600,7 @@ public:
|
||||
inline const char* GetName() const { return name; }
|
||||
inline const char* GetOrigName() const { return orig_name; }
|
||||
inline const char* GetLastName() const { return lastname; }
|
||||
inline const eStandingPetOrder GetPreviousPetOrder() const { return m_previous_pet_order; }
|
||||
inline const uint8 GetPreviousPetOrder() const { return m_previous_pet_order; }
|
||||
const char *GetCleanName();
|
||||
virtual void SetName(const char *new_name = nullptr) { new_name ? strn0cpy(name, new_name, 64) :
|
||||
strn0cpy(name, GetName(), 64); return; };
|
||||
@ -1083,14 +1082,14 @@ public:
|
||||
Mob* GetUltimateOwner();
|
||||
void SetPetID(uint16 NewPetID);
|
||||
inline uint16 GetPetID() const { return petid; }
|
||||
inline PetType GetPetType() const { return type_of_pet; }
|
||||
void SetPetType(PetType p) { type_of_pet = p; }
|
||||
inline uint8 GetPetType() const { return type_of_pet; }
|
||||
void SetPetType(uint8 pet_type) { type_of_pet = pet_type; }
|
||||
inline int16 GetPetPower() const { return (petpower < 0) ? 0 : petpower; }
|
||||
void SetPetPower(int16 p) { if (p < 0) petpower = 0; else petpower = p; }
|
||||
bool IsFamiliar() const { return type_of_pet == petFamiliar; }
|
||||
bool IsAnimation() const { return type_of_pet == petAnimation; }
|
||||
bool IsCharmed() const { return type_of_pet == petCharmed; }
|
||||
bool IsTargetLockPet() const { return type_of_pet == petTargetLock; }
|
||||
bool IsFamiliar() const { return type_of_pet == PetType::Familiar; }
|
||||
bool IsAnimation() const { return type_of_pet == PetType::Animation; }
|
||||
bool IsCharmed() const { return type_of_pet == PetType::Charmed; }
|
||||
bool IsTargetLockPet() const { return type_of_pet == PetType::TargetLock; }
|
||||
inline uint32 GetPetTargetLockID() { return pet_targetlock_id; };
|
||||
inline void SetPetTargetLockID(uint32 value) { pet_targetlock_id = value; };
|
||||
void SetOwnerID(uint16 new_owner_id);
|
||||
@ -1212,8 +1211,8 @@ public:
|
||||
inline const float GetAssistRange() const { return (spellbonuses.AssistRange == -1) ? pAssistRange : spellbonuses.AssistRange; }
|
||||
|
||||
|
||||
void SetPetOrder(eStandingPetOrder i);
|
||||
inline const eStandingPetOrder GetPetOrder() const { return pStandingPetOrder; }
|
||||
void SetPetOrder(uint8 pet_order);
|
||||
inline const uint8 GetPetOrder() const { return m_pet_order; }
|
||||
inline void SetHeld(bool nState) { held = nState; }
|
||||
inline const bool IsHeld() const { return held; }
|
||||
inline void SetGHeld(bool nState) { gheld = nState; }
|
||||
@ -1300,7 +1299,7 @@ public:
|
||||
bool IsPetAggroExempt(Mob *pet_owner);
|
||||
|
||||
void InstillDoubt(Mob *who);
|
||||
bool Charmed() const { return type_of_pet == petCharmed; }
|
||||
bool Charmed() const { return type_of_pet == PetType::Charmed; }
|
||||
static uint32 GetLevelHP(uint8 tlevel);
|
||||
uint32 GetZoneID() const; //for perl
|
||||
uint16 GetInstanceVersion() const; //for perl
|
||||
@ -1596,7 +1595,7 @@ protected:
|
||||
StatBonuses aabonuses;
|
||||
uint16 petid;
|
||||
uint16 ownerid;
|
||||
PetType type_of_pet;
|
||||
uint8 type_of_pet;
|
||||
int16 petpower;
|
||||
uint32 follow_id;
|
||||
uint32 follow_dist;
|
||||
@ -1825,8 +1824,8 @@ protected:
|
||||
Timer viral_timer;
|
||||
|
||||
// MobAI stuff
|
||||
eStandingPetOrder pStandingPetOrder;
|
||||
eStandingPetOrder m_previous_pet_order;
|
||||
uint8 m_pet_order;
|
||||
uint8 m_previous_pet_order;
|
||||
uint32 minLastFightingDelayMoving;
|
||||
uint32 maxLastFightingDelayMoving;
|
||||
float pAggroRange = 0;
|
||||
|
||||
@ -1397,8 +1397,8 @@ void Mob::AI_Process() {
|
||||
else if (AI_movement_timer->Check() && !IsRooted()) {
|
||||
if (IsPet()) {
|
||||
// we're a pet, do as we're told
|
||||
switch (pStandingPetOrder) {
|
||||
case SPO_Follow: {
|
||||
switch (m_pet_order) {
|
||||
case PetOrder::Follow: {
|
||||
|
||||
Mob *owner = GetOwner();
|
||||
if (owner == nullptr) {
|
||||
@ -1447,18 +1447,18 @@ void Mob::AI_Process() {
|
||||
|
||||
break;
|
||||
}
|
||||
case SPO_Sit: {
|
||||
case PetOrder::Sit: {
|
||||
SetAppearance(eaSitting, false);
|
||||
break;
|
||||
}
|
||||
case SPO_Guard: {
|
||||
case PetOrder::Guard: {
|
||||
//only NPCs can guard stuff. (forced by where the guard movement code is in the AI)
|
||||
if (IsNPC()) {
|
||||
CastToNPC()->NextGuardPosition();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPO_FeignDeath: {
|
||||
case PetOrder::Feign: {
|
||||
SetAppearance(eaDead, false);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4014,7 +4014,7 @@ void NPC::SetTaunting(bool is_taunting) {
|
||||
taunting = is_taunting;
|
||||
|
||||
if (IsPet() && IsPetOwnerClient()) {
|
||||
GetOwner()->CastToClient()->SetPetCommandState(PET_BUTTON_TAUNT, is_taunting);
|
||||
GetOwner()->CastToClient()->SetPetCommandState(PetButton::Taunt, is_taunting);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1114,11 +1114,16 @@ uint16 Perl_Mob_GetOwnerID(Mob* self) // @categories Script Utility, Pet
|
||||
return self->GetOwnerID();
|
||||
}
|
||||
|
||||
int Perl_Mob_GetPetType(Mob* self) // @categories Script Utility, Pet
|
||||
uint8 Perl_Mob_GetPetType(Mob* self) // @categories Script Utility, Pet
|
||||
{
|
||||
return self->GetPetType();
|
||||
}
|
||||
|
||||
std::string Perl_Mob_GetPetTypeName(Mob* self) // @categories Script Utility, Pet
|
||||
{
|
||||
return PetType::GetName(self->GetPetType());
|
||||
}
|
||||
|
||||
int Perl_Mob_GetBodyType(Mob* self) // @categories Stats and Attributes
|
||||
{
|
||||
return self->GetBodyType();
|
||||
@ -1254,12 +1259,12 @@ float Perl_Mob_GetAssistRange(Mob* self) // @categories Stats and Attributes, Ha
|
||||
return self->GetAssistRange();
|
||||
}
|
||||
|
||||
void Perl_Mob_SetPetOrder(Mob* self, int order) // @categories Pet
|
||||
void Perl_Mob_SetPetOrder(Mob* self, uint8 pet_order) // @categories Pet
|
||||
{
|
||||
self->SetPetOrder(static_cast<Mob::eStandingPetOrder>(order));
|
||||
self->SetPetOrder(pet_order);
|
||||
}
|
||||
|
||||
int Perl_Mob_GetPetOrder(Mob* self) // @categories Script Utility, Pet
|
||||
uint8 Perl_Mob_GetPetOrder(Mob* self) // @categories Script Utility, Pet
|
||||
{
|
||||
return self->GetPetOrder();
|
||||
}
|
||||
@ -3597,6 +3602,11 @@ perl::array Perl_Mob_GetTimers(Mob* self)
|
||||
return a;
|
||||
}
|
||||
|
||||
void Perl_Mob_SetPetType(Mob* self, uint8 pet_type)
|
||||
{
|
||||
self->SetPetType(pet_type);
|
||||
}
|
||||
|
||||
void perl_register_mob()
|
||||
{
|
||||
perl::interpreter perl(PERL_GET_THX);
|
||||
@ -3926,6 +3936,7 @@ void perl_register_mob()
|
||||
package.add("GetPetID", &Perl_Mob_GetPetID);
|
||||
package.add("GetPetOrder", &Perl_Mob_GetPetOrder);
|
||||
package.add("GetPetType", &Perl_Mob_GetPetType);
|
||||
package.add("GetPetTypeName", &Perl_Mob_GetPetTypeName);
|
||||
package.add("GetPhR", &Perl_Mob_GetPhR);
|
||||
package.add("GetRace", &Perl_Mob_GetRace);
|
||||
package.add("GetRaceName", &Perl_Mob_GetRaceName);
|
||||
@ -4187,6 +4198,7 @@ void perl_register_mob()
|
||||
package.add("SetPet", &Perl_Mob_SetPet);
|
||||
package.add("SetPetID", &Perl_Mob_SetPetID);
|
||||
package.add("SetPetOrder", &Perl_Mob_SetPetOrder);
|
||||
package.add("SetPetType", &Perl_Mob_SetPetType);
|
||||
package.add("SetRace", &Perl_Mob_SetRace);
|
||||
package.add("SetRunAnimSpeed", &Perl_Mob_SetRunAnimSpeed);
|
||||
package.add("SetRunning", &Perl_Mob_SetRunning);
|
||||
|
||||
@ -267,7 +267,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
|
||||
}
|
||||
|
||||
//this takes ownership of the npc_type data
|
||||
auto npc = new Pet(npc_type, this, (PetType)record.petcontrol, spell_id, record.petpower);
|
||||
auto npc = new Pet(npc_type, this, record.petcontrol, spell_id, record.petpower);
|
||||
|
||||
// Now that we have an actual object to interact with, load
|
||||
// the base items for the pet. These are always loaded
|
||||
@ -295,7 +295,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
|
||||
SetPetID(npc->GetID());
|
||||
// We need to handle PetType 5 (petHatelist), add the current target to the hatelist of the pet
|
||||
|
||||
if (record.petcontrol == petTargetLock)
|
||||
if (record.petcontrol == PetType::TargetLock)
|
||||
{
|
||||
Mob* m_target = GetTarget();
|
||||
|
||||
@ -341,7 +341,7 @@ void NPC::TryDepopTargetLockedPets(Mob* current_target) {
|
||||
return;
|
||||
}
|
||||
//Use when pets are given petype 5
|
||||
if (IsPet() && GetPetType() == petTargetLock && GetPetTargetLockID()) {
|
||||
if (IsPet() && GetPetType() == PetType::TargetLock && GetPetTargetLockID()) {
|
||||
CastSpell(SPELL_UNSUMMON_SELF, GetID()); //Live like behavior, damages self for 20K
|
||||
if (!HasDied()) {
|
||||
Kill(); //Ensure pet dies if over 20k HP.
|
||||
@ -356,11 +356,11 @@ void NPC::TryDepopTargetLockedPets(Mob* current_target) {
|
||||
/* This is why the pets ghost - pets were being spawned too far away from its npc owner and some
|
||||
into walls or objects (+10), this sometimes creates the "ghost" effect. I changed to +2 (as close as I
|
||||
could get while it still looked good). I also noticed this can happen if an NPC is spawned on the same spot of another or in a related bad spot.*/
|
||||
Pet::Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power)
|
||||
Pet::Pet(NPCType *type_data, Mob *owner, uint8 pet_type, uint16 spell_id, int16 power)
|
||||
: NPC(type_data, 0, owner->GetPosition() + glm::vec4(2.0f, 2.0f, 0.0f, 0.0f), GravityBehavior::Water)
|
||||
{
|
||||
GiveNPCTypeData(type_data);
|
||||
SetPetType(type);
|
||||
SetPetType(pet_type);
|
||||
SetPetPower(power);
|
||||
SetOwnerID(owner ? owner->GetID() : 0);
|
||||
SetPetSpellID(spell_id);
|
||||
@ -374,8 +374,8 @@ Pet::Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 po
|
||||
if (owner && owner->IsClient()) {
|
||||
if (!(owner->CastToClient()->ClientVersionBit() & EQ::versions::maskUFAndLater)) {
|
||||
if (
|
||||
(GetPetType() != petFamiliar && GetPetType() != petAnimation) ||
|
||||
aabonuses.PetCommands[PET_TAUNT]
|
||||
(GetPetType() != PetType::Familiar && GetPetType() != PetType::Animation) ||
|
||||
aabonuses.PetCommands[PetCommand::Taunt]
|
||||
) {
|
||||
SetTaunting(true);
|
||||
}
|
||||
@ -587,7 +587,7 @@ void NPC::SetPetState(SpellBuff_Struct *pet_buffs, uint32 *items) {
|
||||
|
||||
if (item2) {
|
||||
bool noDrop = (item2->NoDrop == 0); // Field is reverse logic
|
||||
bool petCanHaveNoDrop = (RuleB(Pets, CanTakeNoDrop) && _CLIENTPET(this) && GetPetType() <= petOther);
|
||||
bool petCanHaveNoDrop = (RuleB(Pets, CanTakeNoDrop) && _CLIENTPET(this) && GetPetType() <= PetType::Normal);
|
||||
|
||||
if (!noDrop || petCanHaveNoDrop) {
|
||||
AddLootDrop(item2, LootdropEntriesRepository::NewNpcEntity(), true);
|
||||
|
||||
@ -6,7 +6,7 @@ struct NPCType;
|
||||
|
||||
class Pet : public NPC {
|
||||
public:
|
||||
Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power);
|
||||
Pet(NPCType *type_data, Mob *owner, uint8 pet_type, uint16 spell_id, int16 power);
|
||||
virtual bool CheckSpellLevelRestriction(Mob *caster, uint16 spell_id);
|
||||
|
||||
};
|
||||
|
||||
@ -1907,7 +1907,7 @@ void NPC::DoClassAttacks(Mob *target) {
|
||||
target->GetBodyType() != BodyType::Undead &&
|
||||
taunt_time &&
|
||||
type_of_pet &&
|
||||
type_of_pet != petTargetLock &&
|
||||
type_of_pet != PetType::TargetLock &&
|
||||
DistanceSquared(GetPosition(), target->GetPosition()) <= (RuleI(Pets, PetTauntRange) * RuleI(Pets, PetTauntRange))
|
||||
) {
|
||||
GetOwner()->MessageString(Chat::PetResponse, PET_TAUNTING);
|
||||
|
||||
@ -803,19 +803,19 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
|
||||
caster->SetPet(this);
|
||||
SetOwnerID(caster->GetID());
|
||||
SetPetOrder(SPO_Follow);
|
||||
SetPetOrder(PetOrder::Follow);
|
||||
SetAppearance(eaStanding);
|
||||
// Client has saved previous pet sit/stand - make all new pets
|
||||
// stand and follow on charm.
|
||||
if (caster->IsClient()) {
|
||||
Client *cpet = caster->CastToClient();
|
||||
cpet->SetPetCommandState(PET_BUTTON_SIT,0);
|
||||
cpet->SetPetCommandState(PET_BUTTON_FOLLOW, 1);
|
||||
cpet->SetPetCommandState(PET_BUTTON_GUARD, 0);
|
||||
cpet->SetPetCommandState(PET_BUTTON_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(petCharmed);
|
||||
SetPetType(PetType::Charmed);
|
||||
|
||||
// This was done in AddBuff, but we were not a pet yet, so
|
||||
// the target windows didn't get updated.
|
||||
@ -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(PET_BUTTON_SIT, 0);
|
||||
c->SetPetCommandState(PET_BUTTON_STOP, 0);
|
||||
c->SetPetCommandState(PET_BUTTON_REGROUP, 0);
|
||||
c->SetPetCommandState(PET_BUTTON_FOLLOW, 1);
|
||||
c->SetPetCommandState(PET_BUTTON_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(PET_BUTTON_HOLD, 0);
|
||||
c->SetPetCommandState(PET_BUTTON_GHOLD, 0);
|
||||
c->SetPetCommandState(PET_BUTTON_FOCUS, 0);
|
||||
c->SetPetCommandState(PET_BUTTON_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1618,7 +1618,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
GetOwnerID() && // I'm a pet
|
||||
caster && // there's a caster
|
||||
caster->GetID() == GetOwnerID() && // and it's my master
|
||||
GetPetType() != petCharmed
|
||||
GetPetType() != PetType::Charmed
|
||||
)
|
||||
{
|
||||
uint16 pet_spellid = CastToNPC()->GetPetSpellID();
|
||||
@ -4427,7 +4427,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
SendAppearancePacket(AppearanceType::Pet, 0, true, true);
|
||||
Mob* owner = GetOwner();
|
||||
SetOwnerID(0);
|
||||
SetPetType(petNone);
|
||||
SetPetType(PetType::None);
|
||||
SetHeld(false);
|
||||
SetGHeld(false);
|
||||
SetNoCast(false);
|
||||
|
||||
@ -709,7 +709,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y,
|
||||
//if they have a pet and they are staying in zone, move with them
|
||||
Mob *p = GetPet();
|
||||
if(p != nullptr){
|
||||
p->SetPetOrder(SPO_Follow);
|
||||
p->SetPetOrder(PetOrder::Follow);
|
||||
p->GMMove(x+15, y, z); //so it dosent have to run across the map.
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user