Replace more .names with .FullName or .Name respectively

This commit is contained in:
Lucas Nicodemus 2017-04-19 17:33:17 -06:00
parent 95ad2aeeab
commit 2dee3edb3d
No known key found for this signature in database
GPG key ID: CEE668CCE1BF2C7C

View file

@ -2156,83 +2156,83 @@ namespace TShockAPI
foreach (int i in npcIds) foreach (int i in npcIds)
{ {
npc.SetDefaults(i); npc.SetDefaults(i);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
} }
TSPlayer.All.SendSuccessMessage("{0} has spawned all bosses {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned all bosses {1} time(s).", args.Player.Name, amount);
return; return;
case "brain": case "brain":
case "brain of cthulhu": case "brain of cthulhu":
npc.SetDefaults(266); npc.SetDefaults(266);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned the Brain of Cthulhu {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned the Brain of Cthulhu {1} time(s).", args.Player.Name, amount);
return; return;
case "destroyer": case "destroyer":
npc.SetDefaults(134); npc.SetDefaults(134);
TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SetTime(false, 0.0);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned the Destroyer {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned the Destroyer {1} time(s).", args.Player.Name, amount);
return; return;
case "duke": case "duke":
case "duke fishron": case "duke fishron":
case "fishron": case "fishron":
npc.SetDefaults(370); npc.SetDefaults(370);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned Duke Fishron {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned Duke Fishron {1} time(s).", args.Player.Name, amount);
return; return;
case "eater": case "eater":
case "eater of worlds": case "eater of worlds":
npc.SetDefaults(13); npc.SetDefaults(13);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned the Eater of Worlds {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned the Eater of Worlds {1} time(s).", args.Player.Name, amount);
return; return;
case "eye": case "eye":
case "eye of cthulhu": case "eye of cthulhu":
npc.SetDefaults(4); npc.SetDefaults(4);
TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SetTime(false, 0.0);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned the Eye of Cthulhu {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned the Eye of Cthulhu {1} time(s).", args.Player.Name, amount);
return; return;
case "golem": case "golem":
npc.SetDefaults(245); npc.SetDefaults(245);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned Golem {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned Golem {1} time(s).", args.Player.Name, amount);
return; return;
case "king": case "king":
case "king slime": case "king slime":
npc.SetDefaults(50); npc.SetDefaults(50);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned King Slime {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned King Slime {1} time(s).", args.Player.Name, amount);
return; return;
case "plantera": case "plantera":
npc.SetDefaults(262); npc.SetDefaults(262);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned Plantera {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned Plantera {1} time(s).", args.Player.Name, amount);
return; return;
case "prime": case "prime":
case "skeletron prime": case "skeletron prime":
npc.SetDefaults(127); npc.SetDefaults(127);
TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SetTime(false, 0.0);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron Prime {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron Prime {1} time(s).", args.Player.Name, amount);
return; return;
case "queen": case "queen":
case "queen bee": case "queen bee":
npc.SetDefaults(222); npc.SetDefaults(222);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned Queen Bee {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned Queen Bee {1} time(s).", args.Player.Name, amount);
return; return;
case "skeletron": case "skeletron":
npc.SetDefaults(35); npc.SetDefaults(35);
TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SetTime(false, 0.0);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron {1} time(s).", args.Player.Name, amount);
return; return;
case "twins": case "twins":
TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SetTime(false, 0.0);
npc.SetDefaults(125); npc.SetDefaults(125);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
npc.SetDefaults(126); npc.SetDefaults(126);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned the Twins {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned the Twins {1} time(s).", args.Player.Name, amount);
return; return;
case "wof": case "wof":
@ -2253,7 +2253,7 @@ namespace TShockAPI
case "moon": case "moon":
case "moon lord": case "moon lord":
npc.SetDefaults(398); npc.SetDefaults(398);
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY);
TSPlayer.All.SendSuccessMessage("{0} has spawned the Moon Lord {1} time(s).", args.Player.Name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned the Moon Lord {1} time(s).", args.Player.Name, amount);
return; return;
default: default:
@ -2291,21 +2291,21 @@ namespace TShockAPI
} }
else if (npcs.Count > 1) else if (npcs.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.name)); TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.FullName));
} }
else else
{ {
var npc = npcs[0]; var npc = npcs[0];
if (npc.type >= 1 && npc.type < Main.maxNPCTypes && npc.type != 113) if (npc.type >= 1 && npc.type < Main.maxNPCTypes && npc.type != 113)
{ {
TSPlayer.Server.SpawnNPC(npc.type, npc.name, amount, args.Player.TileX, args.Player.TileY, 50, 20); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY, 50, 20);
if (args.Silent) if (args.Silent)
{ {
args.Player.SendSuccessMessage("Spawned {0} {1} time(s).", npc.name, amount); args.Player.SendSuccessMessage("Spawned {0} {1} time(s).", npc.FullName, amount);
} }
else else
{ {
TSPlayer.All.SendSuccessMessage("{0} has spawned {1} {2} time(s).", args.Player.Name, npc.name, amount); TSPlayer.All.SendSuccessMessage("{0} has spawned {1} {2} time(s).", args.Player.Name, npc.FullName, amount);
} }
} }
else if (npc.type == 113) else if (npc.type == 113)
@ -2533,18 +2533,18 @@ namespace TShockAPI
var matches = new List<NPC>(); var matches = new List<NPC>();
foreach (var npc in Main.npc.Where(npc => npc.active)) foreach (var npc in Main.npc.Where(npc => npc.active))
{ {
if (string.Equals(npc.name, npcStr, StringComparison.CurrentCultureIgnoreCase)) if (string.Equals(npc.FullName, npcStr, StringComparison.CurrentCultureIgnoreCase))
{ {
matches = new List<NPC> { npc }; matches = new List<NPC> { npc };
break; break;
} }
if (npc.name.ToLower().StartsWith(npcStr.ToLower())) if (npc.FullName.ToLower().StartsWith(npcStr.ToLower()))
matches.Add(npc); matches.Add(npc);
} }
if (matches.Count > 1) if (matches.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, matches.Select(n => n.name)); TShock.Utils.SendMultipleMatchError(args.Player, matches.Select(n => n.FullName));
return; return;
} }
if (matches.Count == 0) if (matches.Count == 0)
@ -2555,7 +2555,7 @@ namespace TShockAPI
var target = matches[0]; var target = matches[0];
args.Player.Teleport(target.position.X, target.position.Y); args.Player.Teleport(target.position.X, target.position.Y);
args.Player.SendSuccessMessage("Teleported to the '{0}'.", target.name); args.Player.SendSuccessMessage("Teleported to the '{0}'.", target.FullName);
} }
private static void GetPos(CommandArgs args) private static void GetPos(CommandArgs args)
@ -3202,12 +3202,12 @@ namespace TShockAPI
} }
else if (items.Count > 1) else if (items.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name)); TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.Name));
} }
else else
{ {
TShock.Itembans.AddNewBan(items[0].name); TShock.Itembans.AddNewBan(items[0].Name);
args.Player.SendSuccessMessage("Banned " + items[0].name + "."); args.Player.SendSuccessMessage("Banned " + items[0].Name + ".");
} }
} }
#endregion #endregion
@ -3228,7 +3228,7 @@ namespace TShockAPI
} }
else if (items.Count > 1) else if (items.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name)); TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.Name));
} }
else else
{ {
@ -3238,20 +3238,20 @@ namespace TShockAPI
return; return;
} }
ItemBan ban = TShock.Itembans.GetItemBanByName(items[0].name); ItemBan ban = TShock.Itembans.GetItemBanByName(items[0].Name);
if (ban == null) if (ban == null)
{ {
args.Player.SendErrorMessage("{0} is not banned.", items[0].name); args.Player.SendErrorMessage("{0} is not banned.", items[0].Name);
return; return;
} }
if (!ban.AllowedGroups.Contains(args.Parameters[2])) if (!ban.AllowedGroups.Contains(args.Parameters[2]))
{ {
TShock.Itembans.AllowGroup(items[0].name, args.Parameters[2]); TShock.Itembans.AllowGroup(items[0].Name, args.Parameters[2]);
args.Player.SendSuccessMessage("{0} has been allowed to use {1}.", args.Parameters[2], items[0].name); args.Player.SendSuccessMessage("{0} has been allowed to use {1}.", args.Parameters[2], items[0].Name);
} }
else else
{ {
args.Player.SendWarningMessage("{0} is already allowed to use {1}.", args.Parameters[2], items[0].name); args.Player.SendWarningMessage("{0} is already allowed to use {1}.", args.Parameters[2], items[0].Name);
} }
} }
} }
@ -3273,12 +3273,12 @@ namespace TShockAPI
} }
else if (items.Count > 1) else if (items.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name)); TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.Name));
} }
else else
{ {
TShock.Itembans.RemoveBan(items[0].name); TShock.Itembans.RemoveBan(items[0].Name);
args.Player.SendSuccessMessage("Unbanned " + items[0].name + "."); args.Player.SendSuccessMessage("Unbanned " + items[0].Name + ".");
} }
} }
#endregion #endregion
@ -3299,7 +3299,7 @@ namespace TShockAPI
} }
else if (items.Count > 1) else if (items.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name)); TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.Name));
} }
else else
{ {
@ -3309,20 +3309,20 @@ namespace TShockAPI
return; return;
} }
ItemBan ban = TShock.Itembans.GetItemBanByName(items[0].name); ItemBan ban = TShock.Itembans.GetItemBanByName(items[0].Name);
if (ban == null) if (ban == null)
{ {
args.Player.SendErrorMessage("{0} is not banned.", items[0].name); args.Player.SendErrorMessage("{0} is not banned.", items[0].Name);
return; return;
} }
if (ban.AllowedGroups.Contains(args.Parameters[2])) if (ban.AllowedGroups.Contains(args.Parameters[2]))
{ {
TShock.Itembans.RemoveGroup(items[0].name, args.Parameters[2]); TShock.Itembans.RemoveGroup(items[0].Name, args.Parameters[2]);
args.Player.SendSuccessMessage("{0} has been disallowed to use {1}.", args.Parameters[2], items[0].name); args.Player.SendSuccessMessage("{0} has been disallowed to use {1}.", args.Parameters[2], items[0].Name);
} }
else else
{ {
args.Player.SendWarningMessage("{0} is already disallowed to use {1}.", args.Parameters[2], items[0].name); args.Player.SendWarningMessage("{0} is already disallowed to use {1}.", args.Parameters[2], items[0].Name);
} }
} }
} }
@ -5187,7 +5187,7 @@ namespace TShockAPI
} }
else if (npcs.Count > 1) else if (npcs.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.name)); TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.FullName));
return; return;
} }
else else
@ -5242,7 +5242,7 @@ namespace TShockAPI
} }
else if (matchedItems.Count > 1) else if (matchedItems.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, matchedItems.Select(i => i.name)); TShock.Utils.SendMultipleMatchError(args.Player, matchedItems.Select(i => i.Name));
return; return;
} }
else else
@ -5291,7 +5291,7 @@ namespace TShockAPI
if (itemAmount == 0 || itemAmount > item.maxStack) if (itemAmount == 0 || itemAmount > item.maxStack)
itemAmount = item.maxStack; itemAmount = item.maxStack;
if (args.Player.GiveItemCheck(item.type, item.name, item.width, item.height, itemAmount, prefixId)) if (args.Player.GiveItemCheck(item.type, item.Name, item.width, item.height, itemAmount, prefixId))
{ {
item.prefix = (byte)prefixId; item.prefix = (byte)prefixId;
args.Player.SendSuccessMessage("Gave {0} {1}(s).", itemAmount, item.AffixName()); args.Player.SendSuccessMessage("Gave {0} {1}(s).", itemAmount, item.AffixName());
@ -5325,7 +5325,7 @@ namespace TShockAPI
} }
else if (npcs.Count > 1) else if (npcs.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.name)); TShock.Utils.SendMultipleMatchError(args.Player, npcs.Select(n => n.FullName));
return; return;
} }
else if (args.Parameters[1].Length > 200) else if (args.Parameters[1].Length > 200)
@ -5390,7 +5390,7 @@ namespace TShockAPI
} }
else if (items.Count > 1) else if (items.Count > 1)
{ {
TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.name)); TShock.Utils.SendMultipleMatchError(args.Player, items.Select(i => i.Name));
} }
else else
{ {
@ -5430,10 +5430,10 @@ namespace TShockAPI
{ {
if (itemAmount == 0 || itemAmount > item.maxStack) if (itemAmount == 0 || itemAmount > item.maxStack)
itemAmount = item.maxStack; itemAmount = item.maxStack;
if (plr.GiveItemCheck(item.type, item.name, item.width, item.height, itemAmount, prefix)) if (plr.GiveItemCheck(item.type, item.Name, item.width, item.height, itemAmount, prefix))
{ {
args.Player.SendSuccessMessage(string.Format("Gave {0} {1} {2}(s).", plr.Name, itemAmount, item.name)); args.Player.SendSuccessMessage(string.Format("Gave {0} {1} {2}(s).", plr.Name, itemAmount, item.Name));
plr.SendSuccessMessage(string.Format("{0} gave you {1} {2}(s).", args.Player.Name, itemAmount, item.name)); plr.SendSuccessMessage(string.Format("{0} gave you {1} {2}(s).", args.Player.Name, itemAmount, item.Name));
} }
else else
{ {