mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +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);
|
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 )
|
void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: Recv CMSG_STABLE_PET");
|
DEBUG_LOG("WORLD: Recv CMSG_STABLE_PET");
|
||||||
uint64 npcGUID;
|
ObjectGuid npcGUID;
|
||||||
|
|
||||||
recv_data >> npcGUID;
|
recv_data >> npcGUID;
|
||||||
|
|
||||||
|
|
@ -553,10 +577,8 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
if (!CheckStableMaster(npcGUID))
|
||||||
if (!unit)
|
|
||||||
{
|
{
|
||||||
DEBUG_LOG( "WORLD: HandleStablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
|
||||||
SendStableResult(STABLE_ERR_STABLE);
|
SendStableResult(STABLE_ERR_STABLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -609,15 +631,13 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
||||||
void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: Recv CMSG_UNSTABLE_PET.");
|
DEBUG_LOG("WORLD: Recv CMSG_UNSTABLE_PET.");
|
||||||
uint64 npcGUID;
|
ObjectGuid npcGUID;
|
||||||
uint32 petnumber;
|
uint32 petnumber;
|
||||||
|
|
||||||
recv_data >> npcGUID >> petnumber;
|
recv_data >> npcGUID >> petnumber;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
if (!CheckStableMaster(npcGUID))
|
||||||
if (!unit)
|
|
||||||
{
|
{
|
||||||
DEBUG_LOG( "WORLD: HandleUnstablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
|
||||||
SendStableResult(STABLE_ERR_STABLE);
|
SendStableResult(STABLE_ERR_STABLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -682,14 +702,12 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
||||||
void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
|
void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: Recv CMSG_BUY_STABLE_SLOT.");
|
DEBUG_LOG("WORLD: Recv CMSG_BUY_STABLE_SLOT.");
|
||||||
uint64 npcGUID;
|
ObjectGuid npcGUID;
|
||||||
|
|
||||||
recv_data >> npcGUID;
|
recv_data >> npcGUID;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
if (!CheckStableMaster(npcGUID))
|
||||||
if (!unit)
|
|
||||||
{
|
{
|
||||||
DEBUG_LOG( "WORLD: HandleBuyStableSlot - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
|
||||||
SendStableResult(STABLE_ERR_STABLE);
|
SendStableResult(STABLE_ERR_STABLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -722,15 +740,13 @@ void WorldSession::HandleStableRevivePet( WorldPacket &/* recv_data */)
|
||||||
void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
DEBUG_LOG("WORLD: Recv CMSG_STABLE_SWAP_PET.");
|
DEBUG_LOG("WORLD: Recv CMSG_STABLE_SWAP_PET.");
|
||||||
uint64 npcGUID;
|
ObjectGuid npcGUID;
|
||||||
uint32 pet_number;
|
uint32 pet_number;
|
||||||
|
|
||||||
recv_data >> npcGUID >> pet_number;
|
recv_data >> npcGUID >> pet_number;
|
||||||
|
|
||||||
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
if (!CheckStableMaster(npcGUID))
|
||||||
if (!unit)
|
|
||||||
{
|
{
|
||||||
DEBUG_LOG( "WORLD: HandleStableSwapPet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
|
||||||
SendStableResult(STABLE_ERR_STABLE);
|
SendStableResult(STABLE_ERR_STABLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ enum AuraType
|
||||||
SPELL_AURA_289 = 289,
|
SPELL_AURA_289 = 289,
|
||||||
SPELL_AURA_MOD_ALL_CRIT_CHANCE = 290,
|
SPELL_AURA_MOD_ALL_CRIT_CHANCE = 290,
|
||||||
SPELL_AURA_MOD_QUEST_XP_PCT = 291,
|
SPELL_AURA_MOD_QUEST_XP_PCT = 291,
|
||||||
SPELL_AURA_292 = 292,
|
SPELL_AURA_OPEN_STABLE = 292,
|
||||||
SPELL_AURA_293 = 293,
|
SPELL_AURA_293 = 293,
|
||||||
SPELL_AURA_294 = 294,
|
SPELL_AURA_294 = 294,
|
||||||
SPELL_AURA_295 = 295,
|
SPELL_AURA_295 = 295,
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
||||||
&Aura::HandleUnused, //289 unused (3.2.2a)
|
&Aura::HandleUnused, //289 unused (3.2.2a)
|
||||||
&Aura::HandleAuraModAllCritChance, //290 SPELL_AURA_MOD_ALL_CRIT_CHANCE
|
&Aura::HandleAuraModAllCritChance, //290 SPELL_AURA_MOD_ALL_CRIT_CHANCE
|
||||||
&Aura::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_QUEST_XP_PCT implemented in Player::GiveXP
|
&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, //293 3 spells
|
||||||
&Aura::HandleNULL, //294 2 spells, possible prevent mana regen
|
&Aura::HandleNULL, //294 2 spells, possible prevent mana regen
|
||||||
&Aura::HandleUnused, //295 unused (3.2.2a)
|
&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)
|
void Aura::HandleAuraConvertRune(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
if(!Real)
|
if(!Real)
|
||||||
|
|
|
||||||
|
|
@ -364,6 +364,7 @@ class MANGOS_DLL_SPEC Aura
|
||||||
void HandleModTargetArmorPct(bool Apply, bool Real);
|
void HandleModTargetArmorPct(bool Apply, bool Real);
|
||||||
void HandleAuraModAllCritChance(bool Apply, bool Real);
|
void HandleAuraModAllCritChance(bool Apply, bool Real);
|
||||||
void HandleAllowOnlyAbility(bool Apply, bool Real);
|
void HandleAllowOnlyAbility(bool Apply, bool Real);
|
||||||
|
void HandleAuraOpenStable(bool apply, bool Real);
|
||||||
|
|
||||||
virtual ~Aura();
|
virtual ~Aura();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,7 @@ class MANGOS_DLL_SPEC WorldSession
|
||||||
void SendPetNameQuery(uint64 guid, uint32 petnumber);
|
void SendPetNameQuery(uint64 guid, uint32 petnumber);
|
||||||
void SendStablePet(ObjectGuid guid );
|
void SendStablePet(ObjectGuid guid );
|
||||||
void SendStableResult(uint8 res);
|
void SendStableResult(uint8 res);
|
||||||
|
bool CheckStableMaster(ObjectGuid guid);
|
||||||
|
|
||||||
// Account Data
|
// Account Data
|
||||||
AccountData *GetAccountData(AccountDataType type) { return &m_accountData[type]; }
|
AccountData *GetAccountData(AccountDataType type) { return &m_accountData[type]; }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10235"
|
#define REVISION_NR "10236"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue