Core/Commands: Convert quest commands to new system
Port From (https://github.com/TrinityCore/TrinityCore/commit/6d2b8511547004b997cc1de76cdbaf5498b8b12c)
This commit is contained in:
@@ -93,7 +93,7 @@ namespace Game.Chat
|
||||
if (type.IsEnum)
|
||||
type = type.GetEnumUnderlyingType();
|
||||
|
||||
var (token, tail) = Tokenize(args);
|
||||
var (token, tail) = args.Tokenize();
|
||||
switch (Type.GetTypeCode(type))
|
||||
{
|
||||
case TypeCode.SByte:
|
||||
@@ -271,6 +271,14 @@ namespace Game.Chat
|
||||
|
||||
return ChatCommandResult.FromErrorMessage(handler.GetParsedString(CypherStrings.CmdparserSpellNoExist, tempVal));
|
||||
}
|
||||
case nameof(Quest):
|
||||
{
|
||||
ChatCommandResult result = TryConsume(out dynamic tempVal, typeof(uint), handler, args);
|
||||
if (!result.IsSuccessful() || (val = Global.ObjectMgr.GetQuestTemplate(tempVal)))
|
||||
return result;
|
||||
|
||||
return ChatCommandResult.FromErrorMessage(handler.GetParsedString(CypherStrings.CmdparserQuestNoExist, tempVal));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -312,23 +320,6 @@ namespace Game.Chat
|
||||
else
|
||||
return default;
|
||||
}
|
||||
|
||||
public static (string token, string tail) Tokenize(string args)
|
||||
{
|
||||
(string token, string tail) result = new ("", "");
|
||||
int delimPos = args.IndexOf(' ');
|
||||
if (delimPos != -1)
|
||||
{
|
||||
result.token = args.Substring(0, delimPos);
|
||||
int tailPos = args.FindFirstNotOf(" ", delimPos);
|
||||
if (tailPos != -1)
|
||||
result.tail = args.Substring(tailPos);
|
||||
}
|
||||
else
|
||||
result.token = args;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public struct ChatCommandResult
|
||||
|
||||
Reference in New Issue
Block a user