1using Microsoft.Xna.Framework.Graphics;
3using System.Collections.Generic;
14 private static readonly IDictionary<EquipType, int>
nextEquip =
new Dictionary<EquipType, int>();
16 internal static readonly IDictionary<EquipType, IDictionary<int, EquipTexture>> equipTextures =
17 new Dictionary<EquipType, IDictionary<int, EquipTexture>>();
20 internal static readonly IDictionary<int, IDictionary<EquipType, int>> idToSlot =
21 new Dictionary<int, IDictionary<EquipType, int>>();
25 internal static readonly IDictionary<EquipType, IDictionary<int, int>> slotToId =
26 new Dictionary<EquipType, IDictionary<int, int>>();
29 internal static readonly IDictionary<int, string> femaleTextures =
new Dictionary<int, string>();
30 internal static readonly IDictionary<int, string> armTextures =
new Dictionary<int, string>();
37 equipTextures[type] =
new Dictionary<int, EquipTexture>();
39 slotToId[
EquipType.Head] =
new Dictionary<int, int>();
40 slotToId[
EquipType.Body] =
new Dictionary<int, int>();
41 slotToId[
EquipType.Legs] =
new Dictionary<int, int>();
44 internal static int ReserveEquipID(
EquipType type) {
58 return equipTextures[type].TryGetValue(slot, out texture) ? texture :
null;
61 internal static void ResizeAndFillArrays() {
77 for (
int k = GetNumVanilla(type); k <
nextEquip[type]; k++) {
78 GetLoadedArray(type)[k] =
true;
98 foreach (var entry
in equipTextures[type]) {
100 EquipTexture texture = entry.Value;
101 GetTextureArray(type)[slot] = ModContent.GetTexture(texture.Texture);
103 Main.femaleBodyTexture[slot] = ModContent.GetTexture(femaleTextures[slot]);
104 Main.armorArmTexture[slot] = ModContent.GetTexture(armTextures[slot]);
109 foreach (var entry
in slotToId[
EquipType.Head]) {
110 Item.headType[entry.Key] = entry.Value;
113 foreach (var entry
in slotToId[
EquipType.Body]) {
114 Item.bodyType[entry.Key] = entry.Value;
117 foreach (var entry
in slotToId[
EquipType.Legs]) {
118 Item.legType[entry.Key] = entry.Value;
122 internal static void Unload() {
125 equipTextures[type].Clear();
131 femaleTextures.Clear();
135 internal static int GetNumVanilla(
EquipType type) {
138 return Main.numArmorHead;
140 return Main.numArmorBody;
142 return Main.numArmorLegs;
144 return Main.numAccHandsOn;
146 return Main.numAccHandsOff;
148 return Main.numAccBack;
150 return Main.numAccFront;
152 return Main.numAccShoes;
154 return Main.numAccWaist;
156 return Main.maxWings;
158 return Main.numAccShield;
160 return Main.numAccNeck;
162 return Main.numAccFace;
164 return Main.numAccBalloon;
169 internal static bool[] GetLoadedArray(
EquipType type) {
172 return Main.armorHeadLoaded;
174 return Main.armorBodyLoaded;
176 return Main.armorLegsLoaded;
178 return Main.accHandsOnLoaded;
180 return Main.accHandsOffLoaded;
182 return Main.accBackLoaded;
184 return Main.accFrontLoaded;
186 return Main.accShoesLoaded;
188 return Main.accWaistLoaded;
190 return Main.wingsLoaded;
192 return Main.accShieldLoaded;
194 return Main.accNeckLoaded;
196 return Main.accFaceLoaded;
198 return Main.accballoonLoaded;
203 internal static Texture2D[] GetTextureArray(
EquipType type) {
206 return Main.armorHeadTexture;
208 return Main.armorBodyTexture;
210 return Main.armorLegTexture;
212 return Main.accHandsOnTexture;
214 return Main.accHandsOffTexture;
216 return Main.accBackTexture;
218 return Main.accFrontTexture;
220 return Main.accShoesTexture;
222 return Main.accWaistTexture;
224 return Main.wingsTexture;
226 return Main.accShieldTexture;
228 return Main.accNeckTexture;
230 return Main.accFaceTexture;
232 return Main.accBalloonTexture;
237 internal static void SetSlot(Item item) {
238 IDictionary<EquipType, int> slots;
239 if (!idToSlot.TryGetValue(item.type, out slots))
242 foreach (var entry
in slots) {
243 int slot = entry.Value;
246 item.headSlot = slot;
249 item.bodySlot = slot;
255 item.handOnSlot = (sbyte)slot;
258 item.handOffSlot = (sbyte)slot;
261 item.backSlot = (sbyte)slot;
264 item.frontSlot = (sbyte)slot;
267 item.shoeSlot = (sbyte)slot;
270 item.waistSlot = (sbyte)slot;
273 item.wingSlot = (sbyte)slot;
276 item.shieldSlot = (sbyte)slot;
279 item.neckSlot = (sbyte)slot;
282 item.faceSlot = (sbyte)slot;
285 item.balloonSlot = (sbyte)slot;
291 internal static int GetPlayerEquip(Player player,
EquipType type) {
300 return player.handon;
302 return player.handoff;
314 return player.shield;
320 return player.balloon;
This serves as a central place to store equipment slots and their corresponding textures....
static readonly IDictionary< EquipType, int > nextEquip
static EquipTexture GetEquipTexture(EquipType type, int slot)
Gets the equipment texture for the specified equipment type and ID.
static readonly EquipType[] EquipTypes
This serves as a place for you to program behaviors of equipment textures. This is useful for equipme...
EquipType
This is an enum of all the types of equipment that exist. An equipment type is defined as a type or l...