本文整理汇总了C#中ArgumentList.GetInt方法的典型用法代码示例。如果您正苦于以下问题:C# ArgumentList.GetInt方法的具体用法?C# ArgumentList.GetInt怎么用?C# ArgumentList.GetInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentList
的用法示例。
在下文中一共展示了ArgumentList.GetInt方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Give
/// <summary>
/// Gives specified item to the specified player.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void Give(ISender sender, ArgumentList args)
{
// /give <stack> <item> [prefix] [player]
var index = 0;
int stack = args.GetInt(index++);
string name = args.GetString(index++);
// var max = Tools.AvailableItemSlots; //Perhaps remove a few incase of new drops
// if (stack > max)
// {
// stack = max; // Set to Tools.AvailableItemSlots because number given was larger than this.
// }
int id;
var results = Int32.TryParse(name, out id) ? DefinitionManager.FindItem(id) : DefinitionManager.FindItem(name);
if (results != null && results.Length > 0)
{
if (results.Length > 1)
throw new CommandError(String.Format("More than 1 item found, total is: {0}", results.Length));
var item = results[0];
string prefix;
if (args.TryGetString(index, out prefix))
{
try
{
Affix afx;
if (Enum.TryParse(prefix, out afx))
{
item.Prefix = (int)afx;
index++;
}
}
catch (ArgumentException)
{
throw new CommandError(String.Format("Error, the Prefix you entered was not found: {0}", args.GetString(3)));
}
}
Player receiver;
if (!args.TryGetOnlinePlayer(index, out receiver))
{
if (sender is Player)
receiver = sender as Player;
else throw new CommandError("Expected an online player");
}
receiver.GiveItem(item.Id, stack, item.MaxStack, sender, item.NetId, true, item.Prefix);
}
else
throw new CommandError(String.Format("No item known by: {0}", name));
}
示例2: MaxPlayersCommand
internal static void MaxPlayersCommand(ISender sender, ArgumentList args)
{
if (MaxPlayersDisabled)
{
sender.Message (255, "This command has been disabled.");
return;
}
int maxp = -1;
int overl = -1;
if (args.TryGetInt (0, out maxp) && (maxp < 1 || maxp > MAX_SLOTS))
{
sender.Message (255, "Max numbers of players must be in range 1 .. {0}", MAX_SLOTS);
return;
}
if (args.Count > 1)
{
overl = args.GetInt (1);
if (overl < 0 || overl > maxp)
{
sender.Message (255, "Number of overlimit slots must be in range 0 .. <max player count>");
return;
}
}
int oldmax = maxSlots;
int oldover = overlimitSlots;
int result = maxSlots;
if (maxp >= 0 || overl >= 0)
{
result = ChangeLimits (maxp < 0 ? maxSlots : maxp, overl < 0 ? overlimitSlots : overl);
Server.notifyOps(
String.Format("Max player slots changed to {0}+{1}. [{2}]", result, overlimitSlots, sender.Name)
);
}
sender.Message (255, ChatColor.SteelBlue, "Max player slots: {0}, overlimit slots: {1}", result, overlimitSlots);
if (oldmax != maxSlots || oldover != overlimitSlots)
{
Program.properties.MaxPlayers = maxSlots;
Program.properties.OverlimitSlots = overlimitSlots;
Program.properties.Save (true);
}
}
示例3: SpawnNPC
/// <summary>
/// Spawns specified NPC type.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
/// <remarks>This function also allows NPC custom health.</remarks>
public void SpawnNPC(ISender sender, ArgumentList args)
{
//if (Main.stopSpawns && !Program.properties.NPCSpawnsOverride)
// throw new CommandError("NPC Spawing is disabled.");
//var health = -1;
//var customHealth = args.TryPopAny<Int32>("-health", out health);
Player player = sender as Player;
int amount;
if (args.Count > 4)
throw new CommandError("Too many arguments");
else if (sender is ConsoleSender && args.Count <= 2)
{
if (!Netplay.anyClients || !Tools.TryGetFirstOnlinePlayer(out player))
throw new CommandError("No players online.");
}
else if (args.Count >= 3)
player = args.GetOnlinePlayer(2);
var npcName = args.GetString(1).ToLower().Trim();
// Get the class id of the npc
var npcs = DefinitionManager.FindNPC(npcName);
if (npcs.Length == 0)
throw new CommandError("No npc exists by the name {0}", npcName);
else if (npcs.Length > 1)
{
bool first;
args.TryGetBool(3, out first);
if (!first)
throw new CommandError("Too many results for {0}, total count {1}", npcName, npcs.Length);
}
var npc = npcs[0];
if (npc.Boss.HasValue && npc.Boss == true)
throw new CommandError("This NPC can only be summoned by the SPAWNBOSS command.");
try
{
amount = args.GetInt(0);
//if (NPCAmount > Program.properties.SpawnNPCMax && sender is Player)
//{
// (sender as Player).Kick("Don't spawn that many.");
// return;
//}
}
catch
{
throw new CommandError("Expected amount to spawn");
}
var max = Tools.AvailableNPCSlots; //Perhaps remove a few incase of spawns
if (amount > max)
throw new CommandError("Cannot spawn that many, available slots: {0}", max);
string realNPCName = String.Empty;
for (int i = 0; i < amount; i++)
{
Vector2 location = World.GetRandomClearTile(((int)player.position.X / 16), ((int)player.position.Y / 16), 100, 100, 50);
int npcIndex = NPC.NewNPC(((int)location.X * 16), ((int)location.Y * 16), npc.Id, 0);
//if (customHealth)
//{
// Main.npc[npcIndex].life = health;
// Main.npc[npcIndex].lifeMax = health;
//}
Main.npc[npcIndex].netDefaults(npc.NetId);
realNPCName = Main.npc[npcIndex].name;
}
Tools.NotifyAllOps("Spawned " + amount.ToString() + " of " +
realNPCName + " [" + player.name + "]", true);
}
示例4: Give
/// <summary>
/// Gives specified item to the specified player.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void Give(ISender sender, ArgumentList args)
{
// /give <player> <stack> <name>
Player receiver = args.GetOnlinePlayer(0);
int stack = args.GetInt(1);
string NameOrId = args.GetString(2);
List<Int32> itemlist;
if (Server.TryFindItemByName(NameOrId, out itemlist) && itemlist.Count > 0)
{
if (itemlist.Count > 1)
throw new CommandError("There were {0} Items found regarding the specified name", itemlist.Count);
foreach (int id in itemlist)
receiver.GiveItem(id, stack, sender);
}
else
{
int Id = -1;
try
{
Id = Int32.Parse(NameOrId);
}
catch
{
throw new CommandError("There were {0} Items found regarding the specified Item Id/Name", itemlist.Count);
}
if (Server.TryFindItemByType(Id, out itemlist) && itemlist.Count > 0)
{
if (itemlist.Count > 1)
throw new CommandError("There were {0} Items found regarding the specified Type Id", itemlist.Count);
foreach (int id in itemlist)
receiver.GiveItem(id, stack, sender);
}
else
{
throw new CommandError("There were no Items found regarding the specified Item Id/Name");
}
}
}
示例5: Give
/// <summary>
/// Gives specified item to the specified player.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void Give(ISender sender, ArgumentList args)
{
// /give <player> <stack> <name>
string _prefix;
args.TryPopAny("-prefix", out _prefix);
byte prefix;
if (!Byte.TryParse(_prefix, out prefix))
{
Affix affix;
if (!AffixExtensions.Parse(_prefix ?? String.Empty, out affix, true)) prefix = 0;
else prefix = (byte)affix;
}
Player receiver = args.GetOnlinePlayer(0);
int stack = args.GetInt(1);
string NameOrId = args.GetString(2);
List<ItemInfo> itemlist;
if (Server.TryFindItemByName(NameOrId, out itemlist) && itemlist.Count > 0)
{
if (itemlist.Count > 1)
throw new CommandError(String.Format(Languages.MoreThanOneItemFoundNameId, itemlist.Count));
var item = itemlist[0];
var index = receiver.GiveItem(item.Type, stack, sender, item.NetID, true, prefix);
if (item.NetID < 0)
Main.item[index] = Item.netDefaults(item.NetID);
Main.item[index].Prefix = prefix;
}
else
{
int Id = -1;
try
{
Id = Int32.Parse(NameOrId);
}
catch
{
throw new CommandError(String.Format(Languages.MoreThanOneItemFoundNameId, itemlist.Count));
}
if (Server.TryFindItemByType(Id, out itemlist) && itemlist.Count > 0)
{
if (itemlist.Count > 1)
throw new CommandError(String.Format(Languages.MoreThanOneItemFoundType, itemlist.Count));
//receiver.GiveItem(itemlist[0].Type, stack, sender);
var item = itemlist[0];
var index = receiver.GiveItem(item.Type, stack, sender, item.NetID, true, prefix);
if (item.NetID < 0)
Main.item[index] = Item.netDefaults(item.NetID);
Main.item[index].Prefix = prefix;
}
else
{
throw new CommandError(String.Format(Languages.MoreThanOneItemFoundNameId, "no"));
}
}
}
示例6: SpawnNPC
/// <summary>
/// Spawns specified NPC type.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
/// <remarks>This function also allows NPC custom health.</remarks>
public static void SpawnNPC(ISender sender, ArgumentList args)
{
if (Main.stopSpawns && !Program.properties.NPCSpawnsOverride)
throw new CommandError("NPC Spawing is disabled.");
var health = -1;
var customHealth = args.TryPopAny<Int32>("-health", out health);
Player player = sender as Player;
int NPCAmount;
if (args.Count > 3)
throw new CommandError(Languages.TooManyArguments);
else if (sender is ConsoleSender && args.Count <= 2)
{
if (!NetPlay.anyClients || !Server.TryGetFirstOnlinePlayer(out player))
throw new CommandError(Languages.NobodyOnline);
}
else if (args.Count == 3)
player = args.GetOnlinePlayer(2);
var npcName = args.GetString(1).ToLower().Trim();
// Get the class id of the npc
int realNPCId = 0;
NPC fclass = Registries.NPC.FindClass(npcName);
if (fclass.Name != String.Empty)
realNPCId = fclass.Type;
else
throw new CommandError(Languages.NPCDoesntExist);
try
{
NPCAmount = args.GetInt(0);
if (NPCAmount > Program.properties.SpawnNPCMax && sender is Player)
{
(sender as Player).Kick(Languages.DontSpawnThatMany);
return;
}
}
catch
{
throw new CommandError(Languages.ExpectedSpawnInteger);
}
string realNPCName = String.Empty;
for (int i = 0; i < NPCAmount; i++)
{
Vector2 location = World.GetRandomClearTile(((int)player.Position.X / 16), ((int)player.Position.Y / 16), 100, true, 100, 50);
int npcIndex = NPC.NewNPC(((int)location.X * 16), ((int)location.Y * 16), fclass.Name, 0, Main.SpawnsOverride);
if (customHealth)
{
Main.npcs[npcIndex].life = health;
Main.npcs[npcIndex].lifeMax = health;
}
realNPCName = Main.npcs[npcIndex].Name;
}
Server.notifyOps("Spawned " + NPCAmount.ToString() + " of " +
realNPCName + " [" + player.Name + "]", true);
}
示例7: SpawnNPC
/// <summary>
/// Spawns specified NPC type.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
/// <remarks>This function also allows NPC custom health.</remarks>
public void SpawnNPC(ISender sender, ArgumentList args)
{
//if (Main.stopSpawns && !Program.properties.NPCSpawnsOverride)
// throw new CommandError("NPC Spawing is disabled.");
//var health = -1;
//var customHealth = args.TryPopAny<Int32>("-health", out health);
Player player = sender as Player;
int amount, offset = -1;
if (args.Count > 5)
throw new CommandError("Too many arguments");
else if (sender is ConsoleSender && args.Count <= 2)
{
if (!Netplay.anyClients || !Tools.TryGetFirstOnlinePlayer(out player))
throw new CommandError("No players online.");
}
else if (args.Count == 3)
player = args.GetOnlinePlayer(2);
else if (args.Count >= 4)
{
player = args.GetOnlinePlayer(2);
args.TryPopAny<Int32>("-item", out offset);
}
var npcName = args.GetString(1).ToLower().Trim();
// Get the class id of the npc
var npcs = DefinitionManager.FindNPC(npcName);
if (npcs == null || npcs.Length == 0)
{
int npcId;
if (Int32.TryParse(npcName, out npcId))
{
npcs = DefinitionManager.FindNPC(npcId);
if (npcs == null || npcs.Length == 0)
{
throw new CommandError("No npc exists by type {0}", npcId);
}
}
else throw new CommandError("No npc exists {0}", npcName);
}
npcs = npcs.OrderBy(x => x.Name).ToArray();
if (npcs.Length > 1)
{
if (offset == -1)
{
sender.SendMessage("Npcs matching " + npcName + ':');
for (var x = 0; x < npcs.Length; x++)
{
if (sender is ConsoleSender)
{
sender.SendMessage($"\t{x}\t- {npcs[x].Name}");
}
else
{
sender.SendMessage($"{x} - {npcs[x].Name}");
}
}
return;
}
}
else offset = 0;
var npc = npcs[offset];
if (npc.Boss.HasValue && npc.Boss == true)
throw new CommandError("This NPC can only be summoned by the SPAWNBOSS command.");
try
{
amount = args.GetInt(0);
//if (NPCAmount > Program.properties.SpawnNPCMax && sender is Player)
//{
// (sender as Player).Kick("Don't spawn that many.");
// return;
//}
}
catch
{
throw new CommandError("Expected amount to spawn");
}
var max = Tools.AvailableNPCSlots; //Perhaps remove a few incase of spawns
if (amount > max)
throw new CommandError("Cannot spawn that many, available slots: {0}", max);
string realNPCName = String.Empty;
for (int i = 0; i < amount; i++)
{
Vector2 location = World.GetRandomClearTile(((int)player.position.X / 16), ((int)player.position.Y / 16), 100, 100, 50);
int npcIndex = NPC.NewNPC(((int)location.X * 16), ((int)location.Y * 16), npc.Id, 0);
//if (customHealth)
//{
//.........这里部分代码省略.........
示例8: VariableMan
/// <summary>
/// Allows on the fly variable modifications
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="args">Arguments.</param>
public void VariableMan(ISender sender, ArgumentList args)
{
// var <exec|field>
// var field <namespace.type> <fieldname>
// var field <namespace.type> <fieldname> <valuetobeset>
// var exec <namespace.type> <methodname>
//No arguments supported yet
var cmd = args.GetString(0);
if (cmd == "field" || cmd == "arr")
{
var type = args.GetString(1);
var mem = args.GetString(2);
//Find the type
var at = Type.GetType(type);
if (at == null)
at = System.Reflection.Assembly.GetEntryAssembly().GetType(type);
if (at == null)
at = System.Reflection.Assembly.GetCallingAssembly().GetType(type);
if (at == null)
at = System.Reflection.Assembly.GetExecutingAssembly().GetType(type);
if (at == null)
at = typeof(Terraria.Main).Assembly.GetType(type);
if (at == null)
throw new CommandError("Invalid type: " + type);
//Find the field
var am = at.GetField(mem);
if (am == null)
throw new CommandError("Invalid field: " + mem);
string val = null;
if (cmd != "arr" && args.TryGetString(3, out val))
{
object data = GetDataValue(am.FieldType, val);
am.SetValue(null, data);
var v = am.GetValue(null);
if (v != null)
val = v.ToString();
else
val = "null";
sender.Message("Value is now: " + val);
}
else
{
var v = am.GetValue(null);
if (v != null)
{
if (v.GetType().IsArray)
{
var index = args.GetInt(3);
var obj = (v as Array).GetValue(index);
if (obj is Terraria.RemoteClient)
{
val = "";
var rc = obj as Terraria.RemoteClient;
val += $"Id: {rc.Id}\n";
val += $"IsActive: {rc.IsActive}\n";
val += $"IsAnnouncementCompleted: {rc.IsAnnouncementCompleted}\n";
val += $"IsConnected(): {rc.IsConnected()}\n";
val += $"IsReading: {rc.IsReading}\n";
val += $"Name: {rc.Name}\n";
val += $"PendingTermination: {rc.PendingTermination}\n";
val += $"SpamAddBlock: {rc.SpamAddBlock}\n";
val += $"SpamAddBlockMax: {rc.SpamAddBlockMax}\n";
val += $"SpamDeleteBlock: {rc.SpamDeleteBlock}\n";
val += $"SpamDeleteBlockMax: {rc.SpamDeleteBlockMax}\n";
val += $"SpamProjectile: {rc.SpamProjectile}\n";
val += $"SpamProjectileMax: {rc.SpamProjectileMax}\n";
val += $"SpamWater: {rc.SpamWater}\n";
val += $"SpamWaterMax: {rc.SpamWaterMax}\n";
val += $"State: {rc.State}\n";
val += $"StatusCount: {rc.StatusCount}\n";
val += $"StatusMax: {rc.StatusMax}\n";
val += $"StatusText: {rc.StatusText}\n";
val += $"StatusText2: {rc.StatusText2}\n";
val += $"TimeOutTimer: {rc.TimeOutTimer}\n";
#if CUSTOM_SOCKETS
if (rc.Socket is OTA.Sockets.ClientConnection)
{
val += "\n=======================\nClientConnection\n";
var cc = rc.Socket as OTA.Sockets.ClientConnection;
val += $"Active: {cc.Active}\n";
val += $"BytesReceived: {cc.BytesReceived}\n";
val += $"BytesSent: {cc.BytesSent}\n";
val += $"IsOTAClient: {cc.IsOTAClient}\n";
val += $"QueueLength: {cc.QueueLength}\n";
val += $"QueueSize: {cc.QueueSize}\n";
//val += $"RemoteAddress: {cc.RemoteAddress}\n";
val += $"SlotId: {cc.SlotId}\n";
//.........这里部分代码省略.........
示例9: Give
/// <summary>
/// Gives specified item to the specified player.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void Give(ISender sender, ArgumentList args)
{
// /give <player> <stack> <name>
Player receiver = args.GetOnlinePlayer(0);
int stack = args.GetInt(1);
string name = args.GetString(2);
var max = Tools.AvailableItemSlots; //Perhaps remove a few incase of new drops
if (stack > max)
{
stack = max; // Set to Tools.AvailableItemSlots because number given was larger than this.
}
var results = DefinitionManager.FindItem(name);
if (results != null && results.Length > 0)
{
if (results.Length > 1)
throw new CommandError(String.Format("More than 1 item found, total is: {0}", results.Length));
var item = results[0];
var index = receiver.GiveItem(item.Id, stack, sender, item.NetId, true, item.Prefix);
if (item.NetId < 0)
Main.item[index].netDefaults(item.NetId);
Main.item[index].Prefix(item.Prefix);
}
else
throw new CommandError(String.Format("No item known by: {0}", name));
}
示例10: ListWarp
public static void ListWarp(ISender sender, ArgumentList args)
{
if (WarpManager.WarpList.Count < 1)
throw new CommandError("There are no warps.");
int maxPages = WarpManager.WarpList.Count / 5;
int page = args.GetInt(0);
if (maxPages > 0 && page > maxPages - 1 || page < 1)
{
throw new CommandError("Pages: 1 => {0}", maxPages);
}
page *= 5;
if (page >= WarpManager.WarpList.Count)
page = WarpManager.WarpList.Count;
int start = page - 5;
if (page < 4)
start = 0;
for (int i = start; i < page; i++)
{
Warp warp = WarpManager.WarpList.ToArray()[i];
if (warp.IsUserAccessible(sender.Name) || !(sender is Player) || sender.Op) //!player's = OP ??
{
sender.Message("Warp: {0}", warp.Name);
}
else
{
sender.Message("<PRIVATE>");
}
}
}
示例11: Give
/// <summary>
/// Gives specified item to the specified player.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void Give(ISender sender, ArgumentList args)
{
// /give <player> <stack> <name>
Player receiver = args.GetOnlinePlayer(0);
int stack = args.GetInt(1);
string name = args.GetString(2);
var max = Tools.AvailableItemSlots; //Perhaps remove a few incase of new drops
if (stack > max)
{
stack = max; // Set to Tools.AvailableItemSlots because number given was larger than this.
}
int id;
var results = int.TryParse(name, out id) ? DefinitionManager.FindItem(id) : DefinitionManager.FindItem(name);
if (results != null && results.Length > 0)
{
if (results.Length > 1)
throw new CommandError(String.Format("More than 1 item found, total is: {0}", results.Length));
var item = results[0];
try {
item.Prefix = (int)(Affix)Enum.Parse(typeof(Affix), args.GetString(3), true);
}
catch (CommandError)
{
}catch (ArgumentException)
{
throw new CommandError(String.Format("Error, the Prefix you entered was not found: {0}", args.GetString(3)));
}
var index = receiver.GiveItem(item.Id, stack, sender, item.NetId, true, item.Prefix);
if (item.NetId < 0)
Main.item[index].netDefaults(item.NetId);
Main.item[index].Prefix(item.Prefix);
}
else
throw new CommandError(String.Format("No item known by: {0}", name));
}
示例12: SummonBoss
/// <summary>
/// Summon a Boss
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void SummonBoss(ISender sender, ArgumentList args)
{
var bossName = args.GetString(0).ToLower();
var count = args.GetInt(1);
Player target;
if (!args.TryGetOnlinePlayer(2, out target))
{
if (sender is Player)
{
target = sender as Player;
}
else
throw new CommandError("Expected a player");
}
var position = World.GetRandomClearTile(target.position.X / 16f, target.position.X / 16f);
int type = -1, type1 = -1;
string name = null;
switch (bossName)
{
case "wyvern":
type = 87;
break;
case "brain":
case "brain of cthulhu":
type = 266;
break;
case "crimson mimic":
type = 474;
break;
case "corrupt mimic":
type = 473;
break;
case "hallowed mimic":
type = 475;
break;
case "duke fishron":
case "duke":
case "fishron":
type = 370;
break;
case "everscream":
type = 344;
break;
case "eye of cthulhu":
type = 4;
break;
case "dutchman":
case "flying dutchman":
type = 491;
break;
case "golem":
type = 245;
break;
case "gobin summoner":
type = 471;
break;
case "king":
case "king slime":
type = 50;
break;
case "ice golem":
type = 243;
break;
case "ice queen":
type = 345;
break;
case "lunatic":
case "cultist":
case "lunatic cultist":
type = 439;
break;
case "saucer":
case "martian saucer":
type = 395;
break;
case "moon":
case "moon lord":
type = 398;
//.........这里部分代码省略.........
示例13: SummonBoss
/// <summary>
/// Summon a Boss
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void SummonBoss(ISender sender, ArgumentList args)
{
var count = args.GetInt(0);
var bossName = args.GetString(1).ToLower();
Player target;
if (!args.TryGetOnlinePlayer(2, out target))
{
if (sender is Player)
{
target = sender as Player;
}
else
{
target = Main.player.Where(x => x.active).Random();
if (null == target)
{
throw new CommandError("No players online");
}
}
}
// int type = -1, type1 = -1;
// string name = null;
var queue = new Queue<Boss>();
switch (bossName)
{
case "wyvern":
// type = 87;
queue.Enqueue(new Boss()
{
type = 87
});
break;
case "brain":
case "brain of cthulhu":
// type = 266;
queue.Enqueue(new Boss()
{
type = 266
});
break;
// case "crimson mimic":
// type = 474;
// break;
case "corrupt mimic":
// type = 473;
queue.Enqueue(new Boss()
{
type = 473
});
break;
// case "hallowed mimic":
// type = 475;
// break;
case "duke fishron":
case "duke":
case "fishron":
// type = 370;
queue.Enqueue(new Boss()
{
type = 370
});
break;
case "everscream":
World.SetTime(16200.0, false);
// type = 344;
queue.Enqueue(new Boss()
{
type = 344
});
break;
case "eye":
case "cthulhu":
case "eye of cthulhu":
World.SetTime(16200.0, false);
// type = 4;
queue.Enqueue(new Boss()
{
type = 4
});
break;
case "dutchman":
case "flying dutchman":
// type = 491;
queue.Enqueue(new Boss()
{
type = 491
//.........这里部分代码省略.........
示例14: Give
/// <summary>
/// Gives specified item to the specified player.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void Give(ISender sender, ArgumentList args)
{
// /give <player> <stack> <name>
Player receiver = args.GetOnlinePlayer(0);
int stack = args.GetInt(1);
string name = args.GetString(2);
int id;
var results = Int32.TryParse(name, out id) ? DefinitionManager.FindItem(id) : DefinitionManager.FindItem(name);
if (results != null && results.Length > 0)
{
if (results.Length > 1)
throw new CommandError(String.Format("More than 1 item found, total is: {0}", results.Length));
var item = results[0];
string prefix;
if (args.TryGetString(3, out prefix))
{
try
{
item.Prefix = (int)(Affix)Enum.Parse(typeof(Affix), prefix, true);
}
catch (ArgumentException)
{
throw new CommandError(String.Format("Error, the Prefix you entered was not found: {0}", args.GetString(3)));
}
}
receiver.GiveItem(item.Id, stack, item.MaxStack, sender, item.NetId, true, item.Prefix);
}
else
throw new CommandError(String.Format("No item known by: {0}", name));
}