From 2c43e6f68dab213b8b11c10bbf9ec63e9670eac2 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 6 Jan 2015 19:14:06 -0600 Subject: [PATCH] Added defines for all remaining pet commands and some support for them as well. --- changelog.txt | 1 + common/patches/sod.cpp | 8 ++-- common/patches/sof.cpp | 6 ++- common/patches/titanium.cpp | 6 ++- zone/client_packet.cpp | 75 ++++++++++++++++++++++++++++++++++++- zone/pets.h | 27 +++++++------ 6 files changed, 102 insertions(+), 21 deletions(-) diff --git a/changelog.txt b/changelog.txt index 36e19a297..1b5483e73 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 01/06/2015 == Trevius: Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD. Trevius: (RoF+) The /pet focus on/off and /pet hold on/off commands are now functional. +Trevius: Added defines for all remaining pet commands and some support for them as well. == 01/05/2015 == Uleat: Fixed (added translators for) item/text links. Only 'OP_ChannelMessage' and 'OP_SpecialMesg' are currently handled..more text channels will be added as the need arises. diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index a6025b287..910a094d4 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3121,6 +3121,8 @@ namespace SoD case 0x07: emu->command = 0x02; // /pet attack or Pet Window break; + case 0x03: // Case Guessed + emu->command = 0x03; // /pet qattack case 0x08: emu->command = 0x04; // /pet follow or Pet Window break; @@ -3134,10 +3136,10 @@ namespace SoD emu->command = 0x08; // /pet stand or Pet Window break; case 0x06: - emu->command = 0x03; // /pet guard me + emu->command = 0x1e; // /pet guard me break; - case 0x03: // Case Made Up - emu->command = 0x09; // Stop? + case 0x0f: // Case Made Up + emu->command = 0x09; // /pet stop break; case 0x0b: emu->command = 0x0d; // /pet taunt or Pet Window diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 5e3dff8b1..70fb34597 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2459,6 +2459,8 @@ namespace SoF case 0x07: emu->command = 0x02; // /pet attack or Pet Window break; + case 0x03: // Case Guessed + emu->command = 0x03; // /pet qattack case 0x08: emu->command = 0x04; // /pet follow or Pet Window break; @@ -2472,9 +2474,9 @@ namespace SoF emu->command = 0x08; // /pet stand or Pet Window break; case 0x06: - emu->command = 0x03; // /pet guard me + emu->command = 0x1e; // /pet guard me break; - case 0x03: // Case Made Up + case 0x0f: // Case Made Up emu->command = 0x09; // Stop? break; case 0x0b: diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 895f2ee88..eef600795 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1653,6 +1653,8 @@ namespace Titanium case 0x07: emu->command = 0x02; // /pet attack or Pet Window break; + case 0x03: // Case Guessed + emu->command = 0x03; // /pet qattack case 0x08: emu->command = 0x04; // /pet follow or Pet Window break; @@ -1666,9 +1668,9 @@ namespace Titanium emu->command = 0x08; // /pet stand or Pet Window break; case 0x06: - emu->command = 0x03; // /pet guard me + emu->command = 0x1e; // /pet guard me break; - case 0x03: // Case Made Up + case 0x0f: // Case Made Up emu->command = 0x09; // Stop? break; case 0x0b: diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 785abb0c8..c9ec08b30 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9970,6 +9970,31 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } + case PET_QATTACK: { + if (mypet->IsFeared()) + break; //prevent pet from attacking stuff while feared + + if (!GetTarget()) + break; + if (GetTarget()->IsMezzed()) { + Message_StringID(10, CANNOT_WAKE, mypet->GetCleanName(), GetTarget()->GetCleanName()); + break; + } + + if (!mypet->IsAttackAllowed(GetTarget())) { + mypet->Say_StringID(NOT_LEGAL_TARGET); + break; + } + + if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) { + if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { + zone->AddAggroMob(); + mypet->AddToHateList(GetTarget(), 1); + Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName()); + } + } + break; + } case PET_BACKOFF: { if (mypet->IsFeared()) break; //keeps pet running while feared @@ -10126,6 +10151,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF if (mypet->GetPetType() != petAnimation) { + // Needs to have an IsSleeping() check added and this case should toggle on/off mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); mypet->SetPetOrder(SPO_Sit); mypet->SetRunAnimSpeed(0); @@ -10135,6 +10161,30 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } + case PET_SLUMBER_ON: { + if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF + + if (mypet->GetPetType() != petAnimation) { + mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); + mypet->SetPetOrder(SPO_Sit); + mypet->SetRunAnimSpeed(0); + if (!mypet->UseBardSpellLogic()) //maybe we can have a bard pet + mypet->InterruptSpell(); //No cast 4 u. //i guess the pet should start casting + mypet->SendAppearancePacket(AT_Anim, ANIM_DEATH); + } + break; + } + case PET_SLUMBER_OFF: { + if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF + + if (mypet->GetPetType() != petAnimation) { + mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); + mypet->SetPetOrder(SPO_Follow); + mypet->SetRunAnimSpeed(mypet->GetBaseRunspeed()); + mypet->SendAppearancePacket(AT_Anim, ANIM_STAND); + } + break; + } case PET_HOLD: { if (GetAA(aaPetDiscipline) && mypet->IsNPC()){ if (mypet->IsFeared()) @@ -10169,8 +10219,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) mypet->SetHeld(false); break; } - case PET_NOCAST_ON: - case PET_NOCAST: { + case PET_SPELLHOLD: { if (GetAA(aaAdvancedPetDiscipline) == 2 && mypet->IsNPC()) { if (mypet->IsFeared()) break; @@ -10185,6 +10234,28 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } + case PET_SPELLHOLD_ON: { + if (GetAA(aaAdvancedPetDiscipline) == 2 && mypet->IsNPC()) { + if (mypet->IsFeared()) + break; + if (!mypet->IsNoCast()) { + Message_StringID(MT_PetResponse, PET_NOT_CASTING); + mypet->CastToNPC()->SetNoCast(true); + } + } + break; + } + case PET_SPELLHOLD_OFF: { + if (GetAA(aaAdvancedPetDiscipline) == 2 && mypet->IsNPC()) { + if (mypet->IsFeared()) + break; + if (mypet->IsNoCast()) { + Message_StringID(MT_PetResponse, PET_CASTING); + mypet->CastToNPC()->SetNoCast(false); + } + } + break; + } case PET_FOCUS: { if (GetAA(aaAdvancedPetDiscipline) >= 1 && mypet->IsNPC()) { if (mypet->IsFeared()) diff --git a/zone/pets.h b/zone/pets.h index 243807502..f0c71fbe7 100644 --- a/zone/pets.h +++ b/zone/pets.h @@ -2,33 +2,36 @@ #define PETS_H // Defines based on the RoF2 Client -#define PET_HEALTHREPORT 0 // 0x00 - /pet health -#define PET_LEADER 1 // 0x01 - /pet leader +#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_GUARDME 3 // 0x03 - No longer exists? - define not from client +#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 - Not implemented? - // Guessing 10 and 11 are PET_STOP_ON and PET_STOP_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 +#define PET_HOLD 15 // 0x0f - /pet hold or Pet Window #define PET_HOLD_ON 16 // 0x10 - /pet hold on #define PET_HOLD_OFF 17 // 0x11 - /pet hold off -#define PET_SLUMBER 18 // 0x12 - What is this? - define not from client - // Guessing 19 and 20 are PET_SLUMBER_ON and PET_SLUMBER_OFF -#define PET_NOCAST 21 // 0x15 - /pet no cast -#define PET_NOCAST_ON 22 // 0x16 - Pet Window No Cast -#define PET_NOCAST_OFF 23 // 0x17 - Guessed -#define PET_FOCUS 24 // 0x18 - /pet focus +#define PET_SLUMBER 18 // 0x12 - What activates this? - define guessed +#define PET_SLUMBER_ON 19 // 0x13 - What activates this? - define guessed +#define PET_SLUMBER_OFF 20 // 0x14 - What activates this? - define guessed +#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_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 class Mob; struct NPCType;