aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiscover- <amort11@hotmail.com>2014-01-19 16:51:53 +0100
committerDiscover- <amort11@hotmail.com>2014-01-19 16:51:53 +0100
commit3802cc2904ba7d4684652e6c32bd63d4b6e7929c (patch)
treefca216224aac73e4f21656e78648eada53142c45
parentf6264169d8c2297fd89026e90dbf7ff9d0c20ba0 (diff)
Core/Creature: Fix compile and logic in previous pull request. Also implemented UNIT_NPC_FLAG_MAILBOX.
Thanks @Shauren
-rw-r--r--src/server/game/Entities/Player/Player.cpp5
-rw-r--r--src/server/game/Entities/Unit/Unit.h3
-rw-r--r--src/server/game/Handlers/MailHandler.cpp15
3 files changed, 9 insertions, 14 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 1dea84d0279..61768b0f84c 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -17459,8 +17459,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
UpdateHonorFields();
m_deathExpireTime = time_t(fields[36].GetUInt32());
- if (m_deathExpireTime > now+MAX_DEATH_COUNT*DEATH_EXPIRE_STEP)
- m_deathExpireTime = now+MAX_DEATH_COUNT*DEATH_EXPIRE_STEP-1;
+
+ if (m_deathExpireTime > now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP)
+ m_deathExpireTime = now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP - 1;
// clear channel spell data (if saved at channel spell casting)
SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 151f20d09f9..9eef3b023e0 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -683,7 +683,8 @@ enum NPCFlags
UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click)
- UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000 // players with mounts that have vehicle data should have it set
+ UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000, // players with mounts that have vehicle data should have it set
+ UNIT_NPC_FLAG_MAILBOX = 0x04000000 //
};
enum MovementFlags
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 4cb06a1d469..10ef7810d1d 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -31,29 +31,22 @@
bool WorldSession::CanOpenMailBox(uint64 guid)
{
- if (guid == GetPlayer()->GetGUID())
+ if (guid == _player->GetGUID())
{
if (!HasPermission(rbac::RBAC_PERM_COMMAND_MAILBOX))
{
- TC_LOG_WARN("cheat", "%s attempt open mailbox in cheating way.", GetPlayer()->GetName());
+ TC_LOG_WARN("cheat", "%s attempt open mailbox in cheating way.", _player->GetName().c_str());
return false;
}
}
else if (IS_GAMEOBJECT_GUID(guid))
{
- if(!GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
+ if (!_player->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
return false;
}
else if (IS_CRE_OR_VEH_OR_PET_GUID(guid))
{
- Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
- if (!creature)
- return false;
-
- if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK23))
- return false;
-
- if (creature->GetOwnerGUID() != GetPlayer()->GetGUID())
+ if (!_player->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_MAILBOX))
return false;
}
else