public static Dictionary <Player.Slot, Item> ToEquipment(JsonWeapon mh, JsonWeapon oh, JsonWeapon ranged, Dictionary <string, JsonItem> je) { Dictionary <Player.Slot, Item> res = new Dictionary <Player.Slot, Item>(); foreach (Player.Slot slot in (Player.Slot[])Enum.GetValues(typeof(Player.Slot))) { if (slot == Player.Slot.MH) { res.Add(slot, JsonWeapon.ToWeapon(mh)); } else if (slot == Player.Slot.OH) { res.Add(slot, JsonWeapon.ToWeapon(oh)); } else if (slot == Player.Slot.Ranged) { res.Add(slot, JsonWeapon.ToWeapon(ranged)); } else { Item i = null; string s = Player.FromSlot(slot); if (je.ContainsKey(s)) { i = JsonItem.ToItem(je[s]); } res.Add(slot, JsonItem.ToItem(je[Player.FromSlot(slot)])); } } return(res); }
public static Dictionary <Player.Slot, Item> ToEquipment(Dictionary <string, JsonWeapon> jw, Dictionary <string, JsonItem> je) { Dictionary <Player.Slot, Item> res = new Dictionary <Player.Slot, Item>(); foreach (Player.Slot slot in (Player.Slot[])Enum.GetValues(typeof(Player.Slot))) { if (slot == Player.Slot.MH || slot == Player.Slot.OH || slot == Player.Slot.Ranged) { string s = Player.FromSlot(slot); res.Add(slot, jw.ContainsKey(s) ? JsonWeapon.ToWeapon(jw[s]) : null); } else { string s = Player.FromSlot(slot); res.Add(slot, je.ContainsKey(s) ? JsonItem.ToItem(je[s]) : null); } } return(res); }