Core/Commands: Fixed a error with go creature command.

This commit is contained in:
hondacrx
2018-03-12 10:02:29 -04:00
parent a2fafd2920
commit ef7423fa12
2 changed files with 13 additions and 20 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ public class Log
if (!ShouldLog(LogFilter.Server, LogLevel.Fatal))
return;
outMessage(LogFilter.Server, LogLevel.Fatal, "MemberName: {0} ExceptionMessage: {1}", memberName, ex.Message);
outMessage(LogFilter.Server, LogLevel.Fatal, "CallingMember: {0} ExceptionMessage: {1}", memberName, ex.Message);
}
public static void outFatal(LogFilter type, string text, params object[] args)
+10 -17
View File
@@ -40,36 +40,29 @@ namespace Game.Chat.Commands
Player player = handler.GetSession().GetPlayer();
// "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
string param1 = handler.extractKeyFromLink(args, "Hcreature");
string param1 = handler.extractKeyFromLink(args, "Hcreature", "Hcreature_entry");
if (string.IsNullOrEmpty(param1))
return false;
string whereClause = "";
// User wants to teleport to the NPC's template entry
if (param1.Equals("id"))
if (param1.IsNumber())
{
// Get the "creature_template.entry"
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
string idStr = handler.extractKeyFromLink(args, "Hcreature_entry");
if (string.IsNullOrEmpty(idStr))
return false;
if (!int.TryParse(idStr, out int entry) || entry == 0)
if (!int.TryParse(param1, out int entry) || entry == 0)
{
if (!ulong.TryParse(param1, out ulong guidLow) || guidLow == 0)
return false;
whereClause += "WHERE guid = '" + guidLow + '\'';
}
else
whereClause += "WHERE id = '" + entry + '\'';
}
else
{
// Number is invalid - maybe the user specified the mob's name
if (!ulong.TryParse(param1, out ulong guidLow) || guidLow == 0)
{
string name = param1;
whereClause += ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name LIKE '" + name + '\'';
}
else
whereClause += "WHERE guid = '" + guidLow + '\'';
// param1 is not a number, must be mob's name
whereClause += ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name LIKE '" + param1 + '\'';
}
SQLResult result = DB.World.Query("SELECT position_x, position_y, position_z, orientation, map FROM creature {0}", whereClause);