mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[10236] Implement SPELL_AURA_OPEN_STABLE (292).
(based on Wowka321's repo commit 213ceb0) Signed-off-by: VladimirMangos <vladimir@getmangos.com> Rewrited partly.
This commit is contained in:
parent
e7093e3ebb
commit
d7b6840634
6 changed files with 50 additions and 19 deletions
|
|
@ -540,10 +540,34 @@ void WorldSession::SendStableResult(uint8 res)
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
bool WorldSession::CheckStableMaster(ObjectGuid guid)
|
||||
{
|
||||
// spell case or GM
|
||||
if (guid == GetPlayer()->GetObjectGuid())
|
||||
{
|
||||
if (!GetPlayer()->isGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
|
||||
{
|
||||
DEBUG_LOG("%s attempt open stable in cheating way.", guid.GetString().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// stable master case
|
||||
else
|
||||
{
|
||||
if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
|
||||
{
|
||||
DEBUG_LOG("Stablemaster %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_STABLE_PET");
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
|
||||
recv_data >> npcGUID;
|
||||
|
||||
|
|
@ -553,10 +577,8 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||
if (!unit)
|
||||
if (!CheckStableMaster(npcGUID))
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleStablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
|
@ -609,15 +631,13 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
|||
void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_UNSTABLE_PET.");
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
uint32 petnumber;
|
||||
|
||||
recv_data >> npcGUID >> petnumber;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||
if (!unit)
|
||||
if (!CheckStableMaster(npcGUID))
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleUnstablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
|
@ -682,14 +702,12 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
|||
void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_BUY_STABLE_SLOT.");
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
|
||||
recv_data >> npcGUID;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||
if (!unit)
|
||||
if (!CheckStableMaster(npcGUID))
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleBuyStableSlot - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
|
@ -722,15 +740,13 @@ void WorldSession::HandleStableRevivePet( WorldPacket &/* recv_data */)
|
|||
void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recv CMSG_STABLE_SWAP_PET.");
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
uint32 pet_number;
|
||||
|
||||
recv_data >> npcGUID >> pet_number;
|
||||
|
||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||
if (!unit)
|
||||
if (!CheckStableMaster(npcGUID))
|
||||
{
|
||||
DEBUG_LOG( "WORLD: HandleStableSwapPet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ enum AuraType
|
|||
SPELL_AURA_289 = 289,
|
||||
SPELL_AURA_MOD_ALL_CRIT_CHANCE = 290,
|
||||
SPELL_AURA_MOD_QUEST_XP_PCT = 291,
|
||||
SPELL_AURA_292 = 292,
|
||||
SPELL_AURA_OPEN_STABLE = 292,
|
||||
SPELL_AURA_293 = 293,
|
||||
SPELL_AURA_294 = 294,
|
||||
SPELL_AURA_295 = 295,
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||
&Aura::HandleUnused, //289 unused (3.2.2a)
|
||||
&Aura::HandleAuraModAllCritChance, //290 SPELL_AURA_MOD_ALL_CRIT_CHANCE
|
||||
&Aura::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_QUEST_XP_PCT implemented in Player::GiveXP
|
||||
&Aura::HandleNULL, //292 call stabled pet
|
||||
&Aura::HandleAuraOpenStable, //292 call stabled pet
|
||||
&Aura::HandleNULL, //293 3 spells
|
||||
&Aura::HandleNULL, //294 2 spells, possible prevent mana regen
|
||||
&Aura::HandleUnused, //295 unused (3.2.2a)
|
||||
|
|
@ -7431,6 +7431,19 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real)
|
|||
}
|
||||
}
|
||||
|
||||
void Aura::HandleAuraOpenStable(bool apply, bool Real)
|
||||
{
|
||||
if(!Real || GetTarget()->GetTypeId() != TYPEID_PLAYER || !GetTarget()->IsInWorld())
|
||||
return;
|
||||
|
||||
Player* player = (Player*)GetTarget();
|
||||
|
||||
if (apply)
|
||||
player->GetSession()->SendStablePet(player->GetObjectGuid());
|
||||
|
||||
// client auto close stable dialog at !apply aura
|
||||
}
|
||||
|
||||
void Aura::HandleAuraConvertRune(bool apply, bool Real)
|
||||
{
|
||||
if(!Real)
|
||||
|
|
|
|||
|
|
@ -364,6 +364,7 @@ class MANGOS_DLL_SPEC Aura
|
|||
void HandleModTargetArmorPct(bool Apply, bool Real);
|
||||
void HandleAuraModAllCritChance(bool Apply, bool Real);
|
||||
void HandleAllowOnlyAbility(bool Apply, bool Real);
|
||||
void HandleAuraOpenStable(bool apply, bool Real);
|
||||
|
||||
virtual ~Aura();
|
||||
|
||||
|
|
|
|||
|
|
@ -234,6 +234,7 @@ class MANGOS_DLL_SPEC WorldSession
|
|||
void SendPetNameQuery(uint64 guid, uint32 petnumber);
|
||||
void SendStablePet(ObjectGuid guid );
|
||||
void SendStableResult(uint8 res);
|
||||
bool CheckStableMaster(ObjectGuid guid);
|
||||
|
||||
// Account Data
|
||||
AccountData *GetAccountData(AccountDataType type) { return &m_accountData[type]; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10235"
|
||||
#define REVISION_NR "10236"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue