aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp25
-rw-r--r--src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp14
-rw-r--r--src/game/Creature.cpp27
-rw-r--r--src/game/Creature.h9
-rw-r--r--src/game/Level2.cpp55
-rw-r--r--src/game/Unit.cpp8
-rw-r--r--src/game/WaypointManager.cpp20
-rw-r--r--src/game/WaypointManager.h11
-rw-r--r--src/game/WaypointMovementGenerator.cpp6
-rw-r--r--src/game/WaypointMovementGenerator.h4
-rw-r--r--src/game/Wintergrasp.cpp17
-rw-r--r--src/shared/Database/SQLStorage.cpp4
12 files changed, 98 insertions, 102 deletions
diff --git a/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp b/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp
index 8c6442ade4f..2ac360faa09 100644
--- a/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp
+++ b/src/bindings/scripts/scripts/kalimdor/zulfarrak/zulfarrak.cpp
@@ -228,6 +228,25 @@ bool GOHello_go_shallow_grave(Player* pPlayer, GameObject* pGo)
return false;
}
+/*######
+## at_zumrah
+######*/
+
+enum {
+ ZUMRAH_ID = 7271,
+ ZUMRAH_HOSTILE_FACTION = 37
+};
+
+bool AreaTrigger_at_zumrah(Player* pPlayer, AreaTriggerEntry *at)
+{
+ Creature* Zumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f);
+
+ if (!Zumrah)
+ return false;
+
+ Zumrah->setFaction(ZUMRAH_HOSTILE_FACTION);
+}
+
void AddSC_zulfarrak()
{
Script *newscript;
@@ -250,4 +269,10 @@ void AddSC_zulfarrak()
newscript->Name="go_shallow_grave";
newscript->pGOHello = &GOHello_go_shallow_grave;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "at_zumrah";
+ newscript->pAreaTrigger = &AreaTrigger_at_zumrah;
+ newscript->RegisterSelf();
+
}
diff --git a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp
index c5cae7e7412..30e835711a4 100644
--- a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp
+++ b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp
@@ -17,12 +17,13 @@
/* ScriptData
SDName: Hellfire_Peninsula
SD%Complete: 100
- SDComment: Quest support: 9375, 9418, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths)
+SDComment: Quest support: 9375, 9410, 9418, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths)
SDCategory: Hellfire Peninsula
EndScriptData */
/* ContentData
npc_aeranas
+npc_ancestral_wolf
go_haaleshi_altar
npc_naladu
npc_tracy_proudwell
@@ -337,20 +338,21 @@ bool QuestAccept_npc_wounded_blood_elf(Player* pPlayer, Creature* pCreature, Que
return true;
}
-/*######
-##
-######*/
-
void AddSC_hellfire_peninsula()
{
Script *newscript;
newscript = new Script;
- newscript->Name = "npc_aeranas";
+ newscript->Name = "npc_aeranas";
newscript->GetAI = &GetAI_npc_aeranas;
newscript->RegisterSelf();
newscript = new Script;
+ newscript->Name = "npc_ancestral_wolf";
+ newscript->GetAI = &GetAI_npc_ancestral_wolf;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
newscript->Name = "go_haaleshi_altar";
newscript->pGOHello = &GOHello_go_haaleshi_altar;
newscript->RegisterSelf();
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index e04a552c335..3812ce7865a 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -182,7 +182,7 @@ void Creature::AddToWorld()
m_zoneScript->OnCreatureCreate(this, true);
ObjectAccessor::Instance().AddObject(this);
Unit::AddToWorld();
- SearchFormationAndPath();
+ SearchFormation();
AIM_Initialize();
if(IsVehicle())
GetVehicleKit()->Install();
@@ -212,7 +212,7 @@ void Creature::DisappearAndDie()
RemoveCorpse();
}
-void Creature::SearchFormationAndPath()
+void Creature::SearchFormation()
{
if(isSummon())
return;
@@ -221,28 +221,9 @@ void Creature::SearchFormationAndPath()
if(!lowguid)
return;
- bool usePath = (GetDefaultMovementType() == WAYPOINT_MOTION_TYPE);
CreatureGroupInfoType::iterator frmdata = CreatureGroupMap.find(lowguid);
if(frmdata != CreatureGroupMap.end())
- {
- if(usePath && lowguid != frmdata->second->leaderGUID)
- {
- SetDefaultMovementType(IDLE_MOTION_TYPE);
- usePath = false;
- }
formation_mgr.AddCreatureToGroup(frmdata->second->leaderGUID, this);
- }
-
- if(usePath)
- {
- if(WaypointMgr.GetPath(lowguid * 10))
- SetWaypointPathId(lowguid * 10);
- else
- {
- sLog.outErrorDb("Creature DBGUID %u has waypoint motion type, but it does not have a waypoint path!", lowguid);
- SetDefaultMovementType(IDLE_MOTION_TYPE);
- }
- }
}
void Creature::RemoveCorpse()
@@ -2271,6 +2252,10 @@ bool Creature::LoadCreaturesAddon(bool reload)
if (cainfo->move_flags != 0)
SetUnitMovementFlags(cainfo->move_flags);
+ //Load Path
+ if (cainfo->path_id != 0)
+ m_path_id = cainfo->path_id;
+
if(cainfo->auras)
{
for (CreatureDataAddonAura const* cAura = cainfo->auras; cAura->spell_id; ++cAura)
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 63baee1799b..d7c09c35548 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -317,6 +317,7 @@ struct CreatureDataAddonAura
struct CreatureDataAddon
{
uint32 guidOrEntry;
+ uint32 path_id;
uint32 mount;
uint32 bytes1;
uint32 bytes2;
@@ -696,13 +697,13 @@ class TRINITY_DLL_SPEC Creature : public Unit
uint32 GetGlobalCooldown() const { return m_GlobalCooldown; }
- uint32 GetWaypointPathId() const { return m_pathId; }
- void SetWaypointPathId(uint32 pathid) { m_pathId = pathid; }
+ uint32 GetWaypointPath(){return m_path_id;}
+ void LoadPath(uint32 pathid) { m_path_id = pathid; }
uint32 GetCurrentWaypointID(){return m_waypointID;}
void UpdateWaypointID(uint32 wpID){m_waypointID = wpID;}
- void SearchFormationAndPath();
+ void SearchFormation();
CreatureGroup *GetFormation() {return m_formation;}
void SetFormation(CreatureGroup *formation) {m_formation = formation;}
@@ -777,7 +778,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
private:
//WaypointMovementGenerator vars
uint32 m_waypointID;
- uint32 m_pathId;
+ uint32 m_path_id;
//Formation var
CreatureGroup *m_formation;
diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
index 2524e829a38..b6cf14402c6 100644
--- a/src/game/Level2.cpp
+++ b/src/game/Level2.cpp
@@ -1162,7 +1162,7 @@ bool ChatHandler::HandleNpcAddMoveCommand(const char* args)
// update movement type
WorldDatabase.PExecuteLog("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE,lowguid);
- if(pCreature && pCreature->GetWaypointPathId())
+ if(pCreature && pCreature->GetWaypointPath())
{
pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
pCreature->GetMotionMaster()->Initialize();
@@ -1487,7 +1487,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args)
{
// update movement type
if(doNotDelete == false)
- pCreature->SetWaypointPathId(0);
+ pCreature->LoadPath(0);
pCreature->SetDefaultMovementType(move_type);
pCreature->GetMotionMaster()->Initialize();
@@ -2300,7 +2300,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
if (!path_number)
{
if(target)
- pathid = target->GetWaypointPathId();
+ pathid = target->GetWaypointPath();
else
{
QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(id) FROM waypoint_data");
@@ -2384,7 +2384,6 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args)
return true;
}
- /*
guidlow = target->GetDBTableGUIDLow();
QueryResult *result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow);
@@ -2395,11 +2394,10 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args)
}
else
WorldDatabase.PExecute("INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid);
- */
WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE, guidlow);
- target->SetWaypointPathId(pathid);
+ target->LoadPath(pathid);
target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
target->GetMotionMaster()->Initialize();
target->MonsterSay("Path loaded.",0,0);
@@ -2433,39 +2431,22 @@ bool ChatHandler::HandleWpUnLoadPathCommand(const char *args)
return true;
}
- if(target->GetWaypointPathId())
+ if(target->GetCreatureAddon())
{
- uint32 pathId = target->GetDBTableGUIDLow() * 10;
- if(target->GetWaypointPathId() == pathId)
+ if(target->GetCreatureAddon()->path_id != 0)
{
- for(uint32 i = 1; i < 11; ++i)
- {
- if(i == 10)
- {
- PSendSysMessage("%s%s|r", "|cffff33ff", "Target cannot have more than 9 script paths. Unloading failed.");
- break;
- }
-
- if(WaypointMgr.GetPath(++pathId))
- continue;
-
- WorldDatabase.PExecute("UPDATE waypoint_data SET id = %u WHERE id = %u", pathId, target->GetDBTableGUIDLow() * 10);
- WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", IDLE_MOTION_TYPE, guidlow);
- target->SetWaypointPathId(0);
- target->UpdateWaypointID(0);
- target->SetDefaultMovementType(IDLE_MOTION_TYPE);
- target->GetMotionMaster()->Initialize();
- target->GetMotionMaster()->MoveTargetedHome();
- PSendSysMessage("Path unloaded.");
- break;
- }
+ WorldDatabase.PExecute("DELETE FROM creature_addon WHERE guid = %u", target->GetGUIDLow());
+ target->UpdateWaypointID(0);
+ WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", IDLE_MOTION_TYPE, guidlow);
+ target->LoadPath(0);
+ target->SetDefaultMovementType(IDLE_MOTION_TYPE);
+ target->GetMotionMaster()->MoveTargetedHome();
+ target->GetMotionMaster()->Initialize();
+ target->MonsterSay("Path unloaded.",0,0);
+ return true;
}
- else
- PSendSysMessage("%s%s|r", "|cffff33ff", "Target has path but that path is not its default path. Unloading failed.");
+ PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path.");
}
- else
- PSendSysMessage("%s%s|r", "|cffff33ff", "Target has no loaded path.");
-
return true;
}
@@ -2926,7 +2907,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
return false;
}
- pathid = target->GetWaypointPathId();
+ pathid = target->GetWaypointPath();
}
else
{
@@ -4221,7 +4202,7 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args)
group_member->groupAI = 0;
CreatureGroupMap[lowguid] = group_member;
- pCreature->SearchFormationAndPath();
+ pCreature->SearchFormation();
WorldDatabase.PExecuteLog("INSERT INTO creature_formations (leaderGUID, memberGUID, dist, angle, groupAI) VALUES ('%u','%u','%f', '%f', '%u')",
leaderGUID, lowguid, group_member->follow_dist, group_member->follow_angle, group_member->groupAI);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index a49c78bf918..8b77f5a4036 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7533,6 +7533,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
trigger_spell_id = 26470;
break;
}
+ // Deflection
+ case 52420:
+ {
+ if(GetHealth()*100 / GetMaxHealth() >= 35)
+ return false;
+ break;
+ }
+
// Cheat Death
case 28845:
{
diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp
index a779641c1c1..b9fb027d9c5 100644
--- a/src/game/WaypointManager.cpp
+++ b/src/game/WaypointManager.cpp
@@ -24,12 +24,12 @@
#include "ProgressBar.h"
#include "MapManager.h"
-WaypointPathMap WaypointPathHolder;
+UNORDERED_MAP<uint32, WaypointPath*> waypoint_map;
WaypointStore WaypointMgr;
void WaypointStore::Free()
{
- WaypointPathHolder.clear();
+ waypoint_map.clear();
}
void WaypointStore::Load()
@@ -88,7 +88,7 @@ void WaypointStore::Load()
path_data->push_back(wp);
if(id != last_id)
- WaypointPathHolder[id] = path_data;
+ waypoint_map[id] = path_data;
last_id = id;
@@ -99,16 +99,8 @@ void WaypointStore::Load()
void WaypointStore::UpdatePath(uint32 id)
{
- // Prevent memory leak, deallocate allocated memory instead of just clearing from object holder
- WaypointPathMap::iterator itr = WaypointPathHolder.find(id);
- if(itr != WaypointPathHolder.end())
- {
- for(WaypointPath::iterator jtr = WaypointPathHolder[id]->begin(); jtr != WaypointPathHolder[id]->end(); ++jtr)
- {
- delete (*jtr);
- }
- delete itr->second;
- }
+ if(waypoint_map.find(id)!= waypoint_map.end())
+ waypoint_map[id]->clear();
QueryResult *result;
@@ -150,7 +142,7 @@ void WaypointStore::UpdatePath(uint32 id)
}
while (result->NextRow());
- WaypointPathHolder[id] = path_data;
+ waypoint_map[id] = path_data;
delete result;
}
diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h
index a8f2d5746e9..85f8b765d45 100644
--- a/src/game/WaypointManager.h
+++ b/src/game/WaypointManager.h
@@ -34,9 +34,7 @@ struct WaypointData
};
typedef std::vector<WaypointData*> WaypointPath;
-typedef UNORDERED_MAP<uint32, WaypointPath*> WaypointPathMap;
-
-extern WaypointPathMap WaypointPathHolder;
+extern UNORDERED_MAP<uint32, WaypointPath*> waypoint_map;
class WaypointStore
{
@@ -50,10 +48,9 @@ class WaypointStore
WaypointPath* GetPath(uint32 id)
{
- WaypointPathMap::iterator itr = WaypointPathHolder.find(id);
- if(itr != WaypointPathHolder.end())
- return itr->second;
- return NULL;
+ if(waypoint_map.find(id) != waypoint_map.end())
+ return waypoint_map[id];
+ else return 0;
}
inline uint32 GetRecordsCount() { return records; }
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index 0a11acab88a..0bfd007011b 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -97,7 +97,7 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
//i_nextMoveTime.Reset(0);
StopedByPlayer = false;
if(!path_id)
- path_id = u.GetWaypointPathId();
+ path_id = u.GetWaypointPath();
waypoints = WaypointMgr.GetPath(path_id);
i_currentNode = 0;
if(waypoints && waypoints->size())
@@ -223,7 +223,7 @@ template bool WaypointMovementGenerator<Player>::Update(Player &, const uint32 &
template void WaypointMovementGenerator<Player>::MovementInform(Player &);
//----------------------------------------------------//
-void FlightPathMovementGenerator::SetWaypointPathId(Player &)
+void FlightPathMovementGenerator::LoadPath(Player &)
{
objmgr.GetTaxiPathNodes(i_pathId, i_path,i_mapIds);
}
@@ -248,7 +248,7 @@ void FlightPathMovementGenerator::Initialize(Player &player)
player.getHostilRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
- SetWaypointPathId(player);
+ LoadPath(player);
Traveller<Player> traveller(player);
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h
index 9c93486a675..9804c150d63 100644
--- a/src/game/WaypointMovementGenerator.h
+++ b/src/game/WaypointMovementGenerator.h
@@ -50,7 +50,7 @@ class TRINITY_DLL_SPEC PathMovementBase
bool MovementInProgress(void) const { return i_currentNode < i_path.Size(); }
- void SetWaypointPathId(T &);
+ void LoadPath(T &);
void ReloadPath(T &);
uint32 GetCurrentNode() const { return i_currentNode; }
@@ -104,7 +104,7 @@ public PathMovementBase<Player>
bool Update(Player &, const uint32 &);
MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; }
- void SetWaypointPathId(Player &);
+ void LoadPath(Player &);
void ReloadPath(Player &) { /* don't reload flight path */ }
Path& GetPath() { return i_path; }
diff --git a/src/game/Wintergrasp.cpp b/src/game/Wintergrasp.cpp
index fcd624eb606..e56bd36fc19 100644
--- a/src/game/Wintergrasp.cpp
+++ b/src/game/Wintergrasp.cpp
@@ -634,6 +634,10 @@ bool OPvPWintergrasp::UpdateGameObjectInfo(GameObject *go) const
case 190763:
go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_defender]);
return true;
+ // Titan relic
+ case 192829:
+ go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[OTHER_TEAM(m_defender)]);
+ return true;
}
// Note: this is only for test, still need db support
@@ -742,9 +746,9 @@ void OPvPWintergrasp::UpdateTenacityStack()
if(allianceNum && hordeNum)
{
if(allianceNum < hordeNum)
- newStack = hordeNum / allianceNum - 1; // positive, should cast on alliance
+ newStack = (hordeNum / allianceNum - 1)*4; // positive, should cast on alliance
else if(allianceNum > hordeNum)
- newStack = 1 - int32(allianceNum / hordeNum); // negative, should cast on horde
+ newStack = (1 - int32(allianceNum / hordeNum))*4; // negative, should cast on horde
}
if(newStack == m_tenacityStack)
@@ -774,11 +778,12 @@ void OPvPWintergrasp::UpdateTenacityStack()
{
TeamId team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
if(newStack < 0) newStack = -newStack;
+ int32 auraStack = newStack > 20 ? 20 : newStack; //Dont let it be higher than 20
for(PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
if((*itr)->getLevel() > 69)
- (*itr)->SetAuraStack(SPELL_TENACITY, *itr, newStack);
+ (*itr)->SetAuraStack(SPELL_TENACITY, *itr, auraStack);
for(CreatureSet::iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
- (*itr)->SetAuraStack(SPELL_TENACITY_VEHICLE, *itr, newStack);
+ (*itr)->SetAuraStack(SPELL_TENACITY_VEHICLE, *itr, auraStack);
}
}
@@ -942,13 +947,13 @@ void OPvPWintergrasp::EndBattle()
}
}
- TeamId loser = OTHER_TEAM(m_defender);
+ /*TeamId loser = OTHER_TEAM(m_defender);
for(PlayerSet::iterator itr = m_players[loser].begin(); itr != m_players[loser].end();)
{
Player *plr = *itr;
++itr;
plr->CastSpell(plr, SPELL_TELEPORT_DALARAN, true);
- }
+ }*/
// remove auras from players who are not online
CharacterDatabase.PExecute("DELETE FROM character_aura WHERE spell IN (%u,%u,%u)", SPELL_RECRUIT, SPELL_CORPORAL, SPELL_LIEUTENANT);
diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp
index 4113d35236d..372baafe278 100644
--- a/src/shared/Database/SQLStorage.cpp
+++ b/src/shared/Database/SQLStorage.cpp
@@ -29,9 +29,9 @@ extern DatabaseMysql WorldDatabase;
const char CreatureInfosrcfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiliiis";
const char CreatureInfodstfmt[]="iiiiiiiisssiiiiiiiiiiffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiiffliiiiiliiii";
-const char CreatureDataAddonInfofmt[]="iiiiiis";
+const char CreatureDataAddonInfofmt[]="iiiiiiis";
const char CreatureModelfmt[]="iffbi";
-const char CreatureInfoAddonInfofmt[]="iiiiiis";
+const char CreatureInfoAddonInfofmt[]="iiiiiiis";
const char EquipmentInfofmt[]="iiii";
const char GameObjectInfosrcfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiis";
const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiii";