*Merge with Trinity 793.
--HG-- branch : trunk
This commit is contained in:
@@ -656,7 +656,8 @@ void LoadDatabase()
|
||||
LoadTrinityStrings(TScriptDB,"eventai_texts",-1,1+(TEXT_SOURCE_RANGE));
|
||||
|
||||
// Gather Additional data from EventAI Texts
|
||||
result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM eventai_texts");
|
||||
//result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM eventai_texts");
|
||||
result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM eventai_texts");
|
||||
|
||||
outstring_log("TSCR: Loading EventAI Texts additional data...");
|
||||
if (result)
|
||||
@@ -674,7 +675,7 @@ void LoadDatabase()
|
||||
temp.SoundId = fields[1].GetInt32();
|
||||
temp.Type = fields[2].GetInt32();
|
||||
temp.Language = fields[3].GetInt32();
|
||||
temp.Emote = fields[4].GetInt32();
|
||||
temp.Emote = 0;//fields[4].GetInt32();
|
||||
|
||||
if (i >= 0)
|
||||
{
|
||||
|
||||
@@ -746,8 +746,7 @@ Unit* ScriptedAI::FindCreature(uint32 entry, float range)
|
||||
Creature* target = NULL;
|
||||
Trinity::AllCreaturesOfEntryInRange check(m_creature, entry, range);
|
||||
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, check);
|
||||
m_creature->VisitNearbyGridObject(range, searcher);
|
||||
if(!target) error_log("SD2 ERROR: Entry: %u not found!", entry);
|
||||
m_creature->VisitNearbyObject(range, searcher);
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -757,70 +756,33 @@ GameObject* ScriptedAI::FindGameObject(uint32 entry, float range)
|
||||
Trinity::AllGameObjectsWithEntryInGrid go_check(entry);
|
||||
Trinity::GameObjectSearcher<Trinity::AllGameObjectsWithEntryInGrid> searcher(target, go_check);
|
||||
m_creature->VisitNearbyGridObject(range, searcher);
|
||||
if(!target) error_log("SD2 ERROR: Entry: %u not found!", entry);
|
||||
return target;
|
||||
}
|
||||
|
||||
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
|
||||
{
|
||||
CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
Unit* pUnit = NULL;
|
||||
|
||||
Trinity::MostHPMissingInRange u_check(m_creature, range, MinHPDiff);
|
||||
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(pUnit, u_check);
|
||||
|
||||
/*
|
||||
typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes;
|
||||
This means that if we only search grid then we cannot possibly return pets or players so this is safe
|
||||
*/
|
||||
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap()));
|
||||
m_creature->VisitNearbyObject(range, searcher);
|
||||
return pUnit;
|
||||
}
|
||||
|
||||
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
|
||||
{
|
||||
CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
std::list<Creature*> pList;
|
||||
|
||||
Trinity::FriendlyCCedInRange u_check(m_creature, range);
|
||||
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(pList, u_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap()));
|
||||
|
||||
m_creature->VisitNearbyObject(range, searcher);
|
||||
return pList;
|
||||
}
|
||||
|
||||
std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 spellid)
|
||||
{
|
||||
CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
|
||||
Cell cell(p);
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
cell.SetNoCreate();
|
||||
|
||||
std::list<Creature*> pList;
|
||||
|
||||
Trinity::FriendlyMissingBuffInRange u_check(m_creature, range, spellid);
|
||||
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(pList, u_check);
|
||||
|
||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap()));
|
||||
|
||||
m_creature->VisitNearbyObject(range, searcher);
|
||||
return pList;
|
||||
}
|
||||
|
||||
|
||||
@@ -790,6 +790,8 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
||||
break;
|
||||
case ACTION_T_FLEE:
|
||||
{
|
||||
if(m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||
break;
|
||||
TimetoFleeLeft = 8000;
|
||||
m_creature->DoFleeToGetAssistance();
|
||||
IsFleeing = true;
|
||||
|
||||
@@ -442,6 +442,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL },
|
||||
{ "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL },
|
||||
{ "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL },
|
||||
{ "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL },
|
||||
|
||||
//{ TODO: fix or remove this commands
|
||||
{ "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNameCommand, "", NULL },
|
||||
@@ -475,6 +476,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{ "move", SEC_GAMEMASTER, false, &ChatHandler::HandleMoveObjectCommand, "", NULL },
|
||||
{ "near", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNearObjectCommand, "", NULL },
|
||||
{ "activate", SEC_GAMEMASTER, false, &ChatHandler::HandleActivateObjectCommand, "", NULL },
|
||||
{ "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempGameObjectCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -466,6 +466,9 @@ class ChatHandler
|
||||
bool HandlePlayAllCommand(const char* args);
|
||||
bool HandleRepairitemsCommand(const char* args);
|
||||
|
||||
bool HandleTempGameObjectCommand(const char* args);
|
||||
bool HandleTempAddSpwCommand(const char* args);
|
||||
|
||||
//! Development Commands
|
||||
bool HandleSetValue(const char* args);
|
||||
bool HandleGetValue(const char* args);
|
||||
|
||||
@@ -152,11 +152,11 @@ namespace Trinity
|
||||
double x_offset = (double(x) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL;
|
||||
double y_offset = (double(y) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL;
|
||||
|
||||
int x_val = int(x_offset + 0.5);
|
||||
int y_val = int(y_offset + 0.5);
|
||||
x_off = (float(x_offset) - x_val) * SIZE_OF_GRID_CELL;
|
||||
y_off = (float(y_offset) - y_val) * SIZE_OF_GRID_CELL;
|
||||
return CellPair(x_val + CENTER_GRID_CELL_ID, y_val + CENTER_GRID_CELL_ID);
|
||||
int x_val = int(x_offset + CENTER_GRID_CELL_ID + 0.5);
|
||||
int y_val = int(y_offset + CENTER_GRID_CELL_ID + 0.5);
|
||||
x_off = (float(x_offset) - x_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL;
|
||||
y_off = (float(y_offset) - y_val + CENTER_GRID_CELL_ID) * SIZE_OF_GRID_CELL;
|
||||
return CellPair(x_val, y_val);
|
||||
}
|
||||
|
||||
inline void NormalizeMapCoord(float &c)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
using namespace Trinity;
|
||||
|
||||
void
|
||||
/*void
|
||||
Trinity::PlayerNotifier::Visit(PlayerMapType &m)
|
||||
{
|
||||
for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||
@@ -45,7 +45,7 @@ Trinity::PlayerNotifier::Visit(PlayerMapType &m)
|
||||
for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it)
|
||||
(*it)->UpdateVisibilityOf(iter->getSource());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void
|
||||
VisibleChangesNotifier::Visit(PlayerMapType &m)
|
||||
@@ -68,6 +68,12 @@ VisibleNotifier::Visit(PlayerMapType &m)
|
||||
continue;
|
||||
|
||||
iter->getSource()->UpdateVisibilityOf(&i_player);
|
||||
//i_player.UpdateVisibilityOf(iter->getSource());
|
||||
|
||||
//if (!i_player.GetSharedVisionList().empty())
|
||||
// for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it)
|
||||
// (*it)->UpdateVisibilityOf(iter->getSource());
|
||||
|
||||
i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow);
|
||||
i_clientGUIDs.erase(iter->getSource()->GetGUID());
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ class Player;
|
||||
namespace Trinity
|
||||
{
|
||||
|
||||
struct TRINITY_DLL_DECL PlayerNotifier
|
||||
/*struct TRINITY_DLL_DECL PlayerNotifier
|
||||
{
|
||||
explicit PlayerNotifier(Player &pl) : i_player(pl) {}
|
||||
void Visit(PlayerMapType &);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
Player &i_player;
|
||||
};
|
||||
};*/
|
||||
|
||||
struct TRINITY_DLL_DECL VisibleNotifier
|
||||
{
|
||||
|
||||
@@ -886,6 +886,8 @@ enum TrinityStrings
|
||||
LANG_OPVP_EP_FLIGHT_CGT = 10053,
|
||||
LANG_OPVP_ZM_GOSSIP_ALLIANCE = 10054,
|
||||
LANG_OPVP_ZM_GOSSIP_HORDE = 10055,
|
||||
LANG_NO_ENTER_HALL_OF_LEGENDS = 10056,
|
||||
LANG_NO_ENTER_CHAMPIONS_HALL = 10057,
|
||||
|
||||
// Use for custom patches 11000-11999
|
||||
|
||||
|
||||
+56
-1
@@ -4337,9 +4337,64 @@ bool ChatHandler::HandleActivateObjectCommand(const char *args)
|
||||
|
||||
// Activate
|
||||
obj->SetLootState(GO_READY);
|
||||
obj->UseDoorOrButton(10000);
|
||||
obj->UseDoorOrButton(10000);
|
||||
|
||||
PSendSysMessage("Object activated!");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// add creature, temp only
|
||||
bool ChatHandler::HandleTempAddSpwCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
char* charID = strtok((char*)args, " ");
|
||||
if (!charID)
|
||||
return false;
|
||||
|
||||
Player *chr = m_session->GetPlayer();
|
||||
|
||||
float x = chr->GetPositionX();
|
||||
float y = chr->GetPositionY();
|
||||
float z = chr->GetPositionZ();
|
||||
float ang = chr->GetOrientation();
|
||||
|
||||
uint32 id = atoi(charID);
|
||||
|
||||
chr->SummonCreature(id,x,y,z,ang,TEMPSUMMON_CORPSE_DESPAWN,120);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// add go, temp only
|
||||
bool ChatHandler::HandleTempGameObjectCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
char* charID = strtok((char*)args, " ");
|
||||
if (!charID)
|
||||
return false;
|
||||
|
||||
Player *chr = m_session->GetPlayer();
|
||||
|
||||
char* spawntime = strtok(NULL, " ");
|
||||
uint32 spawntm;
|
||||
|
||||
if( spawntime )
|
||||
spawntm = atoi((char*)spawntime);
|
||||
|
||||
float x = chr->GetPositionX();
|
||||
float y = chr->GetPositionY();
|
||||
float z = chr->GetPositionZ();
|
||||
float ang = chr->GetOrientation();
|
||||
|
||||
float rot2 = sin(ang/2);
|
||||
float rot3 = cos(ang/2);
|
||||
|
||||
uint32 id = atoi(charID);
|
||||
|
||||
chr->SummonGameObject(id,x,y,z,ang,0,0,rot2,rot3,spawntm);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+38
-17
@@ -657,24 +657,30 @@ void Map::RelocationNotify()
|
||||
{
|
||||
//creatures may be added to the list during update
|
||||
i_lock = true;
|
||||
|
||||
//Notify
|
||||
for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
||||
{
|
||||
Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL);
|
||||
if(!unit) continue;
|
||||
if(!unit)
|
||||
continue;
|
||||
|
||||
unit->m_Notified = true;
|
||||
|
||||
if(!unit->IsInWorld())
|
||||
continue;
|
||||
CellPair val = Trinity::ComputeCellPair(unit->GetPositionX(), unit->GetPositionY());
|
||||
Cell cell(val);
|
||||
cell.SetNoCreate();
|
||||
//if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
// PlayerRelocationNotify((Player*)unit, cell, val);
|
||||
//else
|
||||
// CreatureRelocationNotify((Creature*)unit, cell, val);
|
||||
|
||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
UpdatePlayerVisibility((Player*)unit, cell, val);
|
||||
UpdateObjectsVisibilityFor((Player*)unit, cell, val);
|
||||
//UpdatePlayerVisibility((Player*)unit, cell, val);
|
||||
//Trinity::PlayerNotifier pl_notifier(*player);
|
||||
//VisitWorld(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), pl_notifier);
|
||||
|
||||
//UpdateObjectsVisibilityFor((Player*)unit, cell, val);
|
||||
Trinity::VisibleNotifier ob_notifier(*((Player*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier);
|
||||
ob_notifier.Notify();
|
||||
|
||||
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||
}
|
||||
@@ -683,7 +689,20 @@ void Map::RelocationNotify()
|
||||
Trinity::CreatureRelocationNotifier notifier(*((Creature*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||
}
|
||||
|
||||
// Update visibility back to player who is controlling the unit
|
||||
if(unit->GetSharedVisionList().size())
|
||||
{
|
||||
for(SharedVisionList::const_iterator it = unit->GetSharedVisionList().begin(); it != unit->GetSharedVisionList().end(); ++it)
|
||||
{
|
||||
Trinity::VisibleNotifier ob_notifier(**it);
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier);
|
||||
ob_notifier.Notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Clear list
|
||||
for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
||||
{
|
||||
if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL))
|
||||
@@ -693,6 +712,7 @@ void Map::RelocationNotify()
|
||||
}
|
||||
}
|
||||
i_unitsToNotify.clear();
|
||||
|
||||
i_lock = false;
|
||||
}
|
||||
|
||||
@@ -814,7 +834,8 @@ void Map::Remove(Player *player, bool remove)
|
||||
|
||||
SendRemoveTransports(player);
|
||||
|
||||
UpdateObjectsVisibilityFor(player,cell,p);
|
||||
//UpdateObjectsVisibilityFor(player,cell,p);
|
||||
AddUnitToNotify(player);
|
||||
|
||||
if( remove )
|
||||
DeleteFromWorld(player);
|
||||
@@ -903,8 +924,8 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
|
||||
//UpdateObjectsVisibilityFor(player,new_cell,new_val);
|
||||
|
||||
// also update what possessing player sees
|
||||
if(player->isPossessedByPlayer())
|
||||
UpdateObjectsVisibilityFor((Player*)player->GetCharmer(), new_cell, new_val);
|
||||
//if(player->isPossessedByPlayer())
|
||||
// UpdateObjectsVisibilityFor((Player*)player->GetCharmer(), new_cell, new_val);
|
||||
|
||||
//PlayerRelocationNotify(player,new_cell,new_val);
|
||||
AddUnitToNotify(player);
|
||||
@@ -947,8 +968,8 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang
|
||||
{
|
||||
creature->Relocate(x, y, z, ang);
|
||||
// Update visibility back to player who is controlling the creature
|
||||
if(creature->isPossessedByPlayer())
|
||||
UpdateObjectsVisibilityFor((Player*)creature->GetCharmer(), new_cell, new_val);
|
||||
//if(creature->isPossessedByPlayer())
|
||||
// UpdateObjectsVisibilityFor((Player*)creature->GetCharmer(), new_cell, new_val);
|
||||
|
||||
//CreatureRelocationNotify(creature,new_cell,new_val);
|
||||
AddUnitToNotify(creature);
|
||||
@@ -1408,7 +1429,7 @@ void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair
|
||||
cell_lock->Visit(cell_lock, player_notifier, *this);
|
||||
}
|
||||
|
||||
void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
|
||||
/*void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
|
||||
{
|
||||
cell.data.Part.reserved = ALL_DISTRICT;
|
||||
|
||||
@@ -1417,7 +1438,7 @@ void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
|
||||
|
||||
CellLock<ReadGuard> cell_lock(cell, cellpair);
|
||||
cell_lock->Visit(cell_lock, player_notifier, *this);
|
||||
}
|
||||
}*/
|
||||
|
||||
void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpair )
|
||||
{
|
||||
|
||||
+1
-1
@@ -242,7 +242,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
||||
virtual bool RemoveBones(uint64 guid, float x, float y);
|
||||
|
||||
void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair);
|
||||
void UpdatePlayerVisibility(Player* player, Cell cell, CellPair cellpair);
|
||||
//void UpdatePlayerVisibility(Player* player, Cell cell, CellPair cellpair);
|
||||
void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellPair cellpair);
|
||||
|
||||
void resetMarkedCells() { marked_cells.reset(); }
|
||||
|
||||
@@ -1491,8 +1491,9 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
|
||||
return;
|
||||
}
|
||||
// Update visibility after vision change
|
||||
Cell cell(pair);
|
||||
GetPlayer()->GetMap()->UpdateObjectsVisibilityFor(_player, cell, pair);
|
||||
//Cell cell(pair);
|
||||
//GetPlayer()->GetMap()->UpdateObjectsVisibilityFor(_player, cell, pair);
|
||||
GetPlayer()->SetToNotify();
|
||||
}
|
||||
|
||||
void WorldSession::HandleChooseTitleOpcode( WorldPacket & recv_data )
|
||||
|
||||
@@ -592,7 +592,7 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)
|
||||
obj->GetMap()->UpdateObjectVisibility(obj,cell,p);
|
||||
}
|
||||
|
||||
void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
|
||||
/*void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
|
||||
{
|
||||
CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
|
||||
Cell cell(p);
|
||||
@@ -600,7 +600,7 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
|
||||
|
||||
m->UpdatePlayerVisibility(player,cell,p);
|
||||
m->UpdateObjectsVisibilityFor(player,cell,p);
|
||||
}
|
||||
}*/
|
||||
|
||||
/// Define the static member of HashMapHolder
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor
|
||||
static void _buildUpdateObject(Object* obj, UpdateDataMapType &);
|
||||
|
||||
static void UpdateObjectVisibility(WorldObject* obj);
|
||||
static void UpdateVisibilityForPlayer(Player* player);
|
||||
//static void UpdateVisibilityForPlayer(Player* player);
|
||||
private:
|
||||
struct WorldObjectChangeAccumulator
|
||||
{
|
||||
|
||||
@@ -1577,6 +1577,19 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
if(!InBattleGround() && mEntry->IsBattleGroundOrArena())
|
||||
return false;
|
||||
|
||||
// 449 - Champions' Hall (Alliance) // 450 - Hall of Legends (Horde)
|
||||
if(mapid == 449 && GetTeam()==HORDE)
|
||||
{
|
||||
GetSession()->SendNotification(LANG_NO_ENTER_CHAMPIONS_HALL);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mapid == 450 && GetTeam() == ALLIANCE)
|
||||
{
|
||||
GetSession()->SendNotification(LANG_NO_ENTER_HALL_OF_LEGENDS);
|
||||
return false;
|
||||
}
|
||||
|
||||
// client without expansion support
|
||||
if(GetSession()->Expansion() < mEntry->Expansion())
|
||||
{
|
||||
|
||||
+44
-18
@@ -983,6 +983,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
}
|
||||
if(m_MaxVisibleDistance < m_MaxVisibleDistanceInFlight)
|
||||
m_MaxVisibleDistance = m_MaxVisibleDistanceInFlight;
|
||||
m_MaxVisibleDistance += 1.0f;
|
||||
|
||||
///- Read the "Data" directory from the config file
|
||||
std::string dataPath = sConfig.GetStringDefault("DataDir","./");
|
||||
@@ -1461,6 +1462,17 @@ void World::DetectDBCLang()
|
||||
sLog.outString("Using %s DBC Locale as default. All available DBC locales: %s",localeNames[m_defaultDbcLocale],availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
|
||||
}
|
||||
|
||||
void World::RecordTimeDiff(const char *text)
|
||||
{
|
||||
if(m_updateTimeCount != 1)
|
||||
return;
|
||||
sLog.outDebugInLine("Difftime ");
|
||||
sLog.outDebugInLine(text);
|
||||
uint32 thisTime = getMSTime();
|
||||
sLog.outDebug(": %u.", getMSTimeDiff(m_currentTime, thisTime));
|
||||
m_currentTime = thisTime;
|
||||
}
|
||||
|
||||
/// Update the World !
|
||||
void World::Update(time_t diff)
|
||||
{
|
||||
@@ -1472,6 +1484,7 @@ void World::Update(time_t diff)
|
||||
sLog.outString("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
|
||||
m_updateTimeSum = m_updateTime;
|
||||
m_updateTimeCount = 1;
|
||||
m_currentTime = getMSTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1558,6 +1571,7 @@ void World::Update(time_t diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
RecordTimeDiff("UpdateAuction");
|
||||
|
||||
/// <li> Handle session updates when the timer has passed
|
||||
if (m_timers[WUPDATE_SESSIONS].Passed())
|
||||
@@ -1566,6 +1580,7 @@ void World::Update(time_t diff)
|
||||
|
||||
UpdateSessions(diff);
|
||||
}
|
||||
RecordTimeDiff("UpdateSessions");
|
||||
|
||||
/// <li> Handle weather updates when the timer has passed
|
||||
if (m_timers[WUPDATE_WEATHERS].Passed())
|
||||
@@ -1597,6 +1612,7 @@ void World::Update(time_t diff)
|
||||
m_timers[WUPDATE_UPTIME].Reset();
|
||||
WorldDatabase.PExecute("UPDATE uptime SET uptime = %d, maxplayers = %d WHERE starttime = " I64FMTD, tmpDiff, maxClientsNum, uint64(m_startTime));
|
||||
}
|
||||
RecordTimeDiff("UpdateWeatherAndUptime");
|
||||
|
||||
/// <li> Handle all other objects
|
||||
if (m_timers[WUPDATE_OBJECTS].Passed())
|
||||
@@ -1613,9 +1629,11 @@ void World::Update(time_t diff)
|
||||
|
||||
sOutdoorPvPMgr.Update(diff);
|
||||
}
|
||||
RecordTimeDiff("UpdateMaps");
|
||||
|
||||
// execute callbacks from sql queries that were queued recently
|
||||
UpdateResultQueue();
|
||||
RecordTimeDiff("UpdateResultQueue");
|
||||
|
||||
///- Erase corpses once every 20 minutes
|
||||
if (m_timers[WUPDATE_CORPSES].Passed())
|
||||
@@ -1643,6 +1661,7 @@ void World::Update(time_t diff)
|
||||
|
||||
// And last, but not least handle the issued cli commands
|
||||
ProcessCliCommands();
|
||||
RecordTimeDiff("UpdateRemainingThings");
|
||||
}
|
||||
|
||||
void World::ForceGameEventUpdate()
|
||||
@@ -2339,6 +2358,7 @@ void World::ScriptsProcess()
|
||||
sLog.outError("SCRIPT_COMMAND_CALLSCRIPT calls invallid db_script_id or lowguid not present: skipping.");
|
||||
break;
|
||||
}
|
||||
//our target
|
||||
Creature* target = NULL;
|
||||
|
||||
if(source) //using grid searcher
|
||||
@@ -2360,40 +2380,46 @@ void World::ScriptsProcess()
|
||||
if(CreatureData const* data = objmgr.GetCreatureData(step.script->datalong))
|
||||
target = ObjectAccessor::GetObjectInWorld<Creature>(data->mapid, data->posX, data->posY, MAKE_NEW_GUID(step.script->datalong, data->id, HIGHGUID_UNIT), target);
|
||||
}
|
||||
|
||||
//sLog.outDebug("attempting to pass target...");
|
||||
if(!target)
|
||||
break;
|
||||
|
||||
//sLog.outDebug("target passed");
|
||||
//Lets choose our ScriptMap map
|
||||
ScriptMapMap datamap;
|
||||
ScriptMapMap *datamap = NULL;
|
||||
switch(step.script->dataint)
|
||||
{
|
||||
case 1:
|
||||
datamap = sQuestEndScripts;
|
||||
case 1://QUEST END SCRIPTMAP
|
||||
datamap = &sQuestEndScripts;
|
||||
break;
|
||||
case 2:
|
||||
datamap = sQuestStartScripts;
|
||||
case 2://QUEST START SCRIPTMAP
|
||||
datamap = &sQuestStartScripts;
|
||||
break;
|
||||
case 3:
|
||||
datamap = sSpellScripts;
|
||||
case 3://SPELLS SCRIPTMAP
|
||||
datamap = &sSpellScripts;
|
||||
break;
|
||||
case 4:
|
||||
datamap = sGameObjectScripts;
|
||||
case 4://GAMEOBJECTS SCRIPTMAP
|
||||
datamap = &sGameObjectScripts;
|
||||
break;
|
||||
case 5:
|
||||
datamap = sEventScripts;
|
||||
case 5://EVENTS SCRIPTMAP
|
||||
datamap = &sEventScripts;
|
||||
break;
|
||||
case 6:
|
||||
datamap = sWaypointScripts;
|
||||
case 6://WAYPOINTS SCRIPTMAP
|
||||
datamap = &sWaypointScripts;
|
||||
break;
|
||||
default:
|
||||
sLog.outError("SCRIPT_COMMAND_CALLSCRIPT ERROR: no scriptmap present... ignoring");
|
||||
m_scriptSchedule.erase(iter);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
//if no scriptmap present...
|
||||
if(!datamap)
|
||||
break;
|
||||
|
||||
uint32 script_id = step.script->datalong2;
|
||||
//delete iter and return it to begin pos(next one)
|
||||
m_scriptSchedule.erase(iter);
|
||||
ScriptsStart(datamap, script_id, target, NULL);
|
||||
iter = m_scriptSchedule.begin();
|
||||
|
||||
ScriptsStart(*datamap, script_id, target, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -547,6 +547,8 @@ class World
|
||||
uint32 mail_timer_expires;
|
||||
uint32 m_updateTime, m_updateTimeSum;
|
||||
uint32 m_updateTimeCount;
|
||||
uint32 m_currentTime;
|
||||
void RecordTimeDiff(const char * text);
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Weather*> WeatherMap;
|
||||
WeatherMap m_weathers;
|
||||
|
||||
Reference in New Issue
Block a user