//////////////// public override void SetStaticDefaults() { this.DisplayName.SetDefault("Powered Exoskeleton Frame"); this.Tooltip.SetDefault("Attacks, movement, and jumping draw less stamina" + '\n' + "Negates fall damage and knockback" + '\n' + "'Oil Can not included.'"); ExtendedPlayerHooks.AddArmorEquipAction("Stamina:ExoskeletonEquip", delegate(Player player, int slot, Item myitem) { if (myitem.type != ModContent.ItemType <ExoskeletonItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingExoskeleton = true; }); ExtendedPlayerHooks.AddArmorUnequipAction("Stamina:ExoskeletonUnequip", delegate(Player player, int slot, int itemType) { if (itemType != ModContent.ItemType <ExoskeletonItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingExoskeleton = false; }); }
//////////////// public override void SetStaticDefaults() { this.DisplayName.SetDefault("Champion Belt"); this.Tooltip.SetDefault("Attacks draw less stamina" + '\n' + "'We are the champions!'"); ExtendedPlayerHooks.AddArmorEquipAction("Stamina:ChampionBeltEquip", delegate(Player player, int slot, Item myitem) { if (myitem.type != ModContent.ItemType <ChampionBeltItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingMuscleBelt = true; }); ExtendedPlayerHooks.AddArmorUnequipAction("Stamina:ChampionBeltUnequip", delegate(Player player, int slot, int itemType) { if (itemType != ModContent.ItemType <ChampionBeltItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingMuscleBelt = false; }); }
//////////////// public override void SetStaticDefaults() { this.DisplayName.SetDefault("Leg Spring"); this.Tooltip.SetDefault("Jumps draw less stamina" + '\n' + "Negates fall damage" + '\n' + "'Puts a spring in your step.'"); ExtendedPlayerHooks.AddArmorEquipAction("Stamina:LegSprintEquip", delegate(Player player, int slot, Item myitem) { if (myitem.type != ModContent.ItemType <LegSpringItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingLegSprings = true; }); ExtendedPlayerHooks.AddArmorUnequipAction("Stamina:LegSprintUnequip", delegate(Player player, int slot, int itemType) { if (itemType != ModContent.ItemType <LegSpringItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingLegSprings = false; }); }
//////////////// public override void SetStaticDefaults() { this.DisplayName.SetDefault("Joint Bracer"); this.Tooltip.SetDefault("Non-jump movements draw less stamina" + '\n' + "Negates knockback" + '\n' + "'For when push comes to shove.'"); ExtendedPlayerHooks.AddArmorEquipAction("Stamina:JointBracerEquip", delegate(Player player, int slot, Item myitem) { if (myitem.type != ModContent.ItemType <JointBracerItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var modplayer = player.GetModPlayer <StaminaPlayer>(); modplayer.IsWearingJointBracer = true; }); ExtendedPlayerHooks.AddArmorUnequipAction("Stamina:JointBracerUnequip", delegate(Player player, int slot, int itemType) { if (itemType != ModContent.ItemType <JointBracerItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var modplayer = player.GetModPlayer <StaminaPlayer>(); modplayer.IsWearingJointBracer = false; }); }
//////////////// public override void SetStaticDefaults() { this.DisplayName.SetDefault("Exercise Supplements"); this.Tooltip.SetDefault("Makes exercise easier"); ExtendedPlayerHooks.AddArmorEquipAction("Stamina:ExerciseSupplementsEquip", delegate(Player player, int slot, Item myitem) { if (myitem.type != ModContent.ItemType <ExerciseSupplementsItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsUsingSupplements = true; }); ExtendedPlayerHooks.AddArmorUnequipAction("Stamina:ExerciseSupplementsUnequip", delegate(Player player, int slot, int itemType) { if (itemType != ModContent.ItemType <ExerciseSupplementsItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsUsingSupplements = false; }); }
//////////////// public override void SetStaticDefaults() { this.DisplayName.SetDefault("Rage Headband"); this.Tooltip.SetDefault("Trades exhaustion for health loss" + '\n' + "'Feel the burn!'"); ExtendedPlayerHooks.AddArmorEquipAction("Stamina:RageHeadbandEquip", delegate(Player player, int slot, Item myitem) { if (myitem.type != ModContent.ItemType <RageHeadbandItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingRageBandana = true; }); ExtendedPlayerHooks.AddArmorUnequipAction("Stamina:RageHeadbandUnequip", delegate(Player player, int slot, int itemType) { if (itemType != ModContent.ItemType <RageHeadbandItem>()) { return; } if (!PlayerItemHelpers.IsAccessorySlot(player, slot)) { return; } var myplayer = player.GetModPlayer <StaminaPlayer>(); myplayer.IsWearingRageBandana = false; }); }
/// <summary> /// Gets a formatted collection of a player's body equipment. /// </summary> /// <param name="player"></param> /// <returns></returns> public static IDictionary <string, string> GetPlayerEquipment(Player player) { var dict = new Dictionary <string, string>(); int acc = 1; int van = 1; int unk = 1; for (int i = 0; i < player.armor.Length; i++) { string key; Item item = player.armor[i]; if (item == null || item.IsAir) { continue; } if (i == 0) { key = "Head"; } else if (i == 1) { key = "Body"; } else if (i == 2) { key = "Legs"; } else if (PlayerItemHelpers.IsAccessorySlot(player, i)) { key = "Accessory " + acc; acc++; } else if (PlayerItemHelpers.IsVanitySlot(player, i)) { key = "Vanity " + van; van++; } else { key = "? " + unk; unk++; } dict[key] = item.HoverName; } return(dict); }
public static IList <string> GetCurrentPlayerEquipment() { Player player = Main.LocalPlayer; var list = new List <string>(); for (int i = 0; i < player.armor.Length; i++) { string output = ""; Item item = player.armor[i]; if (item == null || item.IsAir) { continue; } if (i == 0) { output += "Head: "; } else if (i == 1) { output += "Body: "; } else if (i == 2) { output += "Legs: "; } else if (PlayerItemHelpers.IsAccessorySlot(player, i)) { output += "Accessory: "; } else if (PlayerItemHelpers.IsVanitySlot(player, i)) { output += "Vanity: "; } output += item.HoverName; list.Add(output); } return(list); }