Cleanup/Housekeeping (#242)
This commit is contained in:
parent
90ede0659f
commit
741e8d8300
228 changed files with 6292 additions and 2690 deletions
|
|
@ -1,23 +1,3 @@
|
|||
/***************************************************************************
|
||||
* Commands.cs
|
||||
* -------------------
|
||||
* begin : May 1, 2002
|
||||
* copyright : (C) The RunUO Software Team
|
||||
* email : info@runuo.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
|
@ -49,7 +29,9 @@ namespace Server
|
|||
public string GetString(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return Arguments[index];
|
||||
}
|
||||
|
|
@ -57,7 +39,9 @@ namespace Server
|
|||
public int GetInt32(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Utility.ToInt32(Arguments[index]);
|
||||
}
|
||||
|
|
@ -65,7 +49,9 @@ namespace Server
|
|||
public uint GetUInt32(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Utility.ToUInt32(Arguments[index]);
|
||||
}
|
||||
|
|
@ -73,7 +59,9 @@ namespace Server
|
|||
public bool GetBoolean(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Utility.ToBoolean(Arguments[index]);
|
||||
}
|
||||
|
|
@ -81,7 +69,9 @@ namespace Server
|
|||
public double GetDouble(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return Utility.ToDouble(Arguments[index]);
|
||||
}
|
||||
|
|
@ -89,7 +79,9 @@ namespace Server
|
|||
public TimeSpan GetTimeSpan(int index)
|
||||
{
|
||||
if (index < 0 || index >= Arguments.Length)
|
||||
{
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
return Utility.ToTimeSpan(Arguments[index]);
|
||||
}
|
||||
|
|
@ -145,10 +137,16 @@ namespace Server
|
|||
var end = start;
|
||||
|
||||
while (end < array.Length)
|
||||
{
|
||||
if (array[end] != '"' || array[end - 1] == '\\')
|
||||
{
|
||||
++end;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
list.Add(value.Substring(start, end - start));
|
||||
|
||||
|
|
@ -159,10 +157,16 @@ namespace Server
|
|||
var end = start;
|
||||
|
||||
while (end < array.Length)
|
||||
{
|
||||
if (array[end] != ' ')
|
||||
{
|
||||
++end;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
list.Add(value.Substring(start, end - start));
|
||||
|
||||
|
|
@ -185,10 +189,14 @@ namespace Server
|
|||
public static bool Handle(Mobile from, string text, MessageType type = MessageType.Regular)
|
||||
{
|
||||
if (!text.StartsWith(Prefix) && type != MessageType.Command)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type != MessageType.Command)
|
||||
{
|
||||
text = text.Substring(Prefix.Length);
|
||||
}
|
||||
|
||||
var indexOf = text.IndexOf(' ');
|
||||
|
||||
|
|
@ -226,7 +234,9 @@ namespace Server
|
|||
else
|
||||
{
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendMessage("You do not have access to that command.");
|
||||
}
|
||||
|
|
@ -234,7 +244,9 @@ namespace Server
|
|||
else
|
||||
{
|
||||
if (from.AccessLevel <= BadCommandIgnoreLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendMessage("That is not a valid command.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue