public static float GetShield(ArmorSpec spec, ItemQuality quality, int Level, Stat stat) { if (table_data == null) { LoadData(); } return(table_data[(int)spec][(int)quality][Level][(int)stat]); }
public static int GetArmor(ArmorSpec spec, int level, ItemQuality quality, SlotType slot) { if (level <= 0) { return(0); } if (table_data == null) { LoadData(); } return(table_data[(int)spec][(int)quality][level][(int)slot]); }
public static bool HasStats(this ArmorSpec spec) { switch (spec) { case ArmorSpec.Generator: case ArmorSpec.Focus: case ArmorSpec.Shield: case ArmorSpec.ShieldForce: return(true); default: return(false); } }
private static void LoadData() { GomObject table = DataObjectModel.GetObject(tablePath); Dictionary <object, object> tableData = table.Data.ValueOrDefault <Dictionary <object, object> >("cbtArmorValues", null); // var rows = Utilities.ReadDataTable(tablePath, ReadArmorRow); table_data = new Dictionary <int, Dictionary <int, Dictionary <int, Dictionary <int, int> > > >(); foreach (var kvp in tableData) { ArmorSpec armorSpec = ArmorSpecExtensions.ToArmorSpec((long)kvp.Key); Dictionary <object, object> qualityToLevelMap = (Dictionary <object, object>)kvp.Value; Dictionary <int, Dictionary <int, Dictionary <int, int> > > container0 = new Dictionary <int, Dictionary <int, Dictionary <int, int> > >(); table_data[(int)armorSpec] = container0; foreach (var quality_level in qualityToLevelMap) { ItemQuality quality = ItemQualityExtensions.ToItemQuality((ScriptEnum)quality_level.Key); var levelToSlotMap = (Dictionary <object, object>)quality_level.Value; Dictionary <int, Dictionary <int, int> > container1 = new Dictionary <int, Dictionary <int, int> >(); container0[(int)quality] = container1; foreach (var level_slot in levelToSlotMap) { int level = (int)(long)level_slot.Key; var slotToArmorMap = (Dictionary <object, object>)level_slot.Value; Dictionary <int, int> container2 = new Dictionary <int, int>(); container1[level] = container2; foreach (var slot_armor in slotToArmorMap) { SlotType slot = SlotTypeExtensions.ToSlotType((ScriptEnum)slot_armor.Key); int armor = (int)(long)slot_armor.Value; container2[(int)slot] = armor; } } } } }
private static void LoadData() { GomObject table = DataObjectModel.GetObject(tablePath); Dictionary <object, object> tableData = table.Data.Get <Dictionary <object, object> >("cbtShieldStatMap"); table_data = new Dictionary <int, Dictionary <int, Dictionary <int, Dictionary <int, float> > > >(); foreach (var kvp in tableData) { //WeaponSpec wpnSpec = WeaponSpecExtensions.ToWeaponSpec((ulong)kvp.Key); ArmorSpec spec = ArmorSpecExtensions.ToArmorSpec((long)kvp.Key); Dictionary <object, object> qualityToLevelMap = (Dictionary <object, object>)kvp.Value; var container0 = new Dictionary <int, Dictionary <int, Dictionary <int, float> > >(); table_data[(int)spec] = container0; foreach (var quality_level in qualityToLevelMap) { ItemQuality quality = ItemQualityExtensions.ToItemQuality((ScriptEnum)quality_level.Key); var levelToStatMap = (Dictionary <object, object>)quality_level.Value; var container1 = new Dictionary <int, Dictionary <int, float> >(); container0[(int)quality] = container1; foreach (var level_stat in levelToStatMap) { int level = (int)(long)level_stat.Key; var shieldStats = (GomObjectData)level_stat.Value; Dictionary <int, float> container2 = new Dictionary <int, float>(); container1[level] = container2; container2[(int)Stat.RangedShieldAbsorb] = shieldStats.ValueOrDefault <float>("cbtRangeAbsorb", 0); container2[(int)Stat.ForcePowerRating] = shieldStats.ValueOrDefault <float>("cbtShieldForcePower", 0); container2[(int)Stat.MeleeShieldAbsorb] = shieldStats.ValueOrDefault <float>("cbtMeleeAbsorb", 0); container2[(int)Stat.TechPowerRating] = shieldStats.ValueOrDefault <float>("cbtShieldTechPower", 0); container2[(int)Stat.MeleeShieldChance] = shieldStats.ValueOrDefault <float>("cbtMeleeChance", 0); container2[(int)Stat.RangedShieldChance] = shieldStats.ValueOrDefault <float>("cbtRangeChance", 0); } } } }