Core/Commands: Fixed a error with go creature command.
This commit is contained in:
@@ -117,7 +117,7 @@ public class Log
|
|||||||
if (!ShouldLog(LogFilter.Server, LogLevel.Fatal))
|
if (!ShouldLog(LogFilter.Server, LogLevel.Fatal))
|
||||||
return;
|
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)
|
public static void outFatal(LogFilter type, string text, params object[] args)
|
||||||
|
|||||||
@@ -40,36 +40,29 @@ namespace Game.Chat.Commands
|
|||||||
Player player = handler.GetSession().GetPlayer();
|
Player player = handler.GetSession().GetPlayer();
|
||||||
|
|
||||||
// "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
|
// "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))
|
if (string.IsNullOrEmpty(param1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string whereClause = "";
|
string whereClause = "";
|
||||||
|
|
||||||
// User wants to teleport to the NPC's template entry
|
// User wants to teleport to the NPC's template entry
|
||||||
if (param1.Equals("id"))
|
if (param1.IsNumber())
|
||||||
{
|
{
|
||||||
// Get the "creature_template.entry"
|
if (!int.TryParse(param1, out int entry) || entry == 0)
|
||||||
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
|
{
|
||||||
string idStr = handler.extractKeyFromLink(args, "Hcreature_entry");
|
if (!ulong.TryParse(param1, out ulong guidLow) || guidLow == 0)
|
||||||
if (string.IsNullOrEmpty(idStr))
|
return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!int.TryParse(idStr, out int entry) || entry == 0)
|
whereClause += "WHERE guid = '" + guidLow + '\'';
|
||||||
return false;
|
}
|
||||||
|
else
|
||||||
whereClause += "WHERE id = '" + entry + '\'';
|
whereClause += "WHERE id = '" + entry + '\'';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Number is invalid - maybe the user specified the mob's name
|
// param1 is not a number, must be mob's name
|
||||||
if (!ulong.TryParse(param1, out ulong guidLow) || guidLow == 0)
|
whereClause += ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name LIKE '" + param1 + '\'';
|
||||||
{
|
|
||||||
string name = param1;
|
|
||||||
whereClause += ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name LIKE '" + name + '\'';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
whereClause += "WHERE guid = '" + guidLow + '\'';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLResult result = DB.World.Query("SELECT position_x, position_y, position_z, orientation, map FROM creature {0}", whereClause);
|
SQLResult result = DB.World.Query("SELECT position_x, position_y, position_z, orientation, map FROM creature {0}", whereClause);
|
||||||
|
|||||||
Reference in New Issue
Block a user