mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[9736] Added more usable interface for grid visits
(based on SilverIce's repo commit f20f01e) Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
9a0de445b8
commit
e3f3f3410a
19 changed files with 88 additions and 406 deletions
|
|
@ -1494,34 +1494,21 @@ namespace MaNGOS
|
|||
|
||||
void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid)
|
||||
{
|
||||
CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_SAY, textId,language,TargetGuid);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||
MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),say_do);
|
||||
TypeContainerVisitor<MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY));
|
||||
Cell::VisitWorldObjects(this, say_worker, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid)
|
||||
{
|
||||
CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
float range = sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL);
|
||||
|
||||
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_YELL, textId,language,TargetGuid);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||
MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,range,say_do);
|
||||
TypeContainerVisitor<MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, range);
|
||||
Cell::VisitWorldObjects(this, say_worker, sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_YELL));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid)
|
||||
|
|
@ -1539,19 +1526,12 @@ void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 Target
|
|||
|
||||
void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote)
|
||||
{
|
||||
CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY());
|
||||
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
float range = sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE);
|
||||
|
||||
MaNGOS::MonsterChatBuilder say_build(*this, IsBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, textId,LANG_UNIVERSAL,TargetGuid);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||
MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> > say_worker(this,range,say_do);
|
||||
TypeContainerVisitor<MaNGOS::PlayerDistWorker<MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
|
||||
cell.Visit(p, message, *GetMap(), *this, range);
|
||||
Cell::VisitWorldObjects(this, say_worker, sWorld.getConfig(IsBossEmote ? CONFIG_FLOAT_LISTEN_RANGE_YELL : CONFIG_FLOAT_LISTEN_RANGE_TEXTEMOTE));
|
||||
}
|
||||
|
||||
void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper)
|
||||
|
|
@ -1779,19 +1759,10 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y,
|
|||
|
||||
// adding used positions around object
|
||||
{
|
||||
CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
MaNGOS::NearUsedPosDo u_do(*this,searcher,absAngle,selector);
|
||||
MaNGOS::WorldObjectWorker<MaNGOS::NearUsedPosDo> worker(this,u_do);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::WorldObjectWorker<MaNGOS::NearUsedPosDo>, GridTypeMapContainer > grid_obj_worker(worker);
|
||||
TypeContainerVisitor<MaNGOS::WorldObjectWorker<MaNGOS::NearUsedPosDo>, WorldTypeMapContainer > world_obj_worker(worker);
|
||||
|
||||
cell.Visit(p, grid_obj_worker, *GetMap(), *this, distance2d);
|
||||
cell.Visit(p, world_obj_worker, *GetMap(), *this, distance2d);
|
||||
|
||||
Cell::VisitAllObjects(this, worker, distance2d);
|
||||
}
|
||||
|
||||
// maybe can just place in primary position
|
||||
|
|
@ -1943,15 +1914,8 @@ struct WorldObjectChangeAccumulator
|
|||
|
||||
void WorldObject::BuildUpdateData( UpdateDataMapType & update_players)
|
||||
{
|
||||
CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY());
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
WorldObjectChangeAccumulator notifier(*this, update_players);
|
||||
TypeContainerVisitor<WorldObjectChangeAccumulator, WorldTypeMapContainer > player_notifier(notifier);
|
||||
Map* aMap = GetMap();
|
||||
//we must build packets for all visible players
|
||||
cell.Visit(p, player_notifier, *aMap, *this, aMap->GetVisibilityDistance());
|
||||
Cell::VisitWorldObjects(this, notifier, GetMap()->GetVisibilityDistance());
|
||||
|
||||
ClearUpdateMask(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue