aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-01-06 12:15:18 -0600
committermegamage <none@none>2009-01-06 12:15:18 -0600
commit2b21f0e7302cfdb0fc79e3255f80dc33b939c974 (patch)
treec1fb071d3c86ead192f9cbf7acffa06c050cd4d5
parent215039055bf5f017870d583c60c01c303d1a2d33 (diff)
parent290a187592d28cbfd9639ded43663077711f3379 (diff)
*Merge with Trinity 793.
--HG-- branch : trunk
-rw-r--r--sql/updates/783_world.sql4
-rw-r--r--sql/updates/785_world.sql4
-rw-r--r--sql/updates/789_world.sql1
-rw-r--r--src/bindings/scripts/ScriptMgr.cpp5
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp46
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp2
-rw-r--r--src/game/Chat.cpp2
-rw-r--r--src/game/Chat.h3
-rw-r--r--src/game/GridDefines.h10
-rw-r--r--src/game/GridNotifiers.cpp10
-rw-r--r--src/game/GridNotifiers.h4
-rw-r--r--src/game/Language.h2
-rw-r--r--src/game/Level2.cpp57
-rw-r--r--src/game/Map.cpp55
-rw-r--r--src/game/Map.h2
-rw-r--r--src/game/MiscHandler.cpp5
-rw-r--r--src/game/ObjectAccessor.cpp4
-rw-r--r--src/game/ObjectAccessor.h2
-rw-r--r--src/game/Player.cpp13
-rw-r--r--src/game/World.cpp62
-rw-r--r--src/game/World.h2
21 files changed, 200 insertions, 95 deletions
diff --git a/sql/updates/783_world.sql b/sql/updates/783_world.sql
new file mode 100644
index 00000000000..24a8481e24e
--- /dev/null
+++ b/sql/updates/783_world.sql
@@ -0,0 +1,4 @@
+DELETE FROM trinity_string where entry IN (10056, 10057);
+INSERT INTO trinity_string (entry, content_default) VALUES
+(10056, 'You must be a member of the Horde to enter the Hall of Legends.'),
+(10057, 'You must be a member of the Alliance to enter the Champion\'s Hall.'); \ No newline at end of file
diff --git a/sql/updates/785_world.sql b/sql/updates/785_world.sql
new file mode 100644
index 00000000000..39b85c3871a
--- /dev/null
+++ b/sql/updates/785_world.sql
@@ -0,0 +1,4 @@
+delete from command where name in ('gobject tempadd', 'npc tempadd');
+insert into command (name, security, help) values
+('gobject tempadd','2','Adds a temporary gameobject that is not saved to DB.'),
+('npc tempadd','2','Adds temporary NPC, not saved to database.'); \ No newline at end of file
diff --git a/sql/updates/789_world.sql b/sql/updates/789_world.sql
new file mode 100644
index 00000000000..0c51d1b3fac
--- /dev/null
+++ b/sql/updates/789_world.sql
@@ -0,0 +1 @@
+ALTER TABLE eventai_texts DROP COLUMN emote; \ No newline at end of file
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp
index d28a17b9104..a4d75f6aeb2 100644
--- a/src/bindings/scripts/ScriptMgr.cpp
+++ b/src/bindings/scripts/ScriptMgr.cpp
@@ -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)
{
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index bb7f98c9f7b..20c5600dc02 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -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;
}
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index a629bf7b4d8..d764fb02c2e 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -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;
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 334133b1f7b..03993fbfac1 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -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 }
};
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 6c809c159a6..5b364d8cb06 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -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);
diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h
index a68ecb4da97..1c67bd0ca3a 100644
--- a/src/game/GridDefines.h
+++ b/src/game/GridDefines.h
@@ -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)
diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp
index b69e185c171..c736be699d0 100644
--- a/src/game/GridNotifiers.cpp
+++ b/src/game/GridNotifiers.cpp
@@ -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());
}
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index b00bd33bd24..eb15d8ea7b2 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -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
{
diff --git a/src/game/Language.h b/src/game/Language.h
index 251ba55174f..aa2ea06d109 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -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
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index c5db2cc2869..61e66ca251e 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -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;
+}
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 89427a02082..f765cf97d20 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -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 )
{
diff --git a/src/game/Map.h b/src/game/Map.h
index b11aea4582c..7e885ebf61f 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -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(); }
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 2d8a898132e..713daf3a7e3 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -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 )
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index 4e876d99418..45429824b9c 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -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
diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h
index 2202748cd5a..91b80eaa7e1 100644
--- a/src/game/ObjectAccessor.h
+++ b/src/game/ObjectAccessor.h
@@ -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
{
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 7c42b48c1fc..de8a1a747a7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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())
{
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 7dac66c99f2..bd265182f2f 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -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;
}
diff --git a/src/game/World.h b/src/game/World.h
index f165a51d2ce..4309ed030c1 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -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;