Various Cleanups (game C-E)

This commit is contained in:
Schmoozerd 2012-07-19 21:45:58 +02:00
parent f80629e307
commit c5c09cee3c
40 changed files with 1826 additions and 1818 deletions

View file

@ -24,7 +24,7 @@
#include "Opcodes.h"
#include "MapPersistentStateMgr.h"
void WorldSession::HandleCalendarGetCalendar(WorldPacket &/*recv_data*/)
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty
@ -44,13 +44,13 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &/*recv_data*/)
size_t p_counter = data.wpos();
data << uint32(counter); // instance state count
for(int i = 0; i < MAX_DIFFICULTY; ++i)
for (int i = 0; i < MAX_DIFFICULTY; ++i)
{
for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
{
if(itr->second.perm)
if (itr->second.perm)
{
DungeonPersistentState *state = itr->second.state;
DungeonPersistentState* state = itr->second.state;
data << uint32(state->GetMapId());
data << uint32(state->GetDifficulty());
data << uint32(state->GetResetTime() - cur_time);
@ -64,40 +64,40 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &/*recv_data*/)
data << (uint32) 1135753200; // base date (28.12.2005 12:00)
data << (uint32) 0; // raid reset count
data << (uint32) 0; // holidays count
/*
for(uint32 i = 0; i < holidays_count; ++i)
{
data << uint32(0); // Holidays.dbc ID
data << uint32(0); // Holidays.dbc region
data << uint32(0); // Holidays.dbc looping
data << uint32(0); // Holidays.dbc priority
data << uint32(0); // Holidays.dbc calendarFilterType
/*
for(uint32 i = 0; i < holidays_count; ++i)
{
data << uint32(0); // Holidays.dbc ID
data << uint32(0); // Holidays.dbc region
data << uint32(0); // Holidays.dbc looping
data << uint32(0); // Holidays.dbc priority
data << uint32(0); // Holidays.dbc calendarFilterType
for(uint32 j = 0; j < 26; j++)
data << uint32(0); // Holidays.dbc date
for(uint32 j = 0; j < 26; j++)
data << uint32(0); // Holidays.dbc date
for(uint32 j = 0; j < 10; j++)
data << uint32(0); // Holidays.dbc duration
for(uint32 j = 0; j < 10; j++)
data << uint32(0); // Holidays.dbc duration
for(uint32 j = 0; j < 10; j++)
data << uint32(0); // Holidays.dbc calendarFlags
for(uint32 j = 0; j < 10; j++)
data << uint32(0); // Holidays.dbc calendarFlags
data << ""; // Holidays.dbc textureFilename
}
*/
data << ""; // Holidays.dbc textureFilename
}
*/
//DEBUG_LOG("Sending calendar");
//data.hexlike();
SendPacket(&data);
}
void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data)
void WorldSession::HandleCalendarGetEvent(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_GET_EVENT");
recv_data.hexlike();
recv_data.read_skip<uint64>(); // unk
}
void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data)
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_GUILD_FILTER");
recv_data.hexlike();
@ -106,14 +106,14 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data)
recv_data.read_skip<uint32>(); // unk3
}
void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data)
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_ARENA_TEAM");
recv_data.hexlike();
recv_data.read_skip<uint32>(); // unk
}
void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data)
void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_ADD_EVENT");
recv_data.hexlike();
@ -149,7 +149,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data)
//}
}
void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data)
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_UPDATE_EVENT");
recv_data.hexlike();
@ -168,7 +168,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data)
//recv_data >> uint32
}
void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data)
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_REMOVE_EVENT");
recv_data.hexlike();
@ -180,7 +180,7 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data)
}
void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data)
void WorldSession::HandleCalendarCopyEvent(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_COPY_EVENT");
recv_data.hexlike();
@ -192,7 +192,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data)
}
void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data)
void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_INVITE");
recv_data.hexlike();
@ -206,7 +206,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data)
}
void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data)
void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_RSVP");
recv_data.hexlike();
@ -217,7 +217,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data)
//recv_data >> uint32
}
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data)
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE");
recv_data.hexlike();
@ -229,7 +229,7 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data)
//recv_data >> uint64
}
void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data)
void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_STATUS");
recv_data.hexlike();
@ -242,7 +242,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data)
//recv_data >> uint32
}
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data)
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS");
recv_data.hexlike();
@ -255,7 +255,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data)
//recv_data >> uint32
}
void WorldSession::HandleCalendarComplain(WorldPacket &recv_data)
void WorldSession::HandleCalendarComplain(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_COMPLAIN");
recv_data.hexlike();
@ -266,7 +266,7 @@ void WorldSession::HandleCalendarComplain(WorldPacket &recv_data)
//recv_data >> uint64
}
void WorldSession::HandleCalendarGetNumPending(WorldPacket & /*recv_data*/)
void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recv_data*/)
{
DEBUG_LOG("WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty

View file

@ -37,7 +37,7 @@ Camera::~Camera()
m_source->GetViewPoint().Detach(this);
}
void Camera::ReceivePacket(WorldPacket *data)
void Camera::ReceivePacket(WorldPacket* data)
{
m_owner.SendDirectMessage(data);
}
@ -52,7 +52,7 @@ void Camera::UpdateForCurrentViewPoint()
UpdateVisibilityForOwner();
}
void Camera::SetView(WorldObject *obj, bool update_far_sight_field /*= true*/)
void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/)
{
MANGOS_ASSERT(obj);
@ -132,16 +132,16 @@ void Camera::UpdateVisibilityOf(WorldObject* target)
}
template<class T>
void Camera::UpdateVisibilityOf(T * target, UpdateData &data, std::set<WorldObject*>& vis)
void Camera::UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& vis)
{
m_owner.template UpdateVisibilityOf<T>(m_source, target,data,vis);
}
template void Camera::UpdateVisibilityOf(Player* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(Creature* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(Corpse* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(GameObject* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(DynamicObject* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(Player* , UpdateData& , std::set<WorldObject*>&);
template void Camera::UpdateVisibilityOf(Creature* , UpdateData& , std::set<WorldObject*>&);
template void Camera::UpdateVisibilityOf(Corpse* , UpdateData& , std::set<WorldObject*>&);
template void Camera::UpdateVisibilityOf(GameObject* , UpdateData& , std::set<WorldObject*>&);
template void Camera::UpdateVisibilityOf(DynamicObject* , UpdateData& , std::set<WorldObject*>&);
void Camera::UpdateVisibilityForOwner()
{

View file

@ -31,7 +31,7 @@ class Player;
/// Camera - object-receiver. Receives broadcast packets from nearby worldobjects, object visibility changes and sends them to client
class MANGOS_DLL_SPEC Camera
{
friend class ViewPoint;
friend class ViewPoint;
public:
explicit Camera(Player* pl);
@ -43,16 +43,16 @@ class MANGOS_DLL_SPEC Camera
// set camera's view to any worldobject
// Note: this worldobject must be in same map, in same phase with camera's owner(player)
// client supports only unit and dynamic objects as farsight objects
void SetView(WorldObject *obj, bool update_far_sight_field = true);
void SetView(WorldObject* obj, bool update_far_sight_field = true);
// set view to camera's owner
void ResetView(bool update_far_sight_field = true);
template<class T>
void UpdateVisibilityOf(T * obj, UpdateData &d, std::set<WorldObject*>& vis);
void UpdateVisibilityOf(T* obj, UpdateData& d, std::set<WorldObject*>& vis);
void UpdateVisibilityOf(WorldObject* obj);
void ReceivePacket(WorldPacket *data);
void ReceivePacket(WorldPacket* data);
// updates visibility of worldobjects around viewpoint for camera's owner
void UpdateVisibilityForOwner();
@ -79,63 +79,63 @@ class MANGOS_DLL_SPEC Camera
/// Object-observer, notifies farsight object state to cameras that attached to it
class MANGOS_DLL_SPEC ViewPoint
{
friend class Camera;
friend class Camera;
typedef std::list<Camera*> CameraList;
typedef std::list<Camera*> CameraList;
CameraList m_cameras;
GridType * m_grid;
CameraList m_cameras;
GridType* m_grid;
void Attach(Camera* c) { m_cameras.push_back(c); }
void Detach(Camera* c) { m_cameras.remove(c); }
void Attach(Camera* c) { m_cameras.push_back(c); }
void Detach(Camera* c) { m_cameras.remove(c); }
void CameraCall(void (Camera::*handler)())
{
if (!m_cameras.empty())
void CameraCall(void (Camera::*handler)())
{
for(CameraList::iterator itr = m_cameras.begin(); itr != m_cameras.end();)
if (!m_cameras.empty())
{
Camera *c = *(itr++);
(c->*handler)();
for (CameraList::iterator itr = m_cameras.begin(); itr != m_cameras.end();)
{
Camera* c = *(itr++);
(c->*handler)();
}
}
}
}
public:
public:
ViewPoint() : m_grid(0) {}
~ViewPoint();
ViewPoint() : m_grid(0) {}
~ViewPoint();
bool hasViewers() const { return !m_cameras.empty(); }
bool hasViewers() const { return !m_cameras.empty(); }
// these events are called when viewpoint changes visibility state
void Event_AddedToWorld(GridType *grid)
{
m_grid = grid;
CameraCall(&Camera::Event_AddedToWorld);
}
// these events are called when viewpoint changes visibility state
void Event_AddedToWorld(GridType* grid)
{
m_grid = grid;
CameraCall(&Camera::Event_AddedToWorld);
}
void Event_RemovedFromWorld()
{
m_grid = NULL;
CameraCall(&Camera::Event_RemovedFromWorld);
}
void Event_RemovedFromWorld()
{
m_grid = NULL;
CameraCall(&Camera::Event_RemovedFromWorld);
}
void Event_GridChanged(GridType *grid)
{
m_grid = grid;
CameraCall(&Camera::Event_Moved);
}
void Event_GridChanged(GridType* grid)
{
m_grid = grid;
CameraCall(&Camera::Event_Moved);
}
void Event_ViewPointVisibilityChanged()
{
CameraCall(&Camera::Event_ViewPointVisibilityChanged);
}
void Event_ViewPointVisibilityChanged()
{
CameraCall(&Camera::Event_ViewPointVisibilityChanged);
}
void Call_UpdateVisibilityForOwner()
{
CameraCall(&Camera::UpdateVisibilityForOwner);
}
void Call_UpdateVisibilityForOwner()
{
CameraCall(&Camera::UpdateVisibilityForOwner);
}
};
#endif

View file

@ -46,81 +46,81 @@ struct MANGOS_DLL_DECL CellArea
struct MANGOS_DLL_DECL Cell
{
Cell() { data.All = 0; }
Cell(const Cell &cell) { data.All = cell.data.All; }
explicit Cell(CellPair const& p);
Cell() { data.All = 0; }
Cell(const Cell& cell) { data.All = cell.data.All; }
explicit Cell(CellPair const& p);
void Compute(uint32 &x, uint32 &y) const
{
x = data.Part.grid_x*MAX_NUMBER_OF_CELLS + data.Part.cell_x;
y = data.Part.grid_y*MAX_NUMBER_OF_CELLS + data.Part.cell_y;
}
bool DiffCell(const Cell &cell) const
{
return( data.Part.cell_x != cell.data.Part.cell_x ||
data.Part.cell_y != cell.data.Part.cell_y );
}
bool DiffGrid(const Cell &cell) const
{
return( data.Part.grid_x != cell.data.Part.grid_x ||
data.Part.grid_y != cell.data.Part.grid_y );
}
uint32 CellX() const { return data.Part.cell_x; }
uint32 CellY() const { return data.Part.cell_y; }
uint32 GridX() const { return data.Part.grid_x; }
uint32 GridY() const { return data.Part.grid_y; }
bool NoCreate() const { return data.Part.nocreate; }
void SetNoCreate() { data.Part.nocreate = 1; }
GridPair gridPair() const { return GridPair(GridX(),GridY()); }
CellPair cellPair() const
{
return CellPair(
data.Part.grid_x*MAX_NUMBER_OF_CELLS+data.Part.cell_x,
data.Part.grid_y*MAX_NUMBER_OF_CELLS+data.Part.cell_y);
}
Cell& operator=(const Cell &cell)
{
data.All = cell.data.All;
return *this;
}
bool operator==(const Cell &cell) const { return (data.All == cell.data.All); }
bool operator!=(const Cell &cell) const { return !operator==(cell); }
union
{
struct
void Compute(uint32& x, uint32& y) const
{
unsigned grid_x : 6;
unsigned grid_y : 6;
unsigned cell_x : 6;
unsigned cell_y : 6;
unsigned nocreate : 1;
unsigned reserved : 7;
} Part;
uint32 All;
} data;
x = data.Part.grid_x*MAX_NUMBER_OF_CELLS + data.Part.cell_x;
y = data.Part.grid_y*MAX_NUMBER_OF_CELLS + data.Part.cell_y;
}
template<class T, class CONTAINER> void Visit(const CellPair &cellPair, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, float x, float y, float radius) const;
template<class T, class CONTAINER> void Visit(const CellPair &cellPair, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject& obj, float radius) const;
bool DiffCell(const Cell& cell) const
{
return(data.Part.cell_x != cell.data.Part.cell_x ||
data.Part.cell_y != cell.data.Part.cell_y);
}
static CellArea CalculateCellArea(float x, float y, float radius);
bool DiffGrid(const Cell& cell) const
{
return(data.Part.grid_x != cell.data.Part.grid_x ||
data.Part.grid_y != cell.data.Part.grid_y);
}
template<class T> static void VisitGridObjects(const WorldObject *obj, T &visitor, float radius, bool dont_load = true);
template<class T> static void VisitWorldObjects(const WorldObject *obj, T &visitor, float radius, bool dont_load = true);
template<class T> static void VisitAllObjects(const WorldObject *obj, T &visitor, float radius, bool dont_load = true);
uint32 CellX() const { return data.Part.cell_x; }
uint32 CellY() const { return data.Part.cell_y; }
uint32 GridX() const { return data.Part.grid_x; }
uint32 GridY() const { return data.Part.grid_y; }
bool NoCreate() const { return data.Part.nocreate; }
void SetNoCreate() { data.Part.nocreate = 1; }
template<class T> static void VisitGridObjects(float x, float y, Map *map, T &visitor, float radius, bool dont_load = true);
template<class T> static void VisitWorldObjects(float x, float y, Map *map, T &visitor, float radius, bool dont_load = true);
template<class T> static void VisitAllObjects(float x, float y, Map *map, T &visitor, float radius, bool dont_load = true);
GridPair gridPair() const { return GridPair(GridX(),GridY()); }
private:
template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair& , const CellPair& ) const;
CellPair cellPair() const
{
return CellPair(
data.Part.grid_x*MAX_NUMBER_OF_CELLS+data.Part.cell_x,
data.Part.grid_y*MAX_NUMBER_OF_CELLS+data.Part.cell_y);
}
Cell& operator=(const Cell& cell)
{
data.All = cell.data.All;
return *this;
}
bool operator==(const Cell& cell) const { return (data.All == cell.data.All); }
bool operator!=(const Cell& cell) const { return !operator==(cell); }
union
{
struct
{
unsigned grid_x : 6;
unsigned grid_y : 6;
unsigned cell_x : 6;
unsigned cell_y : 6;
unsigned nocreate : 1;
unsigned reserved : 7;
} Part;
uint32 All;
} data;
template<class T, class CONTAINER> void Visit(const CellPair& cellPair, TypeContainerVisitor<T, CONTAINER>& visitor, Map& m, float x, float y, float radius) const;
template<class T, class CONTAINER> void Visit(const CellPair& cellPair, TypeContainerVisitor<T, CONTAINER>& visitor, Map& m, const WorldObject& obj, float radius) const;
static CellArea CalculateCellArea(float x, float y, float radius);
template<class T> static void VisitGridObjects(const WorldObject* obj, T& visitor, float radius, bool dont_load = true);
template<class T> static void VisitWorldObjects(const WorldObject* obj, T& visitor, float radius, bool dont_load = true);
template<class T> static void VisitAllObjects(const WorldObject* obj, T& visitor, float radius, bool dont_load = true);
template<class T> static void VisitGridObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load = true);
template<class T> static void VisitWorldObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load = true);
template<class T> static void VisitAllObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load = true);
private:
template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER>&, Map&, const CellPair& , const CellPair&) const;
};
#endif

View file

@ -43,15 +43,15 @@ inline CellArea Cell::CalculateCellArea(float x, float y, float radius)
}
return CellArea
(
MaNGOS::ComputeCellPair(x - radius, y - radius).normalize(),
MaNGOS::ComputeCellPair(x + radius, y + radius).normalize()
);
(
MaNGOS::ComputeCellPair(x - radius, y - radius).normalize(),
MaNGOS::ComputeCellPair(x + radius, y + radius).normalize()
);
}
template<class T, class CONTAINER>
inline void
Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject& obj, float radius) const
Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER>& visitor, Map& m, const WorldObject& obj, float radius) const
{
Cell::Visit(standing_cell, visitor, m, obj.GetPositionX(), obj.GetPositionY(), radius + obj.GetObjectBoundingRadius());
}
@ -59,7 +59,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &v
template<class T, class CONTAINER>
inline void
Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, float x, float y, float radius) const
Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER>& visitor, Map& m, float x, float y, float radius) const
{
if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
return;
@ -67,31 +67,31 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &v
//no jokes here... Actually placing ASSERT() here was good idea, but
//we had some problems with DynamicObjects, which pass radius = 0.0f (DB issue?)
//maybe it is better to just return when radius <= 0.0f?
if(radius <= 0.0f)
if (radius <= 0.0f)
{
m.Visit(*this, visitor);
return;
}
//lets limit the upper value for search radius
if(radius > 333.0f)
if (radius > 333.0f)
radius = 333.0f;
//lets calculate object coord offsets from cell borders.
CellArea area = Cell::CalculateCellArea(x, y, radius);
//if radius fits inside standing cell
if(!area)
if (!area)
{
m.Visit(*this, visitor);
return;
}
CellPair &begin_cell = area.low_bound;
CellPair &end_cell = area.high_bound;
CellPair& begin_cell = area.low_bound;
CellPair& end_cell = area.high_bound;
//visit all cells, found in CalculateCellArea()
//if radius is known to reach cell area more than 4x4 then we should call optimized VisitCircle
//currently this technique works with MAX_NUMBER_OF_CELLS 16 and higher, with lower values
//there are nothing to optimize because SIZE_OF_GRID_CELL is too big...
if(((end_cell.x_coord - begin_cell.x_coord) > 4) && ((end_cell.y_coord - begin_cell.y_coord) > 4))
if (((end_cell.x_coord - begin_cell.x_coord) > 4) && ((end_cell.y_coord - begin_cell.y_coord) > 4))
{
VisitCircle(visitor, m, begin_cell, end_cell);
return;
@ -102,13 +102,13 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &v
m.Visit(*this, visitor);
// loop the cell range
for(uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; x++)
for (uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; x++)
{
for(uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; y++)
for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; y++)
{
CellPair cell_pair(x,y);
//lets skip standing cell since we already visited it
if(cell_pair != standing_cell)
if (cell_pair != standing_cell)
{
Cell r_zone(cell_pair);
r_zone.data.Part.nocreate = data.Part.nocreate;
@ -120,7 +120,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor<T, CONTAINER> &v
template<class T, class CONTAINER>
inline void
Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const
Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER>& visitor, Map& m, const CellPair& begin_cell, const CellPair& end_cell) const
{
//here is an algorithm for 'filling' circum-squared octagon
uint32 x_shift = (uint32)ceilf((end_cell.x_coord - begin_cell.x_coord) * 0.3f - 0.5f);
@ -129,9 +129,9 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel
const uint32 x_end = end_cell.x_coord - x_shift;
//visit central strip with constant width...
for(uint32 x = x_start; x <= x_end; ++x)
for (uint32 x = x_start; x <= x_end; ++x)
{
for(uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; ++y)
for (uint32 y = begin_cell.y_coord; y <= end_cell.y_coord; ++y)
{
CellPair cell_pair(x,y);
Cell r_zone(cell_pair);
@ -142,7 +142,7 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel
//if x_shift == 0 then we have too small cell area, which were already
//visited at previous step, so just return from procedure...
if(x_shift == 0)
if (x_shift == 0)
return;
uint32 y_start = end_cell.y_coord;
@ -172,7 +172,7 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const Cel
}
template<class T>
inline void Cell::VisitGridObjects(const WorldObject *center_obj, T &visitor, float radius, bool dont_load)
inline void Cell::VisitGridObjects(const WorldObject* center_obj, T& visitor, float radius, bool dont_load)
{
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
Cell cell(p);
@ -183,7 +183,7 @@ inline void Cell::VisitGridObjects(const WorldObject *center_obj, T &visitor, fl
}
template<class T>
inline void Cell::VisitWorldObjects(const WorldObject *center_obj, T &visitor, float radius, bool dont_load)
inline void Cell::VisitWorldObjects(const WorldObject* center_obj, T& visitor, float radius, bool dont_load)
{
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
Cell cell(p);
@ -194,7 +194,7 @@ inline void Cell::VisitWorldObjects(const WorldObject *center_obj, T &visitor, f
}
template<class T>
inline void Cell::VisitAllObjects(const WorldObject *center_obj, T &visitor, float radius, bool dont_load)
inline void Cell::VisitAllObjects(const WorldObject* center_obj, T& visitor, float radius, bool dont_load)
{
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
Cell cell(p);
@ -207,7 +207,7 @@ inline void Cell::VisitAllObjects(const WorldObject *center_obj, T &visitor, flo
}
template<class T>
inline void Cell::VisitGridObjects(float x, float y, Map *map, T &visitor, float radius, bool dont_load)
inline void Cell::VisitGridObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load)
{
CellPair p(MaNGOS::ComputeCellPair(x, y));
Cell cell(p);
@ -218,7 +218,7 @@ inline void Cell::VisitGridObjects(float x, float y, Map *map, T &visitor, float
}
template<class T>
inline void Cell::VisitWorldObjects(float x, float y, Map *map, T &visitor, float radius, bool dont_load)
inline void Cell::VisitWorldObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load)
{
CellPair p(MaNGOS::ComputeCellPair(x, y));
Cell cell(p);
@ -229,7 +229,7 @@ inline void Cell::VisitWorldObjects(float x, float y, Map *map, T &visitor, floa
}
template<class T>
inline void Cell::VisitAllObjects(float x, float y, Map *map, T &visitor, float radius, bool dont_load)
inline void Cell::VisitAllObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load)
{
CellPair p(MaNGOS::ComputeCellPair(x, y));
Cell cell(p);

View file

@ -22,24 +22,24 @@
#include "SocialMgr.h"
Channel::Channel(const std::string& name, uint32 channel_id)
: m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id)
: m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id)
{
// set special flags if built-in channel
ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
if(ch) // it's built-in channel
if (ch) // it's built-in channel
{
channel_id = ch->ChannelID; // built-in channel
m_announce = false; // no join/leave announces
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
if(ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
m_flags |= CHANNEL_FLAG_TRADE;
if(ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
m_flags |= CHANNEL_FLAG_CITY;
if(ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
m_flags |= CHANNEL_FLAG_LFG;
else // for all other channels
m_flags |= CHANNEL_FLAG_NOT_LFG;
@ -50,12 +50,12 @@ Channel::Channel(const std::string& name, uint32 channel_id)
}
}
void Channel::Join(ObjectGuid p, const char *pass)
void Channel::Join(ObjectGuid p, const char* pass)
{
WorldPacket data;
if (IsOn(p))
{
if(!IsConstant()) // non send error message for built-in channels
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
@ -70,31 +70,31 @@ void Channel::Join(ObjectGuid p, const char *pass)
return;
}
if(m_password.length() > 0 && strcmp(pass, m_password.c_str()))
if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
return;
}
Player *plr = sObjectMgr.GetPlayer(p);
Player* plr = sObjectMgr.GetPlayer(p);
if(plr)
if (plr)
{
if(HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER )
if (HasFlag(CHANNEL_FLAG_LFG) && sWorld.getConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER)
{
MakeNotInLfg(&data);
SendToOne(&data, p);
return;
}
if(plr->GetGuildId() && (GetFlags() == 0x38))
if (plr->GetGuildId() && (GetFlags() == 0x38))
return;
plr->JoinedChannel(this);
}
if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL) ))
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
MakeJoined(&data, p);
SendToAll(&data);
@ -112,7 +112,7 @@ void Channel::Join(ObjectGuid p, const char *pass)
JoinNotify(p);
// if no owner first logged will become
if(!IsConstant() && !m_ownerGuid)
if (!IsConstant() && !m_ownerGuid)
{
SetOwner(p, (m_players.size() > 1 ? true : false));
m_players[p].SetModerator(true);
@ -123,7 +123,7 @@ void Channel::Leave(ObjectGuid p, bool send)
{
if (!IsOn(p))
{
if(send)
if (send)
{
WorldPacket data;
MakeNotMember(&data);
@ -132,14 +132,14 @@ void Channel::Leave(ObjectGuid p, bool send)
}
else
{
Player *plr = sObjectMgr.GetPlayer(p);
Player* plr = sObjectMgr.GetPlayer(p);
if(send)
if (send)
{
WorldPacket data;
MakeYouLeft(&data);
SendToOne(&data, p);
if(plr)
if (plr)
plr->LeftChannel(this);
data.clear();
}
@ -147,7 +147,7 @@ void Channel::Leave(ObjectGuid p, bool send)
bool changeowner = m_players[p].IsOwner();
m_players.erase(p);
if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL) ))
if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
WorldPacket data;
MakeLeft(&data, p);
@ -156,7 +156,7 @@ void Channel::Leave(ObjectGuid p, bool send)
LeaveNotify(p);
if(changeowner)
if (changeowner)
{
ObjectGuid newowner = !m_players.empty() ? m_players.begin()->second.player : ObjectGuid();
SetOwner(newowner);
@ -164,10 +164,10 @@ void Channel::Leave(ObjectGuid p, bool send)
}
}
void Channel::KickOrBan(ObjectGuid good, const char *badname, bool ban)
void Channel::KickOrBan(ObjectGuid good, const char* badname, bool ban)
{
AccountTypes sec = SEC_PLAYER;
Player *gplr = sObjectMgr.GetPlayer(good);
Player* gplr = sObjectMgr.GetPlayer(good);
if (gplr)
sec = gplr->GetSession()->GetSecurity();
@ -185,7 +185,7 @@ void Channel::KickOrBan(ObjectGuid good, const char *badname, bool ban)
}
else
{
Player *bad = sObjectMgr.GetPlayer(badname);
Player* bad = sObjectMgr.GetPlayer(badname);
if (bad == NULL || !IsOn(bad->GetObjectGuid()))
{
WorldPacket data;
@ -204,7 +204,7 @@ void Channel::KickOrBan(ObjectGuid good, const char *badname, bool ban)
WorldPacket data;
if(ban && !IsBanned(bad->GetObjectGuid()))
if (ban && !IsBanned(bad->GetObjectGuid()))
{
m_banned.insert(bad->GetObjectGuid());
MakePlayerBanned(&data, bad->GetObjectGuid(), good);
@ -216,7 +216,7 @@ void Channel::KickOrBan(ObjectGuid good, const char *badname, bool ban)
m_players.erase(bad->GetObjectGuid());
bad->LeftChannel(this);
if(changeowner)
if (changeowner)
{
ObjectGuid newowner = !m_players.empty() ? good : ObjectGuid();
SetOwner(newowner);
@ -225,11 +225,11 @@ void Channel::KickOrBan(ObjectGuid good, const char *badname, bool ban)
}
}
void Channel::UnBan(ObjectGuid good, const char *badname)
void Channel::UnBan(ObjectGuid good, const char* badname)
{
uint32 sec = 0;
Player *gplr = sObjectMgr.GetPlayer(good);
if(gplr)
Player* gplr = sObjectMgr.GetPlayer(good);
if (gplr)
sec = gplr->GetSession()->GetSecurity();
if (!IsOn(good))
@ -238,7 +238,7 @@ void Channel::UnBan(ObjectGuid good, const char *badname)
MakeNotMember(&data);
SendToOne(&data, good);
}
else if(!m_players[good].IsModerator() && sec < SEC_GAMEMASTER)
else if (!m_players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -246,8 +246,8 @@ void Channel::UnBan(ObjectGuid good, const char *badname)
}
else
{
Player *bad = sObjectMgr.GetPlayer(badname);
if(bad == NULL || !IsBanned(bad->GetObjectGuid()))
Player* bad = sObjectMgr.GetPlayer(badname);
if (bad == NULL || !IsBanned(bad->GetObjectGuid()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
@ -264,10 +264,10 @@ void Channel::UnBan(ObjectGuid good, const char *badname)
}
}
void Channel::Password(ObjectGuid p, const char *pass)
void Channel::Password(ObjectGuid p, const char* pass)
{
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
Player* plr = sObjectMgr.GetPlayer(p);
if (plr)
sec = plr->GetSession()->GetSecurity();
@ -277,7 +277,7 @@ void Channel::Password(ObjectGuid p, const char *pass)
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -293,9 +293,9 @@ void Channel::Password(ObjectGuid p, const char *pass)
}
}
void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
void Channel::SetMode(ObjectGuid p, const char* p2n, bool mod, bool set)
{
Player *plr = sObjectMgr.GetPlayer(p);
Player* plr = sObjectMgr.GetPlayer(p);
if (!plr)
return;
@ -307,7 +307,7 @@ void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
MakeNotMember(&data);
SendToOne(&data, p);
}
else if(!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
else if (!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@ -315,8 +315,8 @@ void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
}
else
{
Player *newp = sObjectMgr.GetPlayer(p2n);
if(!newp)
Player* newp = sObjectMgr.GetPlayer(p2n);
if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@ -325,7 +325,7 @@ void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
}
PlayerInfo inf = m_players[newp->GetObjectGuid()];
if(p == m_ownerGuid && newp->GetObjectGuid() == m_ownerGuid && mod)
if (p == m_ownerGuid && newp->GetObjectGuid() == m_ownerGuid && mod)
return;
if (!IsOn(newp->GetObjectGuid()))
@ -338,8 +338,8 @@ void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
// allow make moderator from another team only if both is GMs
// at this moment this only way to show channel post for GM from another team
if( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) )
if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@ -347,7 +347,7 @@ void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
return;
}
if(m_ownerGuid == newp->GetObjectGuid() && m_ownerGuid != p)
if (m_ownerGuid == newp->GetObjectGuid() && m_ownerGuid != p)
{
WorldPacket data;
MakeNotOwner(&data);
@ -355,16 +355,16 @@ void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
return;
}
if(mod)
if (mod)
SetModerator(newp->GetObjectGuid(), set);
else
SetMute(newp->GetObjectGuid(), set);
}
}
void Channel::SetOwner(ObjectGuid p, const char *newname)
void Channel::SetOwner(ObjectGuid p, const char* newname)
{
Player *plr = sObjectMgr.GetPlayer(p);
Player* plr = sObjectMgr.GetPlayer(p);
if (!plr)
return;
@ -378,7 +378,7 @@ void Channel::SetOwner(ObjectGuid p, const char *newname)
return;
}
if(sec < SEC_GAMEMASTER && p != m_ownerGuid)
if (sec < SEC_GAMEMASTER && p != m_ownerGuid)
{
WorldPacket data;
MakeNotOwner(&data);
@ -386,7 +386,7 @@ void Channel::SetOwner(ObjectGuid p, const char *newname)
return;
}
Player *newp = sObjectMgr.GetPlayer(newname);
Player* newp = sObjectMgr.GetPlayer(newname);
if (newp == NULL || !IsOn(newp->GetObjectGuid()))
{
WorldPacket data;
@ -395,7 +395,7 @@ void Channel::SetOwner(ObjectGuid p, const char *newname)
return;
}
if(newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@ -446,14 +446,14 @@ void Channel::List(Player* player)
AccountTypes gmLevelInWhoList = (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_WHO_LIST);
uint32 count = 0;
for(PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
for (PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
{
Player *plr = sObjectMgr.GetPlayer(i->first);
Player* plr = sObjectMgr.GetPlayer(i->first);
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
plr->IsVisibleGloballyFor(player))
plr->IsVisibleGloballyFor(player))
{
data << ObjectGuid(i->first);
data << uint8(i->second.flags); // flags seems to be changed...
@ -470,8 +470,8 @@ void Channel::List(Player* player)
void Channel::Announce(ObjectGuid p)
{
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
if(plr)
Player* plr = sObjectMgr.GetPlayer(p);
if (plr)
sec = plr->GetSession()->GetSecurity();
if (!IsOn(p))
@ -491,7 +491,7 @@ void Channel::Announce(ObjectGuid p)
m_announce = !m_announce;
WorldPacket data;
if(m_announce)
if (m_announce)
MakeAnnouncementsOn(&data, p);
else
MakeAnnouncementsOff(&data, p);
@ -502,8 +502,8 @@ void Channel::Announce(ObjectGuid p)
void Channel::Moderate(ObjectGuid p)
{
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
if(plr)
Player* plr = sObjectMgr.GetPlayer(p);
if (plr)
sec = plr->GetSession()->GetSecurity();
if (!IsOn(p))
@ -523,7 +523,7 @@ void Channel::Moderate(ObjectGuid p)
m_moderate = !m_moderate;
WorldPacket data;
if(m_moderate)
if (m_moderate)
MakeModerationOn(&data, p);
else
MakeModerationOff(&data, p);
@ -531,7 +531,7 @@ void Channel::Moderate(ObjectGuid p)
}
}
void Channel::Say(ObjectGuid p, const char *what, uint32 lang)
void Channel::Say(ObjectGuid p, const char* what, uint32 lang)
{
if (!what)
return;
@ -539,8 +539,8 @@ void Channel::Say(ObjectGuid p, const char *what, uint32 lang)
lang = LANG_UNIVERSAL;
uint32 sec = 0;
Player *plr = sObjectMgr.GetPlayer(p);
if(plr)
Player* plr = sObjectMgr.GetPlayer(p);
if (plr)
sec = plr->GetSession()->GetSecurity();
if (!IsOn(p))
@ -580,7 +580,7 @@ void Channel::Say(ObjectGuid p, const char *what, uint32 lang)
}
}
void Channel::Invite(ObjectGuid p, const char *newname)
void Channel::Invite(ObjectGuid p, const char* newname)
{
if (!IsOn(p))
{
@ -590,8 +590,8 @@ void Channel::Invite(ObjectGuid p, const char *newname)
return;
}
Player *newp = sObjectMgr.GetPlayer(newname);
if(!newp)
Player* newp = sObjectMgr.GetPlayer(newname);
if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@ -599,7 +599,7 @@ void Channel::Invite(ObjectGuid p, const char *newname)
return;
}
Player *plr = sObjectMgr.GetPlayer(p);
Player* plr = sObjectMgr.GetPlayer(p);
if (!plr)
return;
@ -651,7 +651,7 @@ void Channel::SetOwner(ObjectGuid guid, bool exclaim)
MakeModeChange(&data, m_ownerGuid, oldFlag);
SendToAll(&data);
if(exclaim)
if (exclaim)
{
MakeOwnerChanged(&data, m_ownerGuid);
SendToAll(&data);
@ -659,17 +659,17 @@ void Channel::SetOwner(ObjectGuid guid, bool exclaim)
}
}
void Channel::SendToAll(WorldPacket *data, ObjectGuid p)
void Channel::SendToAll(WorldPacket* data, ObjectGuid p)
{
for(PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
if (Player *plr = sObjectMgr.GetPlayer(i->first))
for (PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
if (Player* plr = sObjectMgr.GetPlayer(i->first))
if (!p || !plr->GetSocial()->HasIgnore(p))
plr->GetSession()->SendPacket(data);
}
void Channel::SendToOne(WorldPacket *data, ObjectGuid who)
void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
{
if (Player *plr = ObjectMgr::GetPlayer(who))
if (Player* plr = ObjectMgr::GetPlayer(who))
plr->GetSession()->SendPacket(data);
}
@ -684,7 +684,7 @@ void Channel::DeVoice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
}
// done
void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type)
void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type)
{
data->Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1);
*data << uint8(notify_type);
@ -692,21 +692,21 @@ void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type)
}
// done 0x00
void Channel::MakeJoined(WorldPacket *data, ObjectGuid guid)
void Channel::MakeJoined(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x01
void Channel::MakeLeft(WorldPacket *data, ObjectGuid guid)
void Channel::MakeLeft(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x02
void Channel::MakeYouJoined(WorldPacket *data)
void Channel::MakeYouJoined(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_YOU_JOINED_NOTICE);
*data << uint8(GetFlags());
@ -715,7 +715,7 @@ void Channel::MakeYouJoined(WorldPacket *data)
}
// done 0x03
void Channel::MakeYouLeft(WorldPacket *data)
void Channel::MakeYouLeft(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE);
*data << uint32(GetChannelId());
@ -723,52 +723,52 @@ void Channel::MakeYouLeft(WorldPacket *data)
}
// done 0x04
void Channel::MakeWrongPassword(WorldPacket *data)
void Channel::MakeWrongPassword(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE);
}
// done 0x05
void Channel::MakeNotMember(WorldPacket *data)
void Channel::MakeNotMember(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE);
}
// done 0x06
void Channel::MakeNotModerator(WorldPacket *data)
void Channel::MakeNotModerator(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
}
// done 0x07
void Channel::MakePasswordChanged(WorldPacket *data, ObjectGuid guid)
void Channel::MakePasswordChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x08
void Channel::MakeOwnerChanged(WorldPacket *data, ObjectGuid guid)
void Channel::MakeOwnerChanged(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x09
void Channel::MakePlayerNotFound(WorldPacket *data, const std::string& name)
void Channel::MakePlayerNotFound(WorldPacket* data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE);
*data << name;
}
// done 0x0A
void Channel::MakeNotOwner(WorldPacket *data)
void Channel::MakeNotOwner(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE);
}
// done 0x0B
void Channel::MakeChannelOwner(WorldPacket *data)
void Channel::MakeChannelOwner(WorldPacket* data)
{
std::string name = "";
@ -780,7 +780,7 @@ void Channel::MakeChannelOwner(WorldPacket *data)
}
// done 0x0C
void Channel::MakeModeChange(WorldPacket *data, ObjectGuid guid, uint8 oldflags)
void Channel::MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags)
{
MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
*data << ObjectGuid(guid);
@ -789,41 +789,41 @@ void Channel::MakeModeChange(WorldPacket *data, ObjectGuid guid, uint8 oldflags)
}
// done 0x0D
void Channel::MakeAnnouncementsOn(WorldPacket *data, ObjectGuid guid)
void Channel::MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x0E
void Channel::MakeAnnouncementsOff(WorldPacket *data, ObjectGuid guid)
void Channel::MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x0F
void Channel::MakeModerationOn(WorldPacket *data, ObjectGuid guid)
void Channel::MakeModerationOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x10
void Channel::MakeModerationOff(WorldPacket *data, ObjectGuid guid)
void Channel::MakeModerationOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x11
void Channel::MakeMuted(WorldPacket *data)
void Channel::MakeMuted(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
}
// done 0x12
void Channel::MakePlayerKicked(WorldPacket *data, ObjectGuid bad, ObjectGuid good)
void Channel::MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
*data << ObjectGuid(bad);
@ -831,13 +831,13 @@ void Channel::MakePlayerKicked(WorldPacket *data, ObjectGuid bad, ObjectGuid goo
}
// done 0x13
void Channel::MakeBanned(WorldPacket *data)
void Channel::MakeBanned(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
}
// done 0x14
void Channel::MakePlayerBanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good)
void Channel::MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
*data << ObjectGuid(bad);
@ -845,7 +845,7 @@ void Channel::MakePlayerBanned(WorldPacket *data, ObjectGuid bad, ObjectGuid goo
}
// done 0x15
void Channel::MakePlayerUnbanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good)
void Channel::MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good)
{
MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
*data << ObjectGuid(bad);
@ -853,91 +853,91 @@ void Channel::MakePlayerUnbanned(WorldPacket *data, ObjectGuid bad, ObjectGuid g
}
// done 0x16
void Channel::MakePlayerNotBanned(WorldPacket *data, ObjectGuid guid)
void Channel::MakePlayerNotBanned(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
*data << ObjectGuid(guid); // should be string!!
}
// done 0x17
void Channel::MakePlayerAlreadyMember(WorldPacket *data, ObjectGuid guid)
void Channel::MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x18
void Channel::MakeInvite(WorldPacket *data, ObjectGuid guid)
void Channel::MakeInvite(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x19
void Channel::MakeInviteWrongFaction(WorldPacket *data)
void Channel::MakeInviteWrongFaction(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE);
}
// done 0x1A
void Channel::MakeWrongFaction(WorldPacket *data)
void Channel::MakeWrongFaction(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE);
}
// done 0x1B
void Channel::MakeInvalidName(WorldPacket *data)
void Channel::MakeInvalidName(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE);
}
// done 0x1C
void Channel::MakeNotModerated(WorldPacket *data)
void Channel::MakeNotModerated(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE);
}
// done 0x1D
void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name)
void Channel::MakePlayerInvited(WorldPacket* data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE);
*data << name;
}
// done 0x1E
void Channel::MakePlayerInviteBanned(WorldPacket *data, ObjectGuid guid)
void Channel::MakePlayerInviteBanned(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
*data << ObjectGuid(guid); // should be string!!
}
// done 0x1F
void Channel::MakeThrottled(WorldPacket *data)
void Channel::MakeThrottled(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE);
}
// done 0x20
void Channel::MakeNotInArea(WorldPacket *data)
void Channel::MakeNotInArea(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE);
}
// done 0x21
void Channel::MakeNotInLfg(WorldPacket *data)
void Channel::MakeNotInLfg(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
}
// done 0x22
void Channel::MakeVoiceOn(WorldPacket *data, ObjectGuid guid)
void Channel::MakeVoiceOn(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
*data << ObjectGuid(guid);
}
// done 0x23
void Channel::MakeVoiceOff(WorldPacket *data, ObjectGuid guid)
void Channel::MakeVoiceOff(WorldPacket* data, ObjectGuid guid)
{
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
*data << ObjectGuid(guid);

View file

@ -69,82 +69,82 @@ enum ChatNotify
CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels.
CHAT_VOICE_ON_NOTICE = 0x22, //+ "[%s] Channel voice enabled by %s.";
CHAT_VOICE_OFF_NOTICE = 0x23 //+ "[%s] Channel voice disabled by %s.";
// 0x24 enable voice?
// 0x24 enable voice?
};
class Channel
{
enum ChannelFlags
{
CHANNEL_FLAG_NONE = 0x00,
CHANNEL_FLAG_CUSTOM = 0x01,
// 0x02
CHANNEL_FLAG_TRADE = 0x04,
CHANNEL_FLAG_NOT_LFG = 0x08,
CHANNEL_FLAG_GENERAL = 0x10,
CHANNEL_FLAG_CITY = 0x20,
CHANNEL_FLAG_LFG = 0x40,
CHANNEL_FLAG_VOICE = 0x80
// General 0x18 = 0x10 | 0x08
// Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04
// LocalDefence 0x18 = 0x10 | 0x08
// GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08
// LookingForGroup 0x50 = 0x40 | 0x10
};
enum ChannelDBCFlags
{
CHANNEL_DBC_FLAG_NONE = 0x00000,
CHANNEL_DBC_FLAG_INITIAL = 0x00001, // General, Trade, LocalDefense, LFG
CHANNEL_DBC_FLAG_ZONE_DEP = 0x00002, // General, Trade, LocalDefense, GuildRecruitment
CHANNEL_DBC_FLAG_GLOBAL = 0x00004, // WorldDefense
CHANNEL_DBC_FLAG_TRADE = 0x00008, // Trade
CHANNEL_DBC_FLAG_CITY_ONLY = 0x00010, // Trade, GuildRecruitment
CHANNEL_DBC_FLAG_CITY_ONLY2 = 0x00020, // Trade, GuildRecruitment
CHANNEL_DBC_FLAG_DEFENSE = 0x10000, // LocalDefense, WorldDefense
CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment
CHANNEL_DBC_FLAG_LFG = 0x40000 // LookingForGroup
};
enum ChannelMemberFlags
{
MEMBER_FLAG_NONE = 0x00,
MEMBER_FLAG_OWNER = 0x01,
MEMBER_FLAG_MODERATOR = 0x02,
MEMBER_FLAG_VOICED = 0x04,
MEMBER_FLAG_MUTED = 0x08,
MEMBER_FLAG_CUSTOM = 0x10,
MEMBER_FLAG_MIC_MUTED = 0x20,
// 0x40
// 0x80
};
struct PlayerInfo
{
ObjectGuid player;
uint8 flags;
bool HasFlag(uint8 flag) { return flags & flag; }
void SetFlag(uint8 flag) { if(!HasFlag(flag)) flags |= flag; }
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
void SetOwner(bool state)
enum ChannelFlags
{
if(state) flags |= MEMBER_FLAG_OWNER;
else flags &= ~MEMBER_FLAG_OWNER;
}
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
void SetModerator(bool state)
CHANNEL_FLAG_NONE = 0x00,
CHANNEL_FLAG_CUSTOM = 0x01,
// 0x02
CHANNEL_FLAG_TRADE = 0x04,
CHANNEL_FLAG_NOT_LFG = 0x08,
CHANNEL_FLAG_GENERAL = 0x10,
CHANNEL_FLAG_CITY = 0x20,
CHANNEL_FLAG_LFG = 0x40,
CHANNEL_FLAG_VOICE = 0x80
// General 0x18 = 0x10 | 0x08
// Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04
// LocalDefence 0x18 = 0x10 | 0x08
// GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08
// LookingForGroup 0x50 = 0x40 | 0x10
};
enum ChannelDBCFlags
{
if(state) flags |= MEMBER_FLAG_MODERATOR;
else flags &= ~MEMBER_FLAG_MODERATOR;
}
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
void SetMuted(bool state)
CHANNEL_DBC_FLAG_NONE = 0x00000,
CHANNEL_DBC_FLAG_INITIAL = 0x00001, // General, Trade, LocalDefense, LFG
CHANNEL_DBC_FLAG_ZONE_DEP = 0x00002, // General, Trade, LocalDefense, GuildRecruitment
CHANNEL_DBC_FLAG_GLOBAL = 0x00004, // WorldDefense
CHANNEL_DBC_FLAG_TRADE = 0x00008, // Trade
CHANNEL_DBC_FLAG_CITY_ONLY = 0x00010, // Trade, GuildRecruitment
CHANNEL_DBC_FLAG_CITY_ONLY2 = 0x00020, // Trade, GuildRecruitment
CHANNEL_DBC_FLAG_DEFENSE = 0x10000, // LocalDefense, WorldDefense
CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment
CHANNEL_DBC_FLAG_LFG = 0x40000 // LookingForGroup
};
enum ChannelMemberFlags
{
if(state) flags |= MEMBER_FLAG_MUTED;
else flags &= ~MEMBER_FLAG_MUTED;
}
};
MEMBER_FLAG_NONE = 0x00,
MEMBER_FLAG_OWNER = 0x01,
MEMBER_FLAG_MODERATOR = 0x02,
MEMBER_FLAG_VOICED = 0x04,
MEMBER_FLAG_MUTED = 0x08,
MEMBER_FLAG_CUSTOM = 0x10,
MEMBER_FLAG_MIC_MUTED = 0x20,
// 0x40
// 0x80
};
struct PlayerInfo
{
ObjectGuid player;
uint8 flags;
bool HasFlag(uint8 flag) { return flags & flag; }
void SetFlag(uint8 flag) { if (!HasFlag(flag)) flags |= flag; }
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
void SetOwner(bool state)
{
if (state) flags |= MEMBER_FLAG_OWNER;
else flags &= ~MEMBER_FLAG_OWNER;
}
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
void SetModerator(bool state)
{
if (state) flags |= MEMBER_FLAG_MODERATOR;
else flags &= ~MEMBER_FLAG_MODERATOR;
}
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
void SetMuted(bool state)
{
if (state) flags |= MEMBER_FLAG_MUTED;
else flags &= ~MEMBER_FLAG_MUTED;
}
};
public:
Channel(const std::string& name, uint32 channel_id);
@ -160,26 +160,26 @@ class Channel
uint8 GetFlags() const { return m_flags; }
bool HasFlag(uint8 flag) { return m_flags & flag; }
void Join(ObjectGuid p, const char *pass);
void Join(ObjectGuid p, const char* pass);
void Leave(ObjectGuid p, bool send = true);
void KickOrBan(ObjectGuid good, const char *badname, bool ban);
void Kick(ObjectGuid good, const char *badname) { KickOrBan(good, badname, false); }
void Ban(ObjectGuid good, const char *badname) { KickOrBan(good, badname, true); }
void UnBan(ObjectGuid good, const char *badname);
void Password(ObjectGuid p, const char *pass);
void SetMode(ObjectGuid p, const char *p2n, bool mod, bool set);
void KickOrBan(ObjectGuid good, const char* badname, bool ban);
void Kick(ObjectGuid good, const char* badname) { KickOrBan(good, badname, false); }
void Ban(ObjectGuid good, const char* badname) { KickOrBan(good, badname, true); }
void UnBan(ObjectGuid good, const char* badname);
void Password(ObjectGuid p, const char* pass);
void SetMode(ObjectGuid p, const char* p2n, bool mod, bool set);
void SetOwner(ObjectGuid p, bool exclaim = true);
void SetOwner(ObjectGuid p, const char *newname);
void SetOwner(ObjectGuid p, const char* newname);
void SendWhoOwner(ObjectGuid p);
void SetModerator(ObjectGuid p, const char *newname) { SetMode(p, newname, true, true); }
void UnsetModerator(ObjectGuid p, const char *newname) { SetMode(p, newname, true, false); }
void SetMute(ObjectGuid p, const char *newname) { SetMode(p, newname, false, true); }
void UnsetMute(ObjectGuid p, const char *newname) { SetMode(p, newname, false, false); }
void SetModerator(ObjectGuid p, const char* newname) { SetMode(p, newname, true, true); }
void UnsetModerator(ObjectGuid p, const char* newname) { SetMode(p, newname, true, false); }
void SetMute(ObjectGuid p, const char* newname) { SetMode(p, newname, false, true); }
void UnsetMute(ObjectGuid p, const char* newname) { SetMode(p, newname, false, false); }
void List(Player* p);
void Announce(ObjectGuid p);
void Moderate(ObjectGuid p);
void Say(ObjectGuid p, const char *what, uint32 lang);
void Invite(ObjectGuid p, const char *newp);
void Say(ObjectGuid p, const char* what, uint32 lang);
void Invite(ObjectGuid p, const char* newp);
void Voice(ObjectGuid guid1, ObjectGuid guid2);
void DeVoice(ObjectGuid guid1, ObjectGuid guid2);
void JoinNotify(ObjectGuid guid); // invisible notify
@ -187,47 +187,47 @@ class Channel
private:
// initial packet data (notify type and channel name)
void MakeNotifyPacket(WorldPacket *data, uint8 notify_type);
void MakeNotifyPacket(WorldPacket* data, uint8 notify_type);
// type specific packet data
void MakeJoined(WorldPacket *data, ObjectGuid guid); //+ 0x00
void MakeLeft(WorldPacket *data, ObjectGuid guid); //+ 0x01
void MakeYouJoined(WorldPacket *data); //+ 0x02
void MakeYouLeft(WorldPacket *data); //+ 0x03
void MakeWrongPassword(WorldPacket *data); //? 0x04
void MakeNotMember(WorldPacket *data); //? 0x05
void MakeNotModerator(WorldPacket *data); //? 0x06
void MakePasswordChanged(WorldPacket *data, ObjectGuid guid); //+ 0x07
void MakeOwnerChanged(WorldPacket *data, ObjectGuid guid); //? 0x08
void MakePlayerNotFound(WorldPacket *data, const std::string& name); //+ 0x09
void MakeNotOwner(WorldPacket *data); //? 0x0A
void MakeChannelOwner(WorldPacket *data); //? 0x0B
void MakeModeChange(WorldPacket *data, ObjectGuid guid, uint8 oldflags);//+ 0x0C
void MakeAnnouncementsOn(WorldPacket *data, ObjectGuid guid); //+ 0x0D
void MakeAnnouncementsOff(WorldPacket *data, ObjectGuid guid); //+ 0x0E
void MakeModerationOn(WorldPacket *data, ObjectGuid guid); //+ 0x0F
void MakeModerationOff(WorldPacket *data, ObjectGuid guid); //+ 0x10
void MakeMuted(WorldPacket *data); //? 0x11
void MakePlayerKicked(WorldPacket *data, ObjectGuid bad, ObjectGuid good);//? 0x12
void MakeBanned(WorldPacket *data); //? 0x13
void MakePlayerBanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good);//? 0x14
void MakePlayerUnbanned(WorldPacket *data, ObjectGuid bad, ObjectGuid good);//? 0x15
void MakePlayerNotBanned(WorldPacket *data, ObjectGuid guid); //? 0x16
void MakePlayerAlreadyMember(WorldPacket *data, ObjectGuid guid); //+ 0x17
void MakeInvite(WorldPacket *data, ObjectGuid guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket *data); //? 0x19
void MakeWrongFaction(WorldPacket *data); //? 0x1A
void MakeInvalidName(WorldPacket *data); //? 0x1B
void MakeNotModerated(WorldPacket *data); //? 0x1C
void MakePlayerInvited(WorldPacket *data, const std::string& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket *data, ObjectGuid guid); //? 0x1E
void MakeThrottled(WorldPacket *data); //? 0x1F
void MakeNotInArea(WorldPacket *data); //? 0x20
void MakeNotInLfg(WorldPacket *data); //? 0x21
void MakeVoiceOn(WorldPacket *data, ObjectGuid guid); //+ 0x22
void MakeVoiceOff(WorldPacket *data, ObjectGuid guid); //+ 0x23
void MakeJoined(WorldPacket* data, ObjectGuid guid); //+ 0x00
void MakeLeft(WorldPacket* data, ObjectGuid guid); //+ 0x01
void MakeYouJoined(WorldPacket* data); //+ 0x02
void MakeYouLeft(WorldPacket* data); //+ 0x03
void MakeWrongPassword(WorldPacket* data); //? 0x04
void MakeNotMember(WorldPacket* data); //? 0x05
void MakeNotModerator(WorldPacket* data); //? 0x06
void MakePasswordChanged(WorldPacket* data, ObjectGuid guid); //+ 0x07
void MakeOwnerChanged(WorldPacket* data, ObjectGuid guid); //? 0x08
void MakePlayerNotFound(WorldPacket* data, const std::string& name); //+ 0x09
void MakeNotOwner(WorldPacket* data); //? 0x0A
void MakeChannelOwner(WorldPacket* data); //? 0x0B
void MakeModeChange(WorldPacket* data, ObjectGuid guid, uint8 oldflags);//+ 0x0C
void MakeAnnouncementsOn(WorldPacket* data, ObjectGuid guid); //+ 0x0D
void MakeAnnouncementsOff(WorldPacket* data, ObjectGuid guid); //+ 0x0E
void MakeModerationOn(WorldPacket* data, ObjectGuid guid); //+ 0x0F
void MakeModerationOff(WorldPacket* data, ObjectGuid guid); //+ 0x10
void MakeMuted(WorldPacket* data); //? 0x11
void MakePlayerKicked(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x12
void MakeBanned(WorldPacket* data); //? 0x13
void MakePlayerBanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x14
void MakePlayerUnbanned(WorldPacket* data, ObjectGuid bad, ObjectGuid good);//? 0x15
void MakePlayerNotBanned(WorldPacket* data, ObjectGuid guid); //? 0x16
void MakePlayerAlreadyMember(WorldPacket* data, ObjectGuid guid); //+ 0x17
void MakeInvite(WorldPacket* data, ObjectGuid guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
void MakeWrongFaction(WorldPacket* data); //? 0x1A
void MakeInvalidName(WorldPacket* data); //? 0x1B
void MakeNotModerated(WorldPacket* data); //? 0x1C
void MakePlayerInvited(WorldPacket* data, const std::string& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket* data, ObjectGuid guid); //? 0x1E
void MakeThrottled(WorldPacket* data); //? 0x1F
void MakeNotInArea(WorldPacket* data); //? 0x20
void MakeNotInLfg(WorldPacket* data); //? 0x21
void MakeVoiceOn(WorldPacket* data, ObjectGuid guid); //+ 0x22
void MakeVoiceOff(WorldPacket* data, ObjectGuid guid); //+ 0x23
void SendToAll(WorldPacket *data, ObjectGuid p = ObjectGuid());
void SendToOne(WorldPacket *data, ObjectGuid who);
void SendToAll(WorldPacket* data, ObjectGuid p = ObjectGuid());
void SendToOne(WorldPacket* data, ObjectGuid who);
bool IsOn(ObjectGuid who) const { return m_players.find(who) != m_players.end(); }
bool IsBanned(ObjectGuid guid) const { return m_banned.find(guid) != m_banned.end(); }

View file

@ -30,12 +30,12 @@ void WorldSession::HandleJoinChannelOpcode(WorldPacket& recvPacket)
recvPacket >> channel_id >> unknown1 >> unknown2;
recvPacket >> channelname;
if(channelname.empty())
if (channelname.empty())
return;
recvPacket >> pass;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetJoinChannel(channelname, channel_id))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
chn->Join(_player->GetObjectGuid(), pass.c_str());
}
@ -49,12 +49,12 @@ void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
recvPacket >> unk; // channel id?
recvPacket >> channelname;
if(channelname.empty())
if (channelname.empty())
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Leave(_player->GetObjectGuid(), true);
cMgr->LeftChannel(channelname);
}
@ -67,8 +67,8 @@ void WorldSession::HandleChannelListOpcode(WorldPacket& recvPacket)
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->List(_player);
}
@ -81,8 +81,8 @@ void WorldSession::HandleChannelPasswordOpcode(WorldPacket& recvPacket)
recvPacket >> pass;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Password(_player->GetObjectGuid(), pass.c_str());
}
@ -96,11 +96,11 @@ void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
recvPacket >> newp;
if(!normalizePlayerName(newp))
if (!normalizePlayerName(newp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->SetOwner(_player->GetObjectGuid(), newp.c_str());
}
@ -110,8 +110,8 @@ void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->SendWhoOwner(_player->GetObjectGuid());
}
@ -124,11 +124,11 @@ void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->SetModerator(_player->GetObjectGuid(), otp.c_str());
}
@ -141,11 +141,11 @@ void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->UnsetModerator(_player->GetObjectGuid(), otp.c_str());
}
@ -158,11 +158,11 @@ void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->SetMute(_player->GetObjectGuid(), otp.c_str());
}
@ -176,11 +176,11 @@ void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->UnsetMute(_player->GetObjectGuid(), otp.c_str());
}
@ -193,11 +193,11 @@ void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Invite(_player->GetObjectGuid(), otp.c_str());
}
@ -209,11 +209,11 @@ void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
recvPacket >> channelname;
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Kick(_player->GetObjectGuid(), otp.c_str());
}
@ -226,11 +226,11 @@ void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Ban(_player->GetObjectGuid(), otp.c_str());
}
@ -244,11 +244,11 @@ void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
recvPacket >> otp;
if(!normalizePlayerName(otp))
if (!normalizePlayerName(otp))
return;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->UnBan(_player->GetObjectGuid(), otp.c_str());
}
@ -258,8 +258,8 @@ void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Announce(_player->GetObjectGuid());
}
@ -269,31 +269,31 @@ void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->Moderate(_player->GetObjectGuid());
}
void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket &recvPacket)
void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("Opcode %u", recvPacket.GetOpcode());
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
chn->List(_player);
}
void WorldSession::HandleGetChannelMemberCountOpcode(WorldPacket &recvPacket)
void WorldSession::HandleGetChannelMemberCountOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("Opcode %u", recvPacket.GetOpcode());
//recvPacket.hexlike();
std::string channelname;
recvPacket >> channelname;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channelname, _player))
if (Channel* chn = cMgr->GetChannel(channelname, _player))
{
WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, chn->GetName().size()+1+1+4);
data << chn->GetName();
@ -304,7 +304,7 @@ void WorldSession::HandleGetChannelMemberCountOpcode(WorldPacket &recvPacket)
}
}
void WorldSession::HandleSetChannelWatchOpcode(WorldPacket &recvPacket)
void WorldSession::HandleSetChannelWatchOpcode(WorldPacket& recvPacket)
{
DEBUG_LOG("Opcode %u", recvPacket.GetOpcode());
//recvPacket.hexlike();

View file

@ -20,17 +20,17 @@
#include "Policies/SingletonImp.h"
#include "World.h"
INSTANTIATE_SINGLETON_1( AllianceChannelMgr );
INSTANTIATE_SINGLETON_1( HordeChannelMgr );
INSTANTIATE_SINGLETON_1(AllianceChannelMgr);
INSTANTIATE_SINGLETON_1(HordeChannelMgr);
ChannelMgr* channelMgr(Team team)
{
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
if(team == ALLIANCE)
if (team == ALLIANCE)
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance();
if(team == HORDE)
if (team == HORDE)
return &MaNGOS::Singleton<HordeChannelMgr>::Instance();
return NULL;
@ -38,13 +38,13 @@ ChannelMgr* channelMgr(Team team)
ChannelMgr::~ChannelMgr()
{
for(ChannelMap::iterator itr = channels.begin();itr!=channels.end(); ++itr)
for (ChannelMap::iterator itr = channels.begin(); itr!=channels.end(); ++itr)
delete itr->second;
channels.clear();
}
Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id)
Channel* ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id)
{
std::wstring wname;
Utf8toWStr(name,wname);
@ -52,7 +52,7 @@ Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id)
if (channels.find(wname) == channels.end())
{
Channel *nchan = new Channel(name,channel_id);
Channel* nchan = new Channel(name,channel_id);
channels[wname] = nchan;
return nchan;
}
@ -60,7 +60,7 @@ Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id)
return channels[wname];
}
Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt)
Channel* ChannelMgr::GetChannel(std::string name, Player* p, bool pkt)
{
std::wstring wname;
Utf8toWStr(name,wname);
@ -68,9 +68,9 @@ Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt)
ChannelMap::const_iterator i = channels.find(wname);
if(i == channels.end())
if (i == channels.end())
{
if(pkt)
if (pkt)
{
WorldPacket data;
MakeNotOnPacket(&data,name);
@ -91,19 +91,19 @@ void ChannelMgr::LeftChannel(std::string name)
ChannelMap::const_iterator i = channels.find(wname);
if(i == channels.end())
if (i == channels.end())
return;
Channel* channel = i->second;
if(channel->GetNumPlayers() == 0 && !channel->IsConstant())
if (channel->GetNumPlayers() == 0 && !channel->IsConstant())
{
channels.erase(wname);
delete channel;
}
}
void ChannelMgr::MakeNotOnPacket(WorldPacket *data, std::string name)
void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string name)
{
data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size
(*data) << (uint8)CHAT_NOT_MEMBER_NOTICE << name;

View file

@ -32,12 +32,12 @@ class ChannelMgr
ChannelMgr() {}
~ChannelMgr();
Channel *GetJoinChannel(std::string name, uint32 channel_id);
Channel *GetChannel(std::string name, Player *p, bool pkt = true);
Channel* GetJoinChannel(std::string name, uint32 channel_id);
Channel* GetChannel(std::string name, Player* p, bool pkt = true);
void LeftChannel(std::string name);
private:
ChannelMap channels;
void MakeNotOnPacket(WorldPacket *data, std::string name);
void MakeNotOnPacket(WorldPacket* data, std::string name);
};
class AllianceChannelMgr : public ChannelMgr {};

View file

@ -26,26 +26,26 @@
void CharacterDatabaseCleaner::CleanDatabase()
{
// config to disable
if(!sWorld.getConfig(CONFIG_BOOL_CLEAN_CHARACTER_DB))
if (!sWorld.getConfig(CONFIG_BOOL_CLEAN_CHARACTER_DB))
return;
sLog.outString("Cleaning character database...");
// check flags which clean ups are necessary
QueryResult* result = CharacterDatabase.PQuery("SELECT cleaning_flags FROM saved_variables");
if(!result)
if (!result)
return;
uint32 flags = (*result)[0].GetUInt32();
delete result;
// clean up
if(flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
CleanCharacterAchievementProgress();
if(flags & CLEANING_FLAG_SKILLS)
if (flags & CLEANING_FLAG_SKILLS)
CleanCharacterSkills();
if(flags & CLEANING_FLAG_SPELLS)
if (flags & CLEANING_FLAG_SPELLS)
CleanCharacterSpell();
if(flags & CLEANING_FLAG_TALENTS)
if (flags & CLEANING_FLAG_TALENTS)
CleanCharacterTalent();
CharacterDatabase.Execute("UPDATE saved_variables SET cleaning_flags = 0");
}
@ -53,9 +53,9 @@ void CharacterDatabaseCleaner::CleanDatabase()
void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32))
{
QueryResult* result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table);
if(!result)
if (!result)
{
sLog.outString( "Table %s is empty.", table );
sLog.outString("Table %s is empty.", table);
return;
}
@ -66,7 +66,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
{
bar.step();
Field *fields = result->Fetch();
Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32();
@ -88,7 +88,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
if (found)
{
ss << ")";
CharacterDatabase.Execute( ss.str().c_str() );
CharacterDatabase.Execute(ss.str().c_str());
}
}
@ -124,11 +124,11 @@ void CharacterDatabaseCleaner::CleanCharacterSpell()
bool CharacterDatabaseCleaner::TalentCheck(uint32 talent_id)
{
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id );
if(!talentInfo)
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talent_id);
if (!talentInfo)
return false;
return sTalentTabStore.LookupEntry( talentInfo->TalentTab );
return sTalentTabStore.LookupEntry(talentInfo->TalentTab);
}
void CharacterDatabaseCleaner::CleanCharacterTalent()

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -47,12 +47,12 @@ class Unit;
class ChatCommand
{
public:
const char * Name;
const char* Name;
uint32 SecurityLevel; // function pointer required correct align (use uint32)
bool AllowConsole;
bool (ChatHandler::*Handler)(char* args);
std::string Help;
ChatCommand * ChildCommands;
ChatCommand* ChildCommands;
};
enum ChatCommandSearchResult
@ -69,34 +69,34 @@ class MANGOS_DLL_SPEC ChatHandler
explicit ChatHandler(Player* player);
~ChatHandler();
static void FillMessageData( WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, ObjectGuid targetGuid, const char *message, Unit *speaker);
static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char* channelName, ObjectGuid targetGuid, const char* message, Unit* speaker);
static void FillMessageData( WorldPacket *data, WorldSession* session, uint8 type, uint32 language, ObjectGuid targetGuid, const char* message)
static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, ObjectGuid targetGuid, const char* message)
{
FillMessageData( data, session, type, language, NULL, targetGuid, message, NULL);
FillMessageData(data, session, type, language, NULL, targetGuid, message, NULL);
}
static void FillMessageData( WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char* message)
static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char* message)
{
FillMessageData( data, session, type, language, NULL, ObjectGuid(), message, NULL);
FillMessageData(data, session, type, language, NULL, ObjectGuid(), message, NULL);
}
void FillSystemMessageData( WorldPacket *data, const char* message )
void FillSystemMessageData(WorldPacket* data, const char* message)
{
FillMessageData( data, m_session, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, ObjectGuid(), message );
FillMessageData(data, m_session, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, ObjectGuid(), message);
}
static char* LineFromMessage(char*& pos) { char* start = strtok(pos,"\n"); pos = NULL; return start; }
// function with different implementation for chat/console
virtual const char *GetMangosString(int32 entry) const;
const char *GetOnOffStr(bool value) const;
virtual const char* GetMangosString(int32 entry) const;
const char* GetOnOffStr(bool value) const;
virtual void SendSysMessage( const char *str);
virtual void SendSysMessage(const char* str);
void SendSysMessage( int32 entry);
void PSendSysMessage( const char *format, ...) ATTR_PRINTF(2,3);
void PSendSysMessage( int32 entry, ... );
void SendSysMessage(int32 entry);
void PSendSysMessage(const char* format, ...) ATTR_PRINTF(2,3);
void PSendSysMessage(int32 entry, ...);
bool ParseCommands(const char* text);
ChatCommand const* FindCommand(char const* text);
@ -120,17 +120,17 @@ class MANGOS_DLL_SPEC ChatHandler
bool HasLowerSecurity(Player* target, ObjectGuid guid = ObjectGuid(), bool strong = false);
bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false);
void SendGlobalSysMessage(const char *str);
void SendGlobalSysMessage(const char* str);
bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help);
bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help);
void ExecuteCommand(const char* text);
void LogCommand(char const* fullcmd);
bool ShowHelpForCommand(ChatCommand *table, const char* cmd);
bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd);
bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd);
ChatCommandSearchResult FindCommand(ChatCommand* table, char const*& text, ChatCommand*& command, ChatCommand** parentCommand = NULL, std::string* cmdNamePtr = NULL, bool allAvailable = false, bool exactlyName = false);
void CheckIntegrity(ChatCommand *table, ChatCommand *parentCommand);
void CheckIntegrity(ChatCommand* table, ChatCommand* parentCommand);
ChatCommand* getCommandTable();
bool HandleAccountCommand(char* args);
@ -622,13 +622,13 @@ class MANGOS_DLL_SPEC ChatHandler
bool ExtractFloat(char** args, float& val);
bool ExtractOptFloat(char** args, float& val, float defVal);
char* ExtractQuotedArg(char** args, bool asis = false);
// string with " or [] or ' around
// string with " or [] or ' around
char* ExtractLiteralArg(char** args, char const* lit = NULL);
// literal string (until whitespace and not started from "['|), any or 'lit' if provided
// literal string (until whitespace and not started from "['|), any or 'lit' if provided
char* ExtractQuotedOrLiteralArg(char** args, bool asis = false);
bool ExtractOnOff(char** args, bool& value);
char* ExtractLinkArg(char** args, char const* const* linkTypes = NULL, int* foundIdx = NULL, char** keyPair = NULL, char** somethingPair = NULL);
// shift-link like arg (with aditional info if need)
// shift-link like arg (with aditional info if need)
char* ExtractArg(char** args, bool asis = false); // any name/number/quote/shift-link strings
char* ExtractOptNotLastArg(char** args); // extract name/number/quote/shift-link arg only if more data in args for parse
@ -644,7 +644,7 @@ class MANGOS_DLL_SPEC ChatHandler
bool ExtractRaceMask(char** text, uint32& raceMask, char const** maskName = NULL);
std::string ExtractPlayerNameFromLink(char** text);
bool ExtractPlayerTarget(char** args, Player** player, ObjectGuid* player_guid = NULL, std::string* player_name = NULL);
// select by arg (name/link) or in-game selection online/offline player
// select by arg (name/link) or in-game selection online/offline player
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
std::string GetNameLink(Player* chr) const;
@ -653,16 +653,16 @@ class MANGOS_DLL_SPEC ChatHandler
// Utility methods for commands
bool ShowAccountListHelper(QueryResult* result, uint32* limit = NULL, bool title = true, bool error = true);
void ShowAchievementListHelper(AchievementEntry const * achEntry, LocaleConstant loc, time_t const* date = NULL, Player* target = NULL);
void ShowAchievementCriteriaListHelper(AchievementCriteriaEntry const* criEntry, AchievementEntry const * achEntry, LocaleConstant loc, Player* target = NULL);
void ShowFactionListHelper(FactionEntry const * factionEntry, LocaleConstant loc, FactionState const* repState = NULL, Player * target = NULL );
void ShowAchievementListHelper(AchievementEntry const* achEntry, LocaleConstant loc, time_t const* date = NULL, Player* target = NULL);
void ShowAchievementCriteriaListHelper(AchievementCriteriaEntry const* criEntry, AchievementEntry const* achEntry, LocaleConstant loc, Player* target = NULL);
void ShowFactionListHelper(FactionEntry const* factionEntry, LocaleConstant loc, FactionState const* repState = NULL, Player* target = NULL);
void ShowItemListHelper(uint32 itemId, int loc_idx, Player* target = NULL);
void ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* target = NULL);
bool ShowPlayerListHelper(QueryResult* result, uint32* limit = NULL, bool title = true, bool error = true);
void ShowSpellListHelper(Player* target, SpellEntry const* spellInfo, LocaleConstant loc);
void ShowPoolListHelper(uint16 pool_id);
void ShowTicket(GMTicket const* ticket);
void ShowTriggerListHelper(AreaTriggerEntry const * atEntry);
void ShowTriggerListHelper(AreaTriggerEntry const* atEntry);
void ShowTriggerTargetListHelper(uint32 id, AreaTrigger const* at, bool subpart = false);
bool LookupPlayerSearchCommand(QueryResult* result, uint32* limit = NULL);
bool HandleBanListHelper(QueryResult* result);
@ -703,9 +703,9 @@ class MANGOS_DLL_SPEC ChatHandler
void HandleCharacterDeletedListHelper(DeletedInfoList const& foundList);
void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo);
void SetSentErrorMessage(bool val){ sentErrorMessage = val;};
void SetSentErrorMessage(bool val) { sentErrorMessage = val;};
private:
WorldSession * m_session; // != NULL for chat command call and NULL for CLI command
WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
// common global flag
static bool load_command_table;
@ -720,11 +720,11 @@ class CliHandler : public ChatHandler
: m_accountId(accountId), m_loginAccessLevel(accessLevel), m_callbackArg(callbackArg), m_print(zprint) {}
// overwrite functions
const char *GetMangosString(int32 entry) const;
const char* GetMangosString(int32 entry) const;
uint32 GetAccountId() const;
AccountTypes GetAccessLevel() const;
bool isAvailable(ChatCommand const& cmd) const;
void SendSysMessage(const char *str);
void SendSysMessage(const char* str);
std::string GetNameLink() const;
bool needReportToTarget(Player* chr) const;
LocaleConstant GetSessionDbcLocale() const;

