aboutsummaryrefslogtreecommitdiff
path: root/src/game/Level2.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-09-19 12:13:08 -0700
committermaximius <none@none>2009-09-19 12:13:08 -0700
commit0cf75ef9eaca43ebc9b7f8cde09428829989cf36 (patch)
tree24f56d1358b46ca0ad5dc513e3b1a3cdcd90bfb0 /src/game/Level2.cpp
parent15d85229fae45405557aa6b706681dabaf854ed5 (diff)
*Wintergrasp: Prevent defenders team to click the relic. Patch by Spp.
*Zum'Rah Area Trigger Script, Zum'Rah should become hostile when approached. By totoro. *Judgement of Light PPM based, not 100%. By Drevi. *Fix Deflection Exploit. By manuel, thanks to TheNecromancer and Gyullo. *Correct Wintergrasp Tenacity formulas, by Gyullo. *A Spirit Guide Escort Quest, code from SD2, patch by manuel. *TrullyOne/MeanMachine Waypoint System Restored. Patch by XTElite1. --HG-- branch : trunk
Diffstat (limited to 'src/game/Level2.cpp')
-rw-r--r--src/game/Level2.cpp55
1 files changed, 18 insertions, 37 deletions
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);