Scripts/Commands: Cleanup and trinity_string for .go instance.
Port From (https://github.com/TrinityCore/TrinityCore/commit/af8b4853da9e7464d75623bc06851e3290e23d11)
This commit is contained in:
@@ -956,19 +956,22 @@ namespace Framework.Constants
|
||||
GuildInfoBankGold = 1181,
|
||||
GuildInfoMotd = 1182,
|
||||
GuildInfoExtraInfo = 1183,
|
||||
GuildInfoLevel = 1184,
|
||||
AccountBnetLinked = 1185,
|
||||
AccountOrBnetDoesNotExist = 1186,
|
||||
AccountAlreadyLinked = 1187,
|
||||
AccountBnetUnlinked = 1188,
|
||||
AccountBnetNotLinked = 1189,
|
||||
DisallowTicketsConfig = 1190,
|
||||
BanExists = 1191,
|
||||
ChangeAccountSuccess = 1192,
|
||||
NotInRaidGroup = 1193,
|
||||
GroupRoleChanged = 1194,
|
||||
LeaderCannotBeAssistant = 1195,
|
||||
// Room for more level 3 1196-1198 not used
|
||||
ChangeAccountSuccess = 1184, // log
|
||||
GroupNotInRaidGroup = 1185,
|
||||
GroupRoleChanged = 1186,
|
||||
LeaderCannotBeAssistant = 1187,
|
||||
BanExists = 1188,
|
||||
CommandNoInstancesMatch = 1189,
|
||||
CommandMultipleInstancesMatch = 1190,
|
||||
CommandMultipleInstancesEntry = 1191,
|
||||
CommandMapNotInstance = 1192,
|
||||
CommandInstanceNoEntrance = 1193,
|
||||
CommandInstanceNoExit = 1194,
|
||||
CommandWentToInstanceGate = 1195,
|
||||
CommandWentToInstanceStart = 1196,
|
||||
CommandGoInstanceFailed = 1197,
|
||||
CommandGoInstanceStartFailed = 1198, // 3.3.5 RESERVED
|
||||
// Room for more level 3 1199 not used
|
||||
|
||||
// Debug Commands
|
||||
CinematicNotExist = 1200,
|
||||
@@ -976,7 +979,22 @@ namespace Framework.Constants
|
||||
DebugAreatriggerOn = 1202,
|
||||
DebugAreatriggerOff = 1203,
|
||||
DebugAreatriggerEntered = 1204,
|
||||
// 1205-1999 - free
|
||||
|
||||
CommandNoBossesMatch = 1205, // 3.3.5 Reserved
|
||||
CommandMultipleBossesMatch = 1206, // 3.3.5 Reserved
|
||||
CommandMultipleBossesEntry = 1207, // 3.3.5 Reserved
|
||||
CommandBossMultipleSpawns = 1208, // 3.3.5 Reserved
|
||||
CommandBossMultipleSpawnEty = 1209, // 3.3.5 Reserved
|
||||
CommandGoBossFailed = 1210, // 3.3.5 Reserved
|
||||
CommandWentToBoss = 1211, // 3.3.5 Reserved
|
||||
GuildInfoLevel = 1212,
|
||||
AccountBnetLinked = 1213,
|
||||
AccountOrBnetDoesNotExist = 1214,
|
||||
AccountAlreadyLinked = 1215,
|
||||
AccountBnetUnlinked = 1216,
|
||||
AccountBnetNotLinked = 1217,
|
||||
DisallowTicketsConfig = 1218,
|
||||
// 1219-1499 - free
|
||||
|
||||
DebugAreatriggerLeft = 1999,
|
||||
// Ticket Strings 2003-2028
|
||||
|
||||
@@ -30,6 +30,18 @@ namespace Game.Chat.Commands
|
||||
[CommandGroup("go", RBACPermissions.CommandGo)]
|
||||
class GoCommands
|
||||
{
|
||||
[Command("bugticket", RBACPermissions.CommandGoBugTicket)]
|
||||
static bool HandleGoBugTicketCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
return HandleGoTicketCommand<BugTicket>(args, handler);
|
||||
}
|
||||
|
||||
[Command("complaintticket", RBACPermissions.CommandGoComplaintTicket)]
|
||||
static bool HandleGoComplaintTicketCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
return HandleGoTicketCommand<ComplaintTicket>(args, handler);
|
||||
}
|
||||
|
||||
[Command("creature", RBACPermissions.CommandGoCreature)]
|
||||
static bool HandleGoCreatureCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
@@ -182,6 +194,85 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("instance", RBACPermissions.CommandGoInstance)]
|
||||
static bool HandleGoInstanceCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
uint mapId = 0;
|
||||
string mapIdOrScriptNameStr = args.NextString();
|
||||
if (mapIdOrScriptNameStr.IsNumber())
|
||||
mapId = uint.Parse(mapIdOrScriptNameStr);
|
||||
|
||||
if (mapId == 0)
|
||||
{
|
||||
List<Tuple<uint, string>> matches = new();
|
||||
foreach (var pair in Global.ObjectMgr.GetInstanceTemplates())
|
||||
{
|
||||
string scriptName = Global.ObjectMgr.GetScriptName(pair.Value.ScriptId);
|
||||
if (scriptName.Contains(mapIdOrScriptNameStr))
|
||||
matches.Add(Tuple.Create(pair.Key, scriptName));
|
||||
}
|
||||
|
||||
if (matches.Empty())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNoInstancesMatch);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (matches.Count > 1)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandMultipleInstancesMatch);
|
||||
return false;
|
||||
}
|
||||
|
||||
mapId = matches[0].Item1;
|
||||
}
|
||||
|
||||
if (mapId == 0)
|
||||
return false;
|
||||
|
||||
InstanceTemplate temp = Global.ObjectMgr.GetInstanceTemplate(mapId);
|
||||
if (temp == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandMapNotInstance, mapId);
|
||||
return false;
|
||||
}
|
||||
string scriptname = Global.ObjectMgr.GetScriptName(temp.ScriptId);
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
if (player.IsInFlight())
|
||||
player.FinishTaxiFlight();
|
||||
else
|
||||
player.SaveRecallPosition();
|
||||
|
||||
// try going to entrance
|
||||
AreaTriggerStruct exit = Global.ObjectMgr.GetGoBackTrigger(mapId);
|
||||
if (exit == null)
|
||||
handler.SendSysMessage(CypherStrings.CommandInstanceNoExit, mapId, scriptname);
|
||||
|
||||
if (exit != null && player.TeleportTo(exit.target_mapId, exit.target_X, exit.target_Y, exit.target_Z, exit.target_Orientation + MathF.PI))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandWentToInstanceGate, mapId, scriptname);
|
||||
return true;
|
||||
}
|
||||
|
||||
// try going to start
|
||||
AreaTriggerStruct entrance = Global.ObjectMgr.GetMapEntranceTrigger(mapId);
|
||||
if (entrance == null)
|
||||
handler.SendSysMessage(CypherStrings.CommandInstanceNoEntrance, mapId, scriptname);
|
||||
|
||||
if (entrance != null && player.TeleportTo(entrance.target_mapId, entrance.target_X, entrance.target_Y, entrance.target_Z, entrance.target_Orientation))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandWentToInstanceStart, mapId, scriptname);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler.SendSysMessage(CypherStrings.CommandGoInstanceFailed, mapId, scriptname, exit.target_mapId);
|
||||
return false;
|
||||
}
|
||||
|
||||
//teleport to gameobject
|
||||
[Command("object", RBACPermissions.CommandGoObject)]
|
||||
static bool HandleGoObjectCommand(StringArguments args, CommandHandler handler)
|
||||
@@ -223,6 +314,46 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("offset", RBACPermissions.CommandGoOffset)]
|
||||
static bool HandleGoOffsetCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
string goX = args.NextString();
|
||||
string goY = args.NextString();
|
||||
string goZ = args.NextString();
|
||||
string port = args.NextString();
|
||||
|
||||
float x, y, z, o;
|
||||
player.GetPosition(out x, out y, out z, out o);
|
||||
if (!goX.IsEmpty())
|
||||
x += float.Parse(goX);
|
||||
if (!goY.IsEmpty())
|
||||
y += float.Parse(goY);
|
||||
if (!goZ.IsEmpty())
|
||||
z += float.Parse(goZ);
|
||||
if (!port.IsEmpty())
|
||||
o += float.Parse(port);
|
||||
|
||||
if (!GridDefines.IsValidMapCoord(x, y, z, o))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, player.GetMapId());
|
||||
return false;
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if (player.IsInFlight())
|
||||
player.FinishTaxiFlight();
|
||||
else
|
||||
player.SaveRecallPosition(); // save only in non-flight case
|
||||
|
||||
player.TeleportTo(player.GetMapId(), x, y, z, o);
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("quest", RBACPermissions.CommandGoQuest)]
|
||||
static bool HandleGoQuestCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
@@ -282,6 +413,12 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("suggestionticket", RBACPermissions.CommandGoSuggestionTicket)]
|
||||
static bool HandleGoSuggestionTicketCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
return HandleGoTicketCommand<SuggestionTicket>(args, handler);
|
||||
}
|
||||
|
||||
[Command("taxinode", RBACPermissions.CommandGoTaxinode)]
|
||||
static bool HandleGoTaxinodeCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
@@ -356,6 +493,62 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
//teleport at coordinates, including Z and orientation
|
||||
[Command("xyz", RBACPermissions.CommandGoXyz)]
|
||||
static bool HandleGoXYZCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float x))
|
||||
return false;
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float y))
|
||||
return false;
|
||||
|
||||
string goZ = args.NextString();
|
||||
|
||||
if (!uint.TryParse(args.NextString(), out uint mapId))
|
||||
mapId = player.GetMapId();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float ort))
|
||||
ort = player.GetOrientation();
|
||||
|
||||
float z;
|
||||
if (!goZ.IsEmpty())
|
||||
{
|
||||
if (!float.TryParse(goZ, out z))
|
||||
return false;
|
||||
|
||||
if (!GridDefines.IsValidMapCoord(mapId, x, y, z))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GridDefines.IsValidMapCoord(mapId, x, y))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
|
||||
return false;
|
||||
}
|
||||
Map map = Global.MapMgr.CreateBaseMap(mapId);
|
||||
z = Math.Max(map.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), map.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if (player.IsInFlight())
|
||||
player.FinishTaxiFlight();
|
||||
else
|
||||
player.SaveRecallPosition(); // save only in non-flight case
|
||||
|
||||
player.TeleportTo(mapId, x, y, z, ort);
|
||||
return true;
|
||||
}
|
||||
|
||||
//teleport at coordinates
|
||||
[Command("zonexy", RBACPermissions.CommandGoZonexy)]
|
||||
static bool HandleGoZoneXYCommand(StringArguments args, CommandHandler handler)
|
||||
@@ -421,80 +614,6 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
//teleport at coordinates, including Z and orientation
|
||||
[Command("xyz", RBACPermissions.CommandGoXyz)]
|
||||
static bool HandleGoXYZCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float x))
|
||||
return false;
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float y))
|
||||
return false;
|
||||
|
||||
string goZ = args.NextString();
|
||||
|
||||
if (!uint.TryParse(args.NextString(), out uint mapId))
|
||||
mapId = player.GetMapId();
|
||||
|
||||
if (!float.TryParse(args.NextString(), out float ort))
|
||||
ort = player.GetOrientation();
|
||||
|
||||
float z;
|
||||
if (!goZ.IsEmpty())
|
||||
{
|
||||
if (!float.TryParse(goZ, out z))
|
||||
return false;
|
||||
|
||||
if (!GridDefines.IsValidMapCoord(mapId, x, y, z))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GridDefines.IsValidMapCoord(mapId, x, y))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
|
||||
return false;
|
||||
}
|
||||
Map map = Global.MapMgr.CreateBaseMap(mapId);
|
||||
z = Math.Max(map.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), map.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if (player.IsInFlight())
|
||||
player.FinishTaxiFlight();
|
||||
else
|
||||
player.SaveRecallPosition(); // save only in non-flight case
|
||||
|
||||
player.TeleportTo(mapId, x, y, z, ort);
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("bugticket", RBACPermissions.CommandGoBugTicket)]
|
||||
static bool HandleGoBugTicketCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
return HandleGoTicketCommand<BugTicket>(args, handler);
|
||||
}
|
||||
|
||||
[Command("complaintticket", RBACPermissions.CommandGoComplaintTicket)]
|
||||
static bool HandleGoComplaintTicketCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
return HandleGoTicketCommand<ComplaintTicket>(args, handler);
|
||||
}
|
||||
|
||||
[Command("suggestionticket", RBACPermissions.CommandGoSuggestionTicket)]
|
||||
static bool HandleGoSuggestionTicketCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
return HandleGoTicketCommand<SuggestionTicket>(args, handler);
|
||||
}
|
||||
|
||||
static bool HandleGoTicketCommand<T>(StringArguments args, CommandHandler handler)where T : Ticket
|
||||
{
|
||||
if (args.Empty())
|
||||
@@ -522,45 +641,5 @@ namespace Game.Chat.Commands
|
||||
ticket.TeleportTo(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("offset", RBACPermissions.CommandGoOffset)]
|
||||
static bool HandleGoOffsetCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
string goX = args.NextString();
|
||||
string goY = args.NextString();
|
||||
string goZ = args.NextString();
|
||||
string port = args.NextString();
|
||||
|
||||
float x, y, z, o;
|
||||
player.GetPosition(out x, out y, out z, out o);
|
||||
if (!goX.IsEmpty())
|
||||
x += float.Parse(goX);
|
||||
if (!goY.IsEmpty())
|
||||
y += float.Parse(goY);
|
||||
if (!goZ.IsEmpty())
|
||||
z += float.Parse(goZ);
|
||||
if (!port.IsEmpty())
|
||||
o += float.Parse(port);
|
||||
|
||||
if (!GridDefines.IsValidMapCoord(x, y, z, o))
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, player.GetMapId());
|
||||
return false;
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if (player.IsInFlight())
|
||||
player.FinishTaxiFlight();
|
||||
else
|
||||
player.SaveRecallPosition(); // save only in non-flight case
|
||||
|
||||
player.TeleportTo(player.GetMapId(), x, y, z, o);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace Game.Chat
|
||||
|
||||
if (!group.IsRaidGroup())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NotInRaidGroup, player.GetName());
|
||||
handler.SendSysMessage(CypherStrings.GroupNotInRaidGroup, player.GetName());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5508,6 +5508,7 @@ namespace Game
|
||||
Cypher.Assert(false, $"Spawn data ({data.type},{data.spawnId}) being removed is member of spawn group {data.spawnGroupData.groupId}, but not actually listed in the lookup table for that group!");
|
||||
}
|
||||
|
||||
public Dictionary<uint, InstanceTemplate> GetInstanceTemplates() { return instanceTemplateStorage; }
|
||||
public InstanceTemplate GetInstanceTemplate(uint mapID)
|
||||
{
|
||||
return instanceTemplateStorage.LookupByKey(mapID);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
--
|
||||
-- resolve branch id conflicts
|
||||
UPDATE `trinity_string` SET `entry`=1212 WHERE `entry`=1184; -- move LANG_GUILD_INFO_LEVEL to free slot
|
||||
UPDATE `trinity_string` SET `entry`=1184 WHERE `entry`=1192; -- move LANG_CHANGEACCOUNT_SUCCESS to 3.3.5 slot
|
||||
|
||||
UPDATE `trinity_string` SET `entry`=1213 WHERE `entry`=1185; -- move LANG_ACCOUNT_BNET_LINKED to free slot
|
||||
UPDATE `trinity_string` SET `entry`=1185 WHERE `entry`=1193; -- move LANG_GROUP_NOT_IN_RAID_GROUP to 3.3.5 slot
|
||||
|
||||
UPDATE `trinity_string` SET `entry`=1214 WHERE `entry`=1186; -- move LANG_ACCOUNT_OR_BNET_DOES_NOT_EXIST to free slot
|
||||
UPDATE `trinity_string` SET `entry`=1186 WHERE `entry`=1194; -- move LANG_GROUP_ROLE_CHANGED to 3.3.5 slot
|
||||
|
||||
UPDATE `trinity_string` SET `entry`=1215 WHERE `entry`=1187; -- move LANG_ACCOUNT_ALREADY_LINKED to free slot
|
||||
UPDATE `trinity_string` SET `entry`=1187 WHERE `entry`=1195; -- move LANG_LEADER_CANNOT_BE_ASSISTANT to 3.3.5 slot
|
||||
|
||||
UPDATE `trinity_string` SET `entry`=1216 WHERE `entry`=1188; -- move LANG_ACCOUNT_BNET_UNLINKED to free slot
|
||||
UPDATE `trinity_string` SET `entry`=1188 WHERE `entry`=1191; -- move LANG_BAN_EXISTS to 3.3.5 slot
|
||||
|
||||
UPDATE `trinity_string` SET `entry`=1217 WHERE `entry`=1189; -- move LANG_ACCOUNT_BNET_NOT_LINKED to free slot
|
||||
|
||||
UPDATE `trinity_string` SET `entry`=1218 WHERE `entry`=1190; -- move LANG_DISALLOW_TICKETS_CONFIG to free slot
|
||||
|
||||
DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1189 AND 1197;
|
||||
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
|
||||
(1189, "No instances were found matching your input"),
|
||||
(1190, "Multiple instances match your input - please be more specific:"),
|
||||
(1191, "│ %04u - %s"),
|
||||
(1192, "Specified map %u is not instanced"),
|
||||
(1193, "Could not find entrance portal for map %u (%s)"),
|
||||
(1194, "Could not find exit portal for map %u (%s)"),
|
||||
(1195, "Teleported you to the entrance of mapid %u (%s)"),
|
||||
(1196, "Teleported you to the starting location of mapid %u (%s)"),
|
||||
(1197, "Failed to teleport you to mapid %u (%s) - missing attunement/expansion for parent map %u?");
|
||||
Reference in New Issue
Block a user