View file

@ -41,14 +41,14 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
if (lang != LANG_ADDON)
{
// strip invisible characters for non-addon messages
if(sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
if (sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
stripLineInvisibleChars(msg);
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
&& !ChatHandler(this).isValidChatMessage(msg.c_str()))
{
sLog.outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
GetPlayer()->GetGUIDLow(), msg.c_str());
GetPlayer()->GetGUIDLow(), msg.c_str());
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK))
KickPlayer();
return false;
@ -58,7 +58,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
return true;
}
void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
{
uint32 type;
uint32 lang;
@ -66,45 +66,45 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
recv_data >> type;
recv_data >> lang;
if(type >= MAX_CHAT_MSG_TYPE)
if (type >= MAX_CHAT_MSG_TYPE)
{
sLog.outError("CHAT: Wrong message type received: %u", type);
return;
}
DEBUG_LOG("CHAT: packet received. type %u, lang %u", type, lang );
DEBUG_LOG("CHAT: packet received. type %u, lang %u", type, lang);
// prevent talking at unknown language (cheating)
LanguageDesc const* langDesc = GetLanguageDescByID(lang);
if(!langDesc)
if (!langDesc)
{
SendNotification(LANG_UNKNOWN_LANGUAGE);
return;
}
if(langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
if (langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
{
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
Unit::AuraList const& langAuras = _player->GetAurasByType(SPELL_AURA_COMPREHEND_LANGUAGE);
bool foundAura = false;
for(Unit::AuraList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)
for (Unit::AuraList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)
{
if((*i)->GetModifier()->m_miscvalue == int32(lang))
if ((*i)->GetModifier()->m_miscvalue == int32(lang))
{
foundAura = true;
break;
}
}
if(!foundAura)
if (!foundAura)
{
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
return;
}
}
if(lang == LANG_ADDON)
if (lang == LANG_ADDON)
{
// Disabled addon channel?
if(!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
return;
}
// LANG_ADDON should not be changed nor be affected by flood control
@ -120,20 +120,20 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
lang = LANG_UNIVERSAL;
else
{
switch(type)
switch (type)
{
case CHAT_MSG_PARTY:
case CHAT_MSG_RAID:
case CHAT_MSG_RAID_LEADER:
case CHAT_MSG_RAID_WARNING:
// allow two side chat at group channel if two side group allowed
if(sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))
lang = LANG_UNIVERSAL;
break;
case CHAT_MSG_GUILD:
case CHAT_MSG_OFFICER:
// allow two side chat at guild channel if two side guild allowed
if(sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))
lang = LANG_UNIVERSAL;
break;
}
@ -141,7 +141,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
Unit::AuraList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
if(!ModLangAuras.empty())
if (!ModLangAuras.empty())
lang = ModLangAuras.front()->GetModifier()->m_miscvalue;
}
@ -158,7 +158,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
}
}
switch(type)
switch (type)
{
case CHAT_MSG_SAY:
case CHAT_MSG_EMOTE:
@ -167,7 +167,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()))
@ -176,14 +176,14 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if(type == CHAT_MSG_SAY)
if (type == CHAT_MSG_SAY)
GetPlayer()->Say(msg, lang);
else if(type == CHAT_MSG_EMOTE)
else if (type == CHAT_MSG_EMOTE)
GetPlayer()->TextEmote(msg);
else if(type == CHAT_MSG_YELL)
else if (type == CHAT_MSG_YELL)
GetPlayer()->Yell(msg, lang);
} break;
@ -196,16 +196,16 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if(!normalizePlayerName(to))
if (!normalizePlayerName(to))
{
SendPlayerNotFoundNotice(to);
break;
}
Player *player = sObjectMgr.GetPlayer(to.c_str());
Player* player = sObjectMgr.GetPlayer(to.c_str());
uint32 tSecurity = GetSecurity();
uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER;
if (!player || (tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers()))
@ -214,7 +214,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
return;
}
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER )
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER)
{
if (GetPlayer()->GetTeam() != player->GetTeam())
{
@ -232,7 +232,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()))
@ -241,15 +241,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /p
Group *group = GetPlayer()->GetOriginalGroup();
if(!group)
Group* group = GetPlayer()->GetOriginalGroup();
if (!group)
{
group = _player->GetGroup();
if(!group || group->isBGGroup())
if (!group || group->isBGGroup())
return;
}
@ -267,7 +267,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()))
@ -276,7 +276,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if (GetPlayer()->GetGuildId())
@ -290,7 +290,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()))
@ -299,7 +299,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if (GetPlayer()->GetGuildId())
@ -313,7 +313,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()))
@ -322,15 +322,15 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup();
if(!group)
Group* group = GetPlayer()->GetOriginalGroup();
if (!group)
{
group = GetPlayer()->GetGroup();
if(!group || group->isBGGroup() || !group->isRaidGroup())
if (!group || group->isBGGroup() || !group->isRaidGroup())
return;
}
@ -343,7 +343,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg;
recv_data >> msg;
if(msg.empty())
if (msg.empty())
break;
if (ChatHandler(this).ParseCommands(msg.c_str()))
@ -352,11 +352,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// if player is in battleground, he cannot say to battleground members by /ra
Group *group = GetPlayer()->GetOriginalGroup();
Group* group = GetPlayer()->GetOriginalGroup();
if (!group)
{
group = GetPlayer()->GetGroup();
@ -377,12 +377,12 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
Group *group = GetPlayer()->GetGroup();
Group* group = GetPlayer()->GetGroup();
if (!group || !group->isRaidGroup() ||
!(group->IsLeader(GetPlayer()->GetObjectGuid()) || group->IsAssistant(GetPlayer()->GetObjectGuid())))
!(group->IsLeader(GetPlayer()->GetObjectGuid()) || group->IsAssistant(GetPlayer()->GetObjectGuid())))
return;
WorldPacket data;
@ -399,12 +399,12 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group *group = GetPlayer()->GetGroup();
if(!group || !group->isBGGroup())
Group* group = GetPlayer()->GetGroup();
if (!group || !group->isBGGroup())
return;
WorldPacket data;
@ -420,11 +420,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
Group *group = GetPlayer()->GetGroup();
Group* group = GetPlayer()->GetGroup();
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetObjectGuid()))
return;
@ -442,11 +442,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
if(msg.empty())
if (msg.empty())
break;
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channel, _player))
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channel, _player))
chn->Say(_player->GetObjectGuid(), msg.c_str(), lang);
} break;
@ -506,9 +506,9 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
}
}
void WorldSession::HandleEmoteOpcode( WorldPacket & recv_data )
void WorldSession::HandleEmoteOpcode(WorldPacket& recv_data)
{
if(!GetPlayer()->isAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
if (!GetPlayer()->isAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
return;
uint32 emote;
@ -548,9 +548,9 @@ namespace MaNGOS
};
} // namespace MaNGOS
void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
{
if(!GetPlayer()->isAlive())
if (!GetPlayer()->isAlive())
return;
if (!GetPlayer()->CanSpeak())
@ -567,13 +567,13 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
recv_data >> emoteNum;
recv_data >> guid;
EmotesTextEntry const *em = sEmotesTextStore.LookupEntry(text_emote);
EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote);
if (!em)
return;
uint32 emote_id = em->textid;
switch(emote_id)
switch (emote_id)
{
case EMOTE_STATE_SLEEP:
case EMOTE_STATE_SIT:
@ -605,7 +605,7 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote);
}
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
{
ObjectGuid iguid;
uint8 unk;
@ -614,8 +614,8 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
recv_data >> iguid;
recv_data >> unk; // probably related to spam reporting
Player *player = sObjectMgr.GetPlayer(iguid);
if(!player || !player->GetSession())
Player* player = sObjectMgr.GetPlayer(iguid);
if (!player || !player->GetSession())
return;
WorldPacket data;

View file

@ -24,40 +24,40 @@
#include "ObjectGuid.h"
#include "Player.h"
void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
void WorldSession::HandleAttackSwingOpcode(WorldPacket& recv_data)
{
ObjectGuid guid;
recv_data >> guid;
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str());
if(!guid.IsUnit())
if (!guid.IsUnit())
{
sLog.outError("WORLD: %s isn't unit", guid.GetString().c_str());
return;
}
Unit *pEnemy = _player->GetMap()->GetUnit(guid);
Unit* pEnemy = _player->GetMap()->GetUnit(guid);
if(!pEnemy)
if (!pEnemy)
{
sLog.outError( "WORLD: Enemy %s not found", guid.GetString().c_str());
sLog.outError("WORLD: Enemy %s not found", guid.GetString().c_str());
// stop attack state at client
SendAttackStop(NULL);
return;
}
if(_player->IsFriendlyTo(pEnemy) || pEnemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
if (_player->IsFriendlyTo(pEnemy) || pEnemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
{
sLog.outError( "WORLD: Enemy %s is friendly",guid.GetString().c_str());
sLog.outError("WORLD: Enemy %s is friendly",guid.GetString().c_str());
// stop attack state at client
SendAttackStop(pEnemy);
return;
}
if(!pEnemy->isAlive())
if (!pEnemy->isAlive())
{
// client can generate swing to known dead target if autoswitch between autoshot and autohit is enabled in client options
// stop attack state at client
@ -68,19 +68,19 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
_player->Attack(pEnemy,true);
}
void WorldSession::HandleAttackStopOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleAttackStopOpcode(WorldPacket& /*recv_data*/)
{
GetPlayer()->AttackStop();
}
void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
void WorldSession::HandleSetSheathedOpcode(WorldPacket& recv_data)
{
uint32 sheathed;
recv_data >> sheathed;
//DEBUG_LOG( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed );
if(sheathed >= MAX_SHEATH_STATE)
if (sheathed >= MAX_SHEATH_STATE)
{
sLog.outError("Unknown sheath state %u ??",sheathed);
return;
@ -91,7 +91,7 @@ void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
void WorldSession::SendAttackStop(Unit const* enemy)
{
WorldPacket data( SMSG_ATTACKSTOP, (4+20) ); // we guess size
WorldPacket data(SMSG_ATTACKSTOP, (4+20)); // we guess size
data << GetPlayer()->GetPackGUID();
data << (enemy ? enemy->GetPackGUID() : PackedGuid()); // must be packed guid
data << uint32(0); // unk, can be 1 also

View file

@ -25,7 +25,7 @@
#include "PathFinder.h"
template<class T>
void ConfusedMovementGenerator<T>::Initialize(T &unit)
void ConfusedMovementGenerator<T>::Initialize(T& unit)
{
// set initial position
unit.GetPosition(i_x, i_y, i_z);
@ -35,14 +35,14 @@ void ConfusedMovementGenerator<T>::Initialize(T &unit)
}
template<class T>
void ConfusedMovementGenerator<T>::Interrupt(T &unit)
void ConfusedMovementGenerator<T>::Interrupt(T& unit)
{
// confused state still applied while movegen disabled
unit.clearUnitState(UNIT_STAT_CONFUSED_MOVE);
}
template<class T>
void ConfusedMovementGenerator<T>::Reset(T &unit)
void ConfusedMovementGenerator<T>::Reset(T& unit)
{
i_nextMoveTime.Reset(0);
unit.StopMoving();
@ -50,7 +50,7 @@ void ConfusedMovementGenerator<T>::Reset(T &unit)
}
template<class T>
bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
bool ConfusedMovementGenerator<T>::Update(T& unit, const uint32& diff)
{
// ignore in case other no reaction state
if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT & ~UNIT_STAT_CONFUSED))
@ -68,7 +68,7 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
// waiting for next move
i_nextMoveTime.Update(diff);
if(i_nextMoveTime.Passed() )
if (i_nextMoveTime.Passed())
{
// start moving
unit.addUnitState(UNIT_STAT_CONFUSED_MOVE);
@ -82,7 +82,7 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
PathFinder path(&unit);
path.setPathLengthLimit(30.0f);
path.calculate(x, y, z);
if(path.getPathType() & PATHFIND_NOPATH)
if (path.getPathType() & PATHFIND_NOPATH)
{
i_nextMoveTime.Reset(urand(800, 1000));
return true;
@ -99,23 +99,23 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
}
template<>
void ConfusedMovementGenerator<Player>::Finalize(Player &unit)
void ConfusedMovementGenerator<Player>::Finalize(Player& unit)
{
unit.clearUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_CONFUSED_MOVE);
unit.StopMoving();
}
template<>
void ConfusedMovementGenerator<Creature>::Finalize(Creature &unit)
void ConfusedMovementGenerator<Creature>::Finalize(Creature& unit)
{
unit.clearUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_CONFUSED_MOVE);
}
template void ConfusedMovementGenerator<Player>::Initialize(Player &player);
template void ConfusedMovementGenerator<Creature>::Initialize(Creature &creature);
template void ConfusedMovementGenerator<Player>::Interrupt(Player &player);
template void ConfusedMovementGenerator<Creature>::Interrupt(Creature &creature);
template void ConfusedMovementGenerator<Player>::Reset(Player &player);
template void ConfusedMovementGenerator<Creature>::Reset(Creature &creature);
template bool ConfusedMovementGenerator<Player>::Update(Player &player, const uint32 &diff);
template bool ConfusedMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff);
template void ConfusedMovementGenerator<Player>::Initialize(Player& player);
template void ConfusedMovementGenerator<Creature>::Initialize(Creature& creature);
template void ConfusedMovementGenerator<Player>::Interrupt(Player& player);
template void ConfusedMovementGenerator<Creature>::Interrupt(Creature& creature);
template void ConfusedMovementGenerator<Player>::Reset(Player& player);
template void ConfusedMovementGenerator<Creature>::Reset(Creature& creature);
template bool ConfusedMovementGenerator<Player>::Update(Player& player, const uint32& diff);
template bool ConfusedMovementGenerator<Creature>::Update(Creature& creature, const uint32& diff);

View file

@ -24,16 +24,16 @@
template<class T>
class MANGOS_DLL_SPEC ConfusedMovementGenerator
: public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> >
: public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> >
{
public:
explicit ConfusedMovementGenerator() : i_nextMoveTime(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 CONFUSED_MOTION_TYPE; }
private:

View file

@ -50,7 +50,7 @@ Corpse::~Corpse()
void Corpse::AddToWorld()
{
///- Register the corpse for guid lookup
if(!IsInWorld())
if (!IsInWorld())
sObjectAccessor.AddObject(this);
Object::AddToWorld();
@ -59,19 +59,19 @@ void Corpse::AddToWorld()
void Corpse::RemoveFromWorld()
{
///- Remove the corpse from the accessor
if(IsInWorld())
if (IsInWorld())
sObjectAccessor.RemoveObject(this);
Object::RemoveFromWorld();
}
bool Corpse::Create( uint32 guidlow )
bool Corpse::Create(uint32 guidlow)
{
Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
return true;
}
bool Corpse::Create( uint32 guidlow, Player *owner)
bool Corpse::Create(uint32 guidlow, Player* owner)
{
MANGOS_ASSERT(owner);
@ -82,10 +82,10 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
//in other way we will get a crash in Corpse::SaveToDB()
SetMap(owner->GetMap());
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
return false;
}
@ -119,7 +119,7 @@ void Corpse::SaveToDB()
<< uint32(GetType()) << ", "
<< int(GetInstanceId()) << ", "
<< uint16(GetPhaseMask()) << ")"; // prevent out of range error
CharacterDatabase.Execute( ss.str().c_str() );
CharacterDatabase.Execute(ss.str().c_str());
CharacterDatabase.CommitTransaction();
}
@ -149,7 +149,7 @@ void Corpse::DeleteFromDB()
stmt.PExecute(GetOwnerGuid().GetCounter());
}
bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
bool Corpse::LoadFromDB(uint32 lowguid, Field* fields)
{
//// 0 1 2 3 4 5 6
//QueryResult *result = CharacterDatabase.Query("SELECT corpse.guid, player, corpse.position_x, corpse.position_y, corpse.position_z, corpse.orientation, corpse.map,"
@ -167,7 +167,7 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
m_time = time_t(fields[7].GetUInt64());
m_type = CorpseType(fields[8].GetUInt32());
if(m_type >= MAX_CORPSE_TYPE)
if (m_type >= MAX_CORPSE_TYPE)
{
sLog.outError("%s Owner %s have wrong corpse type (%i), not load.", GetGuidStr().c_str(), GetOwnerGuid().GetString().c_str(), m_type);
return false;
@ -192,8 +192,8 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
SetObjectScale(DEFAULT_OBJECT_SCALE);
PlayerInfo const *info = sObjectMgr.GetPlayerInfo(race, _class);
if(!info)
PlayerInfo const* info = sObjectMgr.GetPlayerInfo(race, _class);
if (!info)
{
sLog.outError("Player %u has incorrect race/class pair.", GetGUIDLow());
return false;
@ -206,8 +206,8 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
{
uint32 visualbase = slot * 2;
uint32 item_id = GetUInt32ValueFromArray(data, visualbase);
const ItemPrototype * proto = ObjectMgr::GetItemPrototype(item_id);
if(!proto)
const ItemPrototype* proto = ObjectMgr::GetItemPrototype(item_id);
if (!proto)
{
SetUInt32Value(CORPSE_FIELD_ITEM + slot, 0);
continue;
@ -221,17 +221,17 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
uint8 hairstyle = (uint8)(playerBytes >> 16);
uint8 haircolor = (uint8)(playerBytes >> 24);
uint8 facialhair = (uint8)(playerBytes2);
SetUInt32Value( CORPSE_FIELD_BYTES_1, ((0x00) | (race << 8) | (gender << 16) | (skin << 24)) );
SetUInt32Value( CORPSE_FIELD_BYTES_2, ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24)) );
SetUInt32Value(CORPSE_FIELD_BYTES_1, ((0x00) | (race << 8) | (gender << 16) | (skin << 24)));
SetUInt32Value(CORPSE_FIELD_BYTES_2, ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24)));
SetUInt32Value(CORPSE_FIELD_GUILD, guildId);
uint32 flags = CORPSE_FLAG_UNK2;
if(playerFlags & PLAYER_FLAGS_HIDE_HELM)
if (playerFlags & PLAYER_FLAGS_HIDE_HELM)
flags |= CORPSE_FLAG_HIDE_HELM;
if(playerFlags & PLAYER_FLAGS_HIDE_CLOAK)
if (playerFlags & PLAYER_FLAGS_HIDE_CLOAK)
flags |= CORPSE_FLAG_HIDE_CLOAK;
SetUInt32Value( CORPSE_FIELD_FLAGS, flags );
SetUInt32Value(CORPSE_FIELD_FLAGS, flags);
// no need to mark corpse as lootable, because corpses are not saved in battle grounds
@ -241,10 +241,10 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
SetPhaseMask(phaseMask, false);
Relocate(positionX, positionY, positionZ, orientation);
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("%s Owner %s not created. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGuidStr().c_str(), GetOwnerGuid().GetString().c_str(), GetPositionX(), GetPositionY());
GetGuidStr().c_str(), GetOwnerGuid().GetString().c_str(), GetPositionX(), GetPositionY());
return false;
}
@ -258,7 +258,7 @@ bool Corpse::isVisibleForInState(Player const* u, WorldObject const* viewPoint,
return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
}
bool Corpse::IsHostileTo( Unit const* unit ) const
bool Corpse::IsHostileTo(Unit const* unit) const
{
if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid()))
return owner->IsHostileTo(unit);
@ -266,7 +266,7 @@ bool Corpse::IsHostileTo( Unit const* unit ) const
return false;
}
bool Corpse::IsFriendlyTo( Unit const* unit ) const
bool Corpse::IsFriendlyTo(Unit const* unit) const
{
if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid()))
return owner->IsFriendlyTo(unit);
@ -276,7 +276,7 @@ bool Corpse::IsFriendlyTo( Unit const* unit ) const
bool Corpse::IsExpired(time_t t) const
{
if(m_type == CORPSE_BONES)
if (m_type == CORPSE_BONES)
return m_time < t - 60*MINUTE;
else
return m_time < t - 3*DAY;

View file

@ -50,17 +50,17 @@ enum CorpseFlags
class Corpse : public WorldObject
{
public:
explicit Corpse( CorpseType type = CORPSE_BONES );
~Corpse( );
explicit Corpse(CorpseType type = CORPSE_BONES);
~Corpse();
void AddToWorld();
void RemoveFromWorld();
bool Create( uint32 guidlow );
bool Create( uint32 guidlow, Player *owner );
bool Create(uint32 guidlow);
bool Create(uint32 guidlow, Player* owner);
void SaveToDB();
bool LoadFromDB(uint32 guid, Field *fields);
bool LoadFromDB(uint32 guid, Field* fields);
void DeleteBonesFromWorld();
void DeleteFromDB();
@ -83,7 +83,7 @@ class Corpse : public WorldObject
Player* lootRecipient;
bool lootForBody;
GridReference<Corpse> &GetGridRef() { return m_gridRef; }
GridReference<Corpse>& GetGridRef() { return m_gridRef; }
bool IsExpired(time_t t) const;
private:

File diff suppressed because it is too large Load diff

View file

@ -152,11 +152,11 @@ struct CreatureInfo
SkillType GetRequiredLootSkill() const
{
if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
if (type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
return SKILL_HERBALISM;
else if(type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
else if (type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
return SKILL_MINING;
else if(type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
else if (type_flags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
return SKILL_ENGINEERING;
else
return SKILL_SKINNING; // normal case
@ -169,7 +169,7 @@ struct CreatureInfo
bool isTameable(bool exotic) const
{
if(type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE) == 0)
if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPEFLAGS_TAMEABLE) == 0)
return false;
// if can tame exotic then can tame any temable
@ -328,22 +328,22 @@ struct VendorItemData
VendorItem* GetItem(uint32 slot) const
{
if(slot>=m_items.size()) return NULL;
if (slot>=m_items.size()) return NULL;
return m_items[slot];
}
bool Empty() const { return m_items.empty(); }
uint8 GetItemCount() const { return m_items.size(); }
void AddItem( uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost)
void AddItem(uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost)
{
m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost));
}
bool RemoveItem( uint32 item_id );
bool RemoveItem(uint32 item_id);
VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost) const;
void Clear()
{
for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr)
delete (*itr);
delete(*itr);
m_items.clear();
}
};
@ -388,7 +388,7 @@ struct TrainerSpellData
TrainerSpellMap spellList;
uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value.
// req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
// req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
TrainerSpell const* Find(uint32 spell_id) const;
void Clear() { spellList.clear(); }
};
@ -418,7 +418,7 @@ struct CreatureCreatePos
// if dist == 0.0f -> exactly object coordinates used, in other case close point to object (CONTACT_DIST can be used as minimal distances)
CreatureCreatePos(WorldObject* closeObject, float ori, float dist = 0.0f, float angle = 0.0f)
: m_map(closeObject->GetMap()), m_phaseMask(closeObject->GetPhaseMask()),
m_closeObject(closeObject), m_angle(angle), m_dist(dist) { m_pos.o = ori; }
m_closeObject(closeObject), m_angle(angle), m_dist(dist) { m_pos.o = ori; }
public:
Map* GetMap() const { return m_map; }
uint32 GetPhaseMask() const { return m_phaseMask; }
@ -454,7 +454,7 @@ enum TemporaryFactionFlags // Used at real fact
class MANGOS_DLL_SPEC Creature : public Unit
{
CreatureAI *i_AI;
CreatureAI* i_AI;
public:
@ -464,9 +464,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
void AddToWorld();
void RemoveFromWorld();
bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Team team = TEAM_NONE, const CreatureData *data = NULL, GameEventCreatureData const* eventData = NULL);
bool Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Team team = TEAM_NONE, const CreatureData* data = NULL, GameEventCreatureData const* eventData = NULL);
bool LoadCreatureAddon(bool reload);
void SelectLevel(const CreatureInfo *cinfo, float percentHealth = 100.0f, float percentMana = 100.0f);
void SelectLevel(const CreatureInfo* cinfo, float percentHealth = 100.0f, float percentMana = 100.0f);
void LoadEquipment(uint32 equip_entry, bool force=false);
bool HasStaticDBSpawnData() const; // listed in `creature` table and have fixed in DB guid
@ -476,7 +476,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
void Update(uint32 update_diff, uint32 time) override; // overwrite Unit::Update
virtual void RegenerateAll(uint32 update_diff);
void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
void GetRespawnCoord(float& x, float& y, float& z, float* ori = NULL, float* dist =NULL) const;
uint32 GetEquipmentId() const { return m_equipmentId; }
CreatureSubtype GetSubtype() const { return m_subtype; }
@ -503,12 +503,12 @@ class MANGOS_DLL_SPEC Creature : public Unit
void FillGuidsListFromThreatList(GuidVector& guids, uint32 maxamount = 0);
bool IsImmuneToSpell(SpellEntry const* spellInfo);
// redefine Unit::IsImmuneToSpell
// redefine Unit::IsImmuneToSpell
bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const;
// redefine Unit::IsImmuneToSpellEffect
// redefine Unit::IsImmuneToSpellEffect
bool IsElite() const
{
if(IsPet())
if (IsPet())
return false;
uint32 rank = GetCreatureInfo()->rank;
@ -517,7 +517,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
bool IsWorldBoss() const
{
if(IsPet())
if (IsPet())
return false;
return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS;
@ -574,10 +574,10 @@ class MANGOS_DLL_SPEC Creature : public Unit
TrainerSpellData const* GetTrainerTemplateSpells() const;
TrainerSpellData const* GetTrainerSpells() const;
CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; }
CreatureInfo const* GetCreatureInfo() const { return m_creatureInfo; }
CreatureDataAddon const* GetCreatureAddon() const;
static uint32 ChooseDisplayId(const CreatureInfo *cinfo, const CreatureData *data = NULL, GameEventCreatureData const* eventData = NULL);
static uint32 ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData* data = NULL, GameEventCreatureData const* eventData = NULL);
std::string GetAIName() const;
std::string GetScriptName() const;
@ -588,9 +588,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
void SetDeathState(DeathState s); // overwrite virtual Unit::SetDeathState
bool LoadFromDB(uint32 guid, Map *map);
bool LoadFromDB(uint32 guid, Map* map);
void SaveToDB();
// overwrited in Pet
// overwrited in Pet
virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
virtual void DeleteFromDB(); // overwrited in Pet
static void DeleteFromDB(uint32 lowguid, CreatureData const* data);
@ -611,8 +611,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
void AllLootRemovedFromCorpse();
Player* GetOriginalLootRecipient() const; // ignore group changes/etc, not for looting
SpellEntry const *ReachWithSpellAttack(Unit *pVictim);
SpellEntry const *ReachWithSpellCure(Unit *pVictim);
SpellEntry const* ReachWithSpellAttack(Unit* pVictim);
SpellEntry const* ReachWithSpellCure(Unit* pVictim);
uint32 m_spells[CREATURE_MAX_SPELLS];
CreatureSpellCooldowns m_CreatureSpellCooldowns;
@ -673,7 +673,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
bool HasQuest(uint32 quest_id) const;
bool HasInvolvedQuest(uint32 quest_id) const;
GridReference<Creature> &GetGridRef() { return m_gridRef; }
GridReference<Creature>& GetGridRef() { return m_gridRef; }
bool IsRegeneratingHealth() { return m_regenHealth; }
virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
@ -685,25 +685,25 @@ class MANGOS_DLL_SPEC Creature : public Unit
}
void SetCombatStartPosition(float x, float y, float z) { m_combatStartX = x; m_combatStartY = y; m_combatStartZ = z; }
void GetCombatStartPosition(float &x, float &y, float &z) { x = m_combatStartX; y = m_combatStartY; z = m_combatStartZ; }
void GetCombatStartPosition(float& x, float& y, float& z) { x = m_combatStartX; y = m_combatStartY; z = m_combatStartZ; }
void SetSummonPoint(CreatureCreatePos const& pos) { m_summonPos = pos.m_pos; }
void GetSummonPoint(float &fX, float &fY, float &fZ, float &fOrient) const { fX = m_summonPos.x; fY = m_summonPos.y; fZ = m_summonPos.z; fOrient = m_summonPos.o; }
void GetSummonPoint(float& fX, float& fY, float& fZ, float& fOrient) const { fX = m_summonPos.x; fY = m_summonPos.y; fZ = m_summonPos.z; fOrient = m_summonPos.o; }
void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; }
void SetDeadByDefault(bool death_state) { m_isDeadByDefault = death_state; }
void SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags = TEMPFACTION_ALL);
void ClearTemporaryFaction();
uint32 GetTemporaryFactionFlags() { return m_temporaryFactionFlags; }
void SendAreaSpiritHealerQueryOpcode(Player *pl);
void SendAreaSpiritHealerQueryOpcode(Player* pl);
void SetVirtualItem(VirtualItemSlot slot, uint32 item_id) { SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + slot, item_id); }
protected:
bool MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const* pSpellInfo, uint32 selectFlags) const;
bool CreateFromProto(uint32 guidlow, CreatureInfo const* cinfo, Team team, const CreatureData *data = NULL, GameEventCreatureData const* eventData =NULL);
bool CreateFromProto(uint32 guidlow, CreatureInfo const* cinfo, Team team, const CreatureData* data = NULL, GameEventCreatureData const* eventData =NULL);
bool InitEntry(uint32 entry, const CreatureData* data = NULL, GameEventCreatureData const* eventData = NULL);
uint32 m_groupLootTimer; // (msecs)timer used for group loot

