internal static void OnSetDefaultsByName(Item item, string name) { item.name = String.Empty; bool noMatCheck = true; if (Handler.ItemDef.VanillaDefsByName.ContainsKey(name)) { item.SetDefaults(Handler.ItemDef.VanillaDefsByName[name].NetID); // custom SetDefaults supports that, vanilla doesn't return; } switch (name) { case "Blue Phasesaber": item.SetDefaults(ItemID.BluePhaseblade); item.damage = 41; item.scale = 1.15f; item.autoReuse = true; item.useTurn = true; item.rare = 4; item.netID = ItemID.BluePhasesaber; break; case "Red Phasesaber": item.SetDefaults(ItemID.RedPhaseblade); item.damage = 41; item.scale = 1.15f; item.autoReuse = true; item.useTurn = true; item.rare = 4; item.netID = ItemID.RedPhasesaber; break; case "Green Phasesaber": item.SetDefaults(ItemID.GreenPhaseblade); item.damage = 41; item.scale = 1.15f; item.autoReuse = true; item.useTurn = true; item.rare = 4; item.netID = ItemID.GreenPhasesaber; break; case "Purple Phasesaber": item.SetDefaults(ItemID.PurplePhaseblade); item.damage = 41; item.scale = 1.15f; item.autoReuse = true; item.useTurn = true; item.rare = 4; item.netID = ItemID.PurplePhasesaber; break; case "White Phasesaber": item.SetDefaults(ItemID.WhitePhaseblade); item.damage = 41; item.scale = 1.15f; item.autoReuse = true; item.useTurn = true; item.rare = 4; item.netID = ItemID.WhitePhasesaber; break; case "Yellow Phasesaber": item.SetDefaults(ItemID.YellowPhaseblade); item.damage = 41; item.scale = 1.15f; item.autoReuse = true; item.useTurn = true; item.rare = 4; item.netID = ItemID.YellowPhasesaber; break; default: noMatCheck = false; if (!String.IsNullOrEmpty(name)) { for (int i = 0; i < ItemID.Count; i++) if (Main.itemName[i] == name) { item.SetDefaults(i); item.checkMat(); return; } item.name = String.Empty; item.stack = item.type = 0; } break; } if (item.type != 0) { if (noMatCheck) item.material = false; else item.checkMat(); if (Handler.ItemDef.DefsByType.ContainsKey(item.type)) item.name = Handler.ItemDef.DefsByType[item.type].DisplayName; else { item.name = name; item.name = Lang.itemName(item.netID); } item.CheckTip(); } }