mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Various Cleanups (game F-K)
This commit is contained in:
parent
c5c09cee3c
commit
2bd41afb3e
44 changed files with 1903 additions and 1881 deletions
|
|
@ -29,9 +29,9 @@
|
|||
#define MAX_QUIET_DISTANCE 43.0f
|
||||
|
||||
template<class T>
|
||||
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||
void FleeingMovementGenerator<T>::_setTargetLocation(T& owner)
|
||||
{
|
||||
if(!&owner)
|
||||
if (!&owner)
|
||||
return;
|
||||
|
||||
// ignore in case other no reaction state
|
||||
|
|
@ -39,7 +39,7 @@ void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
|||
return;
|
||||
|
||||
float x, y, z;
|
||||
if(!_getPoint(owner, x, y, z))
|
||||
if (!_getPoint(owner, x, y, z))
|
||||
return;
|
||||
|
||||
owner.addUnitState(UNIT_STAT_FLEEING_MOVE);
|
||||
|
|
@ -47,7 +47,7 @@ void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
|||
PathFinder path(&owner);
|
||||
path.setPathLengthLimit(30.0f);
|
||||
path.calculate(x, y, z);
|
||||
if(path.getPathType() & PATHFIND_NOPATH)
|
||||
if (path.getPathType() & PATHFIND_NOPATH)
|
||||
{
|
||||
i_nextCheckTime.Reset(urand(1000, 1500));
|
||||
return;
|
||||
|
|
@ -61,16 +61,16 @@ void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
|||
}
|
||||
|
||||
template<class T>
|
||||
bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||
bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float& z)
|
||||
{
|
||||
if(!&owner)
|
||||
if (!&owner)
|
||||
return false;
|
||||
|
||||
float dist_from_caster, angle_to_caster;
|
||||
if(Unit* fright = ObjectAccessor::GetUnit(owner, i_frightGuid))
|
||||
if (Unit* fright = ObjectAccessor::GetUnit(owner, i_frightGuid))
|
||||
{
|
||||
dist_from_caster = fright->GetDistance(&owner);
|
||||
if(dist_from_caster > 0.2f)
|
||||
if (dist_from_caster > 0.2f)
|
||||
angle_to_caster = fright->GetAngle(&owner);
|
||||
else
|
||||
angle_to_caster = frand(0, 2*M_PI_F);
|
||||
|
|
@ -82,12 +82,12 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
|
|||
}
|
||||
|
||||
float dist, angle;
|
||||
if(dist_from_caster < MIN_QUIET_DISTANCE)
|
||||
if (dist_from_caster < MIN_QUIET_DISTANCE)
|
||||
{
|
||||
dist = frand(0.4f, 1.3f)*(MIN_QUIET_DISTANCE - dist_from_caster);
|
||||
angle = angle_to_caster + frand(-M_PI_F/8, M_PI_F/8);
|
||||
}
|
||||
else if(dist_from_caster > MAX_QUIET_DISTANCE)
|
||||
else if (dist_from_caster > MAX_QUIET_DISTANCE)
|
||||
{
|
||||
dist = frand(0.4f, 1.0f)*(MAX_QUIET_DISTANCE - MIN_QUIET_DISTANCE);
|
||||
angle = -angle_to_caster + frand(-M_PI_F/4, M_PI_F/4);
|
||||
|
|
@ -111,47 +111,47 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
|
|||
}
|
||||
|
||||
template<class T>
|
||||
void FleeingMovementGenerator<T>::Initialize(T &owner)
|
||||
void FleeingMovementGenerator<T>::Initialize(T& owner)
|
||||
{
|
||||
owner.addUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE);
|
||||
owner.StopMoving();
|
||||
|
||||
if(owner.GetTypeId() == TYPEID_UNIT)
|
||||
if (owner.GetTypeId() == TYPEID_UNIT)
|
||||
owner.SetTargetGuid(ObjectGuid());
|
||||
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
||||
template<>
|
||||
void FleeingMovementGenerator<Player>::Finalize(Player &owner)
|
||||
void FleeingMovementGenerator<Player>::Finalize(Player& owner)
|
||||
{
|
||||
owner.clearUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE);
|
||||
owner.StopMoving();
|
||||
}
|
||||
|
||||
template<>
|
||||
void FleeingMovementGenerator<Creature>::Finalize(Creature &owner)
|
||||
void FleeingMovementGenerator<Creature>::Finalize(Creature& owner)
|
||||
{
|
||||
owner.clearUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void FleeingMovementGenerator<T>::Interrupt(T &owner)
|
||||
void FleeingMovementGenerator<T>::Interrupt(T& owner)
|
||||
{
|
||||
// flee state still applied while movegen disabled
|
||||
owner.clearUnitState(UNIT_STAT_FLEEING_MOVE);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void FleeingMovementGenerator<T>::Reset(T &owner)
|
||||
void FleeingMovementGenerator<T>::Reset(T& owner)
|
||||
{
|
||||
Initialize(owner);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||
bool FleeingMovementGenerator<T>::Update(T& owner, const uint32& time_diff)
|
||||
{
|
||||
if( !&owner || !owner.isAlive() )
|
||||
if (!&owner || !owner.isAlive())
|
||||
return false;
|
||||
|
||||
// ignore in case other no reaction state
|
||||
|
|
@ -168,20 +168,20 @@ bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
|||
return true;
|
||||
}
|
||||
|
||||
template void FleeingMovementGenerator<Player>::Initialize(Player &);
|
||||
template void FleeingMovementGenerator<Creature>::Initialize(Creature &);
|
||||
template bool FleeingMovementGenerator<Player>::_getPoint(Player &, float &, float &, float &);
|
||||
template bool FleeingMovementGenerator<Creature>::_getPoint(Creature &, float &, float &, float &);
|
||||
template void FleeingMovementGenerator<Player>::_setTargetLocation(Player &);
|
||||
template void FleeingMovementGenerator<Creature>::_setTargetLocation(Creature &);
|
||||
template void FleeingMovementGenerator<Player>::Interrupt(Player &);
|
||||
template void FleeingMovementGenerator<Creature>::Interrupt(Creature &);
|
||||
template void FleeingMovementGenerator<Player>::Reset(Player &);
|
||||
template void FleeingMovementGenerator<Creature>::Reset(Creature &);
|
||||
template bool FleeingMovementGenerator<Player>::Update(Player &, const uint32 &);
|
||||
template bool FleeingMovementGenerator<Creature>::Update(Creature &, const uint32 &);
|
||||
template void FleeingMovementGenerator<Player>::Initialize(Player&);
|
||||
template void FleeingMovementGenerator<Creature>::Initialize(Creature&);
|
||||
template bool FleeingMovementGenerator<Player>::_getPoint(Player&, float&, float&, float&);
|
||||
template bool FleeingMovementGenerator<Creature>::_getPoint(Creature&, float&, float&, float&);
|
||||
template void FleeingMovementGenerator<Player>::_setTargetLocation(Player&);
|
||||
template void FleeingMovementGenerator<Creature>::_setTargetLocation(Creature&);
|
||||
template void FleeingMovementGenerator<Player>::Interrupt(Player&);
|
||||
template void FleeingMovementGenerator<Creature>::Interrupt(Creature&);
|
||||
template void FleeingMovementGenerator<Player>::Reset(Player&);
|
||||
template void FleeingMovementGenerator<Creature>::Reset(Creature&);
|
||||
template bool FleeingMovementGenerator<Player>::Update(Player&, const uint32&);
|
||||
template bool FleeingMovementGenerator<Creature>::Update(Creature&, const uint32&);
|
||||
|
||||
void TimedFleeingMovementGenerator::Finalize(Unit &owner)
|
||||
void TimedFleeingMovementGenerator::Finalize(Unit& owner)
|
||||
{
|
||||
owner.clearUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE);
|
||||
if (Unit* victim = owner.getVictim())
|
||||
|
|
@ -194,9 +194,9 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner)
|
|||
}
|
||||
}
|
||||
|
||||
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_diff)
|
||||
bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff)
|
||||
{
|
||||
if( !owner.isAlive() )
|
||||
if (!owner.isAlive())
|
||||
return false;
|
||||
|
||||
// ignore in case other no reaction state
|
||||
|
|
|
|||
|
|
@ -24,29 +24,29 @@
|
|||
|
||||
template<class T>
|
||||
class MANGOS_DLL_SPEC FleeingMovementGenerator
|
||||
: public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
||||
: public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
||||
{
|
||||
public:
|
||||
FleeingMovementGenerator(ObjectGuid fright) : i_frightGuid(fright), i_nextCheckTime(0) {}
|
||||
|
||||
void Initialize(T &);
|
||||
void Finalize(T &);
|
||||
void Interrupt(T &);
|
||||
void Reset(T &);
|
||||
bool Update(T &, const uint32 &);
|
||||
void Initialize(T&);
|
||||
void Finalize(T&);
|
||||
void Interrupt(T&);
|
||||
void Reset(T&);
|
||||
bool Update(T&, const uint32&);
|
||||
|
||||
MovementGeneratorType GetMovementGeneratorType() const { return FLEEING_MOTION_TYPE; }
|
||||
|
||||
private:
|
||||
void _setTargetLocation(T &owner);
|
||||
bool _getPoint(T &owner, float &x, float &y, float &z);
|
||||
void _setTargetLocation(T& owner);
|
||||
bool _getPoint(T& owner, float& x, float& y, float& z);
|
||||
|
||||
ObjectGuid i_frightGuid;
|
||||
TimeTracker i_nextCheckTime;
|
||||
};
|
||||
|
||||
class MANGOS_DLL_SPEC TimedFleeingMovementGenerator
|
||||
: public FleeingMovementGenerator<Creature>
|
||||
: public FleeingMovementGenerator<Creature>
|
||||
{
|
||||
public:
|
||||
TimedFleeingMovementGenerator(ObjectGuid fright, uint32 time) :
|
||||
|
|
@ -54,8 +54,8 @@ class MANGOS_DLL_SPEC TimedFleeingMovementGenerator
|
|||
i_totalFleeTime(time) {}
|
||||
|
||||
MovementGeneratorType GetMovementGeneratorType() const { return TIMED_FLEEING_MOTION_TYPE; }
|
||||
bool Update(Unit &, const uint32 &);
|
||||
void Finalize(Unit &);
|
||||
bool Update(Unit&, const uint32&);
|
||||
void Finalize(Unit&);
|
||||
|
||||
private:
|
||||
TimeTracker i_totalFleeTime;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace MaNGOS
|
|||
{
|
||||
inline float hk_honor_at_level(uint32 level, uint32 count=1)
|
||||
{
|
||||
return (float)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f )));
|
||||
return (float)ceil(count*(-0.53177f + 0.59357f * exp((level +23.54042f) / 26.07859f)));
|
||||
}
|
||||
}
|
||||
namespace XP
|
||||
|
|
@ -36,11 +36,11 @@ namespace MaNGOS
|
|||
|
||||
inline uint32 GetGrayLevel(uint32 pl_level)
|
||||
{
|
||||
if( pl_level <= 5 )
|
||||
if (pl_level <= 5)
|
||||
return 0;
|
||||
else if( pl_level <= 39 )
|
||||
else if (pl_level <= 39)
|
||||
return pl_level - 5 - pl_level/10;
|
||||
else if( pl_level <= 59 )
|
||||
else if (pl_level <= 59)
|
||||
return pl_level - 1 - pl_level/5;
|
||||
else
|
||||
return pl_level - 9;
|
||||
|
|
@ -48,13 +48,13 @@ namespace MaNGOS
|
|||
|
||||
inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level)
|
||||
{
|
||||
if( mob_level >= pl_level + 5 )
|
||||
if (mob_level >= pl_level + 5)
|
||||
return RED;
|
||||
else if( mob_level >= pl_level + 3 )
|
||||
else if (mob_level >= pl_level + 3)
|
||||
return ORANGE;
|
||||
else if( mob_level >= pl_level - 2 )
|
||||
else if (mob_level >= pl_level - 2)
|
||||
return YELLOW;
|
||||
else if( mob_level > GetGrayLevel(pl_level) )
|
||||
else if (mob_level > GetGrayLevel(pl_level))
|
||||
return GREEN;
|
||||
else
|
||||
return GRAY;
|
||||
|
|
@ -62,24 +62,24 @@ namespace MaNGOS
|
|||
|
||||
inline uint32 GetZeroDifference(uint32 pl_level)
|
||||
{
|
||||
if( pl_level < 8 ) return 5;
|
||||
if( pl_level < 10 ) return 6;
|
||||
if( pl_level < 12 ) return 7;
|
||||
if( pl_level < 16 ) return 8;
|
||||
if( pl_level < 20 ) return 9;
|
||||
if( pl_level < 30 ) return 11;
|
||||
if( pl_level < 40 ) return 12;
|
||||
if( pl_level < 45 ) return 13;
|
||||
if( pl_level < 50 ) return 14;
|
||||
if( pl_level < 55 ) return 15;
|
||||
if( pl_level < 60 ) return 16;
|
||||
if (pl_level < 8) return 5;
|
||||
if (pl_level < 10) return 6;
|
||||
if (pl_level < 12) return 7;
|
||||
if (pl_level < 16) return 8;
|
||||
if (pl_level < 20) return 9;
|
||||
if (pl_level < 30) return 11;
|
||||
if (pl_level < 40) return 12;
|
||||
if (pl_level < 45) return 13;
|
||||
if (pl_level < 50) return 14;
|
||||
if (pl_level < 55) return 15;
|
||||
if (pl_level < 60) return 16;
|
||||
return 17;
|
||||
}
|
||||
|
||||
inline uint32 BaseGain(uint32 pl_level, uint32 mob_level, ContentLevels content)
|
||||
{
|
||||
uint32 nBaseExp;
|
||||
switch(content)
|
||||
switch (content)
|
||||
{
|
||||
case CONTENT_1_60: nBaseExp = 45; break;
|
||||
case CONTENT_61_70: nBaseExp = 235; break;
|
||||
|
|
@ -89,7 +89,7 @@ namespace MaNGOS
|
|||
nBaseExp = 45; break;
|
||||
}
|
||||
|
||||
if( mob_level >= pl_level )
|
||||
if (mob_level >= pl_level)
|
||||
{
|
||||
uint32 nLevelDiff = mob_level - pl_level;
|
||||
if (nLevelDiff > 4)
|
||||
|
|
@ -99,7 +99,7 @@ namespace MaNGOS
|
|||
else
|
||||
{
|
||||
uint32 gray_level = GetGrayLevel(pl_level);
|
||||
if( mob_level > gray_level )
|
||||
if (mob_level > gray_level)
|
||||
{
|
||||
uint32 ZD = GetZeroDifference(pl_level);
|
||||
return (pl_level*5 + nBaseExp) * (ZD + mob_level - pl_level)/ZD;
|
||||
|
|
@ -108,18 +108,18 @@ namespace MaNGOS
|
|||
}
|
||||
}
|
||||
|
||||
inline uint32 Gain(Player *pl, Unit *u)
|
||||
inline uint32 Gain(Player* pl, Unit* u)
|
||||
{
|
||||
if(u->GetTypeId()==TYPEID_UNIT && (
|
||||
if (u->GetTypeId()==TYPEID_UNIT && (
|
||||
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
||||
(((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ))
|
||||
(((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)))
|
||||
return 0;
|
||||
|
||||
uint32 xp_gain= BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(),pl->GetZoneId()));
|
||||
if( xp_gain == 0 )
|
||||
if (xp_gain == 0)
|
||||
return 0;
|
||||
|
||||
if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsElite())
|
||||
if (u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsElite())
|
||||
xp_gain *= 2;
|
||||
|
||||
return (uint32)(xp_gain*sWorld.getConfig(CONFIG_FLOAT_RATE_XP_KILL));
|
||||
|
|
@ -127,14 +127,14 @@ namespace MaNGOS
|
|||
|
||||
inline float xp_in_group_rate(uint32 count, bool isRaid)
|
||||
{
|
||||
if(isRaid)
|
||||
if (isRaid)
|
||||
{
|
||||
// FIX ME: must apply decrease modifiers dependent from raid size
|
||||
return 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(count)
|
||||
switch (count)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@
|
|||
#include "Player.h"
|
||||
#include "Chat.h"
|
||||
|
||||
void WorldSession::SendGMTicketGetTicket(uint32 status, GMTicket *ticket /*= NULL*/)
|
||||
void WorldSession::SendGMTicketGetTicket(uint32 status, GMTicket* ticket /*= NULL*/)
|
||||
{
|
||||
int len = ticket ? strlen(ticket->GetText()) : 0;
|
||||
WorldPacket data( SMSG_GMTICKET_GETTICKET, (4+len+1+4+2+4+4) );
|
||||
WorldPacket data(SMSG_GMTICKET_GETTICKET, (4+len+1+4+2+4+4));
|
||||
data << uint32(status); // standard 0x0A, 0x06 if text present
|
||||
if (status == 6)
|
||||
{
|
||||
|
|
@ -44,7 +44,7 @@ void WorldSession::SendGMTicketGetTicket(uint32 status, GMTicket *ticket /*= NUL
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendGMResponse(GMTicket *ticket)
|
||||
void WorldSession::SendGMResponse(GMTicket* ticket)
|
||||
{
|
||||
int len = strlen(ticket->GetText())+1+strlen(ticket->GetResponse())+1;
|
||||
WorldPacket data(SMSG_GMTICKET_GET_RESPONSE, 4+4+len+1+1+1);
|
||||
|
|
@ -58,14 +58,14 @@ void WorldSession::SendGMResponse(GMTicket *ticket)
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
SendQueryTimeResponse();
|
||||
|
||||
GMTicket* ticket = sTicketMgr.GetGMTicket(GetPlayer()->GetObjectGuid());
|
||||
if(ticket)
|
||||
if (ticket)
|
||||
{
|
||||
if(ticket->HasResponse())
|
||||
if (ticket->HasResponse())
|
||||
SendGMResponse(ticket);
|
||||
else
|
||||
SendGMTicketGetTicket(0x06, ticket);
|
||||
|
|
@ -74,29 +74,29 @@ void WorldSession::HandleGMTicketGetTicketOpcode( WorldPacket & /*recv_data*/ )
|
|||
SendGMTicketGetTicket(0x0A);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketUpdateTextOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGMTicketUpdateTextOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
std::string ticketText;
|
||||
recv_data >> ticketText;
|
||||
|
||||
if(GMTicket* ticket = sTicketMgr.GetGMTicket(GetPlayer()->GetObjectGuid()))
|
||||
if (GMTicket* ticket = sTicketMgr.GetGMTicket(GetPlayer()->GetObjectGuid()))
|
||||
ticket->SetText(ticketText.c_str());
|
||||
else
|
||||
sLog.outError("Ticket update: Player %s (GUID: %u) doesn't have active ticket", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketDeleteTicketOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleGMTicketDeleteTicketOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
sTicketMgr.Delete(GetPlayer()->GetObjectGuid());
|
||||
|
||||
WorldPacket data( SMSG_GMTICKET_DELETETICKET, 4 );
|
||||
WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
|
||||
data << uint32(9);
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
|
||||
SendGMTicketGetTicket(0x0A);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 map;
|
||||
float x, y, z;
|
||||
|
|
@ -113,27 +113,27 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
|
|||
|
||||
DEBUG_LOG("TicketCreate: map %u, x %f, y %f, z %f, text %s", map, x, y, z, ticketText.c_str());
|
||||
|
||||
if(sTicketMgr.GetGMTicket(GetPlayer()->GetObjectGuid()) && !isFollowup)
|
||||
if (sTicketMgr.GetGMTicket(GetPlayer()->GetObjectGuid()) && !isFollowup)
|
||||
{
|
||||
WorldPacket data( SMSG_GMTICKET_CREATE, 4 );
|
||||
WorldPacket data(SMSG_GMTICKET_CREATE, 4);
|
||||
data << uint32(1); // 1 - You already have GM ticket
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
||||
if(isFollowup)
|
||||
if (isFollowup)
|
||||
sTicketMgr.Delete(_player->GetObjectGuid());
|
||||
|
||||
sTicketMgr.Create(_player->GetObjectGuid(), ticketText.c_str());
|
||||
|
||||
SendQueryTimeResponse();
|
||||
|
||||
WorldPacket data( SMSG_GMTICKET_CREATE, 4 );
|
||||
WorldPacket data(SMSG_GMTICKET_CREATE, 4);
|
||||
data << uint32(2); // 2 - nothing appears (3-error creating, 5-error updating)
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
|
||||
//TODO: Guard player map
|
||||
HashMapHolder<Player>::MapType &m = sObjectAccessor.GetPlayers();
|
||||
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets())
|
||||
|
|
@ -141,15 +141,15 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketSystemStatusOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
WorldPacket data( SMSG_GMTICKET_SYSTEMSTATUS, 4 );
|
||||
WorldPacket data(SMSG_GMTICKET_SYSTEMSTATUS, 4);
|
||||
data << uint32(1); // we can also disable ticket system by sending 0 value
|
||||
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMSurveySubmitOpcode( WorldPacket & recv_data)
|
||||
void WorldSession::HandleGMSurveySubmitOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
// GM survey is shown after SMSG_GM_TICKET_STATUS_UPDATE with status = 3
|
||||
uint32 x;
|
||||
|
|
@ -158,7 +158,7 @@ void WorldSession::HandleGMSurveySubmitOpcode( WorldPacket & recv_data)
|
|||
|
||||
uint8 result[10];
|
||||
memset(result, 0, sizeof(result));
|
||||
for( int i = 0; i < 10; ++i)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
uint32 questionID;
|
||||
recv_data >> questionID; // GMSurveyQuestions.dbc
|
||||
|
|
@ -181,7 +181,7 @@ void WorldSession::HandleGMSurveySubmitOpcode( WorldPacket & recv_data)
|
|||
// TODO: chart this data in some way
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMResponseResolveOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleGMResponseResolveOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
// empty opcode
|
||||
DEBUG_LOG("WORLD: %s", LookupOpcodeName(recv_data.GetOpcode()));
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ void GMTicketMgr::LoadGMTickets()
|
|||
{
|
||||
m_GMTicketMap.clear(); // For reload case
|
||||
|
||||
QueryResult *result = CharacterDatabase.Query(
|
||||
QueryResult* result = CharacterDatabase.Query(
|
||||
// 0 1 2 3 4
|
||||
"SELECT guid, ticket_text, response_text, UNIX_TIMESTAMP(ticket_lastchange), ticket_id FROM character_ticket ORDER BY ticket_id ASC");
|
||||
|
||||
if( !result )
|
||||
if (!result)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
|
||||
|
|
@ -72,7 +72,8 @@ void GMTicketMgr::LoadGMTickets()
|
|||
ticket.Init(guid, fields[1].GetCppString(), fields[2].GetCppString(), time_t(fields[3].GetUInt64()));
|
||||
m_GMTicketListByCreatingOrder.push_back(&ticket);
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
|
|
@ -81,9 +82,9 @@ void GMTicketMgr::LoadGMTickets()
|
|||
|
||||
void GMTicketMgr::DeleteAll()
|
||||
{
|
||||
for(GMTicketMap::const_iterator itr = m_GMTicketMap.begin(); itr != m_GMTicketMap.end(); ++itr)
|
||||
for (GMTicketMap::const_iterator itr = m_GMTicketMap.begin(); itr != m_GMTicketMap.end(); ++itr)
|
||||
{
|
||||
if(Player* owner = sObjectMgr.GetPlayer(itr->first))
|
||||
if (Player* owner = sObjectMgr.GetPlayer(itr->first))
|
||||
owner->GetSession()->SendGMTicketGetTicket(0x0A);
|
||||
}
|
||||
CharacterDatabase.Execute("DELETE FROM character_ticket");
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class GMTicketMgr
|
|||
GMTicket* GetGMTicket(ObjectGuid guid)
|
||||
{
|
||||
GMTicketMap::iterator itr = m_GMTicketMap.find(guid);
|
||||
if(itr == m_GMTicketMap.end())
|
||||
if (itr == m_GMTicketMap.end())
|
||||
return NULL;
|
||||
return &(itr->second);
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ class GMTicketMgr
|
|||
|
||||
GMTicketList::iterator itr = m_GMTicketListByCreatingOrder.begin();
|
||||
std::advance(itr, pos);
|
||||
if(itr == m_GMTicketListByCreatingOrder.end())
|
||||
if (itr == m_GMTicketListByCreatingOrder.end())
|
||||
return NULL;
|
||||
return *itr;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ class GMTicketMgr
|
|||
void Delete(ObjectGuid guid)
|
||||
{
|
||||
GMTicketMap::iterator itr = m_GMTicketMap.find(guid);
|
||||
if(itr == m_GMTicketMap.end())
|
||||
if (itr == m_GMTicketMap.end())
|
||||
return;
|
||||
itr->second.DeleteFromDB();
|
||||
m_GMTicketListByCreatingOrder.remove(&itr->second);
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ INSTANTIATE_SINGLETON_1(GameEventMgr);
|
|||
bool GameEventMgr::CheckOneGameEvent(uint16 entry, time_t currenttime) const
|
||||
{
|
||||
// Get the event information
|
||||
if( mGameEvent[entry].start < currenttime && currenttime < mGameEvent[entry].end &&
|
||||
((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE)) < (mGameEvent[entry].length * MINUTE) )
|
||||
if (mGameEvent[entry].start < currenttime && currenttime < mGameEvent[entry].end &&
|
||||
((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE)) < (mGameEvent[entry].length * MINUTE))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
|
@ -68,24 +68,24 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
|
|||
return delay;
|
||||
}
|
||||
|
||||
void GameEventMgr::StartEvent( uint16 event_id, bool overwrite /*=false*/, bool resume /*=false*/)
|
||||
void GameEventMgr::StartEvent(uint16 event_id, bool overwrite /*=false*/, bool resume /*=false*/)
|
||||
{
|
||||
ApplyNewEvent(event_id, resume);
|
||||
if(overwrite)
|
||||
if (overwrite)
|
||||
{
|
||||
mGameEvent[event_id].start = time(NULL);
|
||||
if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
|
||||
if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
|
||||
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
|
||||
}
|
||||
}
|
||||
|
||||
void GameEventMgr::StopEvent( uint16 event_id, bool overwrite )
|
||||
void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
|
||||
{
|
||||
UnApplyEvent(event_id);
|
||||
if(overwrite)
|
||||
if (overwrite)
|
||||
{
|
||||
mGameEvent[event_id].start = time(NULL) - mGameEvent[event_id].length * MINUTE;
|
||||
if(mGameEvent[event_id].end <= mGameEvent[event_id].start)
|
||||
if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
|
||||
mGameEvent[event_id].end = mGameEvent[event_id].start+mGameEvent[event_id].length;
|
||||
}
|
||||
}
|
||||
|
|
@ -93,15 +93,15 @@ void GameEventMgr::StopEvent( uint16 event_id, bool overwrite )
|
|||
void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
{
|
||||
QueryResult *result = WorldDatabase.Query("SELECT MAX(entry) FROM game_event");
|
||||
if( !result )
|
||||
QueryResult* result = WorldDatabase.Query("SELECT MAX(entry) FROM game_event");
|
||||
if (!result)
|
||||
{
|
||||
sLog.outString(">> Table game_event is empty.");
|
||||
sLog.outString();
|
||||
return;
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 max_event_id = fields[0].GetUInt16();
|
||||
delete result;
|
||||
|
|
@ -109,7 +109,7 @@ void GameEventMgr::LoadFromDB()
|
|||
mGameEvent.resize(max_event_id+1);
|
||||
}
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description FROM game_event");
|
||||
QueryResult* result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description FROM game_event");
|
||||
if (!result)
|
||||
{
|
||||
mGameEvent.clear();
|
||||
|
|
@ -125,7 +125,7 @@ void GameEventMgr::LoadFromDB()
|
|||
do
|
||||
{
|
||||
++count;
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
|
||||
|
|
@ -168,7 +168,8 @@ void GameEventMgr::LoadFromDB()
|
|||
|
||||
pGameEvent.description = fields[6].GetCppString();
|
||||
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
|
|
@ -194,7 +195,7 @@ void GameEventMgr::LoadFromDB()
|
|||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u creatures in game events", count );
|
||||
sLog.outString(">> Loaded %u creatures in game events", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -202,7 +203,7 @@ void GameEventMgr::LoadFromDB()
|
|||
BarGoLink bar(result->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
|
||||
|
|
@ -253,11 +254,12 @@ void GameEventMgr::LoadFromDB()
|
|||
GuidList& crelist = mGameEventCreatureGuids[internal_event_id];
|
||||
crelist.push_back(guid);
|
||||
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u creatures in game events", count );
|
||||
sLog.outString(">> Loaded %u creatures in game events", count);
|
||||
}
|
||||
|
||||
mGameEventGameobjectGuids.resize(mGameEvent.size()*2-1);
|
||||
|
|
@ -272,7 +274,7 @@ void GameEventMgr::LoadFromDB()
|
|||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u gameobjects in game events", count );
|
||||
sLog.outString(">> Loaded %u gameobjects in game events", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -280,7 +282,7 @@ void GameEventMgr::LoadFromDB()
|
|||
BarGoLink bar(result->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
|
||||
|
|
@ -331,15 +333,16 @@ void GameEventMgr::LoadFromDB()
|
|||
GuidList& golist = mGameEventGameobjectGuids[internal_event_id];
|
||||
golist.push_back(guid);
|
||||
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u gameobjects in game events", count );
|
||||
sLog.outString(">> Loaded %u gameobjects in game events", count);
|
||||
}
|
||||
|
||||
// now recheck that all eventPools linked with events after our skip pools with parents
|
||||
for(std::map<uint16,int16>::const_iterator itr = pool2event.begin(); itr != pool2event.end(); ++itr)
|
||||
for (std::map<uint16,int16>::const_iterator itr = pool2event.begin(); itr != pool2event.end(); ++itr)
|
||||
{
|
||||
uint16 pool_id = itr->first;
|
||||
int16 event_id = itr->second;
|
||||
|
|
@ -363,7 +366,7 @@ void GameEventMgr::LoadFromDB()
|
|||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u creature reactions at game events", count );
|
||||
sLog.outString(">> Loaded %u creature reactions at game events", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -371,7 +374,7 @@ void GameEventMgr::LoadFromDB()
|
|||
BarGoLink bar(result->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
|
|
@ -425,11 +428,12 @@ void GameEventMgr::LoadFromDB()
|
|||
equiplist.push_back(GameEventCreatureDataPair(guid, newData));
|
||||
mGameEventCreatureDataPerGuid.insert(GameEventCreatureDataPerGuidMap::value_type(guid, event_id));
|
||||
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u creature reactions at game events", count );
|
||||
sLog.outString(">> Loaded %u creature reactions at game events", count);
|
||||
}
|
||||
|
||||
mGameEventQuests.resize(mGameEvent.size());
|
||||
|
|
@ -443,7 +447,7 @@ void GameEventMgr::LoadFromDB()
|
|||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u quests additions in game events", count );
|
||||
sLog.outString(">> Loaded %u quests additions in game events", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -451,7 +455,7 @@ void GameEventMgr::LoadFromDB()
|
|||
BarGoLink bar(result->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
uint32 quest = fields[0].GetUInt32();
|
||||
|
|
@ -485,11 +489,12 @@ void GameEventMgr::LoadFromDB()
|
|||
QuestList& questlist = mGameEventQuests[event_id];
|
||||
questlist.push_back(quest);
|
||||
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u quest additions in game events", count );
|
||||
sLog.outString(">> Loaded %u quest additions in game events", count);
|
||||
}
|
||||
|
||||
mGameEventMails.resize(mGameEvent.size()*2-1);
|
||||
|
|
@ -503,7 +508,7 @@ void GameEventMgr::LoadFromDB()
|
|||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u start/end game event mails", count );
|
||||
sLog.outString(">> Loaded %u start/end game event mails", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -511,7 +516,7 @@ void GameEventMgr::LoadFromDB()
|
|||
BarGoLink bar(result->GetRowCount());
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
bar.step();
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
|
|
@ -565,11 +570,12 @@ void GameEventMgr::LoadFromDB()
|
|||
MailList& maillist = mGameEventMails[internal_event_id];
|
||||
maillist.push_back(mail);
|
||||
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u start/end game event mails", count );
|
||||
sLog.outString(">> Loaded %u start/end game event mails", count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -579,30 +585,31 @@ uint32 GameEventMgr::Initialize() // return the next e
|
|||
|
||||
ActiveEvents activeAtShutdown;
|
||||
|
||||
if (QueryResult *result = CharacterDatabase.Query("SELECT event FROM game_event_status"))
|
||||
if (QueryResult* result = CharacterDatabase.Query("SELECT event FROM game_event_status"))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
uint16 event_id = fields[0].GetUInt16();
|
||||
activeAtShutdown.insert(event_id);
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
CharacterDatabase.Execute("TRUNCATE game_event_status");
|
||||
}
|
||||
|
||||
uint32 delay = Update(&activeAtShutdown);
|
||||
BASIC_LOG("Game Event system initialized." );
|
||||
BASIC_LOG("Game Event system initialized.");
|
||||
m_IsGameEventsInit = true;
|
||||
return delay;
|
||||
}
|
||||
|
||||
void GameEventMgr::Initialize( MapPersistentState* state )
|
||||
void GameEventMgr::Initialize(MapPersistentState* state)
|
||||
{
|
||||
// At map persistent state creating need only apply pool spawn modifications
|
||||
// other data is global and will be auto-apply
|
||||
for(GameEventMgr::ActiveEvents::const_iterator event_itr = m_ActiveEvents.begin(); event_itr != m_ActiveEvents.end(); ++event_itr)
|
||||
for (GameEventMgr::ActiveEvents::const_iterator event_itr = m_ActiveEvents.begin(); event_itr != m_ActiveEvents.end(); ++event_itr)
|
||||
for (IdList::iterator pool_itr = mGameEventSpawnPoolIds[*event_itr].begin(); pool_itr != mGameEventSpawnPoolIds[*event_itr].end(); ++pool_itr)
|
||||
sPoolMgr.InitSpawnPool(*state, *pool_itr);
|
||||
}
|
||||
|
|
@ -704,7 +711,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||
return;
|
||||
}
|
||||
|
||||
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin();itr != mGameEventCreatureGuids[internal_event_id].end();++itr)
|
||||
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin(); itr != mGameEventCreatureGuids[internal_event_id].end(); ++itr)
|
||||
{
|
||||
// Add to correct cell
|
||||
CreatureData const* data = sObjectMgr.GetCreatureData(*itr);
|
||||
|
|
@ -734,7 +741,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||
return;
|
||||
}
|
||||
|
||||
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin();itr != mGameEventGameobjectGuids[internal_event_id].end();++itr)
|
||||
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr)
|
||||
{
|
||||
// Add to correct cell
|
||||
GameObjectData const* data = sObjectMgr.GetGOData(*itr);
|
||||
|
|
@ -760,13 +767,13 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||
|
||||
if (event_id > 0)
|
||||
{
|
||||
if((size_t)event_id >= mGameEventSpawnPoolIds.size())
|
||||
if ((size_t)event_id >= mGameEventSpawnPoolIds.size())
|
||||
{
|
||||
sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventSpawnPoolIds element %i (size: " SIZEFMTD ")", event_id, mGameEventSpawnPoolIds.size());
|
||||
return;
|
||||
}
|
||||
|
||||
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin();itr != mGameEventSpawnPoolIds[event_id].end();++itr)
|
||||
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin(); itr != mGameEventSpawnPoolIds[event_id].end(); ++itr)
|
||||
sPoolMgr.SpawnPoolInMaps(*itr, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -781,10 +788,10 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
|||
return;
|
||||
}
|
||||
|
||||
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin();itr != mGameEventCreatureGuids[internal_event_id].end();++itr)
|
||||
for (GuidList::iterator itr = mGameEventCreatureGuids[internal_event_id].begin(); itr != mGameEventCreatureGuids[internal_event_id].end(); ++itr)
|
||||
{
|
||||
// Remove the creature from grid
|
||||
if( CreatureData const* data = sObjectMgr.GetCreatureData(*itr) )
|
||||
if (CreatureData const* data = sObjectMgr.GetCreatureData(*itr))
|
||||
{
|
||||
// negative event id for pool element meaning unspawn in pool and exclude for next spawns
|
||||
if (event_id < 0)
|
||||
|
|
@ -811,10 +818,10 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
|||
return;
|
||||
}
|
||||
|
||||
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin();itr != mGameEventGameobjectGuids[internal_event_id].end();++itr)
|
||||
for (GuidList::iterator itr = mGameEventGameobjectGuids[internal_event_id].begin(); itr != mGameEventGameobjectGuids[internal_event_id].end(); ++itr)
|
||||
{
|
||||
// Remove the gameobject from grid
|
||||
if(GameObjectData const* data = sObjectMgr.GetGOData(*itr))
|
||||
if (GameObjectData const* data = sObjectMgr.GetGOData(*itr))
|
||||
{
|
||||
// negative event id for pool element meaning unspawn in pool and exclude for next spawns
|
||||
if (event_id < 0)
|
||||
|
|
@ -843,7 +850,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
|||
return;
|
||||
}
|
||||
|
||||
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin();itr != mGameEventSpawnPoolIds[event_id].end();++itr)
|
||||
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin(); itr != mGameEventSpawnPoolIds[event_id].end(); ++itr)
|
||||
{
|
||||
sPoolMgr.DespawnPoolInMaps(*itr);
|
||||
}
|
||||
|
|
@ -855,7 +862,7 @@ GameEventCreatureData const* GameEventMgr::GetCreatureUpdateDataForActiveEvent(u
|
|||
// only for active event, creature can be listed for many so search all
|
||||
uint32 event_id = 0;
|
||||
GameEventCreatureDataPerGuidBounds bounds = mGameEventCreatureDataPerGuid.equal_range(lowguid);
|
||||
for(GameEventCreatureDataPerGuidMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (GameEventCreatureDataPerGuidMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if (IsActiveEvent(itr->second))
|
||||
{
|
||||
|
|
@ -867,7 +874,7 @@ GameEventCreatureData const* GameEventMgr::GetCreatureUpdateDataForActiveEvent(u
|
|||
if (!event_id)
|
||||
return NULL;
|
||||
|
||||
for(GameEventCreatureDataList::const_iterator itr = mGameEventCreatureData[event_id].begin();itr != mGameEventCreatureData[event_id].end();++itr)
|
||||
for (GameEventCreatureDataList::const_iterator itr = mGameEventCreatureData[event_id].begin(); itr != mGameEventCreatureData[event_id].end(); ++itr)
|
||||
if (itr->first == lowguid)
|
||||
return &itr->second;
|
||||
|
||||
|
|
@ -879,7 +886,7 @@ struct GameEventUpdateCreatureDataInMapsWorker
|
|||
GameEventUpdateCreatureDataInMapsWorker(ObjectGuid guid, CreatureData const* data, GameEventCreatureData* event_data, bool activate)
|
||||
: i_guid(guid), i_data(data), i_event_data(event_data), i_activate(activate) {}
|
||||
|
||||
void operator() (Map* map)
|
||||
void operator()(Map* map)
|
||||
{
|
||||
if (Creature* pCreature = map->GetCreature(i_guid))
|
||||
{
|
||||
|
|
@ -899,11 +906,11 @@ struct GameEventUpdateCreatureDataInMapsWorker
|
|||
|
||||
void GameEventMgr::UpdateCreatureData(int16 event_id, bool activate)
|
||||
{
|
||||
for(GameEventCreatureDataList::iterator itr = mGameEventCreatureData[event_id].begin();itr != mGameEventCreatureData[event_id].end();++itr)
|
||||
for (GameEventCreatureDataList::iterator itr = mGameEventCreatureData[event_id].begin(); itr != mGameEventCreatureData[event_id].end(); ++itr)
|
||||
{
|
||||
// Remove the creature from grid
|
||||
CreatureData const* data = sObjectMgr.GetCreatureData(itr->first);
|
||||
if(!data)
|
||||
if (!data)
|
||||
continue;
|
||||
|
||||
// Update if spawned
|
||||
|
|
@ -917,7 +924,7 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool Activate)
|
|||
QuestList::iterator itr;
|
||||
for (itr = mGameEventQuests[event_id].begin(); itr != mGameEventQuests[event_id].end(); ++itr)
|
||||
{
|
||||
const Quest *pQuest = sObjectMgr.GetQuestTemplate(*itr);
|
||||
const Quest* pQuest = sObjectMgr.GetQuestTemplate(*itr);
|
||||
|
||||
//if (Activate)
|
||||
//{
|
||||
|
|
@ -936,7 +943,7 @@ void GameEventMgr::UpdateWorldStates(uint16 event_id, bool Activate)
|
|||
BattleGroundTypeId bgTypeId = BattleGroundMgr::WeekendHolidayIdToBGType(event.holiday_id);
|
||||
if (bgTypeId != BATTLEGROUND_TYPE_NONE)
|
||||
{
|
||||
BattlemasterListEntry const * bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if (bl && bl->HolidayWorldStateId)
|
||||
{
|
||||
WorldPacket data;
|
||||
|
|
@ -1010,19 +1017,19 @@ GameEventMgr::GameEventMgr()
|
|||
m_IsGameEventsInit = false;
|
||||
}
|
||||
|
||||
bool GameEventMgr::IsActiveHoliday( HolidayIds id )
|
||||
bool GameEventMgr::IsActiveHoliday(HolidayIds id)
|
||||
{
|
||||
if (id == HOLIDAY_NONE)
|
||||
return false;
|
||||
|
||||
for(GameEventMgr::ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr)
|
||||
for (GameEventMgr::ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr)
|
||||
if (mGameEvent[*itr].holiday_id == id)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
MANGOS_DLL_SPEC bool IsHolidayActive( HolidayIds id )
|
||||
MANGOS_DLL_SPEC bool IsHolidayActive(HolidayIds id)
|
||||
{
|
||||
return sGameEventMgr.IsActiveHoliday(id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class GameEventMgr
|
|||
void Initialize(MapPersistentState* state); // called at new MapPersistentState object create
|
||||
uint32 Update(ActiveEvents const* activeAtShutdown = NULL);
|
||||
bool IsValidEvent(uint16 event_id) const { return event_id < mGameEvent.size() && mGameEvent[event_id].isValid(); }
|
||||
bool IsActiveEvent(uint16 event_id) const { return ( m_ActiveEvents.find(event_id)!=m_ActiveEvents.end()); }
|
||||
bool IsActiveEvent(uint16 event_id) const { return (m_ActiveEvents.find(event_id)!=m_ActiveEvents.end()); }
|
||||
bool IsActiveHoliday(HolidayIds id);
|
||||
uint32 Initialize();
|
||||
void StartEvent(uint16 event_id, bool overwrite = false, bool resume = false);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ GameObject::~GameObject()
|
|||
void GameObject::AddToWorld()
|
||||
{
|
||||
///- Register the gameobject for guid lookup
|
||||
if(!IsInWorld())
|
||||
if (!IsInWorld())
|
||||
GetMap()->GetObjectsStore().insert<GameObject>(GetObjectGuid(), (GameObject*)this);
|
||||
|
||||
Object::AddToWorld();
|
||||
|
|
@ -83,7 +83,7 @@ void GameObject::AddToWorld()
|
|||
void GameObject::RemoveFromWorld()
|
||||
{
|
||||
///- Remove the gameobject from the accessor
|
||||
if(IsInWorld())
|
||||
if (IsInWorld())
|
||||
{
|
||||
// Remove GO from owner
|
||||
if (ObjectGuid owner_guid = GetOwnerGuid())
|
||||
|
|
@ -103,14 +103,14 @@ void GameObject::RemoveFromWorld()
|
|||
Object::RemoveFromWorld();
|
||||
}
|
||||
|
||||
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, QuaternionData rotation, uint8 animprogress, GOState go_state)
|
||||
bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, QuaternionData rotation, uint8 animprogress, GOState go_state)
|
||||
{
|
||||
MANGOS_ASSERT(map);
|
||||
Relocate(x,y,z,ang);
|
||||
SetMap(map);
|
||||
SetPhaseMask(phaseMask,false);
|
||||
|
||||
if(!IsPositionValid())
|
||||
if (!IsPositionValid())
|
||||
{
|
||||
sLog.outError("Gameobject (GUID: %u Entry: %u ) not created. Suggested coordinates are invalid (X: %f Y: %f)",guidlow,name_id,x,y);
|
||||
return false;
|
||||
|
|
@ -137,7 +137,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
|
|||
|
||||
SetWorldRotation(rotation.x,rotation.y,rotation.z,rotation.w);
|
||||
// For most of gameobjects is (0, 0, 0, 1) quaternion, only some transports has not standart rotation
|
||||
if (const GameObjectDataAddon * addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(guidlow))
|
||||
if (const GameObjectDataAddon* addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(guidlow))
|
||||
SetTransportPathRotation(addon->path_rotation);
|
||||
else
|
||||
SetTransportPathRotation(QuaternionData(0,0,0,1));
|
||||
|
|
@ -182,7 +182,7 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
|||
{
|
||||
case GO_NOT_READY:
|
||||
{
|
||||
switch(GetGoType())
|
||||
switch (GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_TRAP:
|
||||
{
|
||||
|
|
@ -322,7 +322,7 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
|||
|
||||
if (ok)
|
||||
{
|
||||
Unit *caster = owner ? owner : ok;
|
||||
Unit* caster = owner ? owner : ok;
|
||||
|
||||
caster->CastSpell(ok, goInfo->trap.spellId, true, NULL, NULL, GetObjectGuid());
|
||||
// use template cooldown if provided
|
||||
|
|
@ -336,7 +336,7 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
|||
{
|
||||
//BattleGround gameobjects case
|
||||
if (((Player*)ok)->InBattleGround())
|
||||
if (BattleGround *bg = ((Player*)ok)->GetBattleGround())
|
||||
if (BattleGround* bg = ((Player*)ok)->GetBattleGround())
|
||||
bg->HandleTriggerBuff(GetObjectGuid());
|
||||
}
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
|||
}
|
||||
case GO_ACTIVATED:
|
||||
{
|
||||
switch(GetGoType())
|
||||
switch (GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
|
|
@ -483,10 +483,10 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
|||
void GameObject::Refresh()
|
||||
{
|
||||
// not refresh despawned not casted GO (despawned casted GO destroyed in all cases anyway)
|
||||
if(m_respawnTime > 0 && m_spawnedByDefault)
|
||||
if (m_respawnTime > 0 && m_spawnedByDefault)
|
||||
return;
|
||||
|
||||
if(isSpawned())
|
||||
if (isSpawned())
|
||||
GetMap()->Add(this);
|
||||
}
|
||||
|
||||
|
|
@ -514,7 +514,7 @@ void GameObject::Delete()
|
|||
AddObjectToRemoveList();
|
||||
}
|
||||
|
||||
void GameObject::getFishLoot(Loot *fishloot, Player* loot_owner)
|
||||
void GameObject::getFishLoot(Loot* fishloot, Player* loot_owner)
|
||||
{
|
||||
fishloot->clear();
|
||||
|
||||
|
|
@ -531,8 +531,8 @@ void GameObject::SaveToDB()
|
|||
{
|
||||
// this should only be used when the gameobject has already been loaded
|
||||
// preferably after adding to map, because mapid may not be valid otherwise
|
||||
GameObjectData const *data = sObjectMgr.GetGOData(GetGUIDLow());
|
||||
if(!data)
|
||||
GameObjectData const* data = sObjectMgr.GetGOData(GetGUIDLow());
|
||||
if (!data)
|
||||
{
|
||||
sLog.outError("GameObject::SaveToDB failed, cannot get gameobject data!");
|
||||
return;
|
||||
|
|
@ -543,7 +543,7 @@ void GameObject::SaveToDB()
|
|||
|
||||
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||
{
|
||||
const GameObjectInfo *goI = GetGOInfo();
|
||||
const GameObjectInfo* goI = GetGOInfo();
|
||||
|
||||
if (!goI)
|
||||
return;
|
||||
|
|
@ -594,11 +594,11 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
|||
WorldDatabase.CommitTransaction();
|
||||
}
|
||||
|
||||
bool GameObject::LoadFromDB(uint32 guid, Map *map)
|
||||
bool GameObject::LoadFromDB(uint32 guid, Map* map)
|
||||
{
|
||||
GameObjectData const* data = sObjectMgr.GetGOData(guid);
|
||||
|
||||
if( !data )
|
||||
if (!data)
|
||||
{
|
||||
sLog.outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ",guid);
|
||||
return false;
|
||||
|
|
@ -627,7 +627,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(data->spawntimesecs >= 0)
|
||||
if (data->spawntimesecs >= 0)
|
||||
{
|
||||
m_spawnedByDefault = true;
|
||||
m_respawnDelayTime = data->spawntimesecs;
|
||||
|
|
@ -656,7 +656,7 @@ struct GameObjectRespawnDeleteWorker
|
|||
{
|
||||
explicit GameObjectRespawnDeleteWorker(uint32 guid) : i_guid(guid) {}
|
||||
|
||||
void operator() (MapPersistentState* state)
|
||||
void operator()(MapPersistentState* state)
|
||||
{
|
||||
state->SaveGORespawnTime(i_guid, 0);
|
||||
}
|
||||
|
|
@ -682,7 +682,7 @@ void GameObject::DeleteFromDB()
|
|||
WorldDatabase.PExecuteLog("DELETE FROM gameobject_battleground WHERE guid = '%u'", GetGUIDLow());
|
||||
}
|
||||
|
||||
GameObjectInfo const *GameObject::GetGOInfo() const
|
||||
GameObjectInfo const* GameObject::GetGOInfo() const
|
||||
{
|
||||
return m_goInfo;
|
||||
}
|
||||
|
|
@ -693,7 +693,7 @@ GameObjectInfo const *GameObject::GetGOInfo() const
|
|||
bool GameObject::HasQuest(uint32 quest_id) const
|
||||
{
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestRelationsMapBounds(GetEntry());
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if (itr->second == quest_id)
|
||||
return true;
|
||||
|
|
@ -704,7 +704,7 @@ bool GameObject::HasQuest(uint32 quest_id) const
|
|||
bool GameObject::HasInvolvedQuest(uint32 quest_id) const
|
||||
{
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(GetEntry());
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if (itr->second == quest_id)
|
||||
return true;
|
||||
|
|
@ -715,8 +715,8 @@ bool GameObject::HasInvolvedQuest(uint32 quest_id) const
|
|||
bool GameObject::IsTransport() const
|
||||
{
|
||||
// If something is marked as a transport, don't transmit an out of range packet for it.
|
||||
GameObjectInfo const * gInfo = GetGOInfo();
|
||||
if(!gInfo) return false;
|
||||
GameObjectInfo const* gInfo = GetGOInfo();
|
||||
if (!gInfo) return false;
|
||||
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
|
||||
}
|
||||
|
||||
|
|
@ -727,29 +727,29 @@ Unit* GameObject::GetOwner() const
|
|||
|
||||
void GameObject::SaveRespawnTime()
|
||||
{
|
||||
if(m_respawnTime > time(NULL) && m_spawnedByDefault)
|
||||
if (m_respawnTime > time(NULL) && m_spawnedByDefault)
|
||||
GetMap()->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), m_respawnTime);
|
||||
}
|
||||
|
||||
bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const
|
||||
{
|
||||
// Not in world
|
||||
if(!IsInWorld() || !u->IsInWorld())
|
||||
if (!IsInWorld() || !u->IsInWorld())
|
||||
return false;
|
||||
|
||||
// invisible at client always
|
||||
if(!GetGOInfo()->displayId)
|
||||
if (!GetGOInfo()->displayId)
|
||||
return false;
|
||||
|
||||
// Transport always visible at this step implementation
|
||||
if(IsTransport() && IsInMap(u))
|
||||
if (IsTransport() && IsInMap(u))
|
||||
return true;
|
||||
|
||||
// quick check visibility false cases for non-GM-mode
|
||||
if(!u->isGameMaster())
|
||||
if (!u->isGameMaster())
|
||||
{
|
||||
// despawned and then not visible for non-GM in GM-mode
|
||||
if(!isSpawned())
|
||||
if (!isSpawned())
|
||||
return false;
|
||||
|
||||
// special invisibility cases
|
||||
|
|
@ -768,14 +768,14 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
|
|||
|
||||
void GameObject::Respawn()
|
||||
{
|
||||
if(m_spawnedByDefault && m_respawnTime > 0)
|
||||
if (m_spawnedByDefault && m_respawnTime > 0)
|
||||
{
|
||||
m_respawnTime = time(NULL);
|
||||
GetMap()->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool GameObject::ActivateToQuest(Player *pTarget) const
|
||||
bool GameObject::ActivateToQuest(Player* pTarget) const
|
||||
{
|
||||
// if GO is ReqCreatureOrGoN for quest
|
||||
if (pTarget->HasQuestForGO(GetEntry()))
|
||||
|
|
@ -784,7 +784,7 @@ bool GameObject::ActivateToQuest(Player *pTarget) const
|
|||
if (!sObjectMgr.IsGameObjectForQuests(GetEntry()))
|
||||
return false;
|
||||
|
||||
switch(GetGoType())
|
||||
switch (GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER:
|
||||
{
|
||||
|
|
@ -795,9 +795,9 @@ bool GameObject::ActivateToQuest(Player *pTarget) const
|
|||
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestRelationsMapBounds(GetEntry());
|
||||
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
const Quest *qInfo = sObjectMgr.GetQuestTemplate(itr->second);
|
||||
const Quest* qInfo = sObjectMgr.GetQuestTemplate(itr->second);
|
||||
|
||||
if (pTarget->CanTakeQuest(qInfo, false))
|
||||
return true;
|
||||
|
|
@ -805,7 +805,7 @@ bool GameObject::ActivateToQuest(Player *pTarget) const
|
|||
|
||||
bounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(GetEntry());
|
||||
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if ((pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_INCOMPLETE || pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_COMPLETE)
|
||||
&& !pTarget->GetQuestRewardStatus(itr->second))
|
||||
|
|
@ -824,7 +824,7 @@ bool GameObject::ActivateToQuest(Player *pTarget) const
|
|||
{
|
||||
//look for battlegroundAV for some objects which are only activated after mine gots captured by own team
|
||||
if (GetEntry() == BG_AV_OBJECTID_MINE_N || GetEntry() == BG_AV_OBJECTID_MINE_S)
|
||||
if (BattleGround *bg = pTarget->GetBattleGround())
|
||||
if (BattleGround* bg = pTarget->GetBattleGround())
|
||||
if (bg->GetTypeID() == BATTLEGROUND_AV && !(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(GetEntry(),pTarget->GetTeam())))
|
||||
return false;
|
||||
return true;
|
||||
|
|
@ -942,10 +942,10 @@ void GameObject::ResetDoorOrButton()
|
|||
|
||||
void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = false */)
|
||||
{
|
||||
if(m_lootState != GO_READY)
|
||||
if (m_lootState != GO_READY)
|
||||
return;
|
||||
|
||||
if(!time_to_restore)
|
||||
if (!time_to_restore)
|
||||
time_to_restore = GetGOInfo()->GetAutoCloseTime();
|
||||
|
||||
SwitchDoorOrButton(true,alternative);
|
||||
|
|
@ -956,12 +956,12 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
|
|||
|
||||
void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false */)
|
||||
{
|
||||
if(activate)
|
||||
if (activate)
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
else
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
|
||||
if(GetGoState() == GO_STATE_READY) //if closed -> open
|
||||
if (GetGoState() == GO_STATE_READY) //if closed -> open
|
||||
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
|
||||
else //if open -> close
|
||||
SetGoState(GO_STATE_READY);
|
||||
|
|
@ -1103,7 +1103,7 @@ void GameObject::Use(Unit* user)
|
|||
// every slot will be on that straight line
|
||||
float orthogonalOrientation = GetOrientation() + M_PI_F * 0.5f;
|
||||
// find nearest slot
|
||||
for(uint32 i=0; i<info->chair.slots; ++i)
|
||||
for (uint32 i=0; i<info->chair.slots; ++i)
|
||||
{
|
||||
// the distance between this slot and the center of the go - imagine a 1D space
|
||||
float relativeDistance = (info->size*i)-(info->size*(info->chair.slots-1)/2.0f);
|
||||
|
|
@ -1207,7 +1207,7 @@ void GameObject::Use(Unit* user)
|
|||
spellId = info->goober.spellId;
|
||||
|
||||
// database may contain a dummy spell, so it need replacement by actually existing
|
||||
switch(spellId)
|
||||
switch (spellId)
|
||||
{
|
||||
case 34448: spellId = 26566; break;
|
||||
case 34452: spellId = 26572; break;
|
||||
|
|
@ -1523,7 +1523,7 @@ void GameObject::Use(Unit* user)
|
|||
if (player->CanUseBattleGroundObject())
|
||||
{
|
||||
// in battleground check
|
||||
BattleGround *bg = player->GetBattleGround();
|
||||
BattleGround* bg = player->GetBattleGround();
|
||||
if (!bg)
|
||||
return;
|
||||
// BG flag dropped
|
||||
|
|
@ -1535,7 +1535,7 @@ void GameObject::Use(Unit* user)
|
|||
GameObjectInfo const* info = GetGOInfo();
|
||||
if (info)
|
||||
{
|
||||
switch(info->id)
|
||||
switch (info->id)
|
||||
{
|
||||
case 179785: // Silverwing Flag
|
||||
case 179786: // Warsong Flag
|
||||
|
|
@ -1583,14 +1583,14 @@ void GameObject::Use(Unit* user)
|
|||
if (!spellId)
|
||||
return;
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId, GetEntry(), GetGoType());
|
||||
return;
|
||||
}
|
||||
|
||||
Spell *spell = new Spell(spellCaster, spellInfo, triggered, GetObjectGuid());
|
||||
Spell* spell = new Spell(spellCaster, spellInfo, triggered, GetObjectGuid());
|
||||
|
||||
// spell target is user of GO
|
||||
SpellCastTargets targets;
|
||||
|
|
@ -1604,7 +1604,7 @@ const char* GameObject::GetNameForLocaleIdx(int32 loc_idx) const
|
|||
{
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
GameObjectLocale const *cl = sObjectMgr.GetGameObjectLocale(GetEntry());
|
||||
GameObjectLocale const* cl = sObjectMgr.GetGameObjectLocale(GetEntry());
|
||||
if (cl)
|
||||
{
|
||||
if (cl->Name.size() > (size_t)loc_idx && !cl->Name[loc_idx].empty())
|
||||
|
|
@ -1622,7 +1622,8 @@ struct QuaternionCompressed
|
|||
QuaternionCompressed(int64 val) : m_raw(val) {}
|
||||
QuaternionCompressed(const Quat& quat) { Set(quat); }
|
||||
|
||||
enum{
|
||||
enum
|
||||
{
|
||||
PACK_COEFF_YZ = 1 << 20,
|
||||
PACK_COEFF_X = 1 << 21,
|
||||
};
|
||||
|
|
@ -1676,7 +1677,7 @@ void GameObject::SetTransportPathRotation(QuaternionData rotation)
|
|||
|
||||
void GameObject::SetWorldRotationAngles(float z_rot, float y_rot, float x_rot)
|
||||
{
|
||||
Quat quat( G3D::Matrix3::fromEulerAnglesZYX(z_rot, y_rot, x_rot) );
|
||||
Quat quat(G3D::Matrix3::fromEulerAnglesZYX(z_rot, y_rot, x_rot));
|
||||
SetWorldRotation(quat.x, quat.y, quat.z, quat.w);
|
||||
}
|
||||
|
||||
|
|
@ -1698,8 +1699,8 @@ bool GameObject::IsHostileTo(Unit const* unit) const
|
|||
return true;
|
||||
|
||||
// faction base cases
|
||||
FactionTemplateEntry const*tester_faction = sFactionTemplateStore.LookupEntry(GetGOInfo()->faction);
|
||||
FactionTemplateEntry const*target_faction = unit->getFactionTemplateEntry();
|
||||
FactionTemplateEntry const* tester_faction = sFactionTemplateStore.LookupEntry(GetGOInfo()->faction);
|
||||
FactionTemplateEntry const* target_faction = unit->getFactionTemplateEntry();
|
||||
if (!tester_faction || !target_faction)
|
||||
return false;
|
||||
|
||||
|
|
@ -1741,8 +1742,8 @@ bool GameObject::IsFriendlyTo(Unit const* unit) const
|
|||
return false;
|
||||
|
||||
// faction base cases
|
||||
FactionTemplateEntry const*tester_faction = sFactionTemplateStore.LookupEntry(GetGOInfo()->faction);
|
||||
FactionTemplateEntry const*target_faction = unit->getFactionTemplateEntry();
|
||||
FactionTemplateEntry const* tester_faction = sFactionTemplateStore.LookupEntry(GetGOInfo()->faction);
|
||||
FactionTemplateEntry const* target_faction = unit->getFactionTemplateEntry();
|
||||
if (!tester_faction || !target_faction)
|
||||
return false;
|
||||
|
||||
|
|
@ -1877,7 +1878,7 @@ struct AddGameObjectToRemoveListInMapsWorker
|
|||
{
|
||||
AddGameObjectToRemoveListInMapsWorker(ObjectGuid guid) : i_guid(guid) {}
|
||||
|
||||
void operator() (Map* map)
|
||||
void operator()(Map* map)
|
||||
{
|
||||
if (GameObject* pGameobject = map->GetGameObject(i_guid))
|
||||
pGameobject->AddObjectToRemoveList();
|
||||
|
|
@ -1897,7 +1898,7 @@ struct SpawnGameObjectInMapsWorker
|
|||
SpawnGameObjectInMapsWorker(uint32 guid, GameObjectData const* data)
|
||||
: i_guid(guid), i_data(data) {}
|
||||
|
||||
void operator() (Map* map)
|
||||
void operator()(Map* map)
|
||||
{
|
||||
// Spawn if necessary (loaded grids only)
|
||||
if (map->IsLoaded(i_data->posX, i_data->posY))
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ struct GameObjectInfo
|
|||
uint32 id;
|
||||
uint32 type;
|
||||
uint32 displayId;
|
||||
char *name;
|
||||
char *IconName;
|
||||
char *castBarCaption;
|
||||
char *unk1;
|
||||
char* name;
|
||||
char* IconName;
|
||||
char* castBarCaption;
|
||||
char* unk1;
|
||||
uint32 faction;
|
||||
uint32 flags;
|
||||
float size;
|
||||
|
|
@ -404,7 +404,7 @@ struct GameObjectInfo
|
|||
// helpers
|
||||
bool IsDespawnAtAction() const
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_CHEST: return chest.consumable;
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.consumable;
|
||||
|
|
@ -414,7 +414,7 @@ struct GameObjectInfo
|
|||
|
||||
uint32 GetLockId() const
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: return door.lockId;
|
||||
case GAMEOBJECT_TYPE_BUTTON: return button.lockId;
|
||||
|
|
@ -433,7 +433,7 @@ struct GameObjectInfo
|
|||
|
||||
bool GetDespawnPossibility() const // despawn at targeting of cast?
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune;
|
||||
case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune;
|
||||
|
|
@ -447,7 +447,7 @@ struct GameObjectInfo
|
|||
|
||||
uint32 GetCharges() const // despawn at uses amount
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_TRAP: return trap.charges;
|
||||
case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges;
|
||||
|
|
@ -458,7 +458,7 @@ struct GameObjectInfo
|
|||
|
||||
uint32 GetCooldown() const // not triggering at detection target or use until coolodwn expire
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_TRAP: return trap.cooldown;
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown;
|
||||
|
|
@ -468,7 +468,7 @@ struct GameObjectInfo
|
|||
|
||||
uint32 GetLinkedGameObjectEntry() const
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrapId;
|
||||
case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId;
|
||||
|
|
@ -481,7 +481,7 @@ struct GameObjectInfo
|
|||
uint32 GetAutoCloseTime() const
|
||||
{
|
||||
uint32 autoCloseTime = 0;
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break;
|
||||
case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break;
|
||||
|
|
@ -496,7 +496,7 @@ struct GameObjectInfo
|
|||
|
||||
uint32 GetLootId() const
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_CHEST: return chest.lootId;
|
||||
case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId;
|
||||
|
|
@ -506,7 +506,7 @@ struct GameObjectInfo
|
|||
|
||||
uint32 GetGossipMenuId() const
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID;
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID;
|
||||
|
|
@ -516,7 +516,7 @@ struct GameObjectInfo
|
|||
|
||||
uint32 GetEventScriptId() const
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_GOOBER: return goober.eventId;
|
||||
case GAMEOBJECT_TYPE_CHEST: return chest.eventId;
|
||||
|
|
@ -640,7 +640,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
void AddToWorld();
|
||||
void RemoveFromWorld();
|
||||
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang,
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang,
|
||||
QuaternionData rotation = QuaternionData(), uint8 animprogress = GO_ANIMPROGRESS_DEFAULT, GOState go_state = GO_STATE_READY);
|
||||
void Update(uint32 update_diff, uint32 p_time) override;
|
||||
GameObjectInfo const* GetGOInfo() const;
|
||||
|
|
@ -660,7 +660,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
|
||||
void SaveToDB();
|
||||
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
|
||||
bool LoadFromDB(uint32 guid, Map *map);
|
||||
bool LoadFromDB(uint32 guid, Map* map);
|
||||
void DeleteFromDB();
|
||||
|
||||
void SetOwnerGuid(ObjectGuid ownerGuid)
|
||||
|
|
@ -682,7 +682,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
time_t GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
if(m_respawnTime > now)
|
||||
if (m_respawnTime > now)
|
||||
return m_respawnTime;
|
||||
else
|
||||
return now;
|
||||
|
|
@ -762,7 +762,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
|
||||
bool HasQuest(uint32 quest_id) const;
|
||||
bool HasInvolvedQuest(uint32 quest_id) const;
|
||||
bool ActivateToQuest(Player *pTarget) const;
|
||||
bool ActivateToQuest(Player* pTarget) const;
|
||||
void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false);
|
||||
// 0 = use `gameobject`.`spawntimesecs`
|
||||
void ResetDoorOrButton();
|
||||
|
|
@ -779,7 +779,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
|
||||
void SetCapturePointSlider(int8 value);
|
||||
|
||||
GridReference<GameObject> &GetGridRef() { return m_gridRef; }
|
||||
GridReference<GameObject>& GetGridRef() { return m_gridRef; }
|
||||
|
||||
protected:
|
||||
uint32 m_spellId;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ GossipMenu::~GossipMenu()
|
|||
|
||||
void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded)
|
||||
{
|
||||
MANGOS_ASSERT( m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS );
|
||||
MANGOS_ASSERT(m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS);
|
||||
|
||||
GossipMenuItem gItem;
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ void GossipMenu::AddGossipMenuItemData(int32 action_menu, uint32 action_poi, uin
|
|||
|
||||
void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, bool Coded)
|
||||
{
|
||||
AddMenuItem( Icon, Message, 0, 0, "", 0, Coded);
|
||||
AddMenuItem(Icon, Message, 0, 0, "", 0, Coded);
|
||||
}
|
||||
|
||||
void GossipMenu::AddMenuItem(uint8 Icon, char const* Message, bool Coded)
|
||||
|
|
@ -88,25 +88,25 @@ void GossipMenu::AddMenuItem(uint8 Icon, int32 itemText, uint32 dtSender, uint32
|
|||
AddMenuItem(Icon, std::string(item_text), dtSender, dtAction, std::string(box_text), BoxMoney, Coded);
|
||||
}
|
||||
|
||||
uint32 GossipMenu::MenuItemSender( unsigned int ItemId )
|
||||
uint32 GossipMenu::MenuItemSender(unsigned int ItemId)
|
||||
{
|
||||
if ( ItemId >= m_gItems.size() )
|
||||
if (ItemId >= m_gItems.size())
|
||||
return 0;
|
||||
|
||||
return m_gItems[ ItemId ].m_gSender;
|
||||
}
|
||||
|
||||
uint32 GossipMenu::MenuItemAction( unsigned int ItemId )
|
||||
uint32 GossipMenu::MenuItemAction(unsigned int ItemId)
|
||||
{
|
||||
if ( ItemId >= m_gItems.size() )
|
||||
if (ItemId >= m_gItems.size())
|
||||
return 0;
|
||||
|
||||
return m_gItems[ ItemId ].m_gOptionId;
|
||||
}
|
||||
|
||||
bool GossipMenu::MenuItemCoded( unsigned int ItemId )
|
||||
bool GossipMenu::MenuItemCoded(unsigned int ItemId)
|
||||
{
|
||||
if ( ItemId >= m_gItems.size() )
|
||||
if (ItemId >= m_gItems.size())
|
||||
return 0;
|
||||
|
||||
return m_gItems[ ItemId ].m_gCoded;
|
||||
|
|
@ -119,7 +119,7 @@ void GossipMenu::ClearMenu()
|
|||
m_gMenuId = 0;
|
||||
}
|
||||
|
||||
PlayerMenu::PlayerMenu(WorldSession *session) : mGossipMenu(session)
|
||||
PlayerMenu::PlayerMenu(WorldSession* session) : mGossipMenu(session)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -134,19 +134,19 @@ void PlayerMenu::ClearMenus()
|
|||
mQuestMenu.ClearMenu();
|
||||
}
|
||||
|
||||
uint32 PlayerMenu::GossipOptionSender( unsigned int Selection )
|
||||
uint32 PlayerMenu::GossipOptionSender(unsigned int Selection)
|
||||
{
|
||||
return mGossipMenu.MenuItemSender( Selection );
|
||||
return mGossipMenu.MenuItemSender(Selection);
|
||||
}
|
||||
|
||||
uint32 PlayerMenu::GossipOptionAction( unsigned int Selection )
|
||||
uint32 PlayerMenu::GossipOptionAction(unsigned int Selection)
|
||||
{
|
||||
return mGossipMenu.MenuItemAction( Selection );
|
||||
return mGossipMenu.MenuItemAction(Selection);
|
||||
}
|
||||
|
||||
bool PlayerMenu::GossipOptionCoded( unsigned int Selection )
|
||||
bool PlayerMenu::GossipOptionCoded(unsigned int Selection)
|
||||
{
|
||||
return mGossipMenu.MenuItemCoded( Selection );
|
||||
return mGossipMenu.MenuItemCoded(Selection);
|
||||
}
|
||||
|
||||
void PlayerMenu::SendGossipMenu(uint32 TitleTextId, ObjectGuid objectGuid)
|
||||
|
|
@ -157,7 +157,7 @@ void PlayerMenu::SendGossipMenu(uint32 TitleTextId, ObjectGuid objectGuid)
|
|||
data << uint32(TitleTextId);
|
||||
data << uint32(mGossipMenu.MenuItemCount()); // max count 0x20
|
||||
|
||||
for (uint32 iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI )
|
||||
for (uint32 iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI)
|
||||
{
|
||||
GossipMenuItem const& gItem = mGossipMenu.GetItem(iI);
|
||||
data << uint32(iI);
|
||||
|
|
@ -189,22 +189,22 @@ void PlayerMenu::SendGossipMenu(uint32 TitleTextId, ObjectGuid objectGuid)
|
|||
data << title; // max 0x200
|
||||
}
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
//DEBUG_LOG( "WORLD: Sent SMSG_GOSSIP_MESSAGE NPCGuid=%u",GUID_LOPART(npcGUID) );
|
||||
}
|
||||
|
||||
void PlayerMenu::CloseGossip()
|
||||
{
|
||||
WorldPacket data( SMSG_GOSSIP_COMPLETE, 0 );
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
WorldPacket data(SMSG_GOSSIP_COMPLETE, 0);
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
|
||||
//DEBUG_LOG( "WORLD: Sent SMSG_GOSSIP_COMPLETE" );
|
||||
}
|
||||
|
||||
// Outdated
|
||||
void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, char const * locName )
|
||||
void PlayerMenu::SendPointOfInterest(float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, char const* locName)
|
||||
{
|
||||
WorldPacket data( SMSG_GOSSIP_POI, (4+4+4+4+4+10) ); // guess size
|
||||
WorldPacket data(SMSG_GOSSIP_POI, (4+4+4+4+4+10)); // guess size
|
||||
data << uint32(Flags);
|
||||
data << float(X);
|
||||
data << float(Y);
|
||||
|
|
@ -212,14 +212,14 @@ void PlayerMenu::SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flag
|
|||
data << uint32(Data);
|
||||
data << locName;
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
//DEBUG_LOG("WORLD: Sent SMSG_GOSSIP_POI");
|
||||
}
|
||||
|
||||
void PlayerMenu::SendPointOfInterest( uint32 poi_id )
|
||||
void PlayerMenu::SendPointOfInterest(uint32 poi_id)
|
||||
{
|
||||
PointOfInterest const* poi = sObjectMgr.GetPointOfInterest(poi_id);
|
||||
if(!poi)
|
||||
if (!poi)
|
||||
{
|
||||
sLog.outErrorDb("Requested send nonexistent POI (Id: %u), ignore.",poi_id);
|
||||
return;
|
||||
|
|
@ -229,11 +229,11 @@ void PlayerMenu::SendPointOfInterest( uint32 poi_id )
|
|||
|
||||
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
if (PointOfInterestLocale const *pl = sObjectMgr.GetPointOfInterestLocale(poi_id))
|
||||
if (PointOfInterestLocale const* pl = sObjectMgr.GetPointOfInterestLocale(poi_id))
|
||||
if (pl->IconName.size() > size_t(loc_idx) && !pl->IconName[loc_idx].empty())
|
||||
icon_name = pl->IconName[loc_idx];
|
||||
|
||||
WorldPacket data( SMSG_GOSSIP_POI, (4+4+4+4+4+10) ); // guess size
|
||||
WorldPacket data(SMSG_GOSSIP_POI, (4+4+4+4+4+10)); // guess size
|
||||
data << uint32(poi->flags);
|
||||
data << float(poi->x);
|
||||
data << float(poi->y);
|
||||
|
|
@ -241,20 +241,20 @@ void PlayerMenu::SendPointOfInterest( uint32 poi_id )
|
|||
data << uint32(poi->data);
|
||||
data << icon_name;
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
//DEBUG_LOG("WORLD: Sent SMSG_GOSSIP_POI");
|
||||
}
|
||||
|
||||
void PlayerMenu::SendTalking( uint32 textID )
|
||||
void PlayerMenu::SendTalking(uint32 textID)
|
||||
{
|
||||
GossipText const* pGossip = sObjectMgr.GetGossipText(textID);
|
||||
|
||||
WorldPacket data( SMSG_NPC_TEXT_UPDATE, 100 ); // guess size
|
||||
WorldPacket data(SMSG_NPC_TEXT_UPDATE, 100); // guess size
|
||||
data << textID; // can be < 0
|
||||
|
||||
if (!pGossip)
|
||||
{
|
||||
for(uint32 i = 0; i < 8; ++i)
|
||||
for (uint32 i = 0; i < 8; ++i)
|
||||
{
|
||||
data << float(0);
|
||||
data << "Greetings $N";
|
||||
|
|
@ -297,23 +297,23 @@ void PlayerMenu::SendTalking( uint32 textID )
|
|||
|
||||
data << pGossip->Options[i].Language;
|
||||
|
||||
for(int j = 0; j < 3; ++j)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
data << pGossip->Options[i].Emotes[j]._Delay;
|
||||
data << pGossip->Options[i].Emotes[j]._Emote;
|
||||
}
|
||||
}
|
||||
}
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " );
|
||||
DEBUG_LOG("WORLD: Sent SMSG_NPC_TEXT_UPDATE ");
|
||||
}
|
||||
|
||||
void PlayerMenu::SendTalking( char const * title, char const * text )
|
||||
void PlayerMenu::SendTalking(char const* title, char const* text)
|
||||
{
|
||||
WorldPacket data( SMSG_NPC_TEXT_UPDATE, 50 ); // guess size
|
||||
WorldPacket data(SMSG_NPC_TEXT_UPDATE, 50); // guess size
|
||||
data << uint32(0);
|
||||
for(uint32 i = 0; i < 8; ++i)
|
||||
for (uint32 i = 0; i < 8; ++i)
|
||||
{
|
||||
data << float(0);
|
||||
data << title;
|
||||
|
|
@ -327,9 +327,9 @@ void PlayerMenu::SendTalking( char const * title, char const * text )
|
|||
data << uint32(0);
|
||||
}
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " );
|
||||
DEBUG_LOG("WORLD: Sent SMSG_NPC_TEXT_UPDATE ");
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
|
|
@ -346,13 +346,13 @@ QuestMenu::~QuestMenu()
|
|||
ClearMenu();
|
||||
}
|
||||
|
||||
void QuestMenu::AddMenuItem( uint32 QuestId, uint8 Icon)
|
||||
void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon)
|
||||
{
|
||||
Quest const* qinfo = sObjectMgr.GetQuestTemplate(QuestId);
|
||||
if (!qinfo)
|
||||
return;
|
||||
|
||||
MANGOS_ASSERT( m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS );
|
||||
MANGOS_ASSERT(m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS);
|
||||
|
||||
QuestMenuItem qItem;
|
||||
|
||||
|
|
@ -362,10 +362,10 @@ void QuestMenu::AddMenuItem( uint32 QuestId, uint8 Icon)
|
|||
m_qItems.push_back(qItem);
|
||||
}
|
||||
|
||||
bool QuestMenu::HasItem( uint32 questid )
|
||||
bool QuestMenu::HasItem(uint32 questid)
|
||||
{
|
||||
for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i)
|
||||
if(i->m_qId == questid)
|
||||
if (i->m_qId == questid)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -377,22 +377,22 @@ void QuestMenu::ClearMenu()
|
|||
|
||||
void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, ObjectGuid npcGUID)
|
||||
{
|
||||
WorldPacket data( SMSG_QUESTGIVER_QUEST_LIST, 100 ); // guess size
|
||||
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size
|
||||
data << ObjectGuid(npcGUID);
|
||||
data << Title;
|
||||
data << uint32(eEmote._Delay ); // player emote
|
||||
data << uint32(eEmote._Emote ); // NPC emote
|
||||
data << uint32(eEmote._Delay); // player emote
|
||||
data << uint32(eEmote._Emote); // NPC emote
|
||||
|
||||
size_t count_pos = data.wpos();
|
||||
data << uint8 ( mQuestMenu.MenuItemCount() );
|
||||
data << uint8(mQuestMenu.MenuItemCount());
|
||||
uint32 count = 0;
|
||||
for (; count < mQuestMenu.MenuItemCount(); ++count )
|
||||
for (; count < mQuestMenu.MenuItemCount(); ++count)
|
||||
{
|
||||
QuestMenuItem const& qmi = mQuestMenu.GetItem(count);
|
||||
|
||||
uint32 questID = qmi.m_qId;
|
||||
|
||||
if(Quest const *pQuest = sObjectMgr.GetQuestTemplate(questID))
|
||||
if (Quest const* pQuest = sObjectMgr.GetQuestTemplate(questID))
|
||||
{
|
||||
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
|
||||
std::string title = pQuest->GetTitle();
|
||||
|
|
@ -407,18 +407,18 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
|
|||
}
|
||||
}
|
||||
data.put<uint8>(count_pos, count);
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid = %s", npcGUID.GetString().c_str());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverStatus( uint8 questStatus, ObjectGuid npcGUID )
|
||||
void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, ObjectGuid npcGUID)
|
||||
{
|
||||
WorldPacket data( SMSG_QUESTGIVER_STATUS, 9 );
|
||||
WorldPacket data(SMSG_QUESTGIVER_STATUS, 9);
|
||||
data << npcGUID;
|
||||
data << uint8(questStatus);
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
DEBUG_LOG( "WORLD: Sent SMSG_QUESTGIVER_STATUS for %s", npcGUID.GetString().c_str());
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_STATUS for %s", npcGUID.GetString().c_str());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid, bool ActivateAccept)
|
||||
|
|
@ -430,7 +430,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
|
|||
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
if (QuestLocale const* ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty())
|
||||
Title = ql->Title[loc_idx];
|
||||
|
|
@ -520,13 +520,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
|
|||
data << uint32(0); // bonus arena points
|
||||
data << uint32(0); // rep reward show mask?
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
|
||||
data << uint32(pQuest->RewRepFaction[i]);
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
|
||||
data << int32(pQuest->RewRepValueId[i]);
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
|
||||
data << int32(0);
|
||||
//data << int32(pQuest->RewRepValue[i]); // current field for store of rep value, can be reused to implement "override value"
|
||||
|
||||
|
|
@ -538,13 +538,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
|
|||
data << uint32(pQuest->DetailsEmoteDelay[i]); // DetailsEmoteDelay (in ms)
|
||||
}
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
|
||||
DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS - for %s of %s, questid = %u", GetMenuSession()->GetPlayer()->GetGuidStr().c_str(), guid.GetString().c_str(), pQuest->GetQuestId());
|
||||
}
|
||||
|
||||
// send only static data in this packet!
|
||||
void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
|
||||
void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
|
||||
{
|
||||
std::string Title, Details, Objectives, EndText, CompletedText;
|
||||
std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
|
||||
|
|
@ -560,7 +560,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
|
|||
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
if (QuestLocale const* ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty())
|
||||
Title = ql->Title[loc_idx];
|
||||
|
|
@ -573,13 +573,13 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
|
|||
if (ql->CompletedText.size() > (size_t)loc_idx && !ql->CompletedText[loc_idx].empty())
|
||||
CompletedText = ql->CompletedText[loc_idx];
|
||||
|
||||
for (int i = 0;i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
if (ql->ObjectiveText[i].size() > (size_t)loc_idx && !ql->ObjectiveText[i][loc_idx].empty())
|
||||
ObjectiveText[i] = ql->ObjectiveText[i][loc_idx];
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket data( SMSG_QUEST_QUERY_RESPONSE, 100 ); // guess size
|
||||
WorldPacket data(SMSG_QUEST_QUERY_RESPONSE, 100); // guess size
|
||||
|
||||
data << uint32(pQuest->GetQuestId()); // quest id
|
||||
data << uint32(pQuest->GetQuestMethod()); // Accepted values: 0, 1 or 2. 0==IsAutoComplete() (skip objectives/details)
|
||||
|
|
@ -643,13 +643,13 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
|
||||
data << uint32(pQuest->RewRepFaction[i]);
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
|
||||
data << int32(pQuest->RewRepValueId[i]);
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
|
||||
data << int32(0);
|
||||
//data << int32(pQuest->RewRepValue[i]); // current field for store of rep value, can be reused to implement "override value"
|
||||
|
||||
|
|
@ -689,9 +689,9 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
|
|||
for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
|
||||
data << ObjectiveText[iI];
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", pQuest->GetQuestId() );
|
||||
DEBUG_LOG("WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", pQuest->GetQuestId());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGUID, bool EnableNext)
|
||||
|
|
@ -702,7 +702,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
|
|||
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
if (QuestLocale const* ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty())
|
||||
Title = ql->Title[loc_idx];
|
||||
|
|
@ -711,7 +711,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
|
|||
}
|
||||
}
|
||||
|
||||
WorldPacket data( SMSG_QUESTGIVER_OFFER_REWARD, 50 ); // guess size
|
||||
WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 50); // guess size
|
||||
|
||||
data << ObjectGuid(npcGUID);
|
||||
data << uint32(pQuest->GetQuestId());
|
||||
|
|
@ -725,7 +725,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
|
|||
uint32 EmoteCount = 0;
|
||||
for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
|
||||
{
|
||||
if(pQuest->OfferRewardEmote[i] <= 0)
|
||||
if (pQuest->OfferRewardEmote[i] <= 0)
|
||||
break;
|
||||
++EmoteCount;
|
||||
}
|
||||
|
|
@ -737,17 +737,17 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
|
|||
data << uint32(pQuest->OfferRewardEmote[i]);
|
||||
}
|
||||
|
||||
ItemPrototype const *pItem;
|
||||
ItemPrototype const* pItem;
|
||||
|
||||
data << uint32(pQuest->GetRewChoiceItemsCount());
|
||||
for (uint32 i = 0; i < pQuest->GetRewChoiceItemsCount(); ++i)
|
||||
{
|
||||
pItem = ObjectMgr::GetItemPrototype( pQuest->RewChoiceItemId[i] );
|
||||
pItem = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]);
|
||||
|
||||
data << uint32(pQuest->RewChoiceItemId[i]);
|
||||
data << uint32(pQuest->RewChoiceItemCount[i]);
|
||||
|
||||
if ( pItem )
|
||||
if (pItem)
|
||||
data << uint32(pItem->DisplayInfoID);
|
||||
else
|
||||
data << uint32(0);
|
||||
|
|
@ -760,7 +760,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
|
|||
data << uint32(pQuest->RewItemId[i]);
|
||||
data << uint32(pQuest->RewItemCount[i]);
|
||||
|
||||
if ( pItem )
|
||||
if (pItem)
|
||||
data << uint32(pItem->DisplayInfoID);
|
||||
else
|
||||
data << uint32(0);
|
||||
|
|
@ -787,13 +787,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
|
|||
data << uint32(0); // bonus arena points
|
||||
data << uint32(0); // rew rep show mask?
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
|
||||
data << uint32(pQuest->RewRepFaction[i]);
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
|
||||
data << int32(pQuest->RewRepValueId[i]);
|
||||
|
||||
for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No diplomacy bonus is expected given, reward also does not display in chat window
|
||||
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No diplomacy bonus is expected given, reward also does not display in chat window
|
||||
data << int32(0);
|
||||
//data << int32(pQuest->RewRepValue[i]);
|
||||
|
||||
|
|
@ -801,7 +801,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
|
|||
DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid = %s, questid = %u", npcGUID.GetString().c_str(), pQuest->GetQuestId());
|
||||
}
|
||||
|
||||
void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, ObjectGuid npcGUID, bool Completable, bool CloseOnCancel)
|
||||
void PlayerMenu::SendQuestGiverRequestItems(Quest const* pQuest, ObjectGuid npcGUID, bool Completable, bool CloseOnCancel)
|
||||
{
|
||||
// We can always call to RequestItems, but this packet only goes out if there are actually
|
||||
// items. Otherwise, we'll skip straight to the OfferReward
|
||||
|
|
@ -812,7 +812,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, ObjectGuid npcG
|
|||
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
if (QuestLocale const* ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > (size_t)loc_idx && !ql->Title[loc_idx].empty())
|
||||
Title = ql->Title[loc_idx];
|
||||
|
|
@ -827,7 +827,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, ObjectGuid npcG
|
|||
return;
|
||||
}
|
||||
|
||||
WorldPacket data( SMSG_QUESTGIVER_REQUEST_ITEMS, 50 ); // guess size
|
||||
WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size
|
||||
data << ObjectGuid(npcGUID);
|
||||
data << uint32(pQuest->GetQuestId());
|
||||
data << Title;
|
||||
|
|
@ -835,7 +835,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, ObjectGuid npcG
|
|||
|
||||
data << uint32(0x00); // emote delay
|
||||
|
||||
if(Completable)
|
||||
if (Completable)
|
||||
data << pQuest->GetCompleteEmote(); // emote id
|
||||
else
|
||||
data << pQuest->GetIncompleteEmote();
|
||||
|
|
@ -852,23 +852,23 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, ObjectGuid npcG
|
|||
// Required Money
|
||||
data << uint32(pQuest->GetRewOrReqMoney() < 0 ? -pQuest->GetRewOrReqMoney() : 0);
|
||||
|
||||
data << uint32( pQuest->GetReqItemsCount() );
|
||||
ItemPrototype const *pItem;
|
||||
data << uint32(pQuest->GetReqItemsCount());
|
||||
ItemPrototype const* pItem;
|
||||
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
|
||||
{
|
||||
if ( !pQuest->ReqItemId[i] )
|
||||
if (!pQuest->ReqItemId[i])
|
||||
continue;
|
||||
pItem = ObjectMgr::GetItemPrototype(pQuest->ReqItemId[i]);
|
||||
data << uint32(pQuest->ReqItemId[i]);
|
||||
data << uint32(pQuest->ReqItemCount[i]);
|
||||
|
||||
if ( pItem )
|
||||
if (pItem)
|
||||
data << uint32(pItem->DisplayInfoID);
|
||||
else
|
||||
data << uint32(0);
|
||||
}
|
||||
|
||||
if ( !Completable ) // Completable = flags1 && flags2 && flags3 && flags4
|
||||
if (!Completable) // Completable = flags1 && flags2 && flags3 && flags4
|
||||
data << uint32(0x00); // flags1
|
||||
else
|
||||
data << uint32(0x03);
|
||||
|
|
@ -877,6 +877,6 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, ObjectGuid npcG
|
|||
data << uint32(0x08); // flags3
|
||||
data << uint32(0x10); // flags4
|
||||
|
||||
GetMenuSession()->SendPacket( &data );
|
||||
GetMenuSession()->SendPacket(&data);
|
||||
DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid = %s, questid = %u", npcGUID.GetString().c_str(), pQuest->GetQuestId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ class MANGOS_DLL_SPEC GossipMenu
|
|||
return m_gItems.empty();
|
||||
}
|
||||
|
||||
GossipMenuItem const& GetItem( unsigned int Id )
|
||||
GossipMenuItem const& GetItem(unsigned int Id)
|
||||
{
|
||||
return m_gItems[ Id ];
|
||||
}
|
||||
|
|
@ -195,9 +195,9 @@ class MANGOS_DLL_SPEC GossipMenu
|
|||
return m_gItemsData[indexId];
|
||||
}
|
||||
|
||||
uint32 MenuItemSender( unsigned int ItemId );
|
||||
uint32 MenuItemAction( unsigned int ItemId );
|
||||
bool MenuItemCoded( unsigned int ItemId );
|
||||
uint32 MenuItemSender(unsigned int ItemId);
|
||||
uint32 MenuItemAction(unsigned int ItemId);
|
||||
bool MenuItemCoded(unsigned int ItemId);
|
||||
|
||||
void ClearMenu();
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ class QuestMenu
|
|||
QuestMenu();
|
||||
~QuestMenu();
|
||||
|
||||
void AddMenuItem( uint32 QuestId, uint8 Icon);
|
||||
void AddMenuItem(uint32 QuestId, uint8 Icon);
|
||||
void ClearMenu();
|
||||
|
||||
uint8 MenuItemCount() const
|
||||
|
|
@ -232,9 +232,9 @@ class QuestMenu
|
|||
return m_qItems.empty();
|
||||
}
|
||||
|
||||
bool HasItem( uint32 questid );
|
||||
bool HasItem(uint32 questid);
|
||||
|
||||
QuestMenuItem const& GetItem( uint16 Id )
|
||||
QuestMenuItem const& GetItem(uint16 Id)
|
||||
{
|
||||
return m_qItems[ Id ];
|
||||
}
|
||||
|
|
@ -250,7 +250,7 @@ class MANGOS_DLL_SPEC PlayerMenu
|
|||
QuestMenu mQuestMenu;
|
||||
|
||||
public:
|
||||
explicit PlayerMenu(WorldSession *Session);
|
||||
explicit PlayerMenu(WorldSession* Session);
|
||||
~PlayerMenu();
|
||||
|
||||
GossipMenu& GetGossipMenu() { return mGossipMenu; }
|
||||
|
|
@ -261,16 +261,16 @@ class MANGOS_DLL_SPEC PlayerMenu
|
|||
bool Empty() const { return mGossipMenu.Empty() && mQuestMenu.Empty(); }
|
||||
|
||||
void ClearMenus();
|
||||
uint32 GossipOptionSender( unsigned int Selection );
|
||||
uint32 GossipOptionAction( unsigned int Selection );
|
||||
bool GossipOptionCoded( unsigned int Selection );
|
||||
uint32 GossipOptionSender(unsigned int Selection);
|
||||
uint32 GossipOptionAction(unsigned int Selection);
|
||||
bool GossipOptionCoded(unsigned int Selection);
|
||||
|
||||
void SendGossipMenu(uint32 titleTextId, ObjectGuid objectGuid);
|
||||
void CloseGossip();
|
||||
void SendPointOfInterest( float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char * locName );
|
||||
void SendPointOfInterest( uint32 poi_id );
|
||||
void SendTalking( uint32 textID );
|
||||
void SendTalking( char const * title, char const * text );
|
||||
void SendPointOfInterest(float X, float Y, uint32 Icon, uint32 Flags, uint32 Data, const char* locName);
|
||||
void SendPointOfInterest(uint32 poi_id);
|
||||
void SendTalking(uint32 textID);
|
||||
void SendTalking(char const* title, char const* text);
|
||||
|
||||
/*********************************************************/
|
||||
/*** QUEST SYSTEM ***/
|
||||
|
|
@ -279,10 +279,10 @@ class MANGOS_DLL_SPEC PlayerMenu
|
|||
|
||||
void SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, ObjectGuid npcGUID);
|
||||
|
||||
void SendQuestQueryResponse(Quest const *pQuest);
|
||||
void SendQuestGiverQuestDetails(Quest const *pQuest, ObjectGuid npcGUID, bool ActivateAccept);
|
||||
void SendQuestQueryResponse(Quest const* pQuest);
|
||||
void SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid npcGUID, bool ActivateAccept);
|
||||
|
||||
void SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGUID, bool EnbleNext);
|
||||
void SendQuestGiverRequestItems(Quest const *pQuest, ObjectGuid npcGUID, bool Completable, bool CloseOnCancel);
|
||||
void SendQuestGiverRequestItems(Quest const* pQuest, ObjectGuid npcGUID, bool Completable, bool CloseOnCancel);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -78,10 +78,10 @@ template<const unsigned int LIMIT>
|
|||
struct MANGOS_DLL_DECL CoordPair
|
||||
{
|
||||
CoordPair(uint32 x=0, uint32 y=0) : x_coord(x), y_coord(y) {}
|
||||
CoordPair(const CoordPair<LIMIT> &obj) : x_coord(obj.x_coord), y_coord(obj.y_coord) {}
|
||||
bool operator==(const CoordPair<LIMIT> &obj) const { return (obj.x_coord == x_coord && obj.y_coord == y_coord); }
|
||||
bool operator!=(const CoordPair<LIMIT> &obj) const { return !operator==(obj); }
|
||||
CoordPair<LIMIT>& operator=(const CoordPair<LIMIT> &obj)
|
||||
CoordPair(const CoordPair<LIMIT>& obj) : x_coord(obj.x_coord), y_coord(obj.y_coord) {}
|
||||
bool operator==(const CoordPair<LIMIT>& obj) const { return (obj.x_coord == x_coord && obj.y_coord == y_coord); }
|
||||
bool operator!=(const CoordPair<LIMIT>& obj) const { return !operator==(obj); }
|
||||
CoordPair<LIMIT>& operator=(const CoordPair<LIMIT>& obj)
|
||||
{
|
||||
x_coord = obj.x_coord;
|
||||
y_coord = obj.y_coord;
|
||||
|
|
@ -90,7 +90,7 @@ struct MANGOS_DLL_DECL CoordPair
|
|||
|
||||
void operator<<(const uint32 val)
|
||||
{
|
||||
if( x_coord > val )
|
||||
if (x_coord > val)
|
||||
x_coord -= val;
|
||||
else
|
||||
x_coord = 0;
|
||||
|
|
@ -98,7 +98,7 @@ struct MANGOS_DLL_DECL CoordPair
|
|||
|
||||
void operator>>(const uint32 val)
|
||||
{
|
||||
if( x_coord+val < LIMIT )
|
||||
if (x_coord+val < LIMIT)
|
||||
x_coord += val;
|
||||
else
|
||||
x_coord = LIMIT - 1;
|
||||
|
|
@ -106,7 +106,7 @@ struct MANGOS_DLL_DECL CoordPair
|
|||
|
||||
void operator-=(const uint32 val)
|
||||
{
|
||||
if( y_coord > val )
|
||||
if (y_coord > val)
|
||||
y_coord -= val;
|
||||
else
|
||||
y_coord = 0;
|
||||
|
|
@ -114,7 +114,7 @@ struct MANGOS_DLL_DECL CoordPair
|
|||
|
||||
void operator+=(const uint32 val)
|
||||
{
|
||||
if( y_coord+val < LIMIT )
|
||||
if (y_coord+val < LIMIT)
|
||||
y_coord += val;
|
||||
else
|
||||
y_coord = LIMIT - 1;
|
||||
|
|
@ -158,11 +158,11 @@ namespace MaNGOS
|
|||
return Compute<CellPair, CENTER_GRID_CELL_ID>(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL);
|
||||
}
|
||||
|
||||
inline void NormalizeMapCoord(float &c)
|
||||
inline void NormalizeMapCoord(float& c)
|
||||
{
|
||||
if(c > MAP_HALFSIZE - 0.5)
|
||||
if (c > MAP_HALFSIZE - 0.5)
|
||||
c = MAP_HALFSIZE - 0.5;
|
||||
else if(c < -(MAP_HALFSIZE - 0.5))
|
||||
else if (c < -(MAP_HALFSIZE - 0.5))
|
||||
c = -(MAP_HALFSIZE - 0.5);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,14 +66,14 @@ GridMap::~GridMap()
|
|||
unloadData();
|
||||
}
|
||||
|
||||
bool GridMap::loadData(char *filename)
|
||||
bool GridMap::loadData(char* filename)
|
||||
{
|
||||
// Unload old data if exist
|
||||
unloadData();
|
||||
|
||||
GridMapFileHeader header;
|
||||
// Not return error if file not found
|
||||
FILE *in = fopen(filename, "rb");
|
||||
FILE* in = fopen(filename, "rb");
|
||||
if (!in)
|
||||
return true;
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ void GridMap::unloadData()
|
|||
m_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
}
|
||||
|
||||
bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
GridMapAreaHeader header;
|
||||
fseek(in, offset, SEEK_SET);
|
||||
|
|
@ -158,7 +158,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
GridMapHeightHeader header;
|
||||
fseek(in, offset, SEEK_SET);
|
||||
|
|
@ -202,7 +202,7 @@ bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 /*size*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GridMap::loadGridMapLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
bool GridMap::loadGridMapLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
GridMapLiquidHeader header;
|
||||
fseek(in, offset, SEEK_SET);
|
||||
|
|
@ -286,7 +286,7 @@ float GridMap::getHeightFromFloat(float x, float y) const
|
|||
if (x > y)
|
||||
{
|
||||
// 1 triangle (h1, h2, h5 points)
|
||||
float h1 = m_V9[(x_int )*129 + y_int];
|
||||
float h1 = m_V9[(x_int)*129 + y_int];
|
||||
float h2 = m_V9[(x_int+1)*129 + y_int];
|
||||
float h5 = 2 * m_V8[x_int*128 + y_int];
|
||||
a = h2-h1;
|
||||
|
|
@ -319,7 +319,7 @@ float GridMap::getHeightFromFloat(float x, float y) const
|
|||
else
|
||||
{
|
||||
// 4 triangle (h3, h4, h5 points)
|
||||
float h3 = m_V9[(x_int )*129 + y_int+1];
|
||||
float h3 = m_V9[(x_int)*129 + y_int+1];
|
||||
float h4 = m_V9[(x_int+1)*129 + y_int+1];
|
||||
float h5 = 2 * m_V8[x_int*128 + y_int];
|
||||
a = h4 - h3;
|
||||
|
|
@ -347,7 +347,7 @@ float GridMap::getHeightFromUint8(float x, float y) const
|
|||
y_int &= (MAP_RESOLUTION - 1);
|
||||
|
||||
int32 a, b, c;
|
||||
uint8 *V9_h1_ptr = &m_uint8_V9[x_int*128 + x_int + y_int];
|
||||
uint8* V9_h1_ptr = &m_uint8_V9[x_int*128 + x_int + y_int];
|
||||
if (x+y < 1)
|
||||
{
|
||||
if (x > y)
|
||||
|
|
@ -415,7 +415,7 @@ float GridMap::getHeightFromUint16(float x, float y) const
|
|||
y_int &= (MAP_RESOLUTION - 1);
|
||||
|
||||
int32 a, b, c;
|
||||
uint16 *V9_h1_ptr = &m_uint16_V9[x_int*128 + x_int + y_int];
|
||||
uint16* V9_h1_ptr = &m_uint16_V9[x_int*128 + x_int + y_int];
|
||||
if (x+y < 1)
|
||||
{
|
||||
if (x > y)
|
||||
|
|
@ -481,7 +481,7 @@ float GridMap::getLiquidLevel(float x, float y)
|
|||
if (cx_int < 0 || cx_int >=m_liquid_height)
|
||||
return INVALID_HEIGHT_VALUE;
|
||||
|
||||
if (cy_int < 0 || cy_int >=m_liquid_width )
|
||||
if (cy_int < 0 || cy_int >=m_liquid_width)
|
||||
return INVALID_HEIGHT_VALUE;
|
||||
|
||||
return m_liquid_map[cx_int*m_liquid_width + cy_int];
|
||||
|
|
@ -500,7 +500,7 @@ uint8 GridMap::getTerrainType(float x, float y)
|
|||
}
|
||||
|
||||
// Get water state on map
|
||||
GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data)
|
||||
GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data)
|
||||
{
|
||||
// Check water type (if no water return)
|
||||
if (!m_liquid_type && !m_liquidType)
|
||||
|
|
@ -529,7 +529,7 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
|
|||
return LIQUID_MAP_NO_WATER;
|
||||
|
||||
int ly_int = y_int - m_liquid_offX;
|
||||
if (ly_int < 0 || ly_int >=m_liquid_width )
|
||||
if (ly_int < 0 || ly_int >=m_liquid_width)
|
||||
return LIQUID_MAP_NO_WATER;
|
||||
|
||||
// Get water level
|
||||
|
|
@ -557,7 +557,7 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
|
|||
if (delta > 20) // Under water
|
||||
return LIQUID_MAP_UNDER_WATER;
|
||||
|
||||
if (delta > 0 ) // In water
|
||||
if (delta > 0) // In water
|
||||
return LIQUID_MAP_IN_WATER;
|
||||
|
||||
if (delta > -1) // Walk on water
|
||||
|
|
@ -570,11 +570,11 @@ bool GridMap::ExistMap(uint32 mapid,int gx,int gy)
|
|||
{
|
||||
int len = sWorld.GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1;
|
||||
char* tmp = new char[len];
|
||||
snprintf(tmp, len, (char *)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),mapid,gx,gy);
|
||||
snprintf(tmp, len, (char*)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),mapid,gx,gy);
|
||||
|
||||
FILE *pf=fopen(tmp,"rb");
|
||||
FILE* pf=fopen(tmp,"rb");
|
||||
|
||||
if(!pf)
|
||||
if (!pf)
|
||||
{
|
||||
sLog.outError("Check existing of map file '%s': not exist!",tmp);
|
||||
delete[] tmp;
|
||||
|
|
@ -600,13 +600,13 @@ bool GridMap::ExistMap(uint32 mapid,int gx,int gy)
|
|||
|
||||
bool GridMap::ExistVMap(uint32 mapid,int gx,int gy)
|
||||
{
|
||||
if(VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
if (VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
{
|
||||
if(vmgr->isMapLoadingEnabled())
|
||||
if (vmgr->isMapLoadingEnabled())
|
||||
{
|
||||
// x and y are swapped !! => fixed now
|
||||
bool exists = vmgr->existsMap((sWorld.GetDataPath()+ "vmaps").c_str(), mapid, gx,gy);
|
||||
if(!exists)
|
||||
if (!exists)
|
||||
{
|
||||
std::string name = vmgr->getDirFileName(mapid,gx,gy);
|
||||
sLog.outError("VMap file '%s' is missing or point to wrong version vmap file, redo vmaps with latest vmap_assembler.exe program", (sWorld.GetDataPath()+"vmaps/"+name).c_str());
|
||||
|
|
@ -649,7 +649,7 @@ TerrainInfo::~TerrainInfo()
|
|||
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId);
|
||||
}
|
||||
|
||||
GridMap * TerrainInfo::Load(const uint32 x, const uint32 y)
|
||||
GridMap* TerrainInfo::Load(const uint32 x, const uint32 y)
|
||||
{
|
||||
MANGOS_ASSERT(x < MAX_NUMBER_OF_GRIDS);
|
||||
MANGOS_ASSERT(y < MAX_NUMBER_OF_GRIDS);
|
||||
|
|
@ -658,8 +658,8 @@ GridMap * TerrainInfo::Load(const uint32 x, const uint32 y)
|
|||
RefGrid(x, y);
|
||||
|
||||
//quick check if GridMap already loaded
|
||||
GridMap * pMap = m_GridMaps[x][y];
|
||||
if(!pMap)
|
||||
GridMap* pMap = m_GridMaps[x][y];
|
||||
if (!pMap)
|
||||
pMap = LoadMapAndVMap(x, y);
|
||||
|
||||
return pMap;
|
||||
|
|
@ -671,10 +671,10 @@ void TerrainInfo::Unload(const uint32 x, const uint32 y)
|
|||
MANGOS_ASSERT(x < MAX_NUMBER_OF_GRIDS);
|
||||
MANGOS_ASSERT(y < MAX_NUMBER_OF_GRIDS);
|
||||
|
||||
if(m_GridMaps[x][y])
|
||||
if (m_GridMaps[x][y])
|
||||
{
|
||||
//decrease grid reference count...
|
||||
if(UnrefGrid(x, y) == 0)
|
||||
if (UnrefGrid(x, y) == 0)
|
||||
{
|
||||
//TODO: add your additional logic here
|
||||
|
||||
|
|
@ -687,7 +687,7 @@ void TerrainInfo::Unload(const uint32 x, const uint32 y)
|
|||
void TerrainInfo::CleanUpGrids(const uint32 diff)
|
||||
{
|
||||
i_timer.Update(diff);
|
||||
if( !i_timer.Passed() )
|
||||
if (!i_timer.Passed())
|
||||
return;
|
||||
|
||||
for (int y = 0; y < MAX_NUMBER_OF_GRIDS; ++y)
|
||||
|
|
@ -695,10 +695,10 @@ void TerrainInfo::CleanUpGrids(const uint32 diff)
|
|||
for (int x = 0; x < MAX_NUMBER_OF_GRIDS; ++x)
|
||||
{
|
||||
const int16& iRef = m_GridRef[x][y];
|
||||
GridMap * pMap = m_GridMaps[x][y];
|
||||
GridMap* pMap = m_GridMaps[x][y];
|
||||
|
||||
//delete those GridMap objects which have refcount = 0
|
||||
if(pMap && iRef == 0 )
|
||||
if (pMap && iRef == 0)
|
||||
{
|
||||
m_GridMaps[x][y] = NULL;
|
||||
//delete grid data if reference count == 0
|
||||
|
|
@ -734,7 +734,7 @@ int TerrainInfo::UnrefGrid(const uint32& x, const uint32& y)
|
|||
int16& iRef = m_GridRef[x][y];
|
||||
|
||||
LOCK_GUARD _lock(m_refMutex);
|
||||
if(iRef > 0)
|
||||
if (iRef > 0)
|
||||
return (iRef -= 1);
|
||||
|
||||
return 0;
|
||||
|
|
@ -745,7 +745,7 @@ float TerrainInfo::GetHeight(float x, float y, float z, bool pUseVmaps, float ma
|
|||
// find raw .map surface under Z coordinates
|
||||
float mapHeight;
|
||||
float z2 = z + 2.f;
|
||||
if (GridMap *gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
{
|
||||
float _mapheight = gmap->getHeight(x,y);
|
||||
|
||||
|
|
@ -808,22 +808,22 @@ inline bool IsOutdoorWMO(uint32 mogpFlags, int32 adtId, int32 rootId, int32 grou
|
|||
{
|
||||
bool outdoor = true;
|
||||
|
||||
if(wmoEntry && atEntry)
|
||||
if (wmoEntry && atEntry)
|
||||
{
|
||||
if(atEntry->flags & AREA_FLAG_OUTSIDE)
|
||||
if (atEntry->flags & AREA_FLAG_OUTSIDE)
|
||||
return true;
|
||||
if(atEntry->flags & AREA_FLAG_INSIDE)
|
||||
if (atEntry->flags & AREA_FLAG_INSIDE)
|
||||
return false;
|
||||
}
|
||||
|
||||
outdoor = mogpFlags&0x8;
|
||||
|
||||
if(wmoEntry)
|
||||
if (wmoEntry)
|
||||
{
|
||||
if(wmoEntry->Flags & 4)
|
||||
if (wmoEntry->Flags & 4)
|
||||
return true;
|
||||
|
||||
if((wmoEntry->Flags & 2)!=0)
|
||||
if ((wmoEntry->Flags & 2)!=0)
|
||||
outdoor = false;
|
||||
}
|
||||
return outdoor;
|
||||
|
|
@ -835,12 +835,12 @@ bool TerrainInfo::IsOutdoors(float x, float y, float z) const
|
|||
int32 adtId, rootId, groupId;
|
||||
|
||||
// no wmo found? -> outside by default
|
||||
if(!GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId))
|
||||
if (!GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId))
|
||||
return true;
|
||||
|
||||
AreaTableEntry const* atEntry = 0;
|
||||
WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
|
||||
if(wmoEntry)
|
||||
if (wmoEntry)
|
||||
{
|
||||
DEBUG_LOG("Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId);
|
||||
|
||||
|
|
@ -850,18 +850,18 @@ bool TerrainInfo::IsOutdoors(float x, float y, float z) const
|
|||
return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry);
|
||||
}
|
||||
|
||||
bool TerrainInfo::GetAreaInfo(float x, float y, float z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const
|
||||
bool TerrainInfo::GetAreaInfo(float x, float y, float z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
|
||||
{
|
||||
float vmap_z = z;
|
||||
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
if (vmgr->getAreaInfo(GetMapId(), x, y, vmap_z, flags, adtId, rootId, groupId))
|
||||
{
|
||||
// check if there's terrain between player height and object height
|
||||
if(GridMap *gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
{
|
||||
float _mapheight = gmap->getHeight(x,y);
|
||||
// z + 2.0f condition taken from GetHeight(), not sure if it's such a great choice...
|
||||
if(z + 2.0f > _mapheight && _mapheight > vmap_z)
|
||||
if (z + 2.0f > _mapheight && _mapheight > vmap_z)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -869,7 +869,7 @@ bool TerrainInfo::GetAreaInfo(float x, float y, float z, uint32 &flags, int32 &a
|
|||
return false;
|
||||
}
|
||||
|
||||
uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const
|
||||
uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool* isOutdoors) const
|
||||
{
|
||||
uint32 mogpFlags;
|
||||
int32 adtId, rootId, groupId;
|
||||
|
|
@ -877,11 +877,11 @@ uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool *isOutdoors) con
|
|||
AreaTableEntry const* atEntry = 0;
|
||||
bool haveAreaInfo = false;
|
||||
|
||||
if(GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId))
|
||||
if (GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId))
|
||||
{
|
||||
haveAreaInfo = true;
|
||||
wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
|
||||
if(wmoEntry)
|
||||
if (wmoEntry)
|
||||
atEntry = GetAreaEntryByAreaID(wmoEntry->areaId);
|
||||
}
|
||||
|
||||
|
|
@ -890,7 +890,7 @@ uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool *isOutdoors) con
|
|||
areaflag = atEntry->exploreFlag;
|
||||
else
|
||||
{
|
||||
if(GridMap *gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
areaflag = gmap->getArea(x, y);
|
||||
// this used while not all *.map files generated (instances)
|
||||
else
|
||||
|
|
@ -907,9 +907,9 @@ uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool *isOutdoors) con
|
|||
return areaflag;
|
||||
}
|
||||
|
||||
uint8 TerrainInfo::GetTerrainType(float x, float y ) const
|
||||
uint8 TerrainInfo::GetTerrainType(float x, float y) const
|
||||
{
|
||||
if(GridMap *gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
return gmap->getTerrainType(x, y);
|
||||
else
|
||||
return 0;
|
||||
|
|
@ -931,7 +931,7 @@ void TerrainInfo::GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, floa
|
|||
}
|
||||
|
||||
|
||||
GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data) const
|
||||
GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data) const
|
||||
{
|
||||
GridMapLiquidStatus result = LIQUID_MAP_NO_WATER;
|
||||
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
|
|
@ -957,14 +957,14 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint
|
|||
// Get position delta
|
||||
if (delta > 20) // Under water
|
||||
return LIQUID_MAP_UNDER_WATER;
|
||||
if (delta > 0 ) // In water
|
||||
if (delta > 0) // In water
|
||||
return LIQUID_MAP_IN_WATER;
|
||||
if (delta > -1) // Walk on water
|
||||
return LIQUID_MAP_WATER_WALK;
|
||||
result = LIQUID_MAP_ABOVE_WATER;
|
||||
}
|
||||
}
|
||||
if(GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
{
|
||||
GridMapLiquidData map_data;
|
||||
GridMapLiquidStatus map_result = gmap->getLiquidStatus(x, y, z, ReqLiquidType, &map_data);
|
||||
|
|
@ -979,13 +979,13 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint
|
|||
return result;
|
||||
}
|
||||
|
||||
bool TerrainInfo::IsInWater(float x, float y, float pZ, GridMapLiquidData *data) const
|
||||
bool TerrainInfo::IsInWater(float x, float y, float pZ, GridMapLiquidData* data) const
|
||||
{
|
||||
// Check surface in x, y point for liquid
|
||||
if (const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||
{
|
||||
GridMapLiquidData liquid_status;
|
||||
GridMapLiquidData *liquid_ptr = data ? data : &liquid_status;
|
||||
GridMapLiquidData* liquid_ptr = data ? data : &liquid_status;
|
||||
if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, liquid_ptr))
|
||||
{
|
||||
//if (liquid_prt->level - liquid_prt->depth_level > 2) //???
|
||||
|
|
@ -1029,45 +1029,45 @@ float TerrainInfo::GetWaterOrGroundLevel(float x, float y, float z, float* pGrou
|
|||
GridMapLiquidData liquid_status;
|
||||
|
||||
GridMapLiquidStatus res = getLiquidStatus(x, y, ground_z, MAP_ALL_LIQUIDS, &liquid_status);
|
||||
return res ? ( swim ? liquid_status.level - 2.0f : liquid_status.level) : ground_z;
|
||||
return res ? (swim ? liquid_status.level - 2.0f : liquid_status.level) : ground_z;
|
||||
}
|
||||
|
||||
return VMAP_INVALID_HEIGHT_VALUE;
|
||||
}
|
||||
|
||||
GridMap * TerrainInfo::GetGrid( const float x, const float y )
|
||||
GridMap* TerrainInfo::GetGrid(const float x, const float y)
|
||||
{
|
||||
// half opt method
|
||||
int gx=(int)(32-x/SIZE_OF_GRIDS); //grid x
|
||||
int gy=(int)(32-y/SIZE_OF_GRIDS); //grid y
|
||||
|
||||
//quick check if GridMap already loaded
|
||||
GridMap * pMap = m_GridMaps[gx][gy];
|
||||
if(!pMap)
|
||||
GridMap* pMap = m_GridMaps[gx][gy];
|
||||
if (!pMap)
|
||||
pMap = LoadMapAndVMap(gx, gy);
|
||||
|
||||
return pMap;
|
||||
}
|
||||
|
||||
GridMap * TerrainInfo::LoadMapAndVMap( const uint32 x, const uint32 y )
|
||||
GridMap* TerrainInfo::LoadMapAndVMap(const uint32 x, const uint32 y)
|
||||
{
|
||||
//double checked lock pattern
|
||||
if(!m_GridMaps[x][y])
|
||||
if (!m_GridMaps[x][y])
|
||||
{
|
||||
LOCK_GUARD lock(m_mutex);
|
||||
|
||||
if(!m_GridMaps[x][y])
|
||||
if (!m_GridMaps[x][y])
|
||||
{
|
||||
GridMap * map = new GridMap();
|
||||
GridMap* map = new GridMap();
|
||||
|
||||
// map file name
|
||||
char *tmp=NULL;
|
||||
char* tmp=NULL;
|
||||
int len = sWorld.GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1;
|
||||
tmp = new char[len];
|
||||
snprintf(tmp, len, (char *)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),m_mapId, x, y);
|
||||
snprintf(tmp, len, (char*)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),m_mapId, x, y);
|
||||
sLog.outDetail("Loading map %s",tmp);
|
||||
|
||||
if(!map->loadData(tmp))
|
||||
if (!map->loadData(tmp))
|
||||
{
|
||||
sLog.outError("Error load map file: \n %s\n", tmp);
|
||||
//ASSERT(false);
|
||||
|
|
@ -1077,11 +1077,11 @@ GridMap * TerrainInfo::LoadMapAndVMap( const uint32 x, const uint32 y )
|
|||
m_GridMaps[x][y] = map;
|
||||
|
||||
//load VMAPs for current map/grid...
|
||||
const MapEntry * i_mapEntry = sMapStore.LookupEntry(m_mapId);
|
||||
const MapEntry* i_mapEntry = sMapStore.LookupEntry(m_mapId);
|
||||
const char* mapName = i_mapEntry ? i_mapEntry->name[sWorld.GetDefaultDbcLocale()] : "UNNAMEDMAP\x0";
|
||||
|
||||
int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapManager()->loadMap((sWorld.GetDataPath()+ "vmaps").c_str(), m_mapId, x, y);
|
||||
switch(vmapLoadResult)
|
||||
switch (vmapLoadResult)
|
||||
{
|
||||
case VMAP::VMAP_LOAD_RESULT_OK:
|
||||
sLog.outDetail("VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", mapName, m_mapId, x,y,x,y);
|
||||
|
|
@ -1139,13 +1139,13 @@ TerrainManager::~TerrainManager()
|
|||
delete it->second;
|
||||
}
|
||||
|
||||
TerrainInfo * TerrainManager::LoadTerrain(const uint32 mapId)
|
||||
TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId)
|
||||
{
|
||||
Guard _guard(*this);
|
||||
|
||||
TerrainInfo * ptr = NULL;
|
||||
TerrainInfo* ptr = NULL;
|
||||
TerrainDataMap::const_iterator iter = i_TerrainMap.find(mapId);
|
||||
if(iter == i_TerrainMap.end())
|
||||
if (iter == i_TerrainMap.end())
|
||||
{
|
||||
ptr = new TerrainInfo(mapId);
|
||||
i_TerrainMap[mapId] = ptr;
|
||||
|
|
@ -1158,17 +1158,17 @@ TerrainInfo * TerrainManager::LoadTerrain(const uint32 mapId)
|
|||
|
||||
void TerrainManager::UnloadTerrain(const uint32 mapId)
|
||||
{
|
||||
if(sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD) == 0)
|
||||
if (sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD) == 0)
|
||||
return;
|
||||
|
||||
Guard _guard(*this);
|
||||
|
||||
TerrainDataMap::iterator iter = i_TerrainMap.find(mapId);
|
||||
if(iter != i_TerrainMap.end())
|
||||
if (iter != i_TerrainMap.end())
|
||||
{
|
||||
TerrainInfo * ptr = (*iter).second;
|
||||
TerrainInfo* ptr = (*iter).second;
|
||||
//lets check if this object can be actually freed
|
||||
if(ptr->IsReferenced() == false)
|
||||
if (ptr->IsReferenced() == false)
|
||||
{
|
||||
i_TerrainMap.erase(iter);
|
||||
delete ptr;
|
||||
|
|
@ -1193,7 +1193,7 @@ void TerrainManager::UnloadAll()
|
|||
|
||||
uint32 TerrainManager::GetAreaIdByAreaFlag(uint16 areaflag,uint32 map_id)
|
||||
{
|
||||
AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id);
|
||||
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id);
|
||||
|
||||
if (entry)
|
||||
return entry->ID;
|
||||
|
|
@ -1203,18 +1203,18 @@ uint32 TerrainManager::GetAreaIdByAreaFlag(uint16 areaflag,uint32 map_id)
|
|||
|
||||
uint32 TerrainManager::GetZoneIdByAreaFlag(uint16 areaflag,uint32 map_id)
|
||||
{
|
||||
AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id);
|
||||
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id);
|
||||
|
||||
if( entry )
|
||||
return ( entry->zone != 0 ) ? entry->zone : entry->ID;
|
||||
if (entry)
|
||||
return (entry->zone != 0) ? entry->zone : entry->ID;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TerrainManager::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag,uint32 map_id)
|
||||
{
|
||||
AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id);
|
||||
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag,map_id);
|
||||
|
||||
areaid = entry ? entry->ID : 0;
|
||||
zoneid = entry ? (( entry->zone != 0 ) ? entry->zone : entry->ID) : 0;
|
||||
zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,22 +123,22 @@ class GridMap
|
|||
|
||||
// Area data
|
||||
uint16 m_gridArea;
|
||||
uint16 *m_area_map;
|
||||
uint16* m_area_map;
|
||||
|
||||
// Height level data
|
||||
float m_gridHeight;
|
||||
float m_gridIntHeightMultiplier;
|
||||
union
|
||||
{
|
||||
float *m_V9;
|
||||
uint16 *m_uint16_V9;
|
||||
uint8 *m_uint8_V9;
|
||||
float* m_V9;
|
||||
uint16* m_uint16_V9;
|
||||
uint8* m_uint8_V9;
|
||||
};
|
||||
union
|
||||
{
|
||||
float *m_V8;
|
||||
uint16 *m_uint16_V8;
|
||||
uint8 *m_uint8_V8;
|
||||
float* m_V8;
|
||||
uint16* m_uint16_V8;
|
||||
uint8* m_uint8_V8;
|
||||
};
|
||||
|
||||
// Liquid data
|
||||
|
|
@ -148,15 +148,15 @@ class GridMap
|
|||
uint8 m_liquid_width;
|
||||
uint8 m_liquid_height;
|
||||
float m_liquidLevel;
|
||||
uint8 *m_liquid_type;
|
||||
float *m_liquid_map;
|
||||
uint8* m_liquid_type;
|
||||
float* m_liquid_map;
|
||||
|
||||
bool loadAreaData(FILE *in, uint32 offset, uint32 size);
|
||||
bool loadHeightData(FILE *in, uint32 offset, uint32 size);
|
||||
bool loadGridMapLiquidData(FILE *in, uint32 offset, uint32 size);
|
||||
bool loadAreaData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadHeightData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadGridMapLiquidData(FILE* in, uint32 offset, uint32 size);
|
||||
|
||||
// Get height functions and pointers
|
||||
typedef float (GridMap::*pGetHeightPtr) (float x, float y) const;
|
||||
typedef float(GridMap::*pGetHeightPtr)(float x, float y) const;
|
||||
pGetHeightPtr m_gridGetHeight;
|
||||
float getHeightFromFloat(float x, float y) const;
|
||||
float getHeightFromUint16(float x, float y) const;
|
||||
|
|
@ -168,7 +168,7 @@ class GridMap
|
|||
GridMap();
|
||||
~GridMap();
|
||||
|
||||
bool loadData(char *filaname);
|
||||
bool loadData(char* filaname);
|
||||
void unloadData();
|
||||
|
||||
static bool ExistMap(uint32 mapid, int gx, int gy);
|
||||
|
|
@ -178,20 +178,20 @@ class GridMap
|
|||
float getHeight(float x, float y) { return (this->*m_gridGetHeight)(x, y); }
|
||||
float getLiquidLevel(float x, float y);
|
||||
uint8 getTerrainType(float x, float y);
|
||||
GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data = 0);
|
||||
GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data = 0);
|
||||
};
|
||||
|
||||
template<typename Countable>
|
||||
class MANGOS_DLL_SPEC Referencable
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Referencable() { m_count = 0; }
|
||||
|
||||
void AddRef() { ++m_count; }
|
||||
bool Release() { return (--m_count < 1); }
|
||||
bool IsReferenced() const { return (m_count > 0); }
|
||||
|
||||
private:
|
||||
private:
|
||||
Referencable(const Referencable&);
|
||||
Referencable& operator=(const Referencable&);
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ typedef ACE_Atomic_Op<ACE_Thread_Mutex, long> AtomicLong;
|
|||
//class for sharing and managin GridMap objects
|
||||
class MANGOS_DLL_SPEC TerrainInfo : public Referencable<AtomicLong>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
TerrainInfo(uint32 mapid);
|
||||
~TerrainInfo();
|
||||
|
||||
|
|
@ -221,19 +221,19 @@ public:
|
|||
float GetHeight(float x, float y, float z, bool pCheckVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const;
|
||||
float GetWaterLevel(float x, float y, float z, float* pGround = NULL) const;
|
||||
float GetWaterOrGroundLevel(float x, float y, float z, float* pGround = NULL, bool swim = false) const;
|
||||
bool IsInWater(float x, float y, float z, GridMapLiquidData *data = 0) const;
|
||||
bool IsInWater(float x, float y, float z, GridMapLiquidData* data = 0) const;
|
||||
bool IsUnderWater(float x, float y, float z) const;
|
||||
|
||||
GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData *data = 0) const;
|
||||
GridMapLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, GridMapLiquidData* data = 0) const;
|
||||
|
||||
uint16 GetAreaFlag(float x, float y, float z, bool *isOutdoors=0) const;
|
||||
uint8 GetTerrainType(float x, float y ) const;
|
||||
uint16 GetAreaFlag(float x, float y, float z, bool* isOutdoors=0) const;
|
||||
uint8 GetTerrainType(float x, float y) const;
|
||||
|
||||
uint32 GetAreaId(float x, float y, float z) const;
|
||||
uint32 GetZoneId(float x, float y, float z) const;
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, float y, float z) const;
|
||||
|
||||
bool GetAreaInfo(float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const;
|
||||
bool GetAreaInfo(float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const;
|
||||
bool IsOutdoors(float x, float y, float z) const;
|
||||
|
||||
|
||||
|
|
@ -243,25 +243,25 @@ public:
|
|||
//THIS METHOD IS NOT THREAD-SAFE!!!! AND IT SHOULDN'T BE THREAD-SAFE!!!!
|
||||
void CleanUpGrids(const uint32 diff);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
friend class Map;
|
||||
//load/unload terrain data
|
||||
GridMap * Load(const uint32 x, const uint32 y);
|
||||
GridMap* Load(const uint32 x, const uint32 y);
|
||||
void Unload(const uint32 x, const uint32 y);
|
||||
|
||||
private:
|
||||
private:
|
||||
TerrainInfo(const TerrainInfo&);
|
||||
TerrainInfo& operator=(const TerrainInfo&);
|
||||
|
||||
GridMap * GetGrid( const float x, const float y );
|
||||
GridMap * LoadMapAndVMap(const uint32 x, const uint32 y );
|
||||
GridMap* GetGrid(const float x, const float y);
|
||||
GridMap* LoadMapAndVMap(const uint32 x, const uint32 y);
|
||||
|
||||
int RefGrid(const uint32& x, const uint32& y);
|
||||
int UnrefGrid(const uint32& x, const uint32& y);
|
||||
|
||||
const uint32 m_mapId;
|
||||
|
||||
GridMap *m_GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
GridMap* m_GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
int16 m_GridRef[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
|
||||
//global garbage collection timer
|
||||
|
|
@ -276,11 +276,11 @@ private:
|
|||
//class for managing TerrainData object and all sort of geometry querying operations
|
||||
class MANGOS_DLL_DECL TerrainManager : public MaNGOS::Singleton<TerrainManager, MaNGOS::ClassLevelLockable<TerrainManager, ACE_Thread_Mutex> >
|
||||
{
|
||||
typedef UNORDERED_MAP<uint32, TerrainInfo *> TerrainDataMap;
|
||||
typedef UNORDERED_MAP<uint32, TerrainInfo*> TerrainDataMap;
|
||||
friend class MaNGOS::OperatorNew<TerrainManager>;
|
||||
|
||||
public:
|
||||
TerrainInfo * LoadTerrain(const uint32 mapId);
|
||||
public:
|
||||
TerrainInfo* LoadTerrain(const uint32 mapId);
|
||||
void UnloadTerrain(const uint32 mapId);
|
||||
|
||||
void Update(const uint32 diff);
|
||||
|
|
@ -288,7 +288,7 @@ public:
|
|||
|
||||
uint16 GetAreaFlag(uint32 mapid, float x, float y, float z) const
|
||||
{
|
||||
TerrainInfo *pData = const_cast<TerrainManager*>(this)->LoadTerrain(mapid);
|
||||
TerrainInfo* pData = const_cast<TerrainManager*>(this)->LoadTerrain(mapid);
|
||||
return pData->GetAreaFlag(x, y, z);
|
||||
}
|
||||
uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
|
||||
|
|
@ -308,12 +308,12 @@ public:
|
|||
static uint32 GetZoneIdByAreaFlag(uint16 areaflag,uint32 map_id);
|
||||
static void GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag,uint32 map_id);
|
||||
|
||||
private:
|
||||
private:
|
||||
TerrainManager();
|
||||
~TerrainManager();
|
||||
|
||||
TerrainManager(const TerrainManager &);
|
||||
TerrainManager& operator=(const TerrainManager &);
|
||||
TerrainManager(const TerrainManager&);
|
||||
TerrainManager& operator=(const TerrainManager&);
|
||||
|
||||
typedef MaNGOS::ClassLevelLockable<TerrainManager, ACE_Thread_Mutex>::Lock Guard;
|
||||
TerrainDataMap i_TerrainMap;
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
|
||||
using namespace MaNGOS;
|
||||
|
||||
void VisibleChangesNotifier::Visit(CameraMapType &m)
|
||||
void VisibleChangesNotifier::Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
for (CameraMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
iter->getSource()->UpdateVisibilityOf(&i_object);
|
||||
}
|
||||
|
|
@ -42,9 +42,9 @@ void VisibleNotifier::Notify()
|
|||
Player& player = *i_camera.GetOwner();
|
||||
// at this moment i_clientGUIDs have guids that not iterate at grid level checks
|
||||
// but exist one case when this possible and object not out of range: transports
|
||||
if(Transport* transport = player.GetTransport())
|
||||
if (Transport* transport = player.GetTransport())
|
||||
{
|
||||
for(Transport::PlayerSet::const_iterator itr = transport->GetPassengers().begin();itr!=transport->GetPassengers().end();++itr)
|
||||
for (Transport::PlayerSet::const_iterator itr = transport->GetPassengers().begin(); itr!=transport->GetPassengers().end(); ++itr)
|
||||
{
|
||||
if (i_clientGUIDs.find((*itr)->GetObjectGuid()) != i_clientGUIDs.end())
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ void VisibleNotifier::Notify()
|
|||
|
||||
// generate outOfRange for not iterate objects
|
||||
i_data.AddOutOfRangeGUID(i_clientGUIDs);
|
||||
for(GuidSet::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr)
|
||||
for (GuidSet::iterator itr = i_clientGUIDs.begin(); itr!=i_clientGUIDs.end(); ++itr)
|
||||
{
|
||||
player.m_clientGUIDs.erase(*itr);
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ void VisibleNotifier::Notify()
|
|||
|
||||
// send out of range to other players if need
|
||||
GuidSet const& oor = i_data.GetOutOfRangeGUIDs();
|
||||
for(GuidSet::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
|
||||
for (GuidSet::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
|
||||
{
|
||||
if (!iter->IsPlayer())
|
||||
continue;
|
||||
|
|
@ -88,7 +88,7 @@ void VisibleNotifier::Notify()
|
|||
// Now do operations that required done at object visibility change to visible
|
||||
|
||||
// send data at target visibility change (adding to client)
|
||||
for(std::set<WorldObject*>::const_iterator vItr = i_visibleNow.begin(); vItr != i_visibleNow.end(); ++vItr)
|
||||
for (std::set<WorldObject*>::const_iterator vItr = i_visibleNow.begin(); vItr != i_visibleNow.end(); ++vItr)
|
||||
{
|
||||
// target aura duration for caster show only if target exist at caster client
|
||||
if ((*vItr) != &player && (*vItr)->isType(TYPEMASK_UNIT))
|
||||
|
|
@ -96,9 +96,9 @@ void VisibleNotifier::Notify()
|
|||
}
|
||||
}
|
||||
|
||||
void MessageDeliverer::Visit(CameraMapType &m)
|
||||
void MessageDeliverer::Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player* owner = iter->getSource()->GetOwner();
|
||||
|
||||
|
|
@ -113,9 +113,9 @@ void MessageDeliverer::Visit(CameraMapType &m)
|
|||
}
|
||||
}
|
||||
|
||||
void MessageDelivererExcept::Visit(CameraMapType &m)
|
||||
void MessageDelivererExcept::Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player* owner = iter->getSource()->GetOwner();
|
||||
|
||||
|
|
@ -127,23 +127,23 @@ void MessageDelivererExcept::Visit(CameraMapType &m)
|
|||
}
|
||||
}
|
||||
|
||||
void ObjectMessageDeliverer::Visit(CameraMapType &m)
|
||||
void ObjectMessageDeliverer::Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (CameraMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
if(!iter->getSource()->GetBody()->InSamePhase(i_phaseMask))
|
||||
if (!iter->getSource()->GetBody()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if(WorldSession* session = iter->getSource()->GetOwner()->GetSession())
|
||||
if (WorldSession* session = iter->getSource()->GetOwner()->GetSession())
|
||||
session->SendPacket(i_message);
|
||||
}
|
||||
}
|
||||
|
||||
void MessageDistDeliverer::Visit(CameraMapType &m)
|
||||
void MessageDistDeliverer::Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
for (CameraMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player * owner = iter->getSource()->GetOwner();
|
||||
Player* owner = iter->getSource()->GetOwner();
|
||||
|
||||
if ((i_toSelf || owner != &i_player) &&
|
||||
(!i_ownTeamOnly || owner->GetTeam() == i_player.GetTeam()) &&
|
||||
|
|
@ -158,9 +158,9 @@ void MessageDistDeliverer::Visit(CameraMapType &m)
|
|||
}
|
||||
}
|
||||
|
||||
void ObjectMessageDistDeliverer::Visit(CameraMapType &m)
|
||||
void ObjectMessageDistDeliverer::Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
for (CameraMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
if (!i_dist || iter->getSource()->GetBody()->IsWithinDist(&i_object,i_dist))
|
||||
{
|
||||
|
|
@ -174,9 +174,9 @@ void ObjectMessageDistDeliverer::Visit(CameraMapType &m)
|
|||
}
|
||||
|
||||
template<class T>
|
||||
void ObjectUpdater::Visit(GridRefManager<T> &m)
|
||||
void ObjectUpdater::Visit(GridRefManager<T>& m)
|
||||
{
|
||||
for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
WorldObject::UpdateHelper helper(iter->getSource());
|
||||
helper.Update(i_timeDiff);
|
||||
|
|
@ -186,21 +186,21 @@ void ObjectUpdater::Visit(GridRefManager<T> &m)
|
|||
bool CannibalizeObjectCheck::operator()(Corpse* u)
|
||||
{
|
||||
// ignore bones
|
||||
if(u->GetType()==CORPSE_BONES)
|
||||
if (u->GetType()==CORPSE_BONES)
|
||||
return false;
|
||||
|
||||
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGuid());
|
||||
|
||||
if( !owner || i_fobj->IsFriendlyTo(owner))
|
||||
if (!owner || i_fobj->IsFriendlyTo(owner))
|
||||
return false;
|
||||
|
||||
if(i_fobj->IsWithinDistInMap(u, i_range) )
|
||||
if (i_fobj->IsWithinDistInMap(u, i_range))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MaNGOS::RespawnDo::operator()( Creature* u ) const
|
||||
void MaNGOS::RespawnDo::operator()(Creature* u) const
|
||||
{
|
||||
// prevent respawn creatures for not active BG event
|
||||
Map* map = u->GetMap();
|
||||
|
|
@ -214,7 +214,7 @@ void MaNGOS::RespawnDo::operator()( Creature* u ) const
|
|||
u->Respawn();
|
||||
}
|
||||
|
||||
void MaNGOS::RespawnDo::operator()( GameObject* u ) const
|
||||
void MaNGOS::RespawnDo::operator()(GameObject* u) const
|
||||
{
|
||||
// prevent respawn gameobject for not active BG event
|
||||
Map* map = u->GetMap();
|
||||
|
|
@ -267,5 +267,5 @@ bool MaNGOS::AnyAssistCreatureInRangeCheck::operator()(Creature* u)
|
|||
return true;
|
||||
}
|
||||
|
||||
template void ObjectUpdater::Visit<GameObject>(GameObjectMapType &);
|
||||
template void ObjectUpdater::Visit<DynamicObject>(DynamicObjectMapType &);
|
||||
template void ObjectUpdater::Visit<GameObject>(GameObjectMapType&);
|
||||
template void ObjectUpdater::Visit<DynamicObject>(DynamicObjectMapType&);
|
||||
|
|
|
|||
|
|
@ -39,29 +39,29 @@ namespace MaNGOS
|
|||
GuidSet i_clientGUIDs;
|
||||
std::set<WorldObject*> i_visibleNow;
|
||||
|
||||
explicit VisibleNotifier(Camera &c) : i_camera(c), i_clientGUIDs(c.GetOwner()->m_clientGUIDs) {}
|
||||
template<class T> void Visit(GridRefManager<T> &m);
|
||||
void Visit(CameraMapType &m) {}
|
||||
explicit VisibleNotifier(Camera& c) : i_camera(c), i_clientGUIDs(c.GetOwner()->m_clientGUIDs) {}
|
||||
template<class T> void Visit(GridRefManager<T>& m);
|
||||
void Visit(CameraMapType& m) {}
|
||||
void Notify(void);
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL VisibleChangesNotifier
|
||||
{
|
||||
WorldObject &i_object;
|
||||
WorldObject& i_object;
|
||||
|
||||
explicit VisibleChangesNotifier(WorldObject &object) : i_object(object) {}
|
||||
template<class T> void Visit(GridRefManager<T> &) {}
|
||||
void Visit(CameraMapType &);
|
||||
explicit VisibleChangesNotifier(WorldObject& object) : i_object(object) {}
|
||||
template<class T> void Visit(GridRefManager<T>&) {}
|
||||
void Visit(CameraMapType&);
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL MessageDeliverer
|
||||
{
|
||||
Player &i_player;
|
||||
WorldPacket *i_message;
|
||||
Player& i_player;
|
||||
WorldPacket* i_message;
|
||||
bool i_toSelf;
|
||||
MessageDeliverer(Player &pl, WorldPacket *msg, bool to_self) : i_player(pl), i_message(msg), i_toSelf(to_self) {}
|
||||
void Visit(CameraMapType &m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
MessageDeliverer(Player& pl, WorldPacket* msg, bool to_self) : i_player(pl), i_message(msg), i_toSelf(to_self) {}
|
||||
void Visit(CameraMapType& m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
|
||||
};
|
||||
|
||||
struct MessageDelivererExcept
|
||||
|
|
@ -70,94 +70,94 @@ namespace MaNGOS
|
|||
WorldPacket* i_message;
|
||||
Player const* i_skipped_receiver;
|
||||
|
||||
MessageDelivererExcept(WorldObject const* obj, WorldPacket *msg, Player const* skipped)
|
||||
MessageDelivererExcept(WorldObject const* obj, WorldPacket* msg, Player const* skipped)
|
||||
: i_phaseMask(obj->GetPhaseMask()), i_message(msg), i_skipped_receiver(skipped) {}
|
||||
|
||||
void Visit(CameraMapType &m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
void Visit(CameraMapType& m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL ObjectMessageDeliverer
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
WorldPacket *i_message;
|
||||
explicit ObjectMessageDeliverer(WorldObject& obj, WorldPacket *msg)
|
||||
WorldPacket* i_message;
|
||||
explicit ObjectMessageDeliverer(WorldObject& obj, WorldPacket* msg)
|
||||
: i_phaseMask(obj.GetPhaseMask()), i_message(msg) {}
|
||||
void Visit(CameraMapType &m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
void Visit(CameraMapType& m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL MessageDistDeliverer
|
||||
{
|
||||
Player &i_player;
|
||||
WorldPacket *i_message;
|
||||
Player& i_player;
|
||||
WorldPacket* i_message;
|
||||
bool i_toSelf;
|
||||
bool i_ownTeamOnly;
|
||||
float i_dist;
|
||||
|
||||
MessageDistDeliverer(Player &pl, WorldPacket *msg, float dist, bool to_self, bool ownTeamOnly)
|
||||
MessageDistDeliverer(Player& pl, WorldPacket* msg, float dist, bool to_self, bool ownTeamOnly)
|
||||
: i_player(pl), i_message(msg), i_toSelf(to_self), i_ownTeamOnly(ownTeamOnly), i_dist(dist) {}
|
||||
void Visit(CameraMapType &m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
void Visit(CameraMapType& m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL ObjectMessageDistDeliverer
|
||||
{
|
||||
WorldObject &i_object;
|
||||
WorldPacket *i_message;
|
||||
WorldObject& i_object;
|
||||
WorldPacket* i_message;
|
||||
float i_dist;
|
||||
ObjectMessageDistDeliverer(WorldObject &obj, WorldPacket *msg, float dist) : i_object(obj), i_message(msg), i_dist(dist) {}
|
||||
void Visit(CameraMapType &m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
ObjectMessageDistDeliverer(WorldObject& obj, WorldPacket* msg, float dist) : i_object(obj), i_message(msg), i_dist(dist) {}
|
||||
void Visit(CameraMapType& m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL ObjectUpdater
|
||||
{
|
||||
uint32 i_timeDiff;
|
||||
explicit ObjectUpdater(const uint32 &diff) : i_timeDiff(diff) {}
|
||||
template<class T> void Visit(GridRefManager<T> &m);
|
||||
void Visit(PlayerMapType &) {}
|
||||
void Visit(CorpseMapType &) {}
|
||||
void Visit(CameraMapType &) {}
|
||||
void Visit(CreatureMapType &);
|
||||
explicit ObjectUpdater(const uint32& diff) : i_timeDiff(diff) {}
|
||||
template<class T> void Visit(GridRefManager<T>& m);
|
||||
void Visit(PlayerMapType&) {}
|
||||
void Visit(CorpseMapType&) {}
|
||||
void Visit(CameraMapType&) {}
|
||||
void Visit(CreatureMapType&);
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL PlayerRelocationNotifier
|
||||
{
|
||||
Player &i_player;
|
||||
PlayerRelocationNotifier(Player &pl) : i_player(pl) {}
|
||||
template<class T> void Visit(GridRefManager<T> &) {}
|
||||
void Visit(CreatureMapType &);
|
||||
Player& i_player;
|
||||
PlayerRelocationNotifier(Player& pl) : i_player(pl) {}
|
||||
template<class T> void Visit(GridRefManager<T>&) {}
|
||||
void Visit(CreatureMapType&);
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL CreatureRelocationNotifier
|
||||
{
|
||||
Creature &i_creature;
|
||||
CreatureRelocationNotifier(Creature &c) : i_creature(c) {}
|
||||
template<class T> void Visit(GridRefManager<T> &) {}
|
||||
#ifdef WIN32
|
||||
template<> void Visit(PlayerMapType &);
|
||||
#endif
|
||||
Creature& i_creature;
|
||||
CreatureRelocationNotifier(Creature& c) : i_creature(c) {}
|
||||
template<class T> void Visit(GridRefManager<T>&) {}
|
||||
#ifdef WIN32
|
||||
template<> void Visit(PlayerMapType&);
|
||||
#endif
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL DynamicObjectUpdater
|
||||
{
|
||||
DynamicObject &i_dynobject;
|
||||
DynamicObject& i_dynobject;
|
||||
Unit* i_check;
|
||||
bool i_positive;
|
||||
DynamicObjectUpdater(DynamicObject &dynobject, Unit* caster, bool positive) : i_dynobject(dynobject), i_positive(positive)
|
||||
DynamicObjectUpdater(DynamicObject& dynobject, Unit* caster, bool positive) : i_dynobject(dynobject), i_positive(positive)
|
||||
{
|
||||
i_check = caster;
|
||||
Unit* owner = i_check->GetOwner();
|
||||
if(owner)
|
||||
if (owner)
|
||||
i_check = owner;
|
||||
}
|
||||
|
||||
template<class T> inline void Visit(GridRefManager<T> &) {}
|
||||
#ifdef WIN32
|
||||
template<> inline void Visit<Player>(PlayerMapType &);
|
||||
template<> inline void Visit<Creature>(CreatureMapType &);
|
||||
#endif
|
||||
template<class T> inline void Visit(GridRefManager<T>&) {}
|
||||
#ifdef WIN32
|
||||
template<> inline void Visit<Player>(PlayerMapType&);
|
||||
template<> inline void Visit<Creature>(CreatureMapType&);
|
||||
#endif
|
||||
|
||||
void VisitHelper(Unit* target);
|
||||
};
|
||||
|
|
@ -200,38 +200,38 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL WorldObjectSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
WorldObject* &i_object;
|
||||
Check &i_check;
|
||||
WorldObject*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
WorldObjectSearcher(WorldObject* & result, Check& check)
|
||||
WorldObjectSearcher(WorldObject*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result),i_check(check) {}
|
||||
|
||||
void Visit(GameObjectMapType &m);
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(CorpseMapType &m);
|
||||
void Visit(DynamicObjectMapType &m);
|
||||
void Visit(GameObjectMapType& m);
|
||||
void Visit(PlayerMapType& m);
|
||||
void Visit(CreatureMapType& m);
|
||||
void Visit(CorpseMapType& m);
|
||||
void Visit(DynamicObjectMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Check>
|
||||
struct MANGOS_DLL_DECL WorldObjectListSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
std::list<WorldObject*> &i_objects;
|
||||
std::list<WorldObject*>& i_objects;
|
||||
Check& i_check;
|
||||
|
||||
WorldObjectListSearcher(std::list<WorldObject*> &objects, Check & check)
|
||||
WorldObjectListSearcher(std::list<WorldObject*>& objects, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects),i_check(check) {}
|
||||
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(CorpseMapType &m);
|
||||
void Visit(GameObjectMapType &m);
|
||||
void Visit(DynamicObjectMapType &m);
|
||||
void Visit(PlayerMapType& m);
|
||||
void Visit(CreatureMapType& m);
|
||||
void Visit(CorpseMapType& m);
|
||||
void Visit(GameObjectMapType& m);
|
||||
void Visit(DynamicObjectMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Do>
|
||||
|
|
@ -243,41 +243,41 @@ namespace MaNGOS
|
|||
WorldObjectWorker(WorldObject const* searcher, Do const& _do)
|
||||
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
|
||||
|
||||
void Visit(GameObjectMapType &m)
|
||||
void Visit(GameObjectMapType& m)
|
||||
{
|
||||
for(GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if(itr->getSource()->InSamePhase(i_phaseMask))
|
||||
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
i_do(itr->getSource());
|
||||
}
|
||||
|
||||
void Visit(PlayerMapType &m)
|
||||
void Visit(PlayerMapType& m)
|
||||
{
|
||||
for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if(itr->getSource()->InSamePhase(i_phaseMask))
|
||||
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
i_do(itr->getSource());
|
||||
}
|
||||
void Visit(CreatureMapType &m)
|
||||
void Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if(itr->getSource()->InSamePhase(i_phaseMask))
|
||||
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
i_do(itr->getSource());
|
||||
}
|
||||
|
||||
void Visit(CorpseMapType &m)
|
||||
void Visit(CorpseMapType& m)
|
||||
{
|
||||
for(CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if(itr->getSource()->InSamePhase(i_phaseMask))
|
||||
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
i_do(itr->getSource());
|
||||
}
|
||||
|
||||
void Visit(DynamicObjectMapType &m)
|
||||
void Visit(DynamicObjectMapType& m)
|
||||
{
|
||||
for(DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if(itr->getSource()->InSamePhase(i_phaseMask))
|
||||
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
i_do(itr->getSource());
|
||||
}
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// Gameobject searchers
|
||||
|
|
@ -286,15 +286,15 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL GameObjectSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
GameObject* &i_object;
|
||||
Check &i_check;
|
||||
GameObject*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
GameObjectSearcher(GameObject* & result, Check& check)
|
||||
GameObjectSearcher(GameObject*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result),i_check(check) {}
|
||||
|
||||
void Visit(GameObjectMapType &m);
|
||||
void Visit(GameObjectMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// Last accepted by Check GO if any (Check can change requirements at each call)
|
||||
|
|
@ -302,30 +302,30 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL GameObjectLastSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
GameObject* &i_object;
|
||||
GameObject*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
GameObjectLastSearcher(GameObject* & result, Check& check)
|
||||
GameObjectLastSearcher(GameObject*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
|
||||
|
||||
void Visit(GameObjectMapType &m);
|
||||
void Visit(GameObjectMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Check>
|
||||
struct MANGOS_DLL_DECL GameObjectListSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
std::list<GameObject*> &i_objects;
|
||||
std::list<GameObject*>& i_objects;
|
||||
Check& i_check;
|
||||
|
||||
GameObjectListSearcher(std::list<GameObject*> &objects, Check & check)
|
||||
GameObjectListSearcher(std::list<GameObject*>& objects, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects), i_check(check) {}
|
||||
|
||||
void Visit(GameObjectMapType &m);
|
||||
void Visit(GameObjectMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// Unit searchers
|
||||
|
|
@ -335,16 +335,16 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL UnitSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
Unit* &i_object;
|
||||
Check & i_check;
|
||||
Unit*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
UnitSearcher(Unit* & result, Check & check)
|
||||
UnitSearcher(Unit*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result),i_check(check) {}
|
||||
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(CreatureMapType& m);
|
||||
void Visit(PlayerMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// Last accepted by Check Unit if any (Check can change requirements at each call)
|
||||
|
|
@ -352,16 +352,16 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL UnitLastSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
Unit* &i_object;
|
||||
Check & i_check;
|
||||
Unit*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
UnitLastSearcher(Unit* & result, Check & check)
|
||||
UnitLastSearcher(Unit*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result),i_check(check) {}
|
||||
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(CreatureMapType& m);
|
||||
void Visit(PlayerMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// All accepted by Check units if any
|
||||
|
|
@ -369,16 +369,16 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL UnitListSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
std::list<Unit*> &i_objects;
|
||||
std::list<Unit*>& i_objects;
|
||||
Check& i_check;
|
||||
|
||||
UnitListSearcher(std::list<Unit*> &objects, Check & check)
|
||||
UnitListSearcher(std::list<Unit*>& objects, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects),i_check(check) {}
|
||||
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(PlayerMapType& m);
|
||||
void Visit(CreatureMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// Creature searchers
|
||||
|
|
@ -387,15 +387,15 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL CreatureSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
Creature* &i_object;
|
||||
Check & i_check;
|
||||
Creature*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
CreatureSearcher(Creature* & result, Check & check)
|
||||
CreatureSearcher(Creature*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result),i_check(check) {}
|
||||
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(CreatureMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// Last accepted by Check Creature if any (Check can change requirements at each call)
|
||||
|
|
@ -403,30 +403,30 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL CreatureLastSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
Creature* &i_object;
|
||||
Check & i_check;
|
||||
Creature*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
CreatureLastSearcher(Creature* & result, Check & check)
|
||||
CreatureLastSearcher(Creature*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result),i_check(check) {}
|
||||
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(CreatureMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Check>
|
||||
struct MANGOS_DLL_DECL CreatureListSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
std::list<Creature*> &i_objects;
|
||||
std::list<Creature*>& i_objects;
|
||||
Check& i_check;
|
||||
|
||||
CreatureListSearcher(std::list<Creature*> &objects, Check & check)
|
||||
CreatureListSearcher(std::list<Creature*>& objects, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects),i_check(check) {}
|
||||
|
||||
void Visit(CreatureMapType &m);
|
||||
void Visit(CreatureMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Do>
|
||||
|
|
@ -438,14 +438,14 @@ namespace MaNGOS
|
|||
CreatureWorker(WorldObject const* searcher, Do& _do)
|
||||
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
|
||||
|
||||
void Visit(CreatureMapType &m)
|
||||
void Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if(itr->getSource()->InSamePhase(i_phaseMask))
|
||||
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
i_do(itr->getSource());
|
||||
}
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// Player searchers
|
||||
|
|
@ -454,30 +454,30 @@ namespace MaNGOS
|
|||
struct MANGOS_DLL_DECL PlayerSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
Player* &i_object;
|
||||
Check & i_check;
|
||||
Player*& i_object;
|
||||
Check& i_check;
|
||||
|
||||
PlayerSearcher(Player* & result, Check & check)
|
||||
PlayerSearcher(Player*& result, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result),i_check(check) {}
|
||||
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(PlayerMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Check>
|
||||
struct MANGOS_DLL_DECL PlayerListSearcher
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
std::list<Player*> &i_objects;
|
||||
std::list<Player*>& i_objects;
|
||||
Check& i_check;
|
||||
|
||||
PlayerListSearcher(std::list<Player*> &objects, Check & check)
|
||||
PlayerListSearcher(std::list<Player*>& objects, Check& check)
|
||||
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects),i_check(check) {}
|
||||
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(PlayerMapType& m);
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Do>
|
||||
|
|
@ -489,14 +489,14 @@ namespace MaNGOS
|
|||
PlayerWorker(WorldObject const* searcher, Do& _do)
|
||||
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
|
||||
|
||||
void Visit(PlayerMapType &m)
|
||||
void Visit(PlayerMapType& m)
|
||||
{
|
||||
for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if(itr->getSource()->InSamePhase(i_phaseMask))
|
||||
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
i_do(itr->getSource());
|
||||
}
|
||||
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
template<class Do>
|
||||
|
|
@ -509,13 +509,13 @@ namespace MaNGOS
|
|||
CameraDistWorker(WorldObject const* searcher, float _dist, Do& _do)
|
||||
: i_searcher(searcher), i_dist(_dist), i_do(_do) {}
|
||||
|
||||
void Visit(CameraMapType &m)
|
||||
void Visit(CameraMapType& m)
|
||||
{
|
||||
for(CameraMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
for (CameraMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->GetBody()->InSamePhase(i_searcher) && itr->getSource()->GetBody()->IsWithinDist(i_searcher,i_dist))
|
||||
i_do(itr->getSource()->GetOwner());
|
||||
}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
|
||||
};
|
||||
|
||||
// CHECKS && DO classes
|
||||
|
|
@ -547,7 +547,7 @@ namespace MaNGOS
|
|||
{
|
||||
if (i_fobj->isHonorOrXPTarget(u) ||
|
||||
u->getDeathState() != CORPSE || u->IsDeadByDefault() || u->IsTaxiFlying() ||
|
||||
( u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)) )==0 ||
|
||||
(u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1)))==0 ||
|
||||
(u->GetDisplayId() != u->GetNativeDisplayId()))
|
||||
return false;
|
||||
|
||||
|
|
@ -594,7 +594,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_fobj; }
|
||||
bool operator()(Player* u)
|
||||
{
|
||||
if( i_fobj->IsFriendlyTo(u) || u->isAlive() || u->IsTaxiFlying() )
|
||||
if (i_fobj->IsFriendlyTo(u) || u->isAlive() || u->IsTaxiFlying())
|
||||
return false;
|
||||
|
||||
return i_fobj->IsWithinDistInMap(u, i_range);
|
||||
|
|
@ -635,10 +635,10 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_unit; }
|
||||
bool operator()(GameObject* go) const
|
||||
{
|
||||
if(go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
|
||||
if (go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
|
||||
return false;
|
||||
|
||||
if(go->GetGOInfo()->spellFocus.focusId != i_focusId)
|
||||
if (go->GetGOInfo()->spellFocus.focusId != i_focusId)
|
||||
return false;
|
||||
|
||||
float dist = (float)go->GetGOInfo()->spellFocus.dist;
|
||||
|
|
@ -658,7 +658,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return i_obj; }
|
||||
bool operator()(GameObject* go)
|
||||
{
|
||||
if(go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, (float)go->GetGOInfo()->fishinghole.radius))
|
||||
if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, (float)go->GetGOInfo()->fishinghole.radius))
|
||||
{
|
||||
i_range = i_obj.GetDistance(go);
|
||||
return true;
|
||||
|
|
@ -682,7 +682,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return i_obj; }
|
||||
bool operator()(GameObject* go)
|
||||
{
|
||||
if(go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
|
||||
if (go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
|
||||
{
|
||||
i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
|
||||
return true;
|
||||
|
|
@ -770,7 +770,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
|
||||
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
|
||||
{
|
||||
i_hp = u->GetMaxHealth() - u->GetHealth();
|
||||
return true;
|
||||
|
|
@ -790,7 +790,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
|
||||
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
|
||||
(u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_CAN_NOT_REACT)))
|
||||
{
|
||||
return true;
|
||||
|
|
@ -809,7 +809,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
|
||||
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
|
||||
!(u->HasAura(i_spell, EFFECT_INDEX_0) || u->HasAura(i_spell, EFFECT_INDEX_1) || u->HasAura(i_spell, EFFECT_INDEX_2)))
|
||||
{
|
||||
return true;
|
||||
|
|
@ -829,7 +829,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
|
||||
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
|
@ -866,7 +866,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsFriendlyTo(u))
|
||||
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsFriendlyTo(u))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
|
@ -883,7 +883,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
|
||||
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -901,8 +901,8 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
if( u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
|
||||
!i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,i_funit,false) )
|
||||
if (u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
|
||||
!i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,i_funit,false))
|
||||
{
|
||||
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
|
||||
return true;
|
||||
|
|
@ -936,7 +936,7 @@ namespace MaNGOS
|
|||
return false;
|
||||
|
||||
// ignore totems as AoE targets
|
||||
if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsTotem())
|
||||
if (u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsTotem())
|
||||
return false;
|
||||
|
||||
// check visibility only for unit-like original casters
|
||||
|
|
@ -971,10 +971,10 @@ namespace MaNGOS
|
|||
if (!u->isTargetableForAttack())
|
||||
return false;
|
||||
|
||||
if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsTotem())
|
||||
if (u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->IsTotem())
|
||||
return false;
|
||||
|
||||
if(( i_targetForPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range))
|
||||
if ((i_targetForPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u))&& i_obj->IsWithinDistInMap(u, i_range))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -1030,7 +1030,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_funit; }
|
||||
bool operator()(Creature* u)
|
||||
{
|
||||
if(u->isAlive() && u->IsHostileTo(i_funit) && i_funit->IsWithinDistInMap(u, u->GetAttackDistance(i_funit)))
|
||||
if (u->isAlive() && u->IsHostileTo(i_funit) && i_funit->IsWithinDistInMap(u, u->GetAttackDistance(i_funit)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -1063,15 +1063,15 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Creature* u)
|
||||
{
|
||||
if(u == i_obj)
|
||||
if (u == i_obj)
|
||||
return false;
|
||||
if(!u->CanAssistTo(i_obj,i_enemy))
|
||||
if (!u->CanAssistTo(i_obj,i_enemy))
|
||||
return false;
|
||||
|
||||
if(!i_obj->IsWithinDistInMap(u, i_range))
|
||||
if (!i_obj->IsWithinDistInMap(u, i_range))
|
||||
return false;
|
||||
|
||||
if(!i_obj->IsWithinLOSInMap(u))
|
||||
if (!i_obj->IsWithinLOSInMap(u))
|
||||
return false;
|
||||
|
||||
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
|
||||
|
|
@ -1120,7 +1120,7 @@ namespace MaNGOS
|
|||
public:
|
||||
AllCreaturesOfEntryInRangeCheck(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
|
||||
WorldObject const& GetFocusObject() const { return *m_pObject; }
|
||||
bool operator() (Unit* pUnit)
|
||||
bool operator()(Unit* pUnit)
|
||||
{
|
||||
if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit,m_fRange,false))
|
||||
return true;
|
||||
|
|
@ -1146,7 +1146,7 @@ namespace MaNGOS
|
|||
WorldObject const& GetFocusObject() const { return *i_obj; }
|
||||
bool operator()(Player* u)
|
||||
{
|
||||
if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
|
||||
if (u->isAlive() && i_obj->IsWithinDistInMap(u, i_range))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -1199,10 +1199,10 @@ namespace MaNGOS
|
|||
|
||||
~LocalizedPacketDo()
|
||||
{
|
||||
for(size_t i = 0; i < i_data_cache.size(); ++i)
|
||||
for (size_t i = 0; i < i_data_cache.size(); ++i)
|
||||
delete i_data_cache[i];
|
||||
}
|
||||
void operator()( Player* p );
|
||||
void operator()(Player* p);
|
||||
|
||||
private:
|
||||
Builder& i_builder;
|
||||
|
|
@ -1219,11 +1219,11 @@ namespace MaNGOS
|
|||
|
||||
~LocalizedPacketListDo()
|
||||
{
|
||||
for(size_t i = 0; i < i_data_cache.size(); ++i)
|
||||
for(size_t j = 0; j < i_data_cache[i].size(); ++j)
|
||||
for (size_t i = 0; i < i_data_cache.size(); ++i)
|
||||
for (size_t j = 0; j < i_data_cache[i].size(); ++j)
|
||||
delete i_data_cache[i][j];
|
||||
}
|
||||
void operator()( Player* p );
|
||||
void operator()(Player* p);
|
||||
|
||||
private:
|
||||
Builder& i_builder;
|
||||
|
|
@ -1231,12 +1231,12 @@ namespace MaNGOS
|
|||
// 0 = default, i => i-1 locale index
|
||||
};
|
||||
|
||||
#ifndef WIN32
|
||||
template<> void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType &);
|
||||
template<> void CreatureRelocationNotifier::Visit<Player>(PlayerMapType &);
|
||||
template<> void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType &);
|
||||
template<> inline void DynamicObjectUpdater::Visit<Creature>(CreatureMapType &);
|
||||
template<> inline void DynamicObjectUpdater::Visit<Player>(PlayerMapType &);
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
template<> void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType&);
|
||||
template<> void CreatureRelocationNotifier::Visit<Player>(PlayerMapType&);
|
||||
template<> void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType&);
|
||||
template<> inline void DynamicObjectUpdater::Visit<Creature>(CreatureMapType&);
|
||||
template<> inline void DynamicObjectUpdater::Visit<Player>(PlayerMapType&);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,18 +30,18 @@
|
|||
#include "DBCStores.h"
|
||||
|
||||
template<class T>
|
||||
inline void MaNGOS::VisibleNotifier::Visit(GridRefManager<T> &m)
|
||||
inline void MaNGOS::VisibleNotifier::Visit(GridRefManager<T>& m)
|
||||
{
|
||||
for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
i_camera.UpdateVisibilityOf(iter->getSource(), i_data, i_visibleNow);
|
||||
i_clientGUIDs.erase(iter->getSource()->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
|
||||
inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType &m)
|
||||
inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
WorldObject::UpdateHelper helper(iter->getSource());
|
||||
helper.Update(i_timeDiff);
|
||||
|
|
@ -73,12 +73,12 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
|
|||
}
|
||||
}
|
||||
|
||||
inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m)
|
||||
inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType& m)
|
||||
{
|
||||
if (!i_player.isAlive() || i_player.IsTaxiFlying())
|
||||
return;
|
||||
|
||||
for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Creature* c = iter->getSource();
|
||||
if (c->isAlive())
|
||||
|
|
@ -87,12 +87,12 @@ inline void MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m)
|
|||
}
|
||||
|
||||
template<>
|
||||
inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m)
|
||||
inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType& m)
|
||||
{
|
||||
if (!i_creature.isAlive())
|
||||
return;
|
||||
|
||||
for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player* player = iter->getSource();
|
||||
if (player->isAlive() && !player->IsTaxiFlying())
|
||||
|
|
@ -101,12 +101,12 @@ inline void MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m)
|
|||
}
|
||||
|
||||
template<>
|
||||
inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m)
|
||||
inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType& m)
|
||||
{
|
||||
if (!i_creature.isAlive())
|
||||
return;
|
||||
|
||||
for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Creature* c = iter->getSource();
|
||||
if (c != &i_creature && c->isAlive())
|
||||
|
|
@ -116,7 +116,7 @@ inline void MaNGOS::CreatureRelocationNotifier::Visit(CreatureMapType &m)
|
|||
|
||||
inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
|
||||
{
|
||||
if (!target->isAlive() || target->IsTaxiFlying() )
|
||||
if (!target->isAlive() || target->IsTaxiFlying())
|
||||
return;
|
||||
|
||||
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem())
|
||||
|
|
@ -138,21 +138,21 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
|
|||
return;
|
||||
|
||||
// for player casts use less strict negative and more stricted positive targeting
|
||||
if (i_check->GetTypeId() == TYPEID_PLAYER )
|
||||
if (i_check->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (i_check->IsFriendlyTo( target ) != i_positive)
|
||||
if (i_check->IsFriendlyTo(target) != i_positive)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i_check->IsHostileTo( target ) == i_positive)
|
||||
if (i_check->IsHostileTo(target) == i_positive)
|
||||
return;
|
||||
}
|
||||
|
||||
if (i_dynobject.IsAffecting(target))
|
||||
return;
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId());
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId());
|
||||
SpellEffectIndex eff_index = i_dynobject.GetEffIndex();
|
||||
|
||||
// Check target immune to spell or aura
|
||||
|
|
@ -161,7 +161,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
|
|||
|
||||
// Apply PersistentAreaAura on target
|
||||
// in case 2 dynobject overlap areas for same spell, same holder is selected, so dynobjects share holder
|
||||
SpellAuraHolder *holder = target->GetSpellAuraHolder(spellInfo->Id, i_dynobject.GetCasterGuid());
|
||||
SpellAuraHolder* holder = target->GetSpellAuraHolder(spellInfo->Id, i_dynobject.GetCasterGuid());
|
||||
|
||||
if (holder)
|
||||
{
|
||||
|
|
@ -192,16 +192,16 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target)
|
|||
}
|
||||
|
||||
template<>
|
||||
inline void MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType &m)
|
||||
inline void MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
VisitHelper(itr->getSource());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m)
|
||||
inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType& m)
|
||||
{
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
VisitHelper(itr->getSource());
|
||||
}
|
||||
|
||||
|
|
@ -210,13 +210,13 @@ inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType &m)
|
|||
// WorldObject searchers & workers
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(GameObjectMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -230,13 +230,13 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(PlayerMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -250,13 +250,13 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -270,13 +270,13 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(CorpseMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -290,13 +290,13 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
|
||||
void MaNGOS::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -310,45 +310,45 @@ void MaNGOS::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(PlayerMapType& m)
|
||||
{
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(CorpseMapType& m)
|
||||
{
|
||||
for(CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(GameObjectMapType& m)
|
||||
{
|
||||
for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
|
||||
void MaNGOS::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType& m)
|
||||
{
|
||||
for(DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
|
|
@ -357,13 +357,13 @@ void MaNGOS::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
|
|||
// Gameobject searchers
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::GameObjectSearcher<Check>::Visit(GameObjectMapType &m)
|
||||
void MaNGOS::GameObjectSearcher<Check>::Visit(GameObjectMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -377,9 +377,9 @@ void MaNGOS::GameObjectSearcher<Check>::Visit(GameObjectMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
|
||||
void MaNGOS::GameObjectLastSearcher<Check>::Visit(GameObjectMapType& m)
|
||||
{
|
||||
for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -390,9 +390,9 @@ void MaNGOS::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m)
|
||||
void MaNGOS::GameObjectListSearcher<Check>::Visit(GameObjectMapType& m)
|
||||
{
|
||||
for(GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
|
|
@ -401,13 +401,13 @@ void MaNGOS::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m)
|
|||
// Unit searchers
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::UnitSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::UnitSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -421,13 +421,13 @@ void MaNGOS::UnitSearcher<Check>::Visit(CreatureMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::UnitSearcher<Check>::Visit(PlayerMapType &m)
|
||||
void MaNGOS::UnitSearcher<Check>::Visit(PlayerMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -441,9 +441,9 @@ void MaNGOS::UnitSearcher<Check>::Visit(PlayerMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::UnitLastSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::UnitLastSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -454,9 +454,9 @@ void MaNGOS::UnitLastSearcher<Check>::Visit(CreatureMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::UnitLastSearcher<Check>::Visit(PlayerMapType &m)
|
||||
void MaNGOS::UnitLastSearcher<Check>::Visit(PlayerMapType& m)
|
||||
{
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -467,18 +467,18 @@ void MaNGOS::UnitLastSearcher<Check>::Visit(PlayerMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::UnitListSearcher<Check>::Visit(PlayerMapType &m)
|
||||
void MaNGOS::UnitListSearcher<Check>::Visit(PlayerMapType& m)
|
||||
{
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::UnitListSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::UnitListSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
|
|
@ -487,13 +487,13 @@ void MaNGOS::UnitListSearcher<Check>::Visit(CreatureMapType &m)
|
|||
// Creature searchers
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::CreatureSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::CreatureSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -507,9 +507,9 @@ void MaNGOS::CreatureSearcher<Check>::Visit(CreatureMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::CreatureLastSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::CreatureLastSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -520,22 +520,22 @@ void MaNGOS::CreatureLastSearcher<Check>::Visit(CreatureMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::CreatureListSearcher<Check>::Visit(CreatureMapType &m)
|
||||
void MaNGOS::CreatureListSearcher<Check>::Visit(CreatureMapType& m)
|
||||
{
|
||||
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::PlayerSearcher<Check>::Visit(PlayerMapType &m)
|
||||
void MaNGOS::PlayerSearcher<Check>::Visit(PlayerMapType& m)
|
||||
{
|
||||
// already found
|
||||
if (i_object)
|
||||
return;
|
||||
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (!itr->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
|
@ -549,16 +549,16 @@ void MaNGOS::PlayerSearcher<Check>::Visit(PlayerMapType &m)
|
|||
}
|
||||
|
||||
template<class Check>
|
||||
void MaNGOS::PlayerListSearcher<Check>::Visit(PlayerMapType &m)
|
||||
void MaNGOS::PlayerListSearcher<Check>::Visit(PlayerMapType& m)
|
||||
{
|
||||
for(PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
if (itr->getSource()->InSamePhase(i_phaseMask))
|
||||
if (i_check(itr->getSource()))
|
||||
i_objects.push_back(itr->getSource());
|
||||
}
|
||||
|
||||
template<class Builder>
|
||||
void MaNGOS::LocalizedPacketDo<Builder>::operator()( Player* p )
|
||||
void MaNGOS::LocalizedPacketDo<Builder>::operator()(Player* p)
|
||||
{
|
||||
int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
||||
uint32 cache_idx = loc_idx+1;
|
||||
|
|
@ -583,7 +583,7 @@ void MaNGOS::LocalizedPacketDo<Builder>::operator()( Player* p )
|
|||
}
|
||||
|
||||
template<class Builder>
|
||||
void MaNGOS::LocalizedPacketListDo<Builder>::operator()( Player* p )
|
||||
void MaNGOS::LocalizedPacketListDo<Builder>::operator()(Player* p)
|
||||
{
|
||||
int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
||||
uint32 cache_idx = loc_idx+1;
|
||||
|
|
@ -602,7 +602,7 @@ void MaNGOS::LocalizedPacketListDo<Builder>::operator()( Player* p )
|
|||
else
|
||||
data_list = &i_data_cache[cache_idx];
|
||||
|
||||
for(size_t i = 0; i < data_list->size(); ++i)
|
||||
for (size_t i = 0; i < data_list->size(); ++i)
|
||||
p->SendDirectMessage((*data_list)[i]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,18 +22,18 @@
|
|||
#include "Log.h"
|
||||
|
||||
void
|
||||
InvalidState::Update(Map &, NGridType &, GridInfo &, const uint32 &/*x*/, const uint32 &/*y*/, const uint32 &) const
|
||||
InvalidState::Update(Map&, NGridType&, GridInfo&, const uint32& /*x*/, const uint32& /*y*/, const uint32&) const
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, const uint32 &y, const uint32 &t_diff) const
|
||||
ActiveState::Update(Map& m, NGridType& grid, GridInfo& info, const uint32& x, const uint32& y, const uint32& t_diff) const
|
||||
{
|
||||
// Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle
|
||||
info.UpdateTimeTracker(t_diff);
|
||||
if( info.getTimeTracker().Passed() )
|
||||
if (info.getTimeTracker().Passed())
|
||||
{
|
||||
if( grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y) )
|
||||
if (grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y))
|
||||
{
|
||||
ObjectGridStoper stoper(grid);
|
||||
stoper.StopN();
|
||||
|
|
@ -47,7 +47,7 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, c
|
|||
}
|
||||
|
||||
void
|
||||
IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &) const
|
||||
IdleState::Update(Map& m, NGridType& grid, GridInfo&, const uint32& x, const uint32& y, const uint32&) const
|
||||
{
|
||||
m.ResetGridExpiry(grid);
|
||||
grid.SetGridState(GRID_STATE_REMOVAL);
|
||||
|
|
@ -55,14 +55,14 @@ IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32 &x, const ui
|
|||
}
|
||||
|
||||
void
|
||||
RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 &x, const uint32 &y, const uint32 &t_diff) const
|
||||
RemovalState::Update(Map& m, NGridType& grid, GridInfo& info, const uint32& x, const uint32& y, const uint32& t_diff) const
|
||||
{
|
||||
if(!info.getUnloadLock())
|
||||
if (!info.getUnloadLock())
|
||||
{
|
||||
info.UpdateTimeTracker(t_diff);
|
||||
if( info.getTimeTracker().Passed() )
|
||||
if (info.getTimeTracker().Passed())
|
||||
{
|
||||
if( !m.UnloadGrid(x, y, false) )
|
||||
if (!m.UnloadGrid(x, y, false))
|
||||
{
|
||||
DEBUG_LOG("Grid[%u,%u] for map %u differed unloading due to players or active objects nearby", x, y, m.GetId());
|
||||
m.ResetGridExpiry(grid);
|
||||
|
|
|
|||
|
|
@ -25,35 +25,35 @@ class MANGOS_DLL_DECL GridState
|
|||
{
|
||||
public:
|
||||
|
||||
virtual void Update(Map &, NGridType&, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const = 0;
|
||||
virtual void Update(Map&, NGridType&, GridInfo&, const uint32& x, const uint32& y, const uint32& t_diff) const = 0;
|
||||
};
|
||||
|
||||
class MANGOS_DLL_DECL InvalidState : public GridState
|
||||
{
|
||||
public:
|
||||
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
||||
void Update(Map&, NGridType&, GridInfo&, const uint32& x, const uint32& y, const uint32& t_diff) const;
|
||||
};
|
||||
|
||||
class MANGOS_DLL_DECL ActiveState : public GridState
|
||||
{
|
||||
public:
|
||||
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
||||
void Update(Map&, NGridType&, GridInfo&, const uint32& x, const uint32& y, const uint32& t_diff) const;
|
||||
};
|
||||
|
||||
class MANGOS_DLL_DECL IdleState : public GridState
|
||||
{
|
||||
public:
|
||||
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
||||
void Update(Map&, NGridType&, GridInfo&, const uint32& x, const uint32& y, const uint32& t_diff) const;
|
||||
};
|
||||
|
||||
class MANGOS_DLL_DECL RemovalState : public GridState
|
||||
{
|
||||
public:
|
||||
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &t_diff) const;
|
||||
void Update(Map&, NGridType&, GridInfo&, const uint32& x, const uint32& y, const uint32& t_diff) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -139,7 +139,7 @@ enum GroupUpdateFlags
|
|||
};
|
||||
|
||||
#define GROUP_UPDATE_FLAGS_COUNT 20
|
||||
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19
|
||||
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19
|
||||
static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT] = { 0, 2, 2, 2, 1, 2, 2, 2, 2, 4, 8, 8, 1, 2, 2, 2, 1, 2, 2, 8};
|
||||
|
||||
class Roll : public LootValidatorRef
|
||||
|
|
@ -150,8 +150,8 @@ class Roll : public LootValidatorRef
|
|||
itemCount(li.count), totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0),
|
||||
m_method(method), m_commonVoteMask(ROLL_VOTE_MASK_ALL) {}
|
||||
~Roll() { }
|
||||
void setLoot(Loot *pLoot) { link(pLoot, this); }
|
||||
Loot *getLoot() { return getTarget(); }
|
||||
void setLoot(Loot* pLoot) { link(pLoot, this); }
|
||||
Loot* getLoot() { return getTarget(); }
|
||||
void targetObjectBuildLink();
|
||||
|
||||
void CalculateCommonVoteMask(uint32 max_enchanting_skill);
|
||||
|
|
@ -177,7 +177,7 @@ class Roll : public LootValidatorRef
|
|||
|
||||
struct InstanceGroupBind
|
||||
{
|
||||
DungeonPersistentState *state;
|
||||
DungeonPersistentState* state;
|
||||
bool perm;
|
||||
/* permanent InstanceGroupBinds exist iff the leader has a permanent
|
||||
PlayerInstanceBind for the same instance. */
|
||||
|
|
@ -211,13 +211,13 @@ class MANGOS_DLL_SPEC Group
|
|||
~Group();
|
||||
|
||||
// group manipulation methods
|
||||
bool Create(ObjectGuid guid, const char * name);
|
||||
bool LoadGroupFromDB(Field *fields);
|
||||
bool Create(ObjectGuid guid, const char* name);
|
||||
bool LoadGroupFromDB(Field* fields);
|
||||
bool LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant);
|
||||
bool AddInvite(Player *player);
|
||||
uint32 RemoveInvite(Player *player);
|
||||
bool AddInvite(Player* player);
|
||||
uint32 RemoveInvite(Player* player);
|
||||
void RemoveAllInvites();
|
||||
bool AddLeaderInvite(Player *player);
|
||||
bool AddLeaderInvite(Player* player);
|
||||
bool AddMember(ObjectGuid guid, const char* name);
|
||||
uint32 RemoveMember(ObjectGuid guid, uint8 method); // method: 0=just remove, 1=kick
|
||||
void ChangeLeader(ObjectGuid guid);
|
||||
|
|
@ -235,7 +235,7 @@ class MANGOS_DLL_SPEC Group
|
|||
bool isBGGroup() const { return m_bgGroup != NULL; }
|
||||
bool IsCreated() const { return GetMembersCount() > 0; }
|
||||
ObjectGuid GetLeaderGuid() const { return m_leaderGuid; }
|
||||
const char * GetLeaderName() const { return m_leaderName.c_str(); }
|
||||
const char* GetLeaderName() const { return m_leaderName.c_str(); }
|
||||
LootMethod GetLootMethod() const { return m_lootMethod; }
|
||||
ObjectGuid GetLooterGuid() const { return m_looterGuid; }
|
||||
ItemQualities GetLootThreshold() const { return m_lootThreshold; }
|
||||
|
|
@ -245,7 +245,7 @@ class MANGOS_DLL_SPEC Group
|
|||
bool IsLeader(ObjectGuid guid) const { return GetLeaderGuid() == guid; }
|
||||
ObjectGuid GetMemberGuid(const std::string& name)
|
||||
{
|
||||
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||
if (itr->name == name)
|
||||
return itr->guid;
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ class MANGOS_DLL_SPEC Group
|
|||
MemberSlotList const& GetMemberSlots() const { return m_memberSlots; }
|
||||
GroupReference* GetFirstMember() { return m_memberMgr.getFirst(); }
|
||||
uint32 GetMembersCount() const { return m_memberSlots.size(); }
|
||||
void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level, Player* additional = NULL);
|
||||
void GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player*& member_with_max_level, Player*& not_gray_member_with_max_level, Player* additional = NULL);
|
||||
uint8 GetMemberGroup(ObjectGuid guid) const
|
||||
{
|
||||
member_citerator mslot = _getMemberCSlot(guid);
|
||||
|
|
@ -285,11 +285,11 @@ class MANGOS_DLL_SPEC Group
|
|||
// some additional raid methods
|
||||
void ConvertToRaid();
|
||||
|
||||
void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; }
|
||||
void SetBattlegroundGroup(BattleGround* bg) { m_bgGroup = bg; }
|
||||
GroupJoinBattlegroundResult CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
|
||||
|
||||
void ChangeMembersGroup(ObjectGuid guid, uint8 group);
|
||||
void ChangeMembersGroup(Player *player, uint8 group);
|
||||
void ChangeMembersGroup(Player* player, uint8 group);
|
||||
|
||||
ObjectGuid GetMainTankGuid() const { return m_mainTankGuid; }
|
||||
ObjectGuid GetMainAssistantGuid() const { return m_mainAssistantGuid; }
|
||||
|
|
@ -329,12 +329,12 @@ class MANGOS_DLL_SPEC Group
|
|||
bool InCombatToInstance(uint32 instanceId);
|
||||
void ResetInstances(InstanceResetMethod method, bool isRaid, Player* SendMsgTo);
|
||||
|
||||
void SendTargetIconList(WorldSession *session);
|
||||
void SendTargetIconList(WorldSession* session);
|
||||
void SendUpdate();
|
||||
void UpdatePlayerOutOfRange(Player* pPlayer);
|
||||
// ignore: GUID of player that will be ignored
|
||||
void BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore = ObjectGuid());
|
||||
void BroadcastReadyCheck(WorldPacket *packet);
|
||||
void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore = ObjectGuid());
|
||||
void BroadcastReadyCheck(WorldPacket* packet);
|
||||
void OfflineReadyCheck();
|
||||
|
||||
void RewardGroupAtKill(Unit* pVictim, Player* player_tap);
|
||||
|
|
@ -345,10 +345,10 @@ class MANGOS_DLL_SPEC Group
|
|||
/*** LOOT SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r);
|
||||
void SendLootRoll(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll &r);
|
||||
void SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, RollVote rollType, const Roll &r);
|
||||
void SendLootAllPassed(const Roll &r);
|
||||
void SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll& r);
|
||||
void SendLootRoll(ObjectGuid const& targetGuid, uint8 rollNumber, uint8 rollType, const Roll& r);
|
||||
void SendLootRollWon(ObjectGuid const& targetGuid, uint8 rollNumber, RollVote rollType, const Roll& r);
|
||||
void SendLootAllPassed(const Roll& r);
|
||||
void GroupLoot(WorldObject* pSource, Loot* loot);
|
||||
void NeedBeforeGreed(WorldObject* pSource, Loot* loot);
|
||||
void MasterLoot(WorldObject* pSource, Loot* loot);
|
||||
|
|
@ -356,10 +356,10 @@ class MANGOS_DLL_SPEC Group
|
|||
void StartLootRoll(WorldObject* lootTarget, LootMethod method, Loot* loot, uint8 itemSlot, uint32 maxEnchantingSkill);
|
||||
void EndRoll();
|
||||
|
||||
void LinkMember(GroupReference *pRef) { m_memberMgr.insertFirst(pRef); }
|
||||
void DelinkMember(GroupReference* /*pRef*/ ) { }
|
||||
void LinkMember(GroupReference* pRef) { m_memberMgr.insertFirst(pRef); }
|
||||
void DelinkMember(GroupReference* /*pRef*/) { }
|
||||
|
||||
InstanceGroupBind* BindToInstance(DungeonPersistentState *save, bool permanent, bool load = false);
|
||||
InstanceGroupBind* BindToInstance(DungeonPersistentState* save, bool permanent, bool load = false);
|
||||
void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false);
|
||||
InstanceGroupBind* GetBoundInstance(uint32 mapId, Player* player);
|
||||
InstanceGroupBind* GetBoundInstance(Map* aMap, Difficulty difficulty);
|
||||
|
|
@ -374,11 +374,11 @@ class MANGOS_DLL_SPEC Group
|
|||
void _removeRolls(ObjectGuid guid);
|
||||
|
||||
bool _setMembersGroup(ObjectGuid guid, uint8 group);
|
||||
bool _setAssistantFlag(ObjectGuid guid, const bool &state);
|
||||
bool _setAssistantFlag(ObjectGuid guid, const bool& state);
|
||||
bool _setMainTank(ObjectGuid guid);
|
||||
bool _setMainAssistant(ObjectGuid guid);
|
||||
|
||||
void _homebindIfInstance(Player *player);
|
||||
void _homebindIfInstance(Player* player);
|
||||
|
||||
void _initRaidSubGroupsCounter()
|
||||
{
|
||||
|
|
@ -394,7 +394,7 @@ class MANGOS_DLL_SPEC Group
|
|||
|
||||
member_citerator _getMemberCSlot(ObjectGuid guid) const
|
||||
{
|
||||
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||
if (itr->guid == guid)
|
||||
return itr;
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ class MANGOS_DLL_SPEC Group
|
|||
|
||||
member_witerator _getMemberWSlot(ObjectGuid guid)
|
||||
{
|
||||
for(member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||
for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||
if (itr->guid == guid)
|
||||
return itr;
|
||||
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string&
|
|||
data << uint32(res);
|
||||
data << uint32(0); // LFD cooldown related (used with ERR_PARTY_LFG_BOOT_COOLDOWN_S and ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S)
|
||||
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
std::string membername;
|
||||
recv_data >> membername;
|
||||
|
|
@ -60,62 +60,62 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
|||
// attempt add selected player
|
||||
|
||||
// cheating
|
||||
if(!normalizePlayerName(membername))
|
||||
if (!normalizePlayerName(membername))
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
|
||||
return;
|
||||
}
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(membername.c_str());
|
||||
Player* player = sObjectMgr.GetPlayer(membername.c_str());
|
||||
|
||||
// no player
|
||||
if(!player)
|
||||
if (!player)
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
|
||||
return;
|
||||
}
|
||||
|
||||
// can't group with
|
||||
if(!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION);
|
||||
return;
|
||||
}
|
||||
|
||||
if(GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
|
||||
if (GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_TARGET_NOT_IN_INSTANCE_S);
|
||||
return;
|
||||
}
|
||||
|
||||
// just ignore us
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S);
|
||||
return;
|
||||
}
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if( group && group->isBGGroup() )
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (group && group->isBGGroup())
|
||||
group = GetPlayer()->GetOriginalGroup();
|
||||
|
||||
if(group && group->isRaidGroup() && !player->GetAllowLowLevelRaid() && (player->getLevel() < sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_FOR_RAID)))
|
||||
if (group && group->isRaidGroup() && !player->GetAllowLowLevelRaid() && (player->getLevel() < sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_FOR_RAID)))
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, "", ERR_RAID_DISALLOWED_BY_LEVEL);
|
||||
return;
|
||||
}
|
||||
|
||||
Group *group2 = player->GetGroup();
|
||||
if( group2 && group2->isBGGroup() )
|
||||
Group* group2 = player->GetGroup();
|
||||
if (group2 && group2->isBGGroup())
|
||||
group2 = player->GetOriginalGroup();
|
||||
// player already in another group or invited
|
||||
if( group2 || player->GetGroupInvite() )
|
||||
if (group2 || player->GetGroupInvite())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S);
|
||||
return;
|
||||
}
|
||||
|
||||
if(group)
|
||||
if (group)
|
||||
{
|
||||
// not have permissions for invite
|
||||
if (!group->IsLeader(GetPlayer()->GetObjectGuid()) && !group->IsAssistant(GetPlayer()->GetObjectGuid()))
|
||||
|
|
@ -124,7 +124,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
// not have place
|
||||
if(group->IsFull())
|
||||
if (group->IsFull())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
|
||||
return;
|
||||
|
|
@ -134,16 +134,16 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
|||
// ok, but group not exist, start a new group
|
||||
// but don't create and save the group to the DB until
|
||||
// at least one person joins
|
||||
if(!group)
|
||||
if (!group)
|
||||
{
|
||||
group = new Group;
|
||||
// new group: if can't add then delete
|
||||
if(!group->AddLeaderInvite(GetPlayer()))
|
||||
if (!group->AddLeaderInvite(GetPlayer()))
|
||||
{
|
||||
delete group;
|
||||
return;
|
||||
}
|
||||
if(!group->AddInvite(player))
|
||||
if (!group->AddInvite(player))
|
||||
{
|
||||
delete group;
|
||||
return;
|
||||
|
|
@ -152,7 +152,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
|||
else
|
||||
{
|
||||
// already existing group: if can't add then just leave
|
||||
if(!group->AddInvite(player))
|
||||
if (!group->AddInvite(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -172,11 +172,11 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
|||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
recv_data.read_skip<uint32>(); // roles mask?
|
||||
|
||||
Group *group = GetPlayer()->GetGroupInvite();
|
||||
Group* group = GetPlayer()->GetGroupInvite();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
|
|||
/********************/
|
||||
|
||||
// not have place
|
||||
if(group->IsFull())
|
||||
if (group->IsFull())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL);
|
||||
return;
|
||||
|
|
@ -214,18 +214,18 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// everything is fine, do it, PLAYER'S GROUP IS SET IN ADDMEMBER!!!
|
||||
if(!group->AddMember(GetPlayer()->GetObjectGuid(), GetPlayer()->GetName()))
|
||||
if (!group->AddMember(GetPlayer()->GetObjectGuid(), GetPlayer()->GetName()))
|
||||
return;
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
Group *group = GetPlayer()->GetGroupInvite();
|
||||
Group* group = GetPlayer()->GetGroupInvite();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
// remember leader if online
|
||||
Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
|
||||
Player* leader = sObjectMgr.GetPlayer(group->GetLeaderGuid());
|
||||
|
||||
// uninvite, group can be deleted
|
||||
GetPlayer()->UninviteFromGroup();
|
||||
|
|
@ -234,12 +234,12 @@ void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
|
|||
return;
|
||||
|
||||
// report
|
||||
WorldPacket data( SMSG_GROUP_DECLINE, 10 ); // guess size
|
||||
WorldPacket data(SMSG_GROUP_DECLINE, 10); // guess size
|
||||
data << GetPlayer()->GetName();
|
||||
leader->GetSession()->SendPacket( &data );
|
||||
leader->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
|
@ -260,7 +260,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
Group* grp = GetPlayer()->GetGroup();
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
|
||||
if (grp->IsMember(guid))
|
||||
|
|
@ -278,7 +278,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
|||
SendPartyResult(PARTY_OP_LEAVE, "", ERR_TARGET_NOT_IN_GROUP_S);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
std::string membername;
|
||||
recv_data >> membername;
|
||||
|
|
@ -320,16 +320,16 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
|
|||
SendPartyResult(PARTY_OP_LEAVE, membername, ERR_TARGET_NOT_IN_GROUP_S);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(guid);
|
||||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
|
||||
/** error handling **/
|
||||
if (!player || !group->IsLeader(GetPlayer()->GetObjectGuid()) || player->GetGroup() != group)
|
||||
|
|
@ -340,12 +340,12 @@ void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
|
|||
group->ChangeLeader(guid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
if(!GetPlayer()->GetGroup())
|
||||
if (!GetPlayer()->GetGroup())
|
||||
return;
|
||||
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, "", ERR_INVITE_RESTRICTED);
|
||||
return;
|
||||
|
|
@ -360,14 +360,14 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
|
|||
GetPlayer()->RemoveFromGroup();
|
||||
}
|
||||
|
||||
void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleLootMethodOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 lootMethod;
|
||||
ObjectGuid lootMaster;
|
||||
uint32 lootThreshold;
|
||||
recv_data >> lootMethod >> lootMaster >> lootThreshold;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
|
|||
group->SendUpdate();
|
||||
}
|
||||
|
||||
void WorldSession::HandleLootRoll( WorldPacket &recv_data )
|
||||
void WorldSession::HandleLootRoll(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid lootedTarget;
|
||||
uint32 itemSlot;
|
||||
|
|
@ -402,7 +402,7 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
|
|||
return;
|
||||
|
||||
// everything is fine, do it, if false then some cheating problem found
|
||||
if(!group->CountRollVote(GetPlayer(), lootedTarget, itemSlot, RollVote(rollType)))
|
||||
if (!group->CountRollVote(GetPlayer(), lootedTarget, itemSlot, RollVote(rollType)))
|
||||
return;
|
||||
|
||||
switch (rollType)
|
||||
|
|
@ -423,7 +423,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
|
|||
recv_data >> x;
|
||||
recv_data >> y;
|
||||
|
||||
if(!GetPlayer()->GetGroup())
|
||||
if (!GetPlayer()->GetGroup())
|
||||
return;
|
||||
|
||||
//DEBUG_LOG("Received opcode MSG_MINIMAP_PING X: %f, Y: %f", x, y);
|
||||
|
|
@ -446,7 +446,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
|
|||
recv_data >> maximum;
|
||||
|
||||
/** error handling **/
|
||||
if(minimum > maximum || maximum > 10000) // < 32768 for urand call
|
||||
if (minimum > maximum || maximum > 10000) // < 32768 for urand call
|
||||
return;
|
||||
/********************/
|
||||
|
||||
|
|
@ -460,26 +460,26 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
|
|||
data << uint32(maximum);
|
||||
data << uint32(roll);
|
||||
data << GetPlayer()->GetObjectGuid();
|
||||
if(GetPlayer()->GetGroup())
|
||||
if (GetPlayer()->GetGroup())
|
||||
GetPlayer()->GetGroup()->BroadcastPacket(&data, false);
|
||||
else
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint8 x;
|
||||
recv_data >> x;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
/********************/
|
||||
|
||||
// everything is fine, do it
|
||||
if(x == 0xFF) // target icon request
|
||||
if (x == 0xFF) // target icon request
|
||||
{
|
||||
group->SendTargetIconList(this);
|
||||
}
|
||||
|
|
@ -496,13 +496,13 @@ void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
|
|
@ -515,7 +515,7 @@ void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ )
|
|||
group->ConvertToRaid();
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
std::string name;
|
||||
uint8 groupNr;
|
||||
|
|
@ -527,8 +527,8 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
// we will get correct pointer for group here, so we don't have to check if group is BG raid
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
|
|
@ -550,14 +550,14 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
uint8 flag;
|
||||
recv_data >> guid;
|
||||
recv_data >> flag;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
|
|||
group->SetAssistant(guid, (flag==0?false:true));
|
||||
}
|
||||
|
||||
void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint8 role;
|
||||
uint8 apply;
|
||||
|
|
@ -580,7 +580,7 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
|||
|
||||
DEBUG_LOG("MSG_PARTY_ASSIGNMENT");
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
|
|
@ -592,7 +592,7 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
|||
// everything is fine, do it
|
||||
if (apply)
|
||||
{
|
||||
switch(role)
|
||||
switch (role)
|
||||
{
|
||||
case 0: group->SetMainTank(guid); break;
|
||||
case 1: group->SetMainAssistant(guid); break;
|
||||
|
|
@ -608,12 +608,12 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
if(recv_data.empty()) // request
|
||||
if (recv_data.empty()) // request
|
||||
{
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
|
|
@ -634,8 +634,8 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
|
|||
uint8 state;
|
||||
recv_data >> state;
|
||||
|
||||
Group *group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
// everything is fine, do it
|
||||
|
|
@ -646,7 +646,7 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleRaidReadyCheckFinishedOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
//Group* group = GetPlayer()->GetGroup();
|
||||
//if(!group)
|
||||
|
|
@ -658,7 +658,7 @@ void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data
|
|||
// Is any reaction need?
|
||||
}
|
||||
|
||||
void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data)
|
||||
void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data)
|
||||
{
|
||||
uint32 mask = player->GetGroupUpdateFlag();
|
||||
|
||||
|
|
@ -714,9 +714,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
{
|
||||
const uint64& auramask = player->GetAuraUpdateMask();
|
||||
*data << uint64(auramask);
|
||||
for(uint32 i = 0; i < MAX_AURAS; ++i)
|
||||
for (uint32 i = 0; i < MAX_AURAS; ++i)
|
||||
{
|
||||
if(auramask & (uint64(1) << i))
|
||||
if (auramask & (uint64(1) << i))
|
||||
{
|
||||
*data << uint32(player->GetVisibleAura(i));
|
||||
*data << uint8(1);
|
||||
|
|
@ -724,13 +724,13 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
}
|
||||
}
|
||||
|
||||
Pet *pet = player->GetPet();
|
||||
Pet* pet = player->GetPet();
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
|
||||
*data << (pet ? pet->GetObjectGuid() : ObjectGuid());
|
||||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_NAME)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
*data << pet->GetName();
|
||||
else
|
||||
*data << uint8(0);
|
||||
|
|
@ -738,7 +738,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
*data << uint16(pet->GetDisplayId());
|
||||
else
|
||||
*data << uint16(0);
|
||||
|
|
@ -746,7 +746,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_CUR_HP)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
*data << uint32(pet->GetHealth());
|
||||
else
|
||||
*data << uint32(0);
|
||||
|
|
@ -754,7 +754,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_MAX_HP)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
*data << uint32(pet->GetMaxHealth());
|
||||
else
|
||||
*data << uint32(0);
|
||||
|
|
@ -762,7 +762,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
*data << uint8(pet->getPowerType());
|
||||
else
|
||||
*data << uint8(0);
|
||||
|
|
@ -770,7 +770,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_CUR_POWER)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
*data << uint16(pet->GetPower(pet->getPowerType()));
|
||||
else
|
||||
*data << uint16(0);
|
||||
|
|
@ -778,7 +778,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_MAX_POWER)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
*data << uint16(pet->GetMaxPower(pet->getPowerType()));
|
||||
else
|
||||
*data << uint16(0);
|
||||
|
|
@ -786,13 +786,13 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_AURAS)
|
||||
{
|
||||
if(pet)
|
||||
if (pet)
|
||||
{
|
||||
const uint64& auramask = pet->GetAuraUpdateMask();
|
||||
*data << uint64(auramask);
|
||||
for(uint32 i = 0; i < MAX_AURAS; ++i)
|
||||
for (uint32 i = 0; i < MAX_AURAS; ++i)
|
||||
{
|
||||
if(auramask & (uint64(1) << i))
|
||||
if (auramask & (uint64(1) << i))
|
||||
{
|
||||
*data << uint32(pet->GetVisibleAura(i));
|
||||
*data << uint8(1);
|
||||
|
|
@ -805,7 +805,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
|
|||
}
|
||||
|
||||
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
|
||||
void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
|
||||
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
|
||||
ObjectGuid guid;
|
||||
|
|
@ -823,14 +823,14 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
Pet *pet = player->GetPet();
|
||||
Pet* pet = player->GetPet();
|
||||
|
||||
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
|
||||
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
|
||||
data << player->GetPackGUID();
|
||||
|
||||
uint32 mask1 = 0x00040BFF; // common mask, real flags used 0x000040BFF
|
||||
if(pet)
|
||||
if (pet)
|
||||
mask1 = 0x7FFFFFFF; // for hunters and other classes with pets
|
||||
|
||||
Powers powerType = player->getPowerType();
|
||||
|
|
@ -873,9 +873,9 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
|
|||
uint64 auramask = 0;
|
||||
size_t maskPos = data.wpos();
|
||||
data << uint64(auramask); // placeholder
|
||||
for(uint8 i = 0; i < MAX_AURAS; ++i)
|
||||
for (uint8 i = 0; i < MAX_AURAS; ++i)
|
||||
{
|
||||
if(uint32 aura = player->GetVisibleAura(i))
|
||||
if (uint32 aura = player->GetVisibleAura(i))
|
||||
{
|
||||
auramask |= (uint64(1) << i);
|
||||
data << uint32(aura);
|
||||
|
|
@ -884,7 +884,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
|
|||
}
|
||||
data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS
|
||||
|
||||
if(pet)
|
||||
if (pet)
|
||||
{
|
||||
Powers petpowertype = pet->getPowerType();
|
||||
data << pet->GetObjectGuid(); // GROUP_UPDATE_FLAG_PET_GUID
|
||||
|
|
@ -899,9 +899,9 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
|
|||
uint64 petauramask = 0;
|
||||
size_t petMaskPos = data.wpos();
|
||||
data << uint64(petauramask); // placeholder
|
||||
for(uint8 i = 0; i < MAX_AURAS; ++i)
|
||||
for (uint8 i = 0; i < MAX_AURAS; ++i)
|
||||
{
|
||||
if(uint32 petaura = pet->GetVisibleAura(i))
|
||||
if (uint32 petaura = pet->GetVisibleAura(i))
|
||||
{
|
||||
petauramask |= (uint64(1) << i);
|
||||
data << uint32(petaura);
|
||||
|
|
@ -919,13 +919,13 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestRaidInfoOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
// every time the player checks the character screen
|
||||
_player->SendRaidInfo();
|
||||
}
|
||||
|
||||
void WorldSession::HandleOptOutOfLootOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_OPT_OUT_OF_LOOT");
|
||||
|
||||
|
|
@ -933,18 +933,18 @@ void WorldSession::HandleOptOutOfLootOpcode( WorldPacket & recv_data )
|
|||
recv_data >> unkn;
|
||||
|
||||
// ignore if player not loaded
|
||||
if(!GetPlayer()) // needed because STATUS_AUTHED
|
||||
if (!GetPlayer()) // needed because STATUS_AUTHED
|
||||
{
|
||||
if(unkn != 0)
|
||||
if (unkn != 0)
|
||||
sLog.outError("CMSG_GROUP_PASS_ON_LOOT value<>0 for not-loaded character!");
|
||||
return;
|
||||
}
|
||||
|
||||
if(unkn != 0)
|
||||
if (unkn != 0)
|
||||
sLog.outError("CMSG_GROUP_PASS_ON_LOOT: activation not implemented!");
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetAllowLowLevelRaidOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleSetAllowLowLevelRaidOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_SET_ALLOW_LOW_LEVEL_RAID: %4X", recv_data.GetOpcode());
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ class GroupReference;
|
|||
class GroupRefManager : public RefManager<Group, Player>
|
||||
{
|
||||
public:
|
||||
GroupReference* getFirst() { return ((GroupReference* ) RefManager<Group, Player>::getFirst()); }
|
||||
GroupReference* getFirst() { return ((GroupReference*) RefManager<Group, Player>::getFirst()); }
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class MANGOS_DLL_SPEC GroupReference : public Reference<Group, Player>
|
|||
public:
|
||||
GroupReference() : Reference<Group, Player>(), iSubGroup(0) {}
|
||||
~GroupReference() { unlink(); }
|
||||
GroupReference *next() { return (GroupReference*)Reference<Group, Player>::next(); }
|
||||
GroupReference* next() { return (GroupReference*)Reference<Group, Player>::next(); }
|
||||
uint8 getSubGroup() const { return iSubGroup; }
|
||||
void setSubGroup(uint8 pSubGroup) { iSubGroup = pSubGroup; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include "Player.h"
|
||||
#include "World.h"
|
||||
|
||||
int GuardAI::Permissible(const Creature *creature)
|
||||
int GuardAI::Permissible(const Creature* creature)
|
||||
{
|
||||
if (creature->IsGuard())
|
||||
return PERMIT_BASE_SPECIAL;
|
||||
|
|
@ -30,18 +30,18 @@ int GuardAI::Permissible(const Creature *creature)
|
|||
return PERMIT_BASE_NO;
|
||||
}
|
||||
|
||||
GuardAI::GuardAI(Creature *c) : CreatureAI(c), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
|
||||
GuardAI::GuardAI(Creature* c) : CreatureAI(c), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK)
|
||||
{
|
||||
}
|
||||
|
||||
void GuardAI::MoveInLineOfSight(Unit *u)
|
||||
void GuardAI::MoveInLineOfSight(Unit* u)
|
||||
{
|
||||
// Ignore Z for flying creatures
|
||||
if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
|
||||
if (!m_creature->getVictim() && u->isTargetableForAttack() &&
|
||||
( u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/ ) &&
|
||||
(u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) &&
|
||||
u->isInAccessablePlaceFor(m_creature))
|
||||
{
|
||||
float attackRadius = m_creature->GetAttackDistance(u);
|
||||
|
|
@ -115,18 +115,18 @@ void GuardAI::UpdateAI(const uint32 /*diff*/)
|
|||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
bool GuardAI::IsVisible(Unit *pl) const
|
||||
bool GuardAI::IsVisible(Unit* pl) const
|
||||
{
|
||||
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_FLOAT_SIGHT_GUARDER))
|
||||
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
|
||||
}
|
||||
|
||||
void GuardAI::AttackStart(Unit *u)
|
||||
void GuardAI::AttackStart(Unit* u)
|
||||
{
|
||||
if( !u )
|
||||
if (!u)
|
||||
return;
|
||||
|
||||
if(m_creature->Attack(u,true))
|
||||
if (m_creature->Attack(u,true))
|
||||
{
|
||||
i_victimGuid = u->GetObjectGuid();
|
||||
m_creature->AddThreat(u);
|
||||
|
|
@ -137,8 +137,8 @@ void GuardAI::AttackStart(Unit *u)
|
|||
}
|
||||
}
|
||||
|
||||
void GuardAI::JustDied(Unit *killer)
|
||||
void GuardAI::JustDied(Unit* killer)
|
||||
{
|
||||
if(Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
if (Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
m_creature->SendZoneUnderAttackMessage(pkiller);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,16 +35,16 @@ class MANGOS_DLL_DECL GuardAI : public CreatureAI
|
|||
|
||||
public:
|
||||
|
||||
explicit GuardAI(Creature *c);
|
||||
explicit GuardAI(Creature* c);
|
||||
|
||||
void MoveInLineOfSight(Unit *);
|
||||
void AttackStart(Unit *);
|
||||
void MoveInLineOfSight(Unit*);
|
||||
void AttackStart(Unit*);
|
||||
void EnterEvadeMode();
|
||||
void JustDied(Unit *);
|
||||
bool IsVisible(Unit *) const;
|
||||
void JustDied(Unit*);
|
||||
bool IsVisible(Unit*) const;
|
||||
|
||||
void UpdateAI(const uint32);
|
||||
static int Permissible(const Creature *);
|
||||
static int Permissible(const Creature*);
|
||||
|
||||
private:
|
||||
ObjectGuid i_victimGuid;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void MemberSlot::ChangeRank(uint32 newRank)
|
|||
{
|
||||
RankId = newRank;
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(guid);
|
||||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
// If player not online data in data field will be loaded from guild tabs no need to update it !!
|
||||
if (player)
|
||||
player->SetRank(newRank);
|
||||
|
|
@ -193,11 +193,11 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
|
|||
else
|
||||
{
|
||||
// 0 1 2 3 4
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT name,level,class,zone,account FROM characters WHERE guid = '%u'", lowguid);
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT name,level,class,zone,account FROM characters WHERE guid = '%u'", lowguid);
|
||||
if (!result)
|
||||
return false; // player doesn't exist
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
newmember.Name = fields[0].GetCppString();
|
||||
newmember.Level = fields[1].GetUInt8();
|
||||
newmember.Class = fields[2].GetUInt8();
|
||||
|
|
@ -260,12 +260,12 @@ void Guild::SetGINFO(std::string ginfo)
|
|||
CharacterDatabase.PExecute("UPDATE guild SET info='%s' WHERE guildid='%u'", ginfo.c_str(), m_Id);
|
||||
}
|
||||
|
||||
bool Guild::LoadGuildFromDB(QueryResult *guildDataResult)
|
||||
bool Guild::LoadGuildFromDB(QueryResult* guildDataResult)
|
||||
{
|
||||
if (!guildDataResult)
|
||||
return false;
|
||||
|
||||
Field *fields = guildDataResult->Fetch();
|
||||
Field* fields = guildDataResult->Fetch();
|
||||
|
||||
m_Id = fields[0].GetUInt32();
|
||||
m_Name = fields[1].GetCppString();
|
||||
|
|
@ -315,7 +315,7 @@ bool Guild::CheckGuildStructure()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Guild::LoadRanksFromDB(QueryResult *guildRanksResult)
|
||||
bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult)
|
||||
{
|
||||
if (!guildRanksResult)
|
||||
{
|
||||
|
|
@ -324,7 +324,7 @@ bool Guild::LoadRanksFromDB(QueryResult *guildRanksResult)
|
|||
return true;
|
||||
}
|
||||
|
||||
Field *fields;
|
||||
Field* fields;
|
||||
bool broken_ranks = false;
|
||||
|
||||
// GUILD RANKS are sequence starting from 0 = GUILD_MASTER (ALL PRIVILEGES) to max 9 (lowest privileges)
|
||||
|
|
@ -364,7 +364,8 @@ bool Guild::LoadRanksFromDB(QueryResult *guildRanksResult)
|
|||
rankRights |= GR_RIGHT_ALL;
|
||||
|
||||
AddRank(rankName, rankRights, rankMoney);
|
||||
} while( guildRanksResult->NextRow() );
|
||||
}
|
||||
while (guildRanksResult->NextRow());
|
||||
|
||||
if (m_Ranks.size() < GUILD_RANKS_MIN_COUNT) // if too few ranks, renew them
|
||||
{
|
||||
|
|
@ -379,12 +380,12 @@ bool Guild::LoadRanksFromDB(QueryResult *guildRanksResult)
|
|||
sLog.outError("Guild %u has broken `guild_rank` data, repairing...", m_Id);
|
||||
CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", m_Id);
|
||||
for(size_t i = 0; i < m_Ranks.size(); ++i)
|
||||
for (size_t i = 0; i < m_Ranks.size(); ++i)
|
||||
{
|
||||
std::string name = m_Ranks[i].Name;
|
||||
uint32 rights = m_Ranks[i].Rights;
|
||||
CharacterDatabase.escape_string(name);
|
||||
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights);
|
||||
CharacterDatabase.PExecute("INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights);
|
||||
}
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
|
|
@ -392,14 +393,14 @@ bool Guild::LoadRanksFromDB(QueryResult *guildRanksResult)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Guild::LoadMembersFromDB(QueryResult *guildMembersResult)
|
||||
bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
||||
{
|
||||
if (!guildMembersResult)
|
||||
return false;
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = guildMembersResult->Fetch();
|
||||
Field* fields = guildMembersResult->Fetch();
|
||||
// this condition will be true when all rows in QueryResult are processed and new guild without members is going to be loaded - prevent crash
|
||||
if (!fields)
|
||||
break;
|
||||
|
|
@ -464,7 +465,8 @@ bool Guild::LoadMembersFromDB(QueryResult *guildMembersResult)
|
|||
|
||||
members[lowguid] = newmember;
|
||||
|
||||
} while (guildMembersResult->NextRow());
|
||||
}
|
||||
while (guildMembersResult->NextRow());
|
||||
|
||||
if (members.empty())
|
||||
return false;
|
||||
|
|
@ -526,7 +528,7 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
|||
SetLeader(newLeaderGUID);
|
||||
|
||||
// If player not online data in data field will be loaded from guild tabs no need to update it !!
|
||||
if (Player *newLeader = sObjectMgr.GetPlayer(newLeaderGUID))
|
||||
if (Player* newLeader = sObjectMgr.GetPlayer(newLeaderGUID))
|
||||
newLeader->SetRank(GR_GUILDMASTER);
|
||||
|
||||
// when leader non-exist (at guild load with deleted leader only) not send broadcasts
|
||||
|
|
@ -539,7 +541,7 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
|||
|
||||
members.erase(lowguid);
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(guid);
|
||||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
// If player not online data in data field will be loaded from guild tabs no need to update it !!
|
||||
if (player)
|
||||
{
|
||||
|
|
@ -555,7 +557,7 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
|||
return members.empty();
|
||||
}
|
||||
|
||||
void Guild::BroadcastToGuild(WorldSession *session, const std::string& msg, uint32 language)
|
||||
void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language)
|
||||
{
|
||||
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_GCHATSPEAK))
|
||||
{
|
||||
|
|
@ -564,24 +566,24 @@ void Guild::BroadcastToGuild(WorldSession *session, const std::string& msg, uint
|
|||
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
Player *pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()) )
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()))
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, uint32 language)
|
||||
void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, uint32 language)
|
||||
{
|
||||
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(), GR_RIGHT_OFFCHATSPEAK))
|
||||
{
|
||||
for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
WorldPacket data;
|
||||
ChatHandler::FillMessageData(&data, session, CHAT_MSG_OFFICER, language, msg.c_str());
|
||||
|
||||
Player *pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()))
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
|
|
@ -589,23 +591,23 @@ void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, u
|
|||
}
|
||||
}
|
||||
|
||||
void Guild::BroadcastPacket(WorldPacket *packet)
|
||||
void Guild::BroadcastPacket(WorldPacket* packet)
|
||||
{
|
||||
for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
Player *player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
if (player)
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
void Guild::BroadcastPacketToRank(WorldPacket *packet, uint32 rankId)
|
||||
void Guild::BroadcastPacketToRank(WorldPacket* packet, uint32 rankId)
|
||||
{
|
||||
for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
if (itr->second.RankId == rankId)
|
||||
{
|
||||
Player *player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
if (player)
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
|
|
@ -631,7 +633,7 @@ void Guild::CreateRank(std::string name_,uint32 rights)
|
|||
}
|
||||
// name now can be used for encoding to DB
|
||||
CharacterDatabase.escape_string(name_);
|
||||
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, new_rank_id, name_.c_str(), rights );
|
||||
CharacterDatabase.PExecute("INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, new_rank_id, name_.c_str(), rights);
|
||||
}
|
||||
|
||||
void Guild::AddRank(const std::string& name_,uint32 rights, uint32 money)
|
||||
|
|
@ -722,7 +724,7 @@ void Guild::Disband()
|
|||
sGuildMgr.RemoveGuild(m_Id);
|
||||
}
|
||||
|
||||
void Guild::Roster(WorldSession *session /*= NULL*/)
|
||||
void Guild::Roster(WorldSession* session /*= NULL*/)
|
||||
{
|
||||
// we can only guess size
|
||||
WorldPacket data(SMSG_GUILD_ROSTER, (4+MOTD.length()+1+GINFO.length()+1+4+m_Ranks.size()*(4+4+GUILD_BANK_MAX_TABS*(4+4))+members.size()*50));
|
||||
|
|
@ -743,7 +745,7 @@ void Guild::Roster(WorldSession *session /*= NULL*/)
|
|||
}
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
if (Player *pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)))
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)))
|
||||
{
|
||||
data << pl->GetObjectGuid();
|
||||
data << uint8(1);
|
||||
|
|
@ -775,10 +777,10 @@ void Guild::Roster(WorldSession *session /*= NULL*/)
|
|||
session->SendPacket(&data);
|
||||
else
|
||||
BroadcastPacket(&data);
|
||||
DEBUG_LOG( "WORLD: Sent (SMSG_GUILD_ROSTER)" );
|
||||
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_ROSTER)");
|
||||
}
|
||||
|
||||
void Guild::Query(WorldSession *session)
|
||||
void Guild::Query(WorldSession* session)
|
||||
{
|
||||
WorldPacket data(SMSG_GUILD_QUERY_RESPONSE, (8*32+200));// we can only guess size
|
||||
|
||||
|
|
@ -800,8 +802,8 @@ void Guild::Query(WorldSession *session)
|
|||
data << uint32(m_BackgroundColor);
|
||||
data << uint32(0); // probably real ranks count
|
||||
|
||||
session->SendPacket( &data );
|
||||
DEBUG_LOG( "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)" );
|
||||
session->SendPacket(&data);
|
||||
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)");
|
||||
}
|
||||
|
||||
void Guild::SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor)
|
||||
|
|
@ -839,7 +841,7 @@ uint32 Guild::GetAccountsNumber()
|
|||
// Guild Eventlog part
|
||||
// *************************************************
|
||||
// Display guild eventlog
|
||||
void Guild::DisplayGuildEventLog(WorldSession *session)
|
||||
void Guild::DisplayGuildEventLog(WorldSession* session)
|
||||
{
|
||||
// Sending result
|
||||
WorldPacket data(MSG_GUILD_EVENT_LOG_QUERY, 0);
|
||||
|
|
@ -868,7 +870,7 @@ void Guild::DisplayGuildEventLog(WorldSession *session)
|
|||
void Guild::LoadGuildEventLogFromDB()
|
||||
{
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
||||
if (!result)
|
||||
return;
|
||||
bool isNextLogGuidSet = false;
|
||||
|
|
@ -876,7 +878,7 @@ void Guild::LoadGuildEventLogFromDB()
|
|||
// First event in list will be the oldest and the latest event is last event in list
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
if (!isNextLogGuidSet)
|
||||
{
|
||||
m_GuildEventLogNextGuid = fields[0].GetUInt32();
|
||||
|
|
@ -897,7 +899,8 @@ void Guild::LoadGuildEventLogFromDB()
|
|||
// Add entry to list
|
||||
m_GuildEventLog.push_front(NewEvent);
|
||||
|
||||
} while( result->NextRow() );
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -928,7 +931,7 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl
|
|||
// Guild Bank part
|
||||
// *************************************************
|
||||
// Bank content related
|
||||
void Guild::DisplayGuildBankContent(WorldSession *session, uint8 TabId)
|
||||
void Guild::DisplayGuildBankContent(WorldSession* session, uint8 TabId)
|
||||
{
|
||||
GuildBankTab const* tab = m_TabListMap[TabId];
|
||||
|
||||
|
|
@ -953,7 +956,7 @@ void Guild::DisplayGuildBankContent(WorldSession *session, uint8 TabId)
|
|||
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_BANK_LIST)");
|
||||
}
|
||||
|
||||
void Guild::DisplayGuildBankMoneyUpdate(WorldSession *session)
|
||||
void Guild::DisplayGuildBankMoneyUpdate(WorldSession* session)
|
||||
{
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 8+1+4+1+1);
|
||||
|
||||
|
|
@ -999,7 +1002,7 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2)
|
|||
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
Player *player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
|
|
@ -1034,7 +1037,7 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
|
|||
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
Player *player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
|
|
@ -1059,7 +1062,7 @@ Item* Guild::GetItem(uint8 TabId, uint8 SlotId)
|
|||
// *************************************************
|
||||
// Tab related
|
||||
|
||||
void Guild::DisplayGuildBankTabsInfo(WorldSession *session)
|
||||
void Guild::DisplayGuildBankTabsInfo(WorldSession* session)
|
||||
{
|
||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 500);
|
||||
|
||||
|
|
@ -1123,7 +1126,7 @@ uint32 Guild::GetBankRights(uint32 rankId, uint8 TabId) const
|
|||
void Guild::LoadGuildBankFromDB()
|
||||
{
|
||||
// 0 1 2 3
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT TabId, TabName, TabIcon, TabText FROM guild_bank_tab WHERE guildid='%u' ORDER BY TabId", m_Id);
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT TabId, TabName, TabIcon, TabText FROM guild_bank_tab WHERE guildid='%u' ORDER BY TabId", m_Id);
|
||||
if (!result)
|
||||
{
|
||||
m_TabListMap.clear();
|
||||
|
|
@ -1132,7 +1135,7 @@ void Guild::LoadGuildBankFromDB()
|
|||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
uint8 tabId = fields[0].GetUInt8();
|
||||
if (tabId >= GetPurchasedTabs())
|
||||
{
|
||||
|
|
@ -1140,14 +1143,15 @@ void Guild::LoadGuildBankFromDB()
|
|||
continue;
|
||||
}
|
||||
|
||||
GuildBankTab *NewTab = new GuildBankTab;
|
||||
GuildBankTab* NewTab = new GuildBankTab;
|
||||
|
||||
NewTab->Name = fields[1].GetCppString();
|
||||
NewTab->Icon = fields[2].GetCppString();
|
||||
NewTab->Text = fields[3].GetCppString();
|
||||
|
||||
m_TabListMap[tabId] = NewTab;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
|
|
@ -1159,7 +1163,7 @@ void Guild::LoadGuildBankFromDB()
|
|||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
uint8 TabId = fields[2].GetUInt8();
|
||||
uint8 SlotId = fields[3].GetUInt8();
|
||||
uint32 ItemGuid = fields[4].GetUInt32();
|
||||
|
|
@ -1167,25 +1171,25 @@ void Guild::LoadGuildBankFromDB()
|
|||
|
||||
if (TabId >= GetPurchasedTabs())
|
||||
{
|
||||
sLog.outError( "Guild::LoadGuildBankFromDB: Invalid tab for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry);
|
||||
sLog.outError("Guild::LoadGuildBankFromDB: Invalid tab for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SlotId >= GUILD_BANK_MAX_SLOTS)
|
||||
{
|
||||
sLog.outError( "Guild::LoadGuildBankFromDB: Invalid slot for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry);
|
||||
sLog.outError("Guild::LoadGuildBankFromDB: Invalid slot for item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemPrototype const *proto = ObjectMgr::GetItemPrototype(ItemEntry);
|
||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(ItemEntry);
|
||||
|
||||
if (!proto)
|
||||
{
|
||||
sLog.outError( "Guild::LoadGuildBankFromDB: Unknown item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry);
|
||||
sLog.outError("Guild::LoadGuildBankFromDB: Unknown item (GUID: %u id: #%u) in guild bank, skipped.", ItemGuid,ItemEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
Item *pItem = NewItemOrBag(proto);
|
||||
Item* pItem = NewItemOrBag(proto);
|
||||
if (!pItem->LoadFromDB(ItemGuid, fields))
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE guildid='%u' AND TabId='%u' AND SlotId='%u'", m_Id, uint32(TabId), uint32(SlotId));
|
||||
|
|
@ -1196,7 +1200,8 @@ void Guild::LoadGuildBankFromDB()
|
|||
|
||||
pItem->AddToWorld();
|
||||
m_TabListMap[TabId]->Slots[SlotId] = pItem;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
|
@ -1204,7 +1209,7 @@ void Guild::LoadGuildBankFromDB()
|
|||
// *************************************************
|
||||
// Money deposit/withdraw related
|
||||
|
||||
void Guild::SendMoneyInfo(WorldSession *session, uint32 LowGuid)
|
||||
void Guild::SendMoneyInfo(WorldSession* session, uint32 LowGuid)
|
||||
{
|
||||
WorldPacket data(MSG_GUILD_BANK_MONEY_WITHDRAWN, 4);
|
||||
data << uint32(GetMemberMoneyWithdrawRem(LowGuid));
|
||||
|
|
@ -1224,7 +1229,7 @@ bool Guild::MemberMoneyWithdraw(uint32 amount, uint32 LowGuid)
|
|||
if (MoneyWithDrawRight < WITHDRAW_MONEY_UNLIMITED)
|
||||
{
|
||||
MemberList::iterator itr = members.find(LowGuid);
|
||||
if (itr == members.end() )
|
||||
if (itr == members.end())
|
||||
return false;
|
||||
itr->second.BankRemMoney -= amount;
|
||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'",
|
||||
|
|
@ -1255,7 +1260,7 @@ bool Guild::MemberItemWithdraw(uint8 TabId, uint32 LowGuid)
|
|||
if (SlotsWithDrawRight < WITHDRAW_SLOT_UNLIMITED)
|
||||
{
|
||||
MemberList::iterator itr = members.find(LowGuid);
|
||||
if (itr == members.end() )
|
||||
if (itr == members.end())
|
||||
return false;
|
||||
--itr->second.BankRemSlotsTab[TabId];
|
||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'",
|
||||
|
|
@ -1267,7 +1272,7 @@ bool Guild::MemberItemWithdraw(uint8 TabId, uint32 LowGuid)
|
|||
bool Guild::IsMemberHaveRights(uint32 LowGuid, uint8 TabId, uint32 rights) const
|
||||
{
|
||||
MemberList::const_iterator itr = members.find(LowGuid);
|
||||
if (itr == members.end() )
|
||||
if (itr == members.end())
|
||||
return false;
|
||||
|
||||
if (itr->second.RankId == GR_GUILDMASTER)
|
||||
|
|
@ -1279,7 +1284,7 @@ bool Guild::IsMemberHaveRights(uint32 LowGuid, uint8 TabId, uint32 rights) const
|
|||
uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
|
||||
{
|
||||
MemberList::iterator itr = members.find(LowGuid);
|
||||
if (itr == members.end() )
|
||||
if (itr == members.end())
|
||||
return 0;
|
||||
|
||||
if (itr->second.RankId == GR_GUILDMASTER)
|
||||
|
|
@ -1302,7 +1307,7 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
|
|||
uint32 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
|
||||
{
|
||||
MemberList::iterator itr = members.find(LowGuid);
|
||||
if (itr == members.end() )
|
||||
if (itr == members.end())
|
||||
return 0;
|
||||
|
||||
if (itr->second.RankId == GR_GUILDMASTER)
|
||||
|
|
@ -1393,14 +1398,14 @@ uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
|
|||
// *************************************************
|
||||
// Rights per day related
|
||||
|
||||
bool Guild::LoadBankRightsFromDB(QueryResult *guildBankTabRightsResult)
|
||||
bool Guild::LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult)
|
||||
{
|
||||
if (!guildBankTabRightsResult)
|
||||
return true;
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = guildBankTabRightsResult->Fetch();
|
||||
Field* fields = guildBankTabRightsResult->Fetch();
|
||||
// prevent crash when all rights in result are already processed
|
||||
if (!fields)
|
||||
break;
|
||||
|
|
@ -1423,7 +1428,8 @@ bool Guild::LoadBankRightsFromDB(QueryResult *guildBankTabRightsResult)
|
|||
|
||||
SetBankRightsAndSlots(rankId, TabId, right, SlotPerDay, false);
|
||||
|
||||
} while (guildBankTabRightsResult->NextRow());
|
||||
}
|
||||
while (guildBankTabRightsResult->NextRow());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1440,14 +1446,14 @@ void Guild::LoadGuildBankEventLogFromDB()
|
|||
for (uint32 tabId = 0; tabId < uint32(GetPurchasedTabs()); ++tabId)
|
||||
{
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, tabId, GUILD_BANK_MAX_LOGS);
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, tabId, GUILD_BANK_MAX_LOGS);
|
||||
if (!result)
|
||||
continue;
|
||||
|
||||
bool isNextLogGuidSet = false;
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
GuildBankEventLogEntry NewEvent;
|
||||
NewEvent.EventType = fields[1].GetUInt8();
|
||||
|
|
@ -1476,20 +1482,21 @@ void Guild::LoadGuildBankEventLogFromDB()
|
|||
// we don't have to do m_GuildBankEventLogNextGuid_Item[tabId] %= configCount; - it will be done when creating new record
|
||||
isNextLogGuidSet = true;
|
||||
}
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// special handle for guild bank money log
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
bool isNextMoneyLogGuidSet = false;
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
if (!isNextMoneyLogGuidSet)
|
||||
{
|
||||
m_GuildBankEventLogNextGuid_Money = fields[0].GetUInt32();
|
||||
|
|
@ -1513,11 +1520,12 @@ void Guild::LoadGuildBankEventLogFromDB()
|
|||
// events are ordered from oldest (in beginning) to latest (in the end)
|
||||
m_GuildBankEventLog_Money.push_front(NewEvent);
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Guild::DisplayGuildBankLogs(WorldSession *session, uint8 TabId)
|
||||
void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
|
||||
{
|
||||
if (TabId > GUILD_BANK_MAX_TABS)
|
||||
return;
|
||||
|
|
@ -1625,7 +1633,7 @@ void Guild::LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uin
|
|||
m_Id, currentLogGuid, currentTabId, uint32(NewEvent.EventType), NewEvent.PlayerGuid, NewEvent.ItemOrMoney, uint32(NewEvent.ItemStackCount), uint32(NewEvent.DestTabId), NewEvent.TimeStamp);
|
||||
}
|
||||
|
||||
bool Guild::AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry )
|
||||
bool Guild::AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry)
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE guildid = '%u' AND TabId = '%u'AND SlotId = '%u'", GuildId, BankTab, BankTabSlot);
|
||||
CharacterDatabase.PExecute("INSERT INTO guild_bank_item (guildid,TabId,SlotId,item_guid,item_entry) "
|
||||
|
|
@ -1633,9 +1641,9 @@ bool Guild::AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot
|
|||
return true;
|
||||
}
|
||||
|
||||
void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *tab, int slot )
|
||||
void Guild::AppendDisplayGuildBankSlot(WorldPacket& data, GuildBankTab const* tab, int slot)
|
||||
{
|
||||
Item *pItem = tab->Slots[slot];
|
||||
Item* pItem = tab->Slots[slot];
|
||||
uint32 entry = pItem ? pItem->GetEntry() : 0;
|
||||
|
||||
data << uint8(slot);
|
||||
|
|
@ -1656,9 +1664,9 @@ void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *t
|
|||
size_t enchCountPos = data.wpos();
|
||||
|
||||
data << uint8(enchCount); // number of enchantments
|
||||
for(uint32 i = PERM_ENCHANTMENT_SLOT; i < MAX_ENCHANTMENT_SLOT; ++i)
|
||||
for (uint32 i = PERM_ENCHANTMENT_SLOT; i < MAX_ENCHANTMENT_SLOT; ++i)
|
||||
{
|
||||
if(uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
|
||||
if (uint32 enchId = pItem->GetEnchantmentId(EnchantmentSlot(i)))
|
||||
{
|
||||
data << uint8(i);
|
||||
data << uint32(enchId);
|
||||
|
|
@ -1669,14 +1677,14 @@ void Guild::AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *t
|
|||
}
|
||||
}
|
||||
|
||||
Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem )
|
||||
Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem)
|
||||
{
|
||||
if (!pItem)
|
||||
return NULL;
|
||||
|
||||
Item* lastItem = pItem;
|
||||
|
||||
for (GuildItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); )
|
||||
for (GuildItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end();)
|
||||
{
|
||||
uint8 slot = itr->Slot;
|
||||
uint32 count = itr->Count;
|
||||
|
|
@ -1696,12 +1704,12 @@ Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pIte
|
|||
}
|
||||
|
||||
// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
|
||||
Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool clone )
|
||||
Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool clone)
|
||||
{
|
||||
if (!pItem)
|
||||
return NULL;
|
||||
|
||||
DEBUG_LOG( "GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
||||
DEBUG_LOG("GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
||||
|
||||
Item* pItem2 = m_TabListMap[tab]->Slots[slot];
|
||||
|
||||
|
|
@ -1727,7 +1735,7 @@ Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool
|
|||
}
|
||||
else
|
||||
{
|
||||
pItem2->SetCount( pItem2->GetCount() + count );
|
||||
pItem2->SetCount(pItem2->GetCount() + count);
|
||||
pItem2->FSetState(ITEM_CHANGED);
|
||||
pItem2->SaveToDB(); // not in inventory and can be save standalone
|
||||
|
||||
|
|
@ -1742,14 +1750,14 @@ Item* Guild::_StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool
|
|||
}
|
||||
}
|
||||
|
||||
void Guild::RemoveItem(uint8 tab, uint8 slot )
|
||||
void Guild::RemoveItem(uint8 tab, uint8 slot)
|
||||
{
|
||||
m_TabListMap[tab]->Slots[slot] = NULL;
|
||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE guildid='%u' AND TabId='%u' AND SlotId='%u'",
|
||||
GetId(), uint32(tab), uint32(slot));
|
||||
}
|
||||
|
||||
InventoryResult Guild::_CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCountVec &dest, uint32& count, bool swap, Item* pSrcItem ) const
|
||||
InventoryResult Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32& count, bool swap, Item* pSrcItem) const
|
||||
{
|
||||
Item* pItem2 = m_TabListMap[tab]->Slots[slot];
|
||||
|
||||
|
|
@ -1792,7 +1800,7 @@ InventoryResult Guild::_CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, Guil
|
|||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
InventoryResult Guild::_CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec &dest, uint32& count, bool merge, Item* pSrcItem, uint8 skip_slot ) const
|
||||
InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest, uint32& count, bool merge, Item* pSrcItem, uint8 skip_slot) const
|
||||
{
|
||||
for (uint32 j = 0; j < GUILD_BANK_MAX_SLOTS; ++j)
|
||||
{
|
||||
|
|
@ -1849,9 +1857,9 @@ InventoryResult Guild::_CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec &des
|
|||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
InventoryResult Guild::CanStoreItem( uint8 tab, uint8 slot, GuildItemPosCountVec &dest, uint32 count, Item *pItem, bool swap ) const
|
||||
InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32 count, Item* pItem, bool swap) const
|
||||
{
|
||||
DEBUG_LOG( "GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
||||
DEBUG_LOG("GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
||||
|
||||
if (count > pItem->GetCount())
|
||||
return EQUIP_ERR_COULDNT_SPLIT_ITEMS;
|
||||
|
|
@ -1916,7 +1924,7 @@ void Guild::SetGuildBankTabText(uint8 TabId, std::string text)
|
|||
SendGuildBankTabText(NULL,TabId);
|
||||
}
|
||||
|
||||
void Guild::SendGuildBankTabText(WorldSession *session, uint8 TabId)
|
||||
void Guild::SendGuildBankTabText(WorldSession* session, uint8 TabId)
|
||||
{
|
||||
GuildBankTab const* tab = m_TabListMap[TabId];
|
||||
|
||||
|
|
@ -1930,13 +1938,13 @@ void Guild::SendGuildBankTabText(WorldSession *session, uint8 TabId)
|
|||
BroadcastPacket(&data);
|
||||
}
|
||||
|
||||
void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount )
|
||||
void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount)
|
||||
{
|
||||
// empty operation
|
||||
if (BankTab == BankTabDst && BankTabSlot == BankTabSlotDst)
|
||||
return;
|
||||
|
||||
Item *pItemSrc = GetItem(BankTab, BankTabSlot);
|
||||
Item* pItemSrc = GetItem(BankTab, BankTabSlot);
|
||||
if (!pItemSrc) // may prevent crash
|
||||
return;
|
||||
|
||||
|
|
@ -1945,7 +1953,7 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
else if (SplitedAmount == pItemSrc->GetCount())
|
||||
SplitedAmount = 0; // no split
|
||||
|
||||
Item *pItemDst = GetItem(BankTabDst, BankTabSlotDst);
|
||||
Item* pItemDst = GetItem(BankTabDst, BankTabSlotDst);
|
||||
|
||||
if (BankTab != BankTabDst)
|
||||
{
|
||||
|
|
@ -1960,19 +1968,20 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
}
|
||||
|
||||
if (SplitedAmount)
|
||||
{ // Bank -> Bank item split (in empty or non empty slot
|
||||
{
|
||||
// Bank -> Bank item split (in empty or non empty slot
|
||||
GuildItemPosCountVec dest;
|
||||
InventoryResult msg = CanStoreItem(BankTabDst, BankTabSlotDst, dest, SplitedAmount, pItemSrc, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemSrc, NULL );
|
||||
pl->SendEquipError(msg, pItemSrc, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
Item *pNewItem = pItemSrc->CloneItem( SplitedAmount );
|
||||
Item* pNewItem = pItemSrc->CloneItem(SplitedAmount);
|
||||
if (!pNewItem)
|
||||
{
|
||||
pl->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, pItemSrc, NULL );
|
||||
pl->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItemSrc, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1981,8 +1990,8 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
if (BankTab != BankTabDst)
|
||||
LogBankEvent(GUILD_BANK_LOG_MOVE_ITEM, BankTab, pl->GetGUIDLow(), pItemSrc->GetEntry(), SplitedAmount, BankTabDst);
|
||||
|
||||
pl->ItemRemovedQuestCheck( pItemSrc->GetEntry(), SplitedAmount );
|
||||
pItemSrc->SetCount( pItemSrc->GetCount() - SplitedAmount );
|
||||
pl->ItemRemovedQuestCheck(pItemSrc->GetEntry(), SplitedAmount);
|
||||
pItemSrc->SetCount(pItemSrc->GetCount() - SplitedAmount);
|
||||
pItemSrc->FSetState(ITEM_CHANGED);
|
||||
pItemSrc->SaveToDB(); // not in inventory and can be save standalone
|
||||
StoreItem(BankTabDst, dest, pNewItem);
|
||||
|
|
@ -2009,7 +2018,7 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
msg = CanStoreItem(BankTabDst, BankTabSlotDst, gDest, pItemSrc->GetCount(), pItemSrc, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemSrc, NULL );
|
||||
pl->SendEquipError(msg, pItemSrc, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2017,7 +2026,7 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
msg = CanStoreItem(BankTab, BankTabSlot, gSrc, pItemDst->GetCount(), pItemDst, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemDst, NULL );
|
||||
pl->SendEquipError(msg, pItemDst, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2054,10 +2063,10 @@ void Guild::SwapItems(Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankT
|
|||
}
|
||||
|
||||
|
||||
void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount)
|
||||
void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount)
|
||||
{
|
||||
Item *pItemBank = GetItem(BankTab, BankTabSlot);
|
||||
Item *pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
||||
Item* pItemBank = GetItem(BankTab, BankTabSlot);
|
||||
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
||||
|
||||
if (!pItemBank) // Problem to get bank item
|
||||
return;
|
||||
|
|
@ -2068,11 +2077,12 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
SplitedAmount = 0; // no split
|
||||
|
||||
if (SplitedAmount)
|
||||
{ // Bank -> Char split to slot (patly move)
|
||||
Item *pNewItem = pItemBank->CloneItem( SplitedAmount );
|
||||
{
|
||||
// Bank -> Char split to slot (patly move)
|
||||
Item* pNewItem = pItemBank->CloneItem(SplitedAmount);
|
||||
if (!pNewItem)
|
||||
{
|
||||
pl->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, pItemBank, NULL );
|
||||
pl->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItemBank, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2080,7 +2090,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
InventoryResult msg = pl->CanStoreItem(PlayerBag, PlayerSlot, dest, pNewItem, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pNewItem, NULL );
|
||||
pl->SendEquipError(msg, pNewItem, NULL);
|
||||
delete pNewItem;
|
||||
return;
|
||||
}
|
||||
|
|
@ -2136,7 +2146,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
{
|
||||
if (!pItemChar->CanBeTraded())
|
||||
{
|
||||
pl->SendEquipError( EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pItemChar, NULL );
|
||||
pl->SendEquipError(EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pItemChar, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2145,7 +2155,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
msg = pl->CanStoreItem(PlayerBag, PlayerSlot, iDest, pItemBank, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemBank, NULL );
|
||||
pl->SendEquipError(msg, pItemBank, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2155,7 +2165,7 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
msg = CanStoreItem(BankTab,BankTabSlot,gDest,pItemChar->GetCount(),pItemChar,true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemChar, NULL );
|
||||
pl->SendEquipError(msg, pItemChar, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2202,17 +2212,17 @@ void Guild::MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, u
|
|||
}
|
||||
|
||||
|
||||
void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount )
|
||||
void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount)
|
||||
{
|
||||
Item *pItemBank = GetItem(BankTab, BankTabSlot);
|
||||
Item *pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
||||
Item* pItemBank = GetItem(BankTab, BankTabSlot);
|
||||
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
||||
|
||||
if (!pItemChar) // Problem to get item from player
|
||||
return;
|
||||
|
||||
if (!pItemChar->CanBeTraded())
|
||||
{
|
||||
pl->SendEquipError( EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pItemChar, NULL );
|
||||
pl->SendEquipError(EQUIP_ERR_ITEMS_CANT_BE_SWAPPED, pItemChar, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2226,19 +2236,20 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
SplitedAmount = 0; // no split
|
||||
|
||||
if (SplitedAmount)
|
||||
{ // Char -> Bank split to empty or non-empty slot (partly move)
|
||||
{
|
||||
// Char -> Bank split to empty or non-empty slot (partly move)
|
||||
GuildItemPosCountVec dest;
|
||||
InventoryResult msg = CanStoreItem(BankTab, BankTabSlot, dest, SplitedAmount, pItemChar, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemChar, NULL );
|
||||
pl->SendEquipError(msg, pItemChar, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
Item *pNewItem = pItemChar->CloneItem( SplitedAmount );
|
||||
Item* pNewItem = pItemChar->CloneItem(SplitedAmount);
|
||||
if (!pNewItem)
|
||||
{
|
||||
pl->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, pItemChar, NULL );
|
||||
pl->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItemChar, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2253,7 +2264,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
CharacterDatabase.BeginTransaction();
|
||||
LogBankEvent(GUILD_BANK_LOG_DEPOSIT_ITEM, BankTab, pl->GetGUIDLow(), pItemChar->GetEntry(), SplitedAmount);
|
||||
|
||||
pl->ItemRemovedQuestCheck( pItemChar->GetEntry(), SplitedAmount );
|
||||
pl->ItemRemovedQuestCheck(pItemChar->GetEntry(), SplitedAmount);
|
||||
pItemChar->SetCount(pItemChar->GetCount()-SplitedAmount);
|
||||
pItemChar->SetState(ITEM_CHANGED);
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
|
|
@ -2297,7 +2308,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
msg = pl->CanStoreItem(PlayerBag, PlayerSlot, iDest, pItemBank, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemBank, NULL );
|
||||
pl->SendEquipError(msg, pItemBank, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2306,7 +2317,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot,
|
|||
msg = CanStoreItem(BankTab, BankTabSlot, gDest, pItemChar->GetCount(), pItemChar, true);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
pl->SendEquipError( msg, pItemChar, NULL );
|
||||
pl->SendEquipError(msg, pItemChar, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2380,7 +2391,7 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
|
|||
DEBUG_LOG("WORLD: Sent SMSG_GUILD_EVENT");
|
||||
}
|
||||
|
||||
void Guild::DeleteGuildBankItems( bool alsoInDB /*= false*/ )
|
||||
void Guild::DeleteGuildBankItems(bool alsoInDB /*= false*/)
|
||||
{
|
||||
for (size_t i = 0; i < m_TabListMap.size(); ++i)
|
||||
{
|
||||
|
|
@ -2401,9 +2412,9 @@ void Guild::DeleteGuildBankItems( bool alsoInDB /*= false*/ )
|
|||
m_TabListMap.clear();
|
||||
}
|
||||
|
||||
bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const &vec) const
|
||||
bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const& vec) const
|
||||
{
|
||||
for(GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
|
||||
for (GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
|
||||
if (itr->Slot == this->Slot)
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ enum GuildEmblem
|
|||
|
||||
inline uint32 GetGuildBankTabPrice(uint8 Index)
|
||||
{
|
||||
switch(Index)
|
||||
switch (Index)
|
||||
{
|
||||
case 0: return 100;
|
||||
case 1: return 250;
|
||||
|
|
@ -279,7 +279,7 @@ struct RankInfo
|
|||
{
|
||||
RankInfo(const std::string& _name, uint32 _rights, uint32 _money) : Name(_name), Rights(_rights), BankMoneyPerDay(_money)
|
||||
{
|
||||
for(uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
{
|
||||
TabRight[i] = 0;
|
||||
TabSlotPerDay[i] = 0;
|
||||
|
|
@ -307,7 +307,7 @@ class Guild
|
|||
typedef UNORDERED_MAP<uint32, MemberSlot> MemberList;
|
||||
typedef std::vector<RankInfo> RankList;
|
||||
|
||||
uint32 GetId(){ return m_Id; }
|
||||
uint32 GetId() { return m_Id; }
|
||||
ObjectGuid GetLeaderGuid() const { return m_LeaderGuid; }
|
||||
std::string const& GetName() const { return m_Name; }
|
||||
std::string const& GetMOTD() const { return MOTD; }
|
||||
|
|
@ -334,15 +334,15 @@ class Guild
|
|||
uint32 GetMemberSize() const { return members.size(); }
|
||||
uint32 GetAccountsNumber();
|
||||
|
||||
bool LoadGuildFromDB(QueryResult *guildDataResult);
|
||||
bool LoadGuildFromDB(QueryResult* guildDataResult);
|
||||
bool CheckGuildStructure();
|
||||
bool LoadRanksFromDB(QueryResult *guildRanksResult);
|
||||
bool LoadMembersFromDB(QueryResult *guildMembersResult);
|
||||
bool LoadRanksFromDB(QueryResult* guildRanksResult);
|
||||
bool LoadMembersFromDB(QueryResult* guildMembersResult);
|
||||
|
||||
void BroadcastToGuild(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||
void BroadcastToOfficers(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||
void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId);
|
||||
void BroadcastPacket(WorldPacket *packet);
|
||||
void BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||
void BroadcastToOfficers(WorldSession* session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||
void BroadcastPacketToRank(WorldPacket* packet, uint32 rankId);
|
||||
void BroadcastPacket(WorldPacket* packet);
|
||||
|
||||
void BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1 = NULL, char const* str2 = NULL, char const* str3 = NULL);
|
||||
void BroadcastEvent(GuildEvents event, char const* str1 = NULL, char const* str2 = NULL, char const* str3 = NULL)
|
||||
|
|
@ -353,9 +353,9 @@ class Guild
|
|||
template<class Do>
|
||||
void BroadcastWorker(Do& _do, Player* except = NULL)
|
||||
{
|
||||
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
if(Player *player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)))
|
||||
if(player != except)
|
||||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)))
|
||||
if (player != except)
|
||||
_do(player);
|
||||
}
|
||||
|
||||
|
|
@ -386,35 +386,35 @@ class Guild
|
|||
|
||||
MemberSlot* GetMemberSlot(const std::string& name)
|
||||
{
|
||||
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
if(itr->second.Name == name)
|
||||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
if (itr->second.Name == name)
|
||||
return &itr->second;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Roster(WorldSession *session = NULL); // NULL = broadcast
|
||||
void Query(WorldSession *session);
|
||||
void Roster(WorldSession* session = NULL); // NULL = broadcast
|
||||
void Query(WorldSession* session);
|
||||
|
||||
// Guild EventLog
|
||||
void LoadGuildEventLogFromDB();
|
||||
void DisplayGuildEventLog(WorldSession *session);
|
||||
void DisplayGuildEventLog(WorldSession* session);
|
||||
void LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid playerGuid2 = ObjectGuid(), uint8 newRank = 0);
|
||||
|
||||
// ** Guild bank **
|
||||
// Content & item deposit/withdraw
|
||||
void DisplayGuildBankContent(WorldSession *session, uint8 TabId);
|
||||
void DisplayGuildBankMoneyUpdate(WorldSession *session);
|
||||
void DisplayGuildBankContent(WorldSession* session, uint8 TabId);
|
||||
void DisplayGuildBankMoneyUpdate(WorldSession* session);
|
||||
|
||||
void SwapItems( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount);
|
||||
void MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount);
|
||||
void MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount);
|
||||
void SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount);
|
||||
void MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount);
|
||||
void MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount);
|
||||
|
||||
// Tabs
|
||||
void DisplayGuildBankTabsInfo(WorldSession *session);
|
||||
void DisplayGuildBankTabsInfo(WorldSession* session);
|
||||
void CreateNewBankTab();
|
||||
void SetGuildBankTabText(uint8 TabId, std::string text);
|
||||
void SendGuildBankTabText(WorldSession *session, uint8 TabId);
|
||||
void SendGuildBankTabText(WorldSession* session, uint8 TabId);
|
||||
void SetGuildBankTabInfo(uint8 TabId, std::string name, std::string icon);
|
||||
uint8 GetPurchasedTabs() const { return m_TabListMap.size(); }
|
||||
uint32 GetBankRights(uint32 rankId, uint8 TabId) const;
|
||||
|
|
@ -423,7 +423,7 @@ class Guild
|
|||
// Load
|
||||
void LoadGuildBankFromDB();
|
||||
// Money deposit/withdraw
|
||||
void SendMoneyInfo(WorldSession *session, uint32 LowGuid);
|
||||
void SendMoneyInfo(WorldSession* session, uint32 LowGuid);
|
||||
bool MemberMoneyWithdraw(uint32 amount, uint32 LowGuid);
|
||||
uint64 GetGuildBankMoney() { return m_GuildBankMoney; }
|
||||
void SetBankMoney(int64 money);
|
||||
|
|
@ -436,12 +436,12 @@ class Guild
|
|||
uint32 GetBankMoneyPerDay(uint32 rankId);
|
||||
uint32 GetBankSlotPerDay(uint32 rankId, uint8 TabId);
|
||||
// rights per day
|
||||
bool LoadBankRightsFromDB(QueryResult *guildBankTabRightsResult);
|
||||
bool LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult);
|
||||
// Guild Bank Event Logs
|
||||
void LoadGuildBankEventLogFromDB();
|
||||
void DisplayGuildBankLogs(WorldSession *session, uint8 TabId);
|
||||
void DisplayGuildBankLogs(WorldSession* session, uint8 TabId);
|
||||
void LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uint32 ItemOrMoney, uint8 ItemStackCount=0, uint8 DestTabId=0);
|
||||
bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry );
|
||||
bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry);
|
||||
|
||||
protected:
|
||||
void AddRank(const std::string& name,uint32 rights,uint32 money);
|
||||
|
|
@ -486,16 +486,16 @@ class Guild
|
|||
|
||||
// used only from high level Swap/Move functions
|
||||
Item* GetItem(uint8 TabId, uint8 SlotId);
|
||||
InventoryResult CanStoreItem( uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32 count, Item *pItem, bool swap = false) const;
|
||||
Item* StoreItem( uint8 tab, GuildItemPosCountVec const& pos, Item *pItem );
|
||||
void RemoveItem(uint8 tab, uint8 slot );
|
||||
InventoryResult CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32 count, Item* pItem, bool swap = false) const;
|
||||
Item* StoreItem(uint8 tab, GuildItemPosCountVec const& pos, Item* pItem);
|
||||
void RemoveItem(uint8 tab, uint8 slot);
|
||||
void DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2 = -1);
|
||||
void DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec const& slots);
|
||||
|
||||
// internal common parts for CanStore/StoreItem functions
|
||||
void AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *tab, int32 slot );
|
||||
InventoryResult _CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32& count, bool swap, Item *pSrcItem ) const;
|
||||
InventoryResult _CanStoreItem_InTab( uint8 tab, GuildItemPosCountVec& dest, uint32& count, bool merge, Item *pSrcItem, uint8 skip_slot ) const;
|
||||
Item* _StoreItem( uint8 tab, uint8 slot, Item *pItem, uint32 count, bool clone );
|
||||
void AppendDisplayGuildBankSlot(WorldPacket& data, GuildBankTab const* tab, int32 slot);
|
||||
InventoryResult _CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32& count, bool swap, Item* pSrcItem) const;
|
||||
InventoryResult _CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest, uint32& count, bool merge, Item* pSrcItem, uint8 skip_slot) const;
|
||||
Item* _StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool clone);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
|
|||
std::string gname;
|
||||
recvPacket >> gname;
|
||||
|
||||
if(GetPlayer()->GetGuildId()) // already in guild
|
||||
if (GetPlayer()->GetGuildId()) // already in guild
|
||||
return;
|
||||
|
||||
Guild *guild = new Guild;
|
||||
if(!guild->Create(GetPlayer(), gname))
|
||||
Guild* guild = new Guild;
|
||||
if (!guild->Create(GetPlayer(), gname))
|
||||
{
|
||||
delete guild;
|
||||
return;
|
||||
|
|
@ -69,28 +69,28 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
|
|||
DEBUG_LOG("WORLD: Received CMSG_GUILD_INVITE");
|
||||
|
||||
std::string Invitedname, plname;
|
||||
Player * player = NULL;
|
||||
Player* player = NULL;
|
||||
|
||||
recvPacket >> Invitedname;
|
||||
|
||||
if(normalizePlayerName(Invitedname))
|
||||
if (normalizePlayerName(Invitedname))
|
||||
player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
|
||||
|
||||
if(!player)
|
||||
if (!player)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_INVITE_S, Invitedname, ERR_GUILD_PLAYER_NOT_FOUND_S);
|
||||
return;
|
||||
}
|
||||
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if(!guild)
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
return;
|
||||
}
|
||||
|
||||
// OK result but not send invite
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
|
||||
// not let enemies sign guild charter
|
||||
|
|
@ -100,21 +100,21 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
|
|||
return;
|
||||
}
|
||||
|
||||
if(player->GetGuildId())
|
||||
if (player->GetGuildId())
|
||||
{
|
||||
plname = player->GetName();
|
||||
SendGuildCommandResult(GUILD_INVITE_S, plname, ERR_ALREADY_IN_GUILD_S);
|
||||
return;
|
||||
}
|
||||
|
||||
if(player->GetGuildIdInvited())
|
||||
if (player->GetGuildIdInvited())
|
||||
{
|
||||
plname = player->GetName();
|
||||
SendGuildCommandResult(GUILD_INVITE_S, plname, ERR_ALREADY_INVITED_TO_GUILD_S);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_INVITE))
|
||||
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_INVITE))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
|
||||
return;
|
||||
|
|
@ -193,8 +193,8 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
|
|||
|
||||
void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
|
||||
{
|
||||
Guild *guild;
|
||||
Player *player = GetPlayer();
|
||||
Guild* guild;
|
||||
Player* player = GetPlayer();
|
||||
|
||||
DEBUG_LOG("WORLD: Received CMSG_GUILD_ACCEPT");
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
|
|||
DEBUG_LOG("WORLD: Received CMSG_GUILD_INFO");
|
||||
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if(!guild)
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
return;
|
||||
|
|
@ -256,7 +256,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
|
|||
std::string plName;
|
||||
recvPacket >> plName;
|
||||
|
||||
if(!normalizePlayerName(plName))
|
||||
if (!normalizePlayerName(plName))
|
||||
return;
|
||||
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
|
|
@ -309,18 +309,18 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
|
|||
std::string plName;
|
||||
recvPacket >> plName;
|
||||
|
||||
if(!normalizePlayerName(plName))
|
||||
if (!normalizePlayerName(plName))
|
||||
return;
|
||||
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
|
||||
if(!guild)
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
|
||||
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_INVITE_S, "", ERR_GUILD_PERMISSIONS);
|
||||
return;
|
||||
|
|
@ -432,9 +432,9 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
|
|||
std::string name;
|
||||
recvPacket >> name;
|
||||
|
||||
Player *oldLeader = GetPlayer();
|
||||
Player* oldLeader = GetPlayer();
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
if (!normalizePlayerName(name))
|
||||
return;
|
||||
|
||||
Guild* guild = sGuildMgr.GetGuildById(oldLeader->GetGuildId());
|
||||
|
|
@ -506,7 +506,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
|
|||
std::string name,PNOTE;
|
||||
recvPacket >> name;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
if (!normalizePlayerName(name))
|
||||
return;
|
||||
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
|
|
@ -697,13 +697,13 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
|
|||
recvPacket >> GINFO;
|
||||
|
||||
Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if(!guild)
|
||||
if (!guild)
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_MODIFY_GUILD_INFO))
|
||||
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_MODIFY_GUILD_INFO))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", ERR_GUILD_PERMISSIONS);
|
||||
return;
|
||||
|
|
@ -722,7 +722,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
|
|||
recvPacket >> vendorGuid;
|
||||
recvPacket >> EmblemStyle >> EmblemColor >> BorderStyle >> BorderColor >> BackgroundColor;
|
||||
|
||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||
Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||
if (!pCreature)
|
||||
{
|
||||
//"That's not an emblem vendor!"
|
||||
|
|
@ -771,27 +771,27 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
|
|||
// empty
|
||||
DEBUG_LOG("WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)");
|
||||
|
||||
if(uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
if (uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
if (Guild* pGuild = sGuildMgr.GetGuildById(GuildId))
|
||||
pGuild->DisplayGuildEventLog(this);
|
||||
}
|
||||
|
||||
/****** GUILD BANK *******/
|
||||
|
||||
void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ )
|
||||
void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket& /* recv_data */)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)");
|
||||
|
||||
if(uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
if (uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
if (Guild* pGuild = sGuildMgr.GetGuildById(GuildId))
|
||||
pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow());
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ )
|
||||
void WorldSession::HandleGuildPermissions(WorldPacket& /* recv_data */)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (MSG_GUILD_PERMISSIONS)");
|
||||
|
||||
if(uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
if (uint32 GuildId = GetPlayer()->GetGuildId())
|
||||
{
|
||||
if (Guild* pGuild = sGuildMgr.GetGuildById(GuildId))
|
||||
{
|
||||
|
|
@ -804,7 +804,7 @@ void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ )
|
|||
data << uint32(pGuild->GetMemberMoneyWithdrawRem(GetPlayer()->GetGUIDLow()));
|
||||
data << uint8(pGuild->GetPurchasedTabs()); // tabs count
|
||||
// why sending all info when not all tabs are purchased???
|
||||
for(int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
{
|
||||
data << uint32(pGuild->GetBankRights(rankId, uint8(i)));
|
||||
data << uint32(pGuild->GetMemberSlotWithdrawRem(GetPlayer()->GetGUIDLow(), uint8(i)));
|
||||
|
|
@ -816,7 +816,7 @@ void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ )
|
|||
}
|
||||
|
||||
/* Called when clicking on Guild bank gameobject */
|
||||
void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankerActivate(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)");
|
||||
|
||||
|
|
@ -840,7 +840,7 @@ void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
/* Called when opening guild bank tab only (first one) */
|
||||
void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankQueryTab(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)");
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data )
|
|||
pGuild->DisplayGuildBankContent(this, TabId);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_DEPOSIT_MONEY)");
|
||||
|
||||
|
|
@ -905,7 +905,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
|
|||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
// logging money
|
||||
if(_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE))
|
||||
if (_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE))
|
||||
{
|
||||
sLog.outCommand(_player->GetSession()->GetAccountId(),"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
|
||||
_player->GetName(),_player->GetSession()->GetAccountId(),money,GuildId);
|
||||
|
|
@ -919,7 +919,7 @@ void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data )
|
|||
pGuild->DisplayGuildBankMoneyUpdate(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_WITHDRAW_MONEY)");
|
||||
|
||||
|
|
@ -938,7 +938,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if(!pGuild)
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
if (!pGuild->GetPurchasedTabs())
|
||||
|
|
@ -972,7 +972,7 @@ void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data )
|
|||
pGuild->DisplayGuildBankMoneyUpdate(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankSwapItems(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_SWAP_ITEMS)");
|
||||
|
||||
|
|
@ -1065,9 +1065,9 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
// Player <-> Bank
|
||||
|
||||
// allow work with inventory only
|
||||
if(!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) )
|
||||
if (!Player::IsInventoryPos(PlayerBag, PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT))
|
||||
{
|
||||
_player->SendEquipError( EQUIP_ERR_NONE, NULL, NULL );
|
||||
_player->SendEquipError(EQUIP_ERR_NONE, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1078,7 +1078,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
pGuild->MoveFromCharToBank(_player, PlayerBag, PlayerSlot, BankTab, BankTabSlot, SplitedAmount);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankBuyTab(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_BUY_TAB)");
|
||||
|
||||
|
|
@ -1096,7 +1096,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
Guild* pGuild = sGuildMgr.GetGuildById(GuildId);
|
||||
if(!pGuild)
|
||||
if (!pGuild)
|
||||
return;
|
||||
|
||||
// m_PurchasedTabs = 0 when buying Tab 0, that is why this check can be made
|
||||
|
|
@ -1118,7 +1118,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
|
|||
pGuild->DisplayGuildBankTabsInfo(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (CMSG_GUILD_BANK_UPDATE_TAB)");
|
||||
|
||||
|
|
@ -1157,7 +1157,7 @@ void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data )
|
|||
pGuild->DisplayGuildBankContent(this, TabId);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data )
|
||||
void WorldSession::HandleGuildBankLogQuery(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received (MSG_GUILD_BANK_LOG_QUERY)");
|
||||
|
||||
|
|
@ -1179,7 +1179,7 @@ void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data )
|
|||
pGuild->DisplayGuildBankLogs(this, TabId);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data)
|
||||
void WorldSession::HandleQueryGuildBankTabText(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received MSG_QUERY_GUILD_BANK_TEXT");
|
||||
|
||||
|
|
@ -1200,7 +1200,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data)
|
|||
pGuild->SendGuildBankTabText(this, TabId);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data)
|
||||
void WorldSession::HandleSetGuildBankTabText(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Received CMSG_SET_GUILD_BANK_TEXT");
|
||||
|
||||
|
|
@ -1223,9 +1223,9 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data)
|
|||
pGuild->SetGuildBankTabText(TabId, Text);
|
||||
}
|
||||
|
||||
void WorldSession::SendSaveGuildEmblem( uint32 msg )
|
||||
void WorldSession::SendSaveGuildEmblem(uint32 msg)
|
||||
{
|
||||
WorldPacket data(MSG_SAVE_GUILD_EMBLEM, 4);
|
||||
data << uint32(msg); // not part of guild
|
||||
SendPacket( &data );
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ Guild* GuildMgr::GetGuildById(uint32 guildId) const
|
|||
|
||||
Guild* GuildMgr::GetGuildByName(std::string const& name) const
|
||||
{
|
||||
for(GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
|
||||
for (GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
|
||||
if (itr->second->GetName() == name)
|
||||
return itr->second;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ Guild* GuildMgr::GetGuildByName(std::string const& name) const
|
|||
|
||||
Guild* GuildMgr::GetGuildByLeader(ObjectGuid const& guid) const
|
||||
{
|
||||
for(GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
|
||||
for (GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
|
||||
if (itr->second->GetLeaderGuid() == guid)
|
||||
return itr->second;
|
||||
|
||||
|
|
@ -149,7 +149,8 @@ void GuildMgr::LoadGuilds()
|
|||
newGuild->LoadGuildBankEventLogFromDB();
|
||||
newGuild->LoadGuildBankFromDB();
|
||||
AddGuild(newGuild);
|
||||
} while(result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
delete guildRanksResult;
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@
|
|||
#include "movement/MoveSplineInit.h"
|
||||
#include "movement/MoveSpline.h"
|
||||
|
||||
void HomeMovementGenerator<Creature>::Initialize(Creature & owner)
|
||||
void HomeMovementGenerator<Creature>::Initialize(Creature& owner)
|
||||
{
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
||||
void HomeMovementGenerator<Creature>::Reset(Creature &)
|
||||
void HomeMovementGenerator<Creature>::Reset(Creature&)
|
||||
{
|
||||
}
|
||||
|
||||
void HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
|
||||
void HomeMovementGenerator<Creature>::_setTargetLocation(Creature& owner)
|
||||
{
|
||||
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
return;
|
||||
|
|
@ -55,7 +55,7 @@ void HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
|
|||
owner.clearUnitState(UNIT_STAT_ALL_STATE);
|
||||
}
|
||||
|
||||
bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff)
|
||||
bool HomeMovementGenerator<Creature>::Update(Creature& owner, const uint32& time_diff)
|
||||
{
|
||||
arrived = owner.movespline->Finalized();
|
||||
return !arrived;
|
||||
|
|
|
|||
|
|
@ -28,22 +28,22 @@ class MANGOS_DLL_SPEC HomeMovementGenerator;
|
|||
|
||||
template <>
|
||||
class MANGOS_DLL_SPEC HomeMovementGenerator<Creature>
|
||||
: public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
||||
: public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
||||
{
|
||||
public:
|
||||
|
||||
HomeMovementGenerator() : arrived(false) {}
|
||||
~HomeMovementGenerator() {}
|
||||
|
||||
void Initialize(Creature &);
|
||||
void Finalize(Creature &);
|
||||
void Interrupt(Creature &) {}
|
||||
void Reset(Creature &);
|
||||
bool Update(Creature &, const uint32 &);
|
||||
void Initialize(Creature&);
|
||||
void Finalize(Creature&);
|
||||
void Interrupt(Creature&) {}
|
||||
void Reset(Creature&);
|
||||
bool Update(Creature&, const uint32&);
|
||||
MovementGeneratorType GetMovementGeneratorType() const { return HOME_MOTION_TYPE; }
|
||||
|
||||
private:
|
||||
void _setTargetLocation(Creature &);
|
||||
void _setTargetLocation(Creature&);
|
||||
bool arrived;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "SpellMgr.h"
|
||||
#include "Map.h"
|
||||
|
||||
HostileRefManager::HostileRefManager( Unit *pOwner ) : iOwner(pOwner), m_redirectionMod(0.0f)
|
||||
HostileRefManager::HostileRefManager(Unit* pOwner) : iOwner(pOwner), m_redirectionMod(0.0f)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ HostileRefManager::~HostileRefManager()
|
|||
// The pVictim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
|
||||
void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
|
||||
void HostileRefManager::threatAssist(Unit* pVictim, float pThreat, SpellEntry const* pThreatSpell, bool pSingleTarget)
|
||||
{
|
||||
uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat
|
||||
float threat = pThreat/size;
|
||||
|
|
@ -58,7 +58,7 @@ void HostileRefManager::addThreatPercent(int32 pValue)
|
|||
HostileReference* ref;
|
||||
|
||||
ref = getFirst();
|
||||
while(ref != NULL)
|
||||
while (ref != NULL)
|
||||
{
|
||||
ref->addThreatPercent(pValue);
|
||||
ref = ref->next();
|
||||
|
|
@ -73,7 +73,7 @@ void HostileRefManager::setOnlineOfflineState(bool pIsOnline)
|
|||
HostileReference* ref;
|
||||
|
||||
ref = getFirst();
|
||||
while(ref != NULL)
|
||||
while (ref != NULL)
|
||||
{
|
||||
ref->setOnlineOfflineState(pIsOnline);
|
||||
ref = ref->next();
|
||||
|
|
@ -86,7 +86,7 @@ void HostileRefManager::setOnlineOfflineState(bool pIsOnline)
|
|||
void HostileRefManager::updateThreatTables()
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
while (ref)
|
||||
{
|
||||
ref->updateOnlineStatus();
|
||||
ref = ref->next();
|
||||
|
|
@ -100,7 +100,7 @@ void HostileRefManager::updateThreatTables()
|
|||
void HostileRefManager::deleteReferences()
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
while (ref)
|
||||
{
|
||||
HostileReference* nextRef = ref->next();
|
||||
ref->removeReference();
|
||||
|
|
@ -115,10 +115,10 @@ void HostileRefManager::deleteReferences()
|
|||
void HostileRefManager::deleteReferencesForFaction(uint32 faction)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
while (ref)
|
||||
{
|
||||
HostileReference* nextRef = ref->next();
|
||||
if(ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
|
||||
if (ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction)
|
||||
{
|
||||
ref->removeReference();
|
||||
delete ref;
|
||||
|
|
@ -130,13 +130,13 @@ void HostileRefManager::deleteReferencesForFaction(uint32 faction)
|
|||
//=================================================
|
||||
// delete one reference, defined by Unit
|
||||
|
||||
void HostileRefManager::deleteReference(Unit *pCreature)
|
||||
void HostileRefManager::deleteReference(Unit* pCreature)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
while (ref)
|
||||
{
|
||||
HostileReference* nextRef = ref->next();
|
||||
if(ref->getSource()->getOwner() == pCreature)
|
||||
if (ref->getSource()->getOwner() == pCreature)
|
||||
{
|
||||
ref->removeReference();
|
||||
delete ref;
|
||||
|
|
@ -149,13 +149,13 @@ void HostileRefManager::deleteReference(Unit *pCreature)
|
|||
//=================================================
|
||||
// set state for one reference, defined by Unit
|
||||
|
||||
void HostileRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline)
|
||||
void HostileRefManager::setOnlineOfflineState(Unit* pCreature,bool pIsOnline)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while(ref)
|
||||
while (ref)
|
||||
{
|
||||
HostileReference* nextRef = ref->next();
|
||||
if(ref->getSource()->getOwner() == pCreature)
|
||||
if (ref->getSource()->getOwner() == pCreature)
|
||||
{
|
||||
ref->setOnlineOfflineState(pIsOnline);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ struct SpellEntry;
|
|||
class HostileRefManager : public RefManager<Unit, ThreatManager>
|
||||
{
|
||||
public:
|
||||
explicit HostileRefManager(Unit *pOwner);
|
||||
explicit HostileRefManager(Unit* pOwner);
|
||||
~HostileRefManager();
|
||||
|
||||
Unit* getOwner() { return iOwner; }
|
||||
|
|
@ -41,7 +41,7 @@ class HostileRefManager : public RefManager<Unit, ThreatManager>
|
|||
// send threat to all my hateres for the pVictim
|
||||
// The pVictim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
void threatAssist(Unit *pVictim, float threat, SpellEntry const *threatSpell = 0, bool pSingleTarget=false);
|
||||
void threatAssist(Unit* pVictim, float threat, SpellEntry const* threatSpell = 0, bool pSingleTarget=false);
|
||||
|
||||
void addThreatPercent(int32 pValue);
|
||||
|
||||
|
|
@ -52,17 +52,17 @@ class HostileRefManager : public RefManager<Unit, ThreatManager>
|
|||
// Remove specific faction references
|
||||
void deleteReferencesForFaction(uint32 faction);
|
||||
|
||||
HostileReference* getFirst() { return ((HostileReference* ) RefManager<Unit, ThreatManager>::getFirst()); }
|
||||
HostileReference* getFirst() { return ((HostileReference*) RefManager<Unit, ThreatManager>::getFirst()); }
|
||||
|
||||
void updateThreatTables();
|
||||
|
||||
void setOnlineOfflineState(bool pIsOnline);
|
||||
|
||||
// set state for one reference, defined by Unit
|
||||
void setOnlineOfflineState(Unit *pCreature,bool pIsOnline);
|
||||
void setOnlineOfflineState(Unit* pCreature,bool pIsOnline);
|
||||
|
||||
// delete one reference, defined by Unit
|
||||
void deleteReference(Unit *pCreature);
|
||||
void deleteReference(Unit* pCreature);
|
||||
|
||||
// redirection threat data
|
||||
void SetThreatRedirection(ObjectGuid guid, uint32 pct)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ DistractMovementGenerator::Interrupt(Unit& /*owner*/)
|
|||
bool
|
||||
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
|
||||
{
|
||||
if(time_diff > m_timer)
|
||||
if (time_diff > m_timer)
|
||||
return false;
|
||||
|
||||
m_timer -= time_diff;
|
||||
|
|
@ -61,7 +61,7 @@ DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
|
|||
}
|
||||
|
||||
void
|
||||
AssistanceDistractMovementGenerator::Finalize(Unit &unit)
|
||||
AssistanceDistractMovementGenerator::Finalize(Unit& unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_DISTRACTED);
|
||||
if (Unit* victim = unit.getVictim())
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ class MANGOS_DLL_SPEC IdleMovementGenerator : public MovementGenerator
|
|||
{
|
||||
public:
|
||||
|
||||
void Initialize(Unit &) {}
|
||||
void Finalize(Unit &) {}
|
||||
void Interrupt(Unit &) {}
|
||||
void Reset(Unit &);
|
||||
bool Update(Unit &, const uint32 &) { return true; }
|
||||
void Initialize(Unit&) {}
|
||||
void Finalize(Unit&) {}
|
||||
void Interrupt(Unit&) {}
|
||||
void Reset(Unit&);
|
||||
bool Update(Unit&, const uint32&) { return true; }
|
||||
MovementGeneratorType GetMovementGeneratorType() const { return IDLE_MOTION_TYPE; }
|
||||
};
|
||||
|
||||
|
|
@ -42,8 +42,8 @@ class MANGOS_DLL_SPEC DistractMovementGenerator : public MovementGenerator
|
|||
|
||||
void Initialize(Unit& owner);
|
||||
void Finalize(Unit& owner);
|
||||
void Interrupt(Unit& );
|
||||
void Reset(Unit& );
|
||||
void Interrupt(Unit&);
|
||||
void Reset(Unit&);
|
||||
bool Update(Unit& owner, const uint32& time_diff);
|
||||
MovementGeneratorType GetMovementGeneratorType() const { return DISTRACT_MOTION_TYPE; }
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void InstanceData::SaveToDB()
|
|||
CharacterDatabase.PExecute("UPDATE world SET data = '%s' WHERE map = '%u'", data.c_str(), instance->GetId());
|
||||
}
|
||||
|
||||
bool InstanceData::CheckAchievementCriteriaMeet( uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/ )
|
||||
bool InstanceData::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
|
||||
{
|
||||
sLog.outError("Achievement system call InstanceData::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
|
||||
instance->GetId(),criteria_id);
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ class MANGOS_DLL_SPEC InstanceData
|
|||
{
|
||||
public:
|
||||
|
||||
explicit InstanceData(Map *map) : instance(map) {}
|
||||
explicit InstanceData(Map* map) : instance(map) {}
|
||||
virtual ~InstanceData() {}
|
||||
|
||||
Map *instance;
|
||||
Map* instance;
|
||||
|
||||
//On creation, NOT load.
|
||||
virtual void Initialize() {}
|
||||
|
|
@ -56,28 +56,28 @@ class MANGOS_DLL_SPEC InstanceData
|
|||
virtual bool IsEncounterInProgress() const { return false; };
|
||||
|
||||
//Called when a player successfully enters the instance (after really added to map)
|
||||
virtual void OnPlayerEnter(Player *) {}
|
||||
virtual void OnPlayerEnter(Player*) {}
|
||||
|
||||
//Called when a player dies inside instance
|
||||
virtual void OnPlayerDeath(Player *) {}
|
||||
virtual void OnPlayerDeath(Player*) {}
|
||||
|
||||
//Called when a player leaves the instance (before really removed from map (or possibly world))
|
||||
virtual void OnPlayerLeave(Player *) {}
|
||||
virtual void OnPlayerLeave(Player*) {}
|
||||
|
||||
//Called when a gameobject is created
|
||||
virtual void OnObjectCreate(GameObject *) {}
|
||||
virtual void OnObjectCreate(GameObject*) {}
|
||||
|
||||
//called on creature creation
|
||||
virtual void OnCreatureCreate(Creature * /*creature*/) {}
|
||||
virtual void OnCreatureCreate(Creature* /*creature*/) {}
|
||||
|
||||
//called on creature enter combat
|
||||
virtual void OnCreatureEnterCombat(Creature * /*creature*/) {}
|
||||
virtual void OnCreatureEnterCombat(Creature* /*creature*/) {}
|
||||
|
||||
//called on creature evade
|
||||
virtual void OnCreatureEvade(Creature * /*creature*/) {}
|
||||
virtual void OnCreatureEvade(Creature* /*creature*/) {}
|
||||
|
||||
//called on creature death
|
||||
virtual void OnCreatureDeath(Creature * /*creature*/) {}
|
||||
virtual void OnCreatureDeath(Creature* /*creature*/) {}
|
||||
|
||||
//All-purpose data storage 64 bit
|
||||
virtual uint64 GetData64(uint32 /*Data*/) { return 0; }
|
||||
|
|
|
|||
|
|
@ -840,12 +840,12 @@ bool Item::CanBeTraded(bool mail) const
|
|||
if ((!mail || !IsBoundAccountWide()) && IsSoulBound())
|
||||
return false;
|
||||
|
||||
if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()) )
|
||||
if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()))
|
||||
return false;
|
||||
|
||||
if (Player* owner = GetOwner())
|
||||
{
|
||||
if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK )
|
||||
if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
|
||||
return false;
|
||||
if (owner->GetLootGuid() == GetObjectGuid())
|
||||
return false;
|
||||
|
|
@ -1078,7 +1078,7 @@ void Item::SendTimeUpdate(Player* owner)
|
|||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
Item* Item::CreateItem( uint32 item, uint32 count, Player const* player, uint32 randomPropertyId)
|
||||
Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 randomPropertyId)
|
||||
{
|
||||
if (count < 1)
|
||||
return NULL; //don't create item at zero count
|
||||
|
|
|
|||
|
|
@ -268,17 +268,17 @@ struct ItemRequiredTarget
|
|||
bool IsFitToRequirements(Unit* pUnitTarget) const;
|
||||
};
|
||||
|
||||
bool ItemCanGoIntoBag(ItemPrototype const *proto, ItemPrototype const *pBagProto);
|
||||
bool ItemCanGoIntoBag(ItemPrototype const* proto, ItemPrototype const* pBagProto);
|
||||
|
||||
class MANGOS_DLL_SPEC Item : public Object
|
||||
{
|
||||
public:
|
||||
static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL, uint32 randomPropertyId = 0);
|
||||
Item* CloneItem( uint32 count, Player const* player = NULL ) const;
|
||||
Item* CloneItem(uint32 count, Player const* player = NULL) const;
|
||||
|
||||
Item();
|
||||
|
||||
virtual bool Create( uint32 guidlow, uint32 itemid, Player const* owner);
|
||||
virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
|
||||
|
||||
ItemPrototype const* GetProto() const;
|
||||
|
||||
|
|
@ -308,8 +308,8 @@ class MANGOS_DLL_SPEC Item : public Object
|
|||
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
|
||||
bool GemsFitSockets() const;
|
||||
|
||||
uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); }
|
||||
void SetCount(uint32 value) { SetUInt32Value (ITEM_FIELD_STACK_COUNT, value); }
|
||||
uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
|
||||
void SetCount(uint32 value) { SetUInt32Value(ITEM_FIELD_STACK_COUNT, value); }
|
||||
uint32 GetMaxStackCount() const { return GetProto()->GetMaxStackSize(); }
|
||||
uint8 GetGemCountWithID(uint32 GemID) const;
|
||||
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
|
||||
|
|
@ -320,7 +320,7 @@ class MANGOS_DLL_SPEC Item : public Object
|
|||
uint8 GetBagSlot() const;
|
||||
void SetSlot(uint8 slot) {m_slot = slot;}
|
||||
uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
|
||||
void SetContainer(Bag *container) { m_container = container; }
|
||||
void SetContainer(Bag* container) { m_container = container; }
|
||||
|
||||
bool IsInBag() const { return m_container != NULL; }
|
||||
bool IsEquipped() const;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void LoadRandomEnchantmentsTable()
|
|||
float chance;
|
||||
uint32 count = 0;
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
|
||||
QueryResult* result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
|
||||
|
||||
if (result)
|
||||
{
|
||||
|
|
@ -61,7 +61,7 @@ void LoadRandomEnchantmentsTable()
|
|||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
entry = fields[0].GetUInt32();
|
||||
|
|
@ -69,20 +69,21 @@ void LoadRandomEnchantmentsTable()
|
|||
chance = fields[2].GetFloat();
|
||||
|
||||
if (chance > 0.000001f && chance <= 100.0f)
|
||||
RandomItemEnch[entry].push_back( EnchStoreItem(ench, chance) );
|
||||
RandomItemEnch[entry].push_back(EnchStoreItem(ench, chance));
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u Item Enchantment definitions", count );
|
||||
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outString();
|
||||
sLog.outErrorDb( ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
|
||||
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +102,7 @@ uint32 GetItemEnchantMod(uint32 entry)
|
|||
double dRoll = rand_chance();
|
||||
float fCount = 0;
|
||||
|
||||
for(EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
|
||||
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
|
||||
{
|
||||
fCount += ench_iter->chance;
|
||||
|
||||
|
|
@ -112,7 +113,7 @@ uint32 GetItemEnchantMod(uint32 entry)
|
|||
dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100;
|
||||
fCount = 0;
|
||||
|
||||
for(EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
|
||||
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
|
||||
{
|
||||
fCount += ench_iter->chance;
|
||||
|
||||
|
|
@ -124,19 +125,19 @@ uint32 GetItemEnchantMod(uint32 entry)
|
|||
|
||||
uint32 GenerateEnchSuffixFactor(uint32 item_id)
|
||||
{
|
||||
ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(item_id);
|
||||
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id);
|
||||
|
||||
if(!itemProto)
|
||||
if (!itemProto)
|
||||
return 0;
|
||||
if(!itemProto->RandomSuffix)
|
||||
if (!itemProto->RandomSuffix)
|
||||
return 0;
|
||||
|
||||
RandomPropertiesPointsEntry const *randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
|
||||
if(!randomProperty)
|
||||
RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
|
||||
if (!randomProperty)
|
||||
return 0;
|
||||
|
||||
uint32 suffixFactor;
|
||||
switch(itemProto->InventoryType)
|
||||
switch (itemProto->InventoryType)
|
||||
{
|
||||
// Items of that type don`t have points
|
||||
case INVTYPE_NON_EQUIP:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -477,7 +477,7 @@ const uint32 MaxItemSubclassValues[MAX_ITEM_CLASS] =
|
|||
|
||||
inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemSubClass)
|
||||
{
|
||||
switch(ItemClass)
|
||||
switch (ItemClass)
|
||||
{
|
||||
case ITEM_CLASS_WEAPON: return ItemSubClass;
|
||||
case ITEM_CLASS_ARMOR: return ItemSubClass + 21;
|
||||
|
|
@ -615,7 +615,7 @@ struct ItemPrototype
|
|||
// helpers
|
||||
bool CanChangeEquipStateInCombat() const
|
||||
{
|
||||
switch(InventoryType)
|
||||
switch (InventoryType)
|
||||
{
|
||||
case INVTYPE_RELIC:
|
||||
case INVTYPE_SHIELD:
|
||||
|
|
@ -623,7 +623,7 @@ struct ItemPrototype
|
|||
return true;
|
||||
}
|
||||
|
||||
switch(Class)
|
||||
switch (Class)
|
||||
{
|
||||
case ITEM_CLASS_WEAPON:
|
||||
case ITEM_CLASS_PROJECTILE:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue