Core/Waypoints: Drop waypoint_scripts table
Port From (https://github.com/TrinityCore/TrinityCore/commit/3f6f683ce4b5f4a95a2d70921de2c80de6b3a8fe)
This commit is contained in:
@@ -568,8 +568,7 @@ namespace Framework.Constants
|
||||
CommandReloadSpellThreats = 702,
|
||||
CommandReloadSpellGroupStackRules = 703,
|
||||
CommandReloadCypherString = 704,
|
||||
// 705 previously used, do not reuse
|
||||
CommandReloadWaypointScripts = 706,
|
||||
// 705 - 706 previously used, do not reuse
|
||||
CommandReloadWaypointData = 707,
|
||||
CommandReloadVehicleAccesory = 708,
|
||||
CommandReloadVehicleTemplateAccessory = 709,
|
||||
|
||||
@@ -32,36 +32,20 @@ namespace Framework.Database
|
||||
PrepareStatement(WorldStatements.DEL_WAYPOINT_DATA, "DELETE FROM waypoint_data WHERE id = ? AND point = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_POINT, "UPDATE waypoint_data SET point = point - 1 WHERE id = ? AND point > ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_POSITION, "UPDATE waypoint_data SET position_x = ?, position_y = ?, position_z = ?, orientation = ? where id = ? AND point = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_WPGUID, "UPDATE waypoint_data SET wpguid = ? WHERE id = ? and point = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_ID, "SELECT MAX(id) FROM waypoint_data");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_POINT, "SELECT MAX(point) FROM waypoint_data WHERE id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_ID, "SELECT point, position_x, position_y, position_z, orientation, move_type, delay, action, action_chance FROM waypoint_data WHERE id = ? ORDER BY point");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_ID, "SELECT point, position_x, position_y, position_z, orientation, move_type, delay FROM waypoint_data WHERE id = ? ORDER BY point");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_BY_ID, "SELECT point, position_x, position_y, position_z, orientation FROM waypoint_data WHERE id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_FIRST_BY_ID, "SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE point = 1 AND id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_LAST_BY_ID, "SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE id = ? ORDER BY point DESC LIMIT 1");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_WPGUID, "SELECT id, point FROM waypoint_data WHERE wpguid = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_ALL_BY_WPGUID, "SELECT id, point, delay, move_type, action, action_chance FROM waypoint_data WHERE wpguid = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_ALL_WPGUID, "UPDATE waypoint_data SET wpguid = 0");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_POS, "SELECT id, point FROM waypoint_data WHERE (abs(position_x - ?) <= ?) and (abs(position_y - ?) <= ?) and (abs(position_z - ?) <= ?)");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_WPGUID_BY_ID, "SELECT wpguid FROM waypoint_data WHERE id = ? and wpguid <> 0");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_ACTION, "SELECT DISTINCT action FROM waypoint_data");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_SCRIPTS_MAX_ID, "SELECT MAX(guid) FROM waypoint_scripts");
|
||||
PrepareStatement(WorldStatements.INS_CREATURE_ADDON, "INSERT INTO creature_addon(guid, path_id) VALUES (?, ?)");
|
||||
PrepareStatement(WorldStatements.UPD_CREATURE_ADDON_PATH, "UPDATE creature_addon SET path_id = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.DEL_CREATURE_ADDON, "DELETE FROM creature_addon WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.SEL_CREATURE_ADDON_BY_GUID, "SELECT guid FROM creature_addon WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.INS_WAYPOINT_SCRIPT, "INSERT INTO waypoint_scripts (guid) VALUES (?)");
|
||||
PrepareStatement(WorldStatements.DEL_WAYPOINT_SCRIPT, "DELETE FROM waypoint_scripts WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_ID, "UPDATE waypoint_scripts SET id = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_X, "UPDATE waypoint_scripts SET x = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Y, "UPDATE waypoint_scripts SET y = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Z, "UPDATE waypoint_scripts SET z = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_O, "UPDATE waypoint_scripts SET o = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.DEL_CREATURE, "DELETE FROM creature WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.SEL_COMMANDS, "SELECT name, help FROM command");
|
||||
PrepareStatement(WorldStatements.SEL_CREATURE_TEMPLATE, "SELECT entry, KillCredit1, KillCredit2, name, femaleName, subname, TitleAlt, IconName, RequiredExpansion, VignetteID, faction, npcflag, speed_walk, speed_run, scale, `rank`, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, unit_flags3, family, trainer_class, type, VehicleId, AIName, MovementType, ctm.Ground, ctm.Swim, ctm.Flight, ctm.Rooted, ctm.Chase, ctm.Random, ctm.InteractionPauseTimer, ExperienceModifier, RacialLeader, movementId, WidgetSetID, WidgetSetUnitConditionID, RegenHealth, mechanic_immune_mask, spell_school_immune_mask, flags_extra, ScriptName, StringId FROM creature_template ct LEFT JOIN creature_template_movement ctm ON ct.entry = ctm.CreatureId WHERE entry = ? OR 1 = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_");
|
||||
PrepareStatement(WorldStatements.SEL_CREATURE_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_");
|
||||
@@ -120,24 +104,13 @@ namespace Framework.Database
|
||||
SEL_WAYPOINT_DATA_MAX_POINT,
|
||||
SEL_WAYPOINT_DATA_BY_POS,
|
||||
SEL_WAYPOINT_DATA_WPGUID_BY_ID,
|
||||
SEL_WAYPOINT_DATA_ACTION,
|
||||
SEL_WAYPOINT_SCRIPTS_MAX_ID,
|
||||
UPD_CREATURE_ADDON_PATH,
|
||||
INS_CREATURE_ADDON,
|
||||
DEL_CREATURE_ADDON,
|
||||
SEL_CREATURE_ADDON_BY_GUID,
|
||||
INS_WAYPOINT_SCRIPT,
|
||||
DEL_WAYPOINT_SCRIPT,
|
||||
UPD_WAYPOINT_SCRIPT_ID,
|
||||
UPD_WAYPOINT_SCRIPT_X,
|
||||
UPD_WAYPOINT_SCRIPT_Y,
|
||||
UPD_WAYPOINT_SCRIPT_Z,
|
||||
UPD_WAYPOINT_SCRIPT_O,
|
||||
SEL_WAYPOINT_SCRIPT_ID_BY_GUID,
|
||||
DEL_CREATURE,
|
||||
SEL_COMMANDS,
|
||||
SEL_CREATURE_TEMPLATE,
|
||||
SEL_WAYPOINT_SCRIPT_BY_ID,
|
||||
SEL_CREATURE_BY_ID,
|
||||
SEL_GAMEOBJECT_NEAREST,
|
||||
SEL_CREATURE_NEAREST,
|
||||
|
||||
@@ -328,8 +328,6 @@ namespace Game.AI
|
||||
waypoint.orientation = orientation;
|
||||
waypoint.moveType = run ? WaypointMoveType.Run : WaypointMoveType.Walk;
|
||||
waypoint.delay = (uint)waitTime.TotalMilliseconds;
|
||||
waypoint.eventId = 0;
|
||||
waypoint.eventChance = 100;
|
||||
_path.nodes.Add(waypoint);
|
||||
}
|
||||
|
||||
|
||||
@@ -929,26 +929,6 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("waypoint_scripts", RBACPermissions.CommandReloadWaypointScripts, true)]
|
||||
static bool HandleReloadWpScriptsCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
if (Global.MapMgr.IsScriptScheduled())
|
||||
{
|
||||
handler.SendSysMessage("DB scripts used currently, please attempt reload later.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args != null)
|
||||
Log.outInfo(LogFilter.Server, "Re-Loading Scripts from `waypoint_scripts`...");
|
||||
|
||||
Global.ObjectMgr.LoadWaypointScripts();
|
||||
|
||||
if (args != null)
|
||||
handler.SendGlobalGMSysMessage("DB table `waypoint_scripts` reloaded.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[CommandGroup("all")]
|
||||
class AllCommand
|
||||
{
|
||||
@@ -1080,7 +1060,6 @@ namespace Game.Chat
|
||||
HandleReloadEventScriptsCommand(handler, null);
|
||||
HandleReloadSpellScriptsCommand(handler, null);
|
||||
handler.SendGlobalGMSysMessage("DB tables `*_scripts` reloaded.");
|
||||
HandleReloadWpScriptsCommand(handler, null);
|
||||
HandleReloadWpCommand(handler, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,244 +72,6 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("event", RBACPermissions.CommandWpEvent)]
|
||||
static bool HandleWpEventCommand(CommandHandler handler, string subCommand, uint id, [OptionalArg] string arg, [OptionalArg] string arg2)
|
||||
{
|
||||
PreparedStatement stmt;
|
||||
|
||||
// Check
|
||||
if ((subCommand != "add") && (subCommand != "mod") && (subCommand != "del") && (subCommand != "listid"))
|
||||
return false;
|
||||
|
||||
if (subCommand == "add")
|
||||
{
|
||||
if (id != 0)
|
||||
{
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
stmt.AddValue(0, id);
|
||||
SQLResult result = DB.World.Query(stmt);
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_WAYPOINT_SCRIPT);
|
||||
stmt.AddValue(0, id);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Wp Event: New waypoint event added: {0}|r", "", id);
|
||||
}
|
||||
else
|
||||
handler.SendSysMessage("|cff00ff00Wp Event: You have choosed an existing waypoint script guid: {0}|r", id);
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPTS_MAX_ID);
|
||||
SQLResult result = DB.World.Query(stmt);
|
||||
id = result.Read<uint>(0);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_WAYPOINT_SCRIPT);
|
||||
stmt.AddValue(0, id + 1);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Wp Event: New waypoint event added: |r|cff00ffff{0}|r", id + 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (subCommand == "listid")
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
handler.SendSysMessage("|cff33ffffWp Event: You must provide waypoint script id.|r");
|
||||
return true;
|
||||
}
|
||||
|
||||
uint a2, a3, a4, a5, a6;
|
||||
float a8, a9, a10, a11;
|
||||
string a7;
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_BY_ID);
|
||||
stmt.AddValue(0, id);
|
||||
SQLResult result = DB.World.Query(stmt);
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
handler.SendSysMessage("|cff33ffffWp Event: No waypoint scripts found on id: {0}|r", id);
|
||||
return true;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
a2 = result.Read<uint>(0);
|
||||
a3 = result.Read<uint>(1);
|
||||
a4 = result.Read<uint>(2);
|
||||
a5 = result.Read<uint>(3);
|
||||
a6 = result.Read<uint>(4);
|
||||
a7 = result.Read<string>(5);
|
||||
a8 = result.Read<float>(6);
|
||||
a9 = result.Read<float>(7);
|
||||
a10 = result.Read<float>(8);
|
||||
a11 = result.Read<float>(9);
|
||||
|
||||
handler.SendSysMessage("|cffff33ffid:|r|cff00ffff {0}|r|cff00ff00, guid: |r|cff00ffff{1}|r|cff00ff00, delay: |r|cff00ffff{2}|r|cff00ff00, command: |r|cff00ffff{3}|r|cff00ff00," +
|
||||
"datalong: |r|cff00ffff{4}|r|cff00ff00, datalong2: |r|cff00ffff{5}|r|cff00ff00, datatext: |r|cff00ffff{6}|r|cff00ff00, posx: |r|cff00ffff{7}|r|cff00ff00, " +
|
||||
"posy: |r|cff00ffff{8}|r|cff00ff00, posz: |r|cff00ffff{9}|r|cff00ff00, orientation: |r|cff00ffff{10}|r", id, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
|
||||
}
|
||||
while (result.NextRow());
|
||||
}
|
||||
|
||||
if (subCommand == "del")
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
handler.SendSysMessage("|cffff33ffERROR: Waypoint script guid not present.|r");
|
||||
return true;
|
||||
}
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
stmt.AddValue(0, id);
|
||||
SQLResult result = DB.World.Query(stmt);
|
||||
|
||||
if (!result.IsEmpty())
|
||||
{
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_WAYPOINT_SCRIPT);
|
||||
stmt.AddValue(0, id);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00{0}{1}|r", "Wp Event: Waypoint script removed: ", id);
|
||||
}
|
||||
else
|
||||
handler.SendSysMessage("|cffff33ffWp Event: ERROR: you have selected a non existing script: {0}|r", id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (subCommand == "mod")
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
handler.SendSysMessage("|cffff33ffERROR: No valid waypoint script id not present.|r");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (arg.IsEmpty())
|
||||
{
|
||||
handler.SendSysMessage("|cffff33ffERROR: No argument present.|r");
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((arg != "setid") && (arg != "delay") && (arg != "command")
|
||||
&& (arg != "datalong") && (arg != "datalong2") && (arg != "dataint") && (arg != "posx")
|
||||
&& (arg != "posy") && (arg != "posz") && (arg != "orientation"))
|
||||
{
|
||||
handler.SendSysMessage("|cffff33ffERROR: No valid argument present.|r");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (arg2.IsEmpty())
|
||||
{
|
||||
handler.SendSysMessage("|cffff33ffERROR: No additional argument present.|r");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (arg == "setid")
|
||||
{
|
||||
if (!uint.TryParse(arg2, out uint newid))
|
||||
return false;
|
||||
handler.SendSysMessage("|cff00ff00Wp Event: Waypoint script guid: {0}|r|cff00ffff id changed: |r|cff00ff00{1}|r", newid, id);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_ID);
|
||||
stmt.AddValue(0, newid);
|
||||
stmt.AddValue(1, id);
|
||||
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
stmt.AddValue(0, id);
|
||||
SQLResult result = DB.World.Query(stmt);
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
handler.SendSysMessage("|cffff33ffERROR: You have selected an non existing waypoint script guid.|r");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (arg == "posx")
|
||||
{
|
||||
if (!float.TryParse(arg2, out float arg3))
|
||||
return false;
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_X);
|
||||
stmt.AddValue(0, arg3);
|
||||
stmt.AddValue(1, id);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff {0}|r|cff00ff00 position_x updated.|r", id);
|
||||
return true;
|
||||
}
|
||||
else if (arg == "posy")
|
||||
{
|
||||
if (!float.TryParse(arg2, out float arg3))
|
||||
return false;
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Y);
|
||||
stmt.AddValue(0, arg3);
|
||||
stmt.AddValue(1, id);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Waypoint script: {0} position_y updated.|r", id);
|
||||
return true;
|
||||
}
|
||||
else if (arg == "posz")
|
||||
{
|
||||
if (!float.TryParse(arg2, out float arg3))
|
||||
return false;
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Z);
|
||||
stmt.AddValue(0, arg3);
|
||||
stmt.AddValue(1, id);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff{0}|r|cff00ff00 position_z updated.|r", id);
|
||||
return true;
|
||||
}
|
||||
else if (arg == "orientation")
|
||||
{
|
||||
if (!float.TryParse(arg2, out float arg3))
|
||||
return false;
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_O);
|
||||
stmt.AddValue(0, arg3);
|
||||
stmt.AddValue(1, id);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff{0}|r|cff00ff00 orientation updated.|r", id);
|
||||
return true;
|
||||
}
|
||||
else if (arg == "dataint")
|
||||
{
|
||||
if (!uint.TryParse(arg2, out uint arg3))
|
||||
return false;
|
||||
|
||||
DB.World.Execute("UPDATE waypoint_scripts SET {0}='{1}' WHERE guid='{2}'", arg, arg3, id); // Query can't be a prepared statement
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff{0}|r|cff00ff00 dataint updated.|r", id);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DB.World.Execute("UPDATE waypoint_scripts SET {0}='{1}' WHERE guid='{2}'", arg, arg, id); // Query can't be a prepared statement
|
||||
}
|
||||
}
|
||||
handler.SendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff{0}:|r|cff00ff00 {1} updated.|r", id, arg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("load", RBACPermissions.CommandWpLoad)]
|
||||
static bool HandleWpLoadCommand(CommandHandler handler, uint? optionalPathId)
|
||||
{
|
||||
@@ -621,14 +383,10 @@ namespace Game.Chat.Commands
|
||||
uint point = result.Read<uint>(1);
|
||||
uint delay = result.Read<uint>(2);
|
||||
uint flag = result.Read<uint>(3);
|
||||
uint ev_id = result.Read<uint>(4);
|
||||
uint ev_chance = result.Read<ushort>(5);
|
||||
|
||||
handler.SendSysMessage("|cff00ff00Show info: for current point: |r|cff00ffff{0}|r|cff00ff00, Path ID: |r|cff00ffff{1}|r", point, pathId);
|
||||
handler.SendSysMessage("|cff00ff00Show info: delay: |r|cff00ffff{0}|r", delay);
|
||||
handler.SendSysMessage("|cff00ff00Show info: Move flag: |r|cff00ffff{0}|r", flag);
|
||||
handler.SendSysMessage("|cff00ff00Show info: Waypoint event: |r|cff00ffff{0}|r", ev_id);
|
||||
handler.SendSysMessage("|cff00ff00Show info: Event chance: |r|cff00ffff{0}|r", ev_chance);
|
||||
}
|
||||
while (result.NextRow());
|
||||
|
||||
|
||||
@@ -1540,32 +1540,6 @@ namespace Game
|
||||
}
|
||||
|
||||
//Load WP Scripts
|
||||
public void LoadWaypointScripts()
|
||||
{
|
||||
LoadScripts(ScriptsType.Waypoint);
|
||||
|
||||
List<uint> actionSet = new();
|
||||
|
||||
foreach (var script in sWaypointScripts)
|
||||
actionSet.Add(script.Key);
|
||||
|
||||
PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_ACTION);
|
||||
SQLResult result = DB.World.Query(stmt);
|
||||
|
||||
if (!result.IsEmpty())
|
||||
{
|
||||
do
|
||||
{
|
||||
uint action = result.Read<uint>(0);
|
||||
|
||||
actionSet.Remove(action);
|
||||
}
|
||||
while (result.NextRow());
|
||||
}
|
||||
|
||||
foreach (var id in actionSet)
|
||||
Log.outError(LogFilter.Sql, "There is no waypoint which links to the waypoint script {0}", id);
|
||||
}
|
||||
public void LoadSpellScriptNames()
|
||||
{
|
||||
uint oldMSTime = Time.GetMSTime();
|
||||
@@ -1747,8 +1721,6 @@ namespace Game
|
||||
return sSpellScripts;
|
||||
case ScriptsType.Event:
|
||||
return sEventScripts;
|
||||
case ScriptsType.Waypoint:
|
||||
return sWaypointScripts;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -1761,8 +1733,6 @@ namespace Game
|
||||
return "spell_scripts";
|
||||
case ScriptsType.Event:
|
||||
return "event_scripts";
|
||||
case ScriptsType.Waypoint:
|
||||
return "waypoint_scripts";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -10798,7 +10768,6 @@ namespace Game
|
||||
MultiMap<uint, uint> spellScriptsStorage = new();
|
||||
public Dictionary<uint, MultiMap<uint, ScriptInfo>> sSpellScripts = new();
|
||||
public Dictionary<uint, MultiMap<uint, ScriptInfo>> sEventScripts = new();
|
||||
public Dictionary<uint, MultiMap<uint, ScriptInfo>> sWaypointScripts = new();
|
||||
Dictionary<uint, uint> areaTriggerScriptStorage = new();
|
||||
List<uint> _eventStorage = new();
|
||||
Dictionary<uint, uint> _eventScriptStorage = new();
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Game.Movement
|
||||
}
|
||||
|
||||
if (_waitTimeRangeAtPathEnd.HasValue && _followPathBackwardsFromEndToStart
|
||||
&& ((_isReturningToStart && _currentNode == 0) || (!_isReturningToStart && _currentNode == _path.nodes.Count - 1)))
|
||||
&& ((_isReturningToStart && _currentNode == 0) || (!_isReturningToStart && _currentNode == _path.nodes.Count - 1)))
|
||||
{
|
||||
owner.ClearUnitState(UnitState.RoamingMove);
|
||||
TimeSpan waitTime = RandomHelper.RandTime(_waitTimeRangeAtPathEnd.Value.min, _waitTimeRangeAtPathEnd.Value.max);
|
||||
@@ -301,13 +301,6 @@ namespace Game.Movement
|
||||
_nextMoveTime.Reset(waitTime);
|
||||
}
|
||||
|
||||
if (waypoint.eventId != 0 && RandomHelper.URand(0, 99) < waypoint.eventChance)
|
||||
{
|
||||
Log.outDebug(LogFilter.MapsScript, $"Creature movement start script {waypoint.eventId} at point {_currentNode} for {owner.GetGUID()}.");
|
||||
owner.ClearUnitState(UnitState.RoamingMove);
|
||||
owner.GetMap().ScriptsStart(ScriptsType.Waypoint, waypoint.eventId, owner, null);
|
||||
}
|
||||
|
||||
// inform AI
|
||||
CreatureAI ai = owner.GetAI();
|
||||
if (ai != null)
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace Game
|
||||
{
|
||||
var oldMSTime = Time.GetMSTime();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
SQLResult result = DB.World.Query("SELECT id, point, position_x, position_y, position_z, orientation, move_type, delay, action, action_chance FROM waypoint_data ORDER BY id, point");
|
||||
// 0 1 2 3 4 5 6 7
|
||||
SQLResult result = DB.World.Query("SELECT id, point, position_x, position_y, position_z, orientation, move_type, delay FROM waypoint_data ORDER BY id, point");
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
@@ -55,8 +55,6 @@ namespace Game
|
||||
}
|
||||
|
||||
waypoint.delay = result.Read<uint>(7);
|
||||
waypoint.eventId = result.Read<uint>(8);
|
||||
waypoint.eventChance = result.Read<byte>(9);
|
||||
|
||||
if (!_waypointStore.ContainsKey(pathId))
|
||||
_waypointStore[pathId] = new WaypointPath();
|
||||
@@ -110,8 +108,6 @@ namespace Game
|
||||
}
|
||||
|
||||
waypoint.delay = result.Read<uint>(6);
|
||||
waypoint.eventId = result.Read<uint>(7);
|
||||
waypoint.eventChance = result.Read<byte>(8);
|
||||
|
||||
values.Add(waypoint);
|
||||
}
|
||||
@@ -139,18 +135,14 @@ namespace Game
|
||||
z = _z;
|
||||
orientation = _orientation;
|
||||
delay = _delay;
|
||||
eventId = 0;
|
||||
moveType = WaypointMoveType.Walk;
|
||||
eventChance = 100;
|
||||
}
|
||||
|
||||
public uint id;
|
||||
public float x, y, z;
|
||||
public float? orientation;
|
||||
public uint delay;
|
||||
public uint eventId;
|
||||
public WaypointMoveType moveType;
|
||||
public byte eventChance;
|
||||
}
|
||||
|
||||
public class WaypointPath
|
||||
|
||||
@@ -963,7 +963,6 @@ namespace Game
|
||||
// Load and initialize scripts
|
||||
Global.ObjectMgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
Global.ObjectMgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
Global.ObjectMgr.LoadWaypointScripts();
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loading spell script names...");
|
||||
Global.ObjectMgr.LoadSpellScriptNames();
|
||||
|
||||
Reference in New Issue
Block a user