View file

@ -25,13 +25,13 @@ CreatureAI::~CreatureAI()
{
}
void CreatureAI::AttackedBy( Unit* attacker )
void CreatureAI::AttackedBy(Unit* attacker)
{
if(!m_creature->getVictim())
if (!m_creature->getVictim())
AttackStart(attacker);
}
CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry *pSpell, bool isTriggered)
CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell, bool isTriggered)
{
// If not triggered, we check
if (!isTriggered)
@ -51,7 +51,7 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry *pSpell,
return CAST_FAIL_POWER;
}
if (const SpellRangeEntry *pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex))
if (const SpellRangeEntry* pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex))
{
if (pTarget != m_creature)
{

View file

@ -272,17 +272,17 @@ class MANGOS_DLL_SPEC CreatureAI
struct SelectableAI : public FactoryHolder<CreatureAI>, public Permissible<Creature>
{
SelectableAI(const char *id) : FactoryHolder<CreatureAI>(id) {}
SelectableAI(const char* id) : FactoryHolder<CreatureAI>(id) {}
};
template<class REAL_AI>
struct CreatureAIFactory : public SelectableAI
{
CreatureAIFactory(const char *name) : SelectableAI(name) {}
CreatureAIFactory(const char* name) : SelectableAI(name) {}
CreatureAI* Create(void *) const;
CreatureAI* Create(void*) const;
int Permit(const Creature *c) const { return REAL_AI::Permissible(c); }
int Permit(const Creature* c) const { return REAL_AI::Permissible(c); }
};
enum Permitions

View file

@ -22,9 +22,9 @@
template<class REAL_AI>
inline CreatureAI*
CreatureAIFactory<REAL_AI>::Create(void *data) const
CreatureAIFactory<REAL_AI>::Create(void* data) const
{
Creature* creature = reinterpret_cast<Creature *>(data);
Creature* creature = reinterpret_cast<Creature*>(data);
return (new REAL_AI(creature));
}
#endif

View file

@ -30,31 +30,31 @@ INSTANTIATE_SINGLETON_1(MovementGeneratorRegistry);
namespace FactorySelector
{
CreatureAI* selectAI(Creature *creature)
CreatureAI* selectAI(Creature* creature)
{
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if ((!creature->IsPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed())
if (CreatureAI* scriptedAI = sScriptMgr.GetCreatureAI(creature))
return scriptedAI;
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
CreatureAIRegistry& ai_registry(CreatureAIRepository::Instance());
const CreatureAICreator *ai_factory = NULL;
const CreatureAICreator* ai_factory = NULL;
std::string ainame=creature->GetAIName();
// select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems
// excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI
Unit *owner=NULL;
Unit* owner=NULL;
if ((creature->IsPet() && ((Pet*)creature)->isControlled() &&
((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER)) || creature->isCharmed())
((owner=creature->GetOwner()) && owner->GetTypeId()==TYPEID_PLAYER)) || creature->isCharmed())
ai_factory = ai_registry.GetRegistryItem("PetAI");
else if (creature->IsTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI");
// select by script name
if (!ai_factory && !ainame.empty())
ai_factory = ai_registry.GetRegistryItem( ainame.c_str() );
ai_factory = ai_registry.GetRegistryItem(ainame.c_str());
if (!ai_factory && creature->IsGuard())
ai_factory = ai_registry.GetRegistryItem("GuardAI");
@ -64,14 +64,14 @@ namespace FactorySelector
{
int best_val = PERMIT_BASE_NO;
typedef CreatureAIRegistry::RegistryMapType RMT;
RMT const &l = ai_registry.GetRegisteredItems();
for( RMT::const_iterator iter = l.begin(); iter != l.end(); ++iter)
RMT const& l = ai_registry.GetRegisteredItems();
for (RMT::const_iterator iter = l.begin(); iter != l.end(); ++iter)
{
const CreatureAICreator *factory = iter->second;
const SelectableAI *p = dynamic_cast<const SelectableAI *>(factory);
MANGOS_ASSERT( p != NULL );
const CreatureAICreator* factory = iter->second;
const SelectableAI* p = dynamic_cast<const SelectableAI*>(factory);
MANGOS_ASSERT(p != NULL);
int val = p->Permit(creature);
if( val > best_val )
if (val > best_val)
{
best_val = val;
ai_factory = p;
@ -82,16 +82,16 @@ namespace FactorySelector
// select NullCreatureAI if not another cases
ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key();
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str() );
return ( ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature) );
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str());
return (ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature));
}
MovementGenerator* selectMovementGenerator(Creature *creature)
MovementGenerator* selectMovementGenerator(Creature* creature)
{
MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance());
MANGOS_ASSERT( creature->GetCreatureInfo() != NULL );
MovementGeneratorCreator const * mv_factory = mv_registry.GetRegistryItem(
creature->GetOwnerGuid().IsPlayer() ? FOLLOW_MOTION_TYPE : creature->GetDefaultMovementType());
MovementGeneratorRegistry& mv_registry(MovementGeneratorRepository::Instance());
MANGOS_ASSERT(creature->GetCreatureInfo() != NULL);
MovementGeneratorCreator const* mv_factory = mv_registry.GetRegistryItem(
creature->GetOwnerGuid().IsPlayer() ? FOLLOW_MOTION_TYPE : creature->GetDefaultMovementType());
/* if( mv_factory == NULL )
{
@ -112,7 +112,7 @@ namespace FactorySelector
}
}*/
return ( mv_factory == NULL ? NULL : mv_factory->Create(creature) );
return (mv_factory == NULL ? NULL : mv_factory->Create(creature));
}
}

View file

@ -25,7 +25,7 @@ class MovementGenerator;
namespace FactorySelector
{
CreatureAI* selectAI(Creature *);
MovementGenerator* selectMovementGenerator(Creature *);
CreatureAI* selectAI(Creature*);
MovementGenerator* selectMovementGenerator(Creature*);
}
#endif

View file

@ -31,7 +31,7 @@
#include "Chat.h"
#include "Language.h"
bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeatMin, uint32 repeatMax )
bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax)
{
if (repeatMin == repeatMax)
Time = repeatMin;
@ -47,9 +47,9 @@ bool CreatureEventAIHolder::UpdateRepeatTimer( Creature* creature, uint32 repeat
return true;
}
int CreatureEventAI::Permissible(const Creature *creature)
int CreatureEventAI::Permissible(const Creature* creature)
{
if( creature->GetAIName() == "EventAI" )
if (creature->GetAIName() == "EventAI")
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
}
@ -61,7 +61,7 @@ void CreatureEventAI::GetAIInformation(ChatHandler& reader)
reader.PSendSysMessage(LANG_NPC_EVENTAI_COMBAT, reader.GetOnOffStr(m_MeleeEnabled));
}
CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c)
{
// Need make copy for filter unneeded steps and safe in case table reload
CreatureEventAI_Event_Map::const_iterator creatureEventsItr = sEventAIMgr.GetCreatureEventAIMap().find(m_creature->GetEntry());
@ -71,10 +71,10 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
for (CreatureEventAI_Event_Vec::const_iterator i = (*creatureEventsItr).second.begin(); i != (*creatureEventsItr).second.end(); ++i)
{
//Debug check
#ifndef MANGOS_DEBUG
#ifndef MANGOS_DEBUG
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
continue;
#endif
#endif
if (m_creature->GetMap()->IsDungeon())
{
if ((1 << (m_creature->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
@ -95,10 +95,10 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
{
//Debug check
#ifndef MANGOS_DEBUG
#ifndef MANGOS_DEBUG
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
continue;
#endif
#endif
if (m_creature->GetMap()->IsDungeon())
{
if ((1 << (m_creature->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
@ -335,7 +335,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
return false;
SpellAuraHolder* holder = m_creature->getVictim()->GetSpellAuraHolder(event.buffed.spellId);
if(!holder || holder->GetStackAmount() < event.buffed.amount)
if (!holder || holder->GetStackAmount() < event.buffed.amount)
return false;
//Repeat Timers
@ -525,7 +525,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
CanCastResult castResult = DoCastSpellIfCan(target, action.cast.spellId, action.cast.castFlags);
switch(castResult)
switch (castResult)
{
case CAST_FAIL_POWER:
case CAST_FAIL_TOO_FAR:
@ -533,7 +533,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
// Melee current victim if flag not set
if (!(action.cast.castFlags & CAST_NO_MELEE_IF_OOM))
{
switch(m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType())
switch (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType())
{
case CHASE_MOTION_TYPE:
case FOLLOW_MOTION_TYPE:
@ -567,7 +567,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
if (!pCreature)
sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry());
else if (action.summon.target != TARGET_T_SELF && target)
pCreature->AI()->AttackStart(target);
break;
@ -580,7 +580,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{
ThreatList const& threatList = m_creature->getThreatManager().getThreatList();
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if(Unit* Temp = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()))
if (Unit* Temp = m_creature->GetMap()->GetUnit((*i)->getUnitGuid()))
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
break;
}
@ -620,7 +620,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_COMBAT_MOVEMENT:
// ignore no affect case
if(m_CombatMovementEnabled==(action.combat_movement.state!=0))
if (m_CombatMovementEnabled==(action.combat_movement.state!=0))
return;
m_CombatMovementEnabled = action.combat_movement.state != 0;
@ -628,8 +628,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
//Allow movement (create new targeted movement gen only if idle)
if (m_CombatMovementEnabled)
{
if(action.combat_movement.melee && m_creature->isInCombat())
if(Unit* victim = m_creature->getVictim())
if (action.combat_movement.melee && m_creature->isInCombat())
if (Unit* victim = m_creature->getVictim())
m_creature->SendMeleeAttackStart(victim);
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE)
@ -640,8 +640,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
else
{
if(action.combat_movement.melee && m_creature->isInCombat())
if(Unit* victim = m_creature->getVictim())
if (action.combat_movement.melee && m_creature->isInCombat())
if (Unit* victim = m_creature->getVictim())
m_creature->SendMeleeAttackStop(victim);
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
@ -660,12 +660,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
int32 new_phase = int32(m_Phase)+action.set_inc_phase.step;
if (new_phase < 0)
{
sLog.outErrorDb( "CreatureEventAI: Event %d decrease Phase under 0. CreatureEntry = %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d decrease Phase under 0. CreatureEntry = %d", EventId, m_creature->GetEntry());
m_Phase = 0;
}
else if (new_phase >= MAX_PHASE)
{
sLog.outErrorDb( "CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, m_creature->GetEntry());
m_Phase = MAX_PHASE-1;
}
else
@ -688,7 +688,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
ThreatList const& threatList = m_creature->getThreatManager().getThreatList();
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid()))
temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId);
temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId);
break;
}
case ACTION_T_REMOVEAURASFROMSPELL:
@ -716,7 +716,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (action.random_phase_range.phaseMax > action.random_phase_range.phaseMin)
m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin));
else
sLog.outErrorDb( "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry());
break;
case ACTION_T_SUMMON_ID:
{
@ -725,7 +725,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId);
if (i == sEventAIMgr.GetCreatureEventAISummonMap().end())
{
sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, m_creature->GetEntry());
return;
}
@ -736,7 +736,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
if (!pCreature)
sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry());
else if (action.summon_id.target != TARGET_T_SELF && target)
pCreature->AI()->AttackStart(target);
@ -826,7 +826,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
{
if(action.invincibility_hp_level.is_percent)
if (action.invincibility_hp_level.is_percent)
m_InvinceabilityHpLevel = m_creature->GetMaxHealth()*action.invincibility_hp_level.hp_level/100;
else
m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
@ -884,7 +884,7 @@ void CreatureEventAI::Reset()
CreatureEventAI_Event const& event = (*i).Event;
switch (event.event_type)
{
//Reset all out of combat timers
//Reset all out of combat timers
case EVENT_T_TIMER_OOC:
{
if ((*i).UpdateRepeatTimer(m_creature,event.timer.initialMin,event.timer.initialMax))
@ -1009,7 +1009,7 @@ void CreatureEventAI::SummonedCreatureDespawn(Creature* pUnit)
}
}
void CreatureEventAI::EnterCombat(Unit *enemy)
void CreatureEventAI::EnterCombat(Unit* enemy)
{
//Check for on combat start events
if (!m_bEmptyList)
@ -1041,7 +1041,7 @@ void CreatureEventAI::EnterCombat(Unit *enemy)
m_EventDiff = 0;
}
void CreatureEventAI::AttackStart(Unit *who)
void CreatureEventAI::AttackStart(Unit* who)
{
if (!who)
return;
@ -1064,7 +1064,7 @@ void CreatureEventAI::AttackStart(Unit *who)
}
}
void CreatureEventAI::MoveInLineOfSight(Unit *who)
void CreatureEventAI::MoveInLineOfSight(Unit* who)
{
if (!who)
return;
@ -1084,7 +1084,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
{
//if friendly event&&who is not hostile OR hostile event&&who is hostile
if (((*itr).Event.ooc_los.noHostile && !m_creature->IsHostileTo(who)) ||
((!(*itr).Event.ooc_los.noHostile) && m_creature->IsHostileTo(who)))
((!(*itr).Event.ooc_los.noHostile) && m_creature->IsHostileTo(who)))
ProcessEvent(*itr, who);
}
}
@ -1095,7 +1095,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
return;
if (m_creature->CanInitiateAttack() && who->isTargetableForAttack() &&
m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature))
m_creature->IsHostileTo(who) && who->isInAccessablePlaceFor(m_creature))
{
if (!m_creature->CanFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
return;
@ -1206,10 +1206,10 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady();
}
bool CreatureEventAI::IsVisible(Unit *pl) const
bool CreatureEventAI::IsVisible(Unit* pl) const
{
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_FLOAT_SIGHT_MONSTER))
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
&& pl->isVisibleForOrDetect(m_creature,m_creature,true);
}
inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3)
@ -1313,7 +1313,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote);
if((*i).second.SoundId)
if ((*i).second.SoundId)
{
if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId))
pSource->PlayDirectSound((*i).second.SoundId);
@ -1321,7 +1321,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId);
}
if((*i).second.Emote)
if ((*i).second.Emote)
{
if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
{
@ -1331,7 +1331,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId());
}
switch((*i).second.Type)
switch ((*i).second.Type)
{
case CHAT_TYPE_SAY:
pSource->MonsterSay(textEntry, (*i).second.Language, target);
@ -1350,20 +1350,20 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
if (target && target->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(textEntry, target);
else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
}break;
} break;
case CHAT_TYPE_BOSS_WHISPER:
{
if (target && target->GetTypeId() == TYPEID_PLAYER)
pSource->MonsterWhisper(textEntry, target, true);
else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
}break;
} break;
case CHAT_TYPE_ZONE_YELL:
pSource->MonsterYellToZone(textEntry, (*i).second.Language, target);
break;
}
}
bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const* Spell, bool Triggered)
{
//No target so we can't cast
if (!Target || !Spell)
@ -1371,14 +1371,14 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
//Silenced so we can't cast
if (!Triggered && (m_creature->hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL) ||
m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)))
m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)))
return false;
//Check for power
if (!Triggered && m_creature->GetPower((Powers)Spell->powerType) < Spell::CalculatePowerCost(Spell, m_creature))
return false;
SpellRangeEntry const *TempRange = NULL;
SpellRangeEntry const* TempRange = NULL;
TempRange = GetSpellRangeStore()->LookupEntry(Spell->rangeIndex);
@ -1415,11 +1415,11 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
}
}
void CreatureEventAI::DamageTaken( Unit* /*done_by*/, uint32& damage )
void CreatureEventAI::DamageTaken(Unit* /*done_by*/, uint32& damage)
{
if(m_InvinceabilityHpLevel > 0 && m_creature->GetHealth() < m_InvinceabilityHpLevel+damage)
if (m_InvinceabilityHpLevel > 0 && m_creature->GetHealth() < m_InvinceabilityHpLevel+damage)
{
if(m_creature->GetHealth() <= m_InvinceabilityHpLevel)
if (m_creature->GetHealth() <= m_InvinceabilityHpLevel)
damage = 0;
else
damage = m_creature->GetHealth() - m_InvinceabilityHpLevel;
@ -1428,7 +1428,7 @@ void CreatureEventAI::DamageTaken( Unit* /*done_by*/, uint32& damage )
bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event)
{
if(event.event_type != EVENT_T_SPAWNED)
if (event.event_type != EVENT_T_SPAWNED)
return false;
switch (event.spawned.condition)

View file

@ -563,7 +563,7 @@ typedef UNORDERED_MAP<uint32, CreatureEventAI_Summon> CreatureEventAI_Summon_Map
struct CreatureEventAIHolder
{
CreatureEventAIHolder(CreatureEventAI_Event p) : Event(p), Time(0), Enabled(true){}
CreatureEventAIHolder(CreatureEventAI_Event p) : Event(p), Time(0), Enabled(true) {}
CreatureEventAI_Event Event;
uint32 Time;
@ -576,7 +576,7 @@ struct CreatureEventAIHolder
class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI
{
public:
explicit CreatureEventAI(Creature *c);
explicit CreatureEventAI(Creature* c);
~CreatureEventAI()
{
m_CreatureEventAIList.clear();
@ -587,22 +587,22 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI
void JustRespawned();
void Reset();
void JustReachedHome();
void EnterCombat(Unit *enemy);
void EnterCombat(Unit* enemy);
void EnterEvadeMode();
void JustDied(Unit* killer);
void KilledUnit(Unit* victim);
void JustSummoned(Creature* pUnit);
void AttackStart(Unit *who);
void MoveInLineOfSight(Unit *who);
void AttackStart(Unit* who);
void MoveInLineOfSight(Unit* who);
void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
void DamageTaken(Unit* done_by, uint32& damage);
void UpdateAI(const uint32 diff);
bool IsVisible(Unit *) const;
bool IsVisible(Unit*) const;
void ReceiveEmote(Player* pPlayer, uint32 text_emote);
void SummonedCreatureJustDied(Creature* unit);
void SummonedCreatureDespawn(Creature* unit);
static int Permissible(const Creature *);
static int Permissible(const Creature*);
bool ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker = NULL);
void ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker);
@ -611,7 +611,7 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI
inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker);
void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target);
bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered);
bool CanCast(Unit* Target, SpellEntry const* Spell, bool Triggered);
bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event);

View file

@ -39,7 +39,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use)
sObjectMgr.LoadMangosStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
// Gather Additional data from EventAI Texts
QueryResult *result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
QueryResult* result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
sLog.outString("Loading EventAI Texts additional data...");
if (result)
@ -93,11 +93,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use)
m_CreatureEventAI_TextMap[i] = temp;
++count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;
if(check_entry_use)
if (check_entry_use)
CheckUnusedAITexts();
sLog.outString();
@ -116,23 +117,23 @@ void CreatureEventAIMgr::CheckUnusedAITexts()
{
std::set<int32> idx_set;
// check not used strings this is negative range
for(CreatureEventAI_TextMap::const_iterator itr = m_CreatureEventAI_TextMap.begin(); itr != m_CreatureEventAI_TextMap.end(); ++itr)
for (CreatureEventAI_TextMap::const_iterator itr = m_CreatureEventAI_TextMap.begin(); itr != m_CreatureEventAI_TextMap.end(); ++itr)
idx_set.insert(itr->first);
for(CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
{
for(size_t i = 0; i < itr->second.size(); ++i)
for (size_t i = 0; i < itr->second.size(); ++i)
{
CreatureEventAI_Event const& event = itr->second[i];
for(int j = 0; j < MAX_ACTIONS; ++j)
for (int j = 0; j < MAX_ACTIONS; ++j)
{
CreatureEventAI_Action const& action = event.action[j];
switch(action.type)
switch (action.type)
{
case ACTION_T_TEXT:
{
for(int k = 0; k < 3; ++k)
for (int k = 0; k < 3; ++k)
if (action.text.TextId[k])
idx_set.erase(action.text.TextId[k]);
break;
@ -144,7 +145,7 @@ void CreatureEventAIMgr::CheckUnusedAITexts()
}
}
for(std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` but not used in EventAI scripts.",*itr);
}
@ -165,7 +166,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use)
do
{
bar.step();
Field *fields = result->Fetch();
Field* fields = result->Fetch();
CreatureEventAI_Summon temp;
@ -185,16 +186,18 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use)
//Add to map
m_CreatureEventAI_Summon_Map[temp.id] = temp;
++Count;
}while (result->NextRow());
}
while (result->NextRow());
delete result;
if(check_entry_use)
if (check_entry_use)
CheckUnusedAISummons();
sLog.outString();
sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count);
}else
}
else
{
BarGoLink bar(1);
bar.step();
@ -207,19 +210,19 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
{
std::set<int32> idx_set;
// check not used strings this is negative range
for(CreatureEventAI_Summon_Map::const_iterator itr = m_CreatureEventAI_Summon_Map.begin(); itr != m_CreatureEventAI_Summon_Map.end(); ++itr)
for (CreatureEventAI_Summon_Map::const_iterator itr = m_CreatureEventAI_Summon_Map.begin(); itr != m_CreatureEventAI_Summon_Map.end(); ++itr)
idx_set.insert(itr->first);
for(CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
{
for(size_t i = 0; i < itr->second.size(); ++i)
for (size_t i = 0; i < itr->second.size(); ++i)
{
CreatureEventAI_Event const& event = itr->second[i];
for(int j = 0; j < MAX_ACTIONS; ++j)
for (int j = 0; j < MAX_ACTIONS; ++j)
{
CreatureEventAI_Action const& action = event.action[j];
switch(action.type)
switch (action.type)
{
case ACTION_T_SUMMON_ID:
{
@ -234,7 +237,7 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
}
}
for(std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_summons` but not used in EventAI scripts.",*itr);
}
@ -245,12 +248,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
m_CreatureEventAI_Event_Map.clear();
// Gather event data
QueryResult *result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
"event_param1, event_param2, event_param3, event_param4, "
"action1_type, action1_param1, action1_param2, action1_param3, "
"action2_type, action2_param1, action2_param2, action2_param3, "
"action3_type, action3_param1, action3_param2, action3_param3 "
"FROM creature_ai_scripts");
QueryResult* result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
"event_param1, event_param2, event_param3, event_param4, "
"action1_type, action1_param1, action1_param2, action1_param3, "
"action2_type, action2_param1, action2_param2, action2_param3, "
"action3_type, action3_param1, action3_param2, action3_param3 "
"FROM creature_ai_scripts");
if (result)
{
BarGoLink bar(result->GetRowCount());
@ -259,7 +262,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
do
{
bar.step();
Field *fields = result->Fetch();
Field* fields = result->Fetch();
CreatureEventAI_Event temp;
temp.event_id = EventAI_Type(fields[0].GetUInt32());
@ -359,16 +362,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_SPAWNED:
switch(temp.spawned.condition)
switch (temp.spawned.condition)
{
case SPAWNED_EVENT_ALWAY:
break;
case SPAWNED_EVENT_MAP:
if(!sMapStore.LookupEntry(temp.spawned.conditionValue1))
if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
break;
case SPAWNED_EVENT_ZONE:
if(!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but area (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
default:
sLog.outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
@ -511,17 +514,17 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_TEXT:
{
bool not_set = false;
for(int k = 0; k < 3; ++k)
for (int k = 0; k < 3; ++k)
{
if (action.text.TextId[k])
{
if (k > 0 && not_set)
sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param%d, but it follow after not set param. Required for randomized text.", i, j+1, k+1);
if(!action.text.TextId[k])
if (!action.text.TextId[k])
not_set = true;
// range negative
else if(action.text.TextId[k] > MIN_CREATURE_AI_TEXT_STRING_ID || action.text.TextId[k] <= MAX_CREATURE_AI_TEXT_STRING_ID)
else if (action.text.TextId[k] > MIN_CREATURE_AI_TEXT_STRING_ID || action.text.TextId[k] <= MAX_CREATURE_AI_TEXT_STRING_ID)
{
sLog.outErrorDb("CreatureEventAI: Event %u Action %u param%d references out-of-range entry (%i) in texts table.", i, j+1, k+1, action.text.TextId[k]);
action.text.TextId[k] = 0;
@ -592,7 +595,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case ACTION_T_CAST:
{
const SpellEntry *spell = sSpellStore.LookupEntry(action.cast.spellId);
const SpellEntry* spell = sSpellStore.LookupEntry(action.cast.spellId);
if (!spell)
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent SpellID %u.", i, j+1, action.cast.spellId);
/* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
@ -753,9 +756,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
break;
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
if(action.invincibility_hp_level.is_percent)
if (action.invincibility_hp_level.is_percent)
{
if(action.invincibility_hp_level.hp_level > 100)
if (action.invincibility_hp_level.hp_level > 100)
{
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
action.invincibility_hp_level.hp_level = 100;
@ -811,7 +814,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
//Add to list
m_CreatureEventAI_Event_Map[creature_id].push_back(temp);
++Count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;
@ -834,7 +838,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outString();
sLog.outString(">> Loaded %u CreatureEventAI scripts", Count);
}else
}
else
{
BarGoLink bar(1);
bar.step();

View file

@ -25,8 +25,8 @@
class CreatureEventAIMgr
{
public:
CreatureEventAIMgr(){};
~CreatureEventAIMgr(){};
CreatureEventAIMgr() {};
~CreatureEventAIMgr() {};
void LoadCreatureEventAI_Texts(bool check_entry_use);
void LoadCreatureEventAI_Summons(bool check_entry_use);

View file

@ -242,7 +242,7 @@ bool CreatureLinkingMgr::IsLinkingEntryValid(uint32 slaveEntry, CreatureLinkingI
if (pTmp->searchRange == 0 && pTmp->linkingFlag & (FLAG_FOLLOW | FLAG_CANT_SPAWN_IF_BOSS_DEAD | FLAG_CANT_SPAWN_IF_BOSS_ALIVE))
{
// Painfully slow, needs better idea
QueryResult *result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id=%u AND map=%u", pTmp->masterId, pTmp->mapId);
QueryResult* result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id=%u AND map=%u", pTmp->masterId, pTmp->mapId);
if (result)
{
if ((*result)[0].GetUInt32() > 1)

View file

@ -296,7 +296,7 @@ enum FactionMasks
FACTION_MASK_ALLIANCE = 2, // player or creature from alliance team
FACTION_MASK_HORDE = 4, // player or creature from horde team
FACTION_MASK_MONSTER = 8 // aggressive creature from monster team
// if none flags set then non-aggressive creature
// if none flags set then non-aggressive creature
};
enum MapTypes // Lua_IsInInstance

View file

@ -47,7 +47,7 @@ struct WMOAreaTableTripple
int32 adtId;
};
typedef std::map<WMOAreaTableTripple, WMOAreaTableEntry const *> WMOAreaInfoByTripple;
typedef std::map<WMOAreaTableTripple, WMOAreaTableEntry const*> WMOAreaInfoByTripple;
DBCStorage <AreaTableEntry> sAreaStore(AreaTableEntryfmt);
DBCStorage <AreaGroupEntry> sAreaGroupStore(AreaGroupEntryfmt);
@ -195,8 +195,8 @@ typedef std::list<std::string> StoreProblemList;
bool IsAcceptableClientBuild(uint32 build)
{
int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD;
for(int i = 0; accepted_versions[i]; ++i)
if(int(build) == accepted_versions[i])
for (int i = 0; accepted_versions[i]; ++i)
if (int(build) == accepted_versions[i])
return true;
return false;
@ -206,7 +206,7 @@ std::string AcceptableClientBuildsListStr()
{
std::ostringstream data;
int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD;
for(int i = 0; accepted_versions[i]; ++i)
for (int i = 0; accepted_versions[i]; ++i)
data << accepted_versions[i] << " ";
return data.str();
}
@ -215,7 +215,7 @@ static bool ReadDBCBuildFileText(const std::string& dbc_path, char const* locale
{
std::string filename = dbc_path + "component.wow-" + localeName + ".txt";
if(FILE* file = fopen(filename.c_str(),"rb"))
if (FILE* file = fopen(filename.c_str(),"rb"))
{
char buf[100];
fread(buf,1,100-1,file);
@ -234,7 +234,7 @@ static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const* loc
if (!localeNameStr)
{
for(LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr)
for (LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr)
{
if (ReadDBCBuildFileText(dbc_path,itr->name,text))
{
@ -291,10 +291,10 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
MANGOS_ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
std::string dbc_filename = dbc_path + filename;
if(storage.Load(dbc_filename.c_str()))
if (storage.Load(dbc_filename.c_str()))
{
bar.step();
for(uint8 i = 0; fullLocaleNameList[i].name; ++i)
for (uint8 i = 0; fullLocaleNameList[i].name; ++i)
{
if (!(localeData.availableDbcLocales & (1 << i)))
continue;
@ -309,7 +309,7 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
uint32 build_loc = ReadDBCBuild(dbc_dir_loc,localStr);
if(localeData.main_build != build_loc)
if (localeData.main_build != build_loc)
{
localeData.availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
@ -327,15 +327,15 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
}
std::string dbc_filename_loc = dbc_path + localStr->name + "/" + filename;
if(!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
if (!storage.LoadStringsFrom(dbc_filename_loc.c_str()))
localeData.availableDbcLocales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic dbc to (1) non compatible and (2) nonexistent
FILE * f=fopen(dbc_filename.c_str(),"rb");
if(f)
FILE* f=fopen(dbc_filename.c_str(),"rb");
if (f)
{
char buf[100];
snprintf(buf, 100, " (exist, but have %u fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
@ -383,7 +383,7 @@ void LoadDBCStores(const std::string& dataPath)
sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag));
// fill MapId->DBC records ( skip sub zones and continents )
if(area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 )
if (area->zone==0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571)
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag));
}
}
@ -414,12 +414,12 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sEmotesStore, dbcPath,"Emotes.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sEmotesTextStore, dbcPath,"EmotesText.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionStore, dbcPath,"Faction.dbc");
for (uint32 i=0;i<sFactionStore.GetNumRows(); ++i)
for (uint32 i=0; i<sFactionStore.GetNumRows(); ++i)
{
FactionEntry const * faction = sFactionStore.LookupEntry(i);
FactionEntry const* faction = sFactionStore.LookupEntry(i);
if (faction && faction->team)
{
SimpleFactionsList &flist = sFactionTeamMap[faction->team];
SimpleFactionsList& flist = sFactionTeamMap[faction->team];
flist.push_back(i);
}
}
@ -461,8 +461,8 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapDifficultyStore, dbcPath,"MapDifficulty.dbc");
// fill data
for(uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
if(MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
sMapDifficultyMap[MAKE_PAIR32(entry->MapId,entry->Difficulty)] = MapDifficulty(entry->resetTime,entry->maxPlayers);
sMapDifficultyStore.Clear();
@ -472,7 +472,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore, dbcPath,"QuestSort.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestXPLevelStore, dbcPath,"QuestXP.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sPvPDifficultyStore, dbcPath,"PvpDifficulty.dbc");
for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
MANGOS_ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
@ -485,24 +485,24 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillRaceClassInfoStore, dbcPath,"SkillRaceClassInfo.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSoundEntriesStore, dbcPath,"SoundEntries.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellStore, dbcPath,"Spell.dbc");
for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const * spell = sSpellStore.LookupEntry(i);
if(spell && spell->Category)
SpellEntry const* spell = sSpellStore.LookupEntry(i);
if (spell && spell->Category)
sSpellCategoryStore[spell->Category].insert(i);
// DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields
// uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view
#if MANGOS_ENDIAN == MANGOS_BIGENDIAN
#if MANGOS_ENDIAN == MANGOS_BIGENDIAN
std::swap(*((uint32*)(&spell->SpellFamilyFlags)),*(((uint32*)(&spell->SpellFamilyFlags))+1));
#endif
#endif
}
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
{
SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j);
SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j);
if(!skillLine)
if (!skillLine)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
@ -511,10 +511,10 @@ void LoadDBCStores(const std::string& dataPath)
for (unsigned int i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
if(!cFamily)
if (!cFamily)
continue;
if(skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
continue;
sPetFamilySpellsStore[i].insert(spellInfo->Id);
@ -539,10 +539,10 @@ void LoadDBCStores(const std::string& dataPath)
// create talent spells set
for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i)
{
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue;
for (int j = 0; j < MAX_TALENT_RANK; j++)
if(talentInfo->RankID[j])
if (talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j);
}
@ -551,10 +551,10 @@ void LoadDBCStores(const std::string& dataPath)
// prepare fast data access to bit pos of talent ranks for use at inspecting
{
// now have all max ranks (and then bit amount used for store talent ranks in inspect)
for(uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
{
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentTabId );
if(!talentTabInfo)
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
if (!talentTabInfo)
continue;
// prevent memory corruption; otherwise cls will become 12 below
@ -563,7 +563,7 @@ void LoadDBCStores(const std::string& dataPath)
// store class talent tab pages
uint32 cls = 1;
for(uint32 m=1;!(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES;m <<=1, ++cls) {}
for (uint32 m=1; !(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES; m <<=1, ++cls) {}
sTalentTabPages[cls][talentTabInfo->tabpage]=talentTabId;
}
@ -572,8 +572,8 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiNodesStore, dbcPath,"TaxiNodes.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathStore, dbcPath,"TaxiPath.dbc");
for(uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
if(TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID,entry->price);
uint32 pathCount = sTaxiPathStore.GetNumRows();
@ -582,54 +582,54 @@ void LoadDBCStores(const std::string& dataPath)
// Calculate path nodes count
std::vector<uint32> pathLength;
pathLength.resize(pathCount); // 0 and some other indexes not used
for(uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
{
if (pathLength[entry->path] < entry->index + 1)
pathLength[entry->path] = entry->index + 1;
}
// Set path length
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
for(uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
sTaxiPathNodesByPath[i].resize(pathLength[i]);
// fill data (pointers to sTaxiPathNodeStore elements
for(uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if(TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
sTaxiPathNodesByPath[entry->path].set(entry->index, entry);
// Initialize global taxinodes mask
// include existing nodes that have at least single not spell base (scripted) path
{
std::set<uint32> spellPaths;
for(uint32 i = 1; i < sSpellStore.GetNumRows (); ++i)
if(SpellEntry const* sInfo = sSpellStore.LookupEntry (i))
for(int j=0; j < MAX_EFFECT_INDEX; ++j)
if(sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
if (SpellEntry const* sInfo = sSpellStore.LookupEntry(i))
for (int j=0; j < MAX_EFFECT_INDEX; ++j)
if (sInfo->Effect[j]==123 /*SPELL_EFFECT_SEND_TAXI*/)
spellPaths.insert(sInfo->EffectMiscValue[j]);
memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask));
memset(sOldContinentsNodesMask,0,sizeof(sTaxiNodesMask));
for(uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
if(!node)
if (!node)
continue;
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
if(src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
if (src_i!=sTaxiPathSetBySource.end() && !src_i->second.empty())
{
bool ok = false;
for(TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin();dest_i != src_i->second.end(); ++dest_i)
for (TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin(); dest_i != src_i->second.end(); ++dest_i)
{
// not spell path
if(spellPaths.find(dest_i->second.ID)==spellPaths.end())
if (spellPaths.find(dest_i->second.ID)==spellPaths.end())
{
ok = true;
break;
}
}
if(!ok)
if (!ok)
continue;
}
@ -650,9 +650,9 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleSeatStore, dbcPath,"VehicleSeat.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapAreaStore, dbcPath,"WorldMapArea.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWMOAreaTableStore, dbcPath,"WMOAreaTable.dbc");
for(uint32 i = 0; i < sWMOAreaTableStore.GetNumRows(); ++i)
for (uint32 i = 0; i < sWMOAreaTableStore.GetNumRows(); ++i)
{
if(WMOAreaTableEntry const* entry = sWMOAreaTableStore.LookupEntry(i))
if (WMOAreaTableEntry const* entry = sWMOAreaTableStore.LookupEntry(i))
{
sWMOAreaInfoByTripple.insert(WMOAreaInfoByTripple::value_type(WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId), entry));
}
@ -661,16 +661,16 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc");
// error checks
if (bad_dbc_files.size() >= DBCFilesCount )
if (bad_dbc_files.size() >= DBCFilesCount)
{
sLog.outError("\nIncorrect DataDir value in mangosd.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str());
Log::WaitBeforeContinueIfNeed();
exit(1);
}
else if (!bad_dbc_files.empty() )
else if (!bad_dbc_files.empty())
{
std::string str;
for(std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
str += *i + "\n";
sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s",(uint32)bad_dbc_files.size(),DBCFilesCount,str.c_str());
@ -680,12 +680,12 @@ void LoadDBCStores(const std::string& dataPath)
// Check loaded DBC files proper version
if (!sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.5a
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
!sGemPropertiesStore.LookupEntry(1629) || // last gem property added in 3.3.5a
!sItemStore.LookupEntry(56806) || // last client known item added in 3.3.5a
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last added spell in 3.3.5a
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
!sGemPropertiesStore.LookupEntry(1629) || // last gem property added in 3.3.5a
!sItemStore.LookupEntry(56806) || // last client known item added in 3.3.5a
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864)) // last added spell in 3.3.5a
{
sLog.outError("\nYou have mixed version DBC files. Please re-extract DBC files for one from client build: %s",AcceptableClientBuildsListStr().c_str());
Log::WaitBeforeContinueIfNeed();
@ -693,23 +693,23 @@ void LoadDBCStores(const std::string& dataPath)
}
sLog.outString();
sLog.outString( ">> Initialized %d data stores", DBCFilesCount );
sLog.outString(">> Initialized %d data stores", DBCFilesCount);
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)
{
FactionTeamMap::const_iterator itr = sFactionTeamMap.find(faction);
if(itr==sFactionTeamMap.end())
if (itr==sFactionTeamMap.end())
return NULL;
return &itr->second;
}
char const* GetPetName(uint32 petfamily, uint32 dbclang)
{
if(!petfamily)
if (!petfamily)
return NULL;
CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
if(!pet_family)
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
if (!pet_family)
return NULL;
return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL;
}
@ -717,7 +717,7 @@ char const* GetPetName(uint32 petfamily, uint32 dbclang)
TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
{
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
if(itr==sTalentSpellPosMap.end())
if (itr==sTalentSpellPosMap.end())
return NULL;
return &itr->second;
@ -739,7 +739,7 @@ uint32 GetTalentSpellCost(uint32 spellId)
int32 GetAreaFlagByAreaID(uint32 area_id)
{
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
if(i == sAreaFlagByAreaID.end())
if (i == sAreaFlagByAreaID.end())
return -1;
return i->second;
@ -747,28 +747,28 @@ int32 GetAreaFlagByAreaID(uint32 area_id)
WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid)
{
WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid));
if(i == sWMOAreaInfoByTripple.end())
return NULL;
return i->second;
WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid));
if (i == sWMOAreaInfoByTripple.end())
return NULL;
return i->second;
}
AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
{
int32 areaflag = GetAreaFlagByAreaID(area_id);
if(areaflag < 0)
if (areaflag < 0)
return NULL;
return sAreaStore.LookupEntry(areaflag );
return sAreaStore.LookupEntry(areaflag);
}
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id)
{
if(area_flag)
if (area_flag)
return sAreaStore.LookupEntry(area_flag);
if(MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
return GetAreaEntryByAreaID(mapEntry->linked_zone);
return NULL;
@ -777,7 +777,7 @@ AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_i
uint32 GetAreaFlagByMapId(uint32 mapid)
{
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
if(i == sAreaFlagByMapID.end())
if (i == sAreaFlagByMapID.end())
return 0;
else
return i->second;
@ -785,10 +785,10 @@ uint32 GetAreaFlagByMapId(uint32 mapid)
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
{
if(mapid != 530 && mapid != 571) // speed for most cases
if (mapid != 530 && mapid != 571) // speed for most cases
return mapid;
if(WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
return mapid;
@ -797,14 +797,14 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
{
mapid = GetVirtualMapForMapAndZone(mapid,zoneId);
if(mapid < 2)
if (mapid < 2)
return CONTENT_1_60;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if(!mapEntry)
if (!mapEntry)
return CONTENT_1_60;
switch(mapEntry->Expansion())
switch (mapEntry->Expansion())
{
default: return CONTENT_1_60;
case 1: return CONTENT_61_70;
@ -815,10 +815,10 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId)
ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
{
// not sorted, numbering index from 0
for(uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i)
{
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
if(ch && ch->ChannelID == channel_id)
if (ch && ch->ChannelID == channel_id)
return ch;
}
return NULL;
@ -826,19 +826,19 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
{
if(requiredTotemCategoryId==0)
if (requiredTotemCategoryId==0)
return true;
if(itemTotemCategoryId==0)
if (itemTotemCategoryId==0)
return false;
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
if(!itemEntry)
if (!itemEntry)
return false;
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
if(!reqEntry)
if (!reqEntry)
return false;
if(itemEntry->categoryType!=reqEntry->categoryType)
if (itemEntry->categoryType!=reqEntry->categoryType)
return false;
return (itemEntry->categoryMask & reqEntry->categoryMask)==reqEntry->categoryMask;
@ -880,10 +880,10 @@ MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty)
return itr != sMapDifficultyMap.end() ? &itr->second : NULL;
}
PvPDifficultyEntry const* GetBattlegroundBracketByLevel( uint32 mapid, uint32 level )
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
{
PvPDifficultyEntry const* maxEntry = NULL; // used for level > max listed level case
for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
{
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
{
@ -906,7 +906,7 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel( uint32 mapid, uint32 le
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id)
{
for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
if (entry->mapId == mapid && entry->GetBracketId() == id)
return entry;
@ -928,7 +928,7 @@ bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, flo
{
// if we have radius check it
float dist2 = (x-atEntry->x)*(x-atEntry->x) + (y-atEntry->y)*(y-atEntry->y) + (z-atEntry->z)*(z-atEntry->z);
if(dist2 > (atEntry->radius + delta)*(atEntry->radius + delta))
if (dist2 > (atEntry->radius + delta)*(atEntry->radius + delta))
return false;
}
else
@ -953,9 +953,9 @@ bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, flo
float dz = z - atEntry->z;
float dx = rotPlayerX - atEntry->x;
float dy = rotPlayerY - atEntry->y;
if( (fabs(dx) > atEntry->box_x/2 + delta) ||
(fabs(dy) > atEntry->box_y/2 + delta) ||
(fabs(dz) > atEntry->box_z/2 + delta) )
if ((fabs(dx) > atEntry->box_x/2 + delta) ||
(fabs(dy) > atEntry->box_y/2 + delta) ||
(fabs(dz) > atEntry->box_z/2 + delta))
{
return false;
}

View file

@ -210,4 +210,5 @@ MANGOS_DLL_SPEC DBCStorage <ItemEntry> const* GetItemDisplaySto
MANGOS_DLL_SPEC DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore();
MANGOS_DLL_SPEC DBCStorage <EmotesEntry> const* GetEmotesStore();
MANGOS_DLL_SPEC DBCStorage <EmotesTextEntry> const* GetEmotesTextStore();
#endif

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@ const char BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxiiii";
const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi";
const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx";
// ChatChannelsEntryfmt, index not used (more compact store)
// ChatChannelsEntryfmt, index not used (more compact store)
const char ChrClassesEntryfmt[]="nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
const char CinematicSequencesEntryfmt[]="nxxxxxxxxx";

View file

@ -29,16 +29,16 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
ObjectGuid guid;
recvPacket >> guid;
if(!GetPlayer()->duel) // ignore accept from duel-sender
if (!GetPlayer()->duel) // ignore accept from duel-sender
return;
Player *pl = GetPlayer();
Player *plTarget = pl->duel->opponent;
Player* pl = GetPlayer();
Player* plTarget = pl->duel->opponent;
if(pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
return;
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: received CMSG_DUEL_ACCEPTED" );
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: received CMSG_DUEL_ACCEPTED");
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName());
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
@ -55,14 +55,14 @@ void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
//DEBUG_LOG( "WORLD: received CMSG_DUEL_CANCELLED" );
// no duel requested
if(!GetPlayer()->duel)
if (!GetPlayer()->duel)
return;
// player surrendered in a duel using /forfeit
if(GetPlayer()->duel->startTime != 0)
if (GetPlayer()->duel->startTime != 0)
{
GetPlayer()->CombatStopWithPets(true);
if(GetPlayer()->duel->opponent)
if (GetPlayer()->duel->opponent)
GetPlayer()->duel->opponent->CombatStopWithPets(true);
GetPlayer()->CastSpell(GetPlayer(), 7267, true); // beg

View file

@ -41,7 +41,7 @@ DynamicObject::DynamicObject() : WorldObject()
void DynamicObject::AddToWorld()
{
///- Register the dynamicObject for guid lookup
if(!IsInWorld())
if (!IsInWorld())
GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this);
Object::AddToWorld();
@ -50,7 +50,7 @@ void DynamicObject::AddToWorld()
void DynamicObject::RemoveFromWorld()
{
///- Remove the dynamicObject from the accessor
if(IsInWorld())
if (IsInWorld())
{
GetMap()->GetObjectsStore().erase<DynamicObject>(GetObjectGuid(), (DynamicObject*)NULL);
GetViewPoint().Event_RemovedFromWorld();
@ -59,13 +59,13 @@ void DynamicObject::RemoveFromWorld()
Object::RemoveFromWorld();
}
bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type)
bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type)
{
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
SetMap(caster->GetMap());
Relocate(x, y, z, 0);
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,effIndex,GetPositionX(),GetPositionY());
return false;
@ -119,7 +119,7 @@ void DynamicObject::Update(uint32 update_diff, uint32 p_time)
{
// caster can be not in world at time dynamic object update, but dynamic object not yet deleted in Unit destructor
Unit* caster = GetCaster();
if(!caster)
if (!caster)
{
Delete();
return;
@ -127,20 +127,20 @@ void DynamicObject::Update(uint32 update_diff, uint32 p_time)
bool deleteThis = false;
if(m_aliveDuration > int32(p_time))
if (m_aliveDuration > int32(p_time))
m_aliveDuration -= p_time;
else
deleteThis = true;
// have radius and work as persistent effect
if(m_radius)
if (m_radius)
{
// TODO: make a timer and update this in larger intervals
MaNGOS::DynamicObjectUpdater notifier(*this, caster, m_positive);
Cell::VisitAllObjects(this, notifier, m_radius);
}
if(deleteThis)
if (deleteThis)
{
caster->RemoveDynObjectWithGUID(GetObjectGuid());
Delete();
@ -156,12 +156,12 @@ void DynamicObject::Delete()
void DynamicObject::Delay(int32 delaytime)
{
m_aliveDuration -= delaytime;
for (GuidSet::iterator iter = m_affected.begin(); iter != m_affected.end(); )
for (GuidSet::iterator iter = m_affected.begin(); iter != m_affected.end();)
{
Unit *target = GetMap()->GetUnit((*iter));
Unit* target = GetMap()->GetUnit((*iter));
if (target)
{
SpellAuraHolder *holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid());
SpellAuraHolder* holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid());
if (!holder)
{
++iter;
@ -205,7 +205,7 @@ bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* view
return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
}
bool DynamicObject::IsHostileTo( Unit const* unit ) const
bool DynamicObject::IsHostileTo(Unit const* unit) const
{
if (Unit* owner = GetCaster())
return owner->IsHostileTo(unit);
@ -213,7 +213,7 @@ bool DynamicObject::IsHostileTo( Unit const* unit ) const
return false;
}
bool DynamicObject::IsFriendlyTo( Unit const* unit ) const
bool DynamicObject::IsFriendlyTo(Unit const* unit) const
{
if (Unit* owner = GetCaster())
return owner->IsFriendlyTo(unit);

View file

@ -40,7 +40,7 @@ class DynamicObject : public WorldObject
void AddToWorld();
void RemoveFromWorld();
bool Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type);
bool Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type);
void Update(uint32 update_diff, uint32 p_time) override;
void Delete();
uint32 GetSpellId() const { return m_spellId; }
@ -50,9 +50,9 @@ class DynamicObject : public WorldObject
Unit* GetCaster() const;
float GetRadius() const { return m_radius; }
DynamicObjectType GetType() const { return (DynamicObjectType)GetByteValue(DYNAMICOBJECT_BYTES,0); }
bool IsAffecting(Unit *unit) const { return m_affected.find(unit->GetObjectGuid()) != m_affected.end(); }
void AddAffected(Unit *unit) { m_affected.insert(unit->GetObjectGuid()); }
void RemoveAffected(Unit *unit) { m_affected.erase(unit->GetObjectGuid()); }
bool IsAffecting(Unit* unit) const { return m_affected.find(unit->GetObjectGuid()) != m_affected.end(); }
void AddAffected(Unit* unit) { m_affected.insert(unit->GetObjectGuid()); }
void RemoveAffected(Unit* unit) { m_affected.erase(unit->GetObjectGuid()); }
void Delay(int32 delaytime);
bool IsHostileTo(Unit const* unit) const;
@ -65,7 +65,7 @@ class DynamicObject : public WorldObject
bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const;
GridReference<DynamicObject> &GetGridRef() { return m_gridRef; }
GridReference<DynamicObject>& GetGridRef() { return m_gridRef; }
protected:
uint32 m_spellId;