private void LoadTables() { try { basePrimaryTableDie = TableLoader.GetTrapBaseTableDie(); var trapBases = TableLoader.GetTrapBaseContents(); mechanismTableDie = TableLoader.GetTrapMechanismTableDie(); var mechanismTypes = TableLoader.GetTrapMechanismContents(); effectPrimaryTableDie = TableLoader.GetTrapEffectsTableDie(); var trapEffects = TableLoader.GetTrapEffectsContents(); pitTrapTableDie = TableLoader.GetPitTrapTableDie(); var pitContents = TableLoader.GetPitTrapContents(); gasTrapTableDie = TableLoader.GetGasTrapTableDie(); var gasTypes = TableLoader.GetGasTrpContents(); trapDamageTableDie = TableLoader.GetTrapDamageTableDie(); var trapDamages = TableLoader.GetTrapDamages(); foreach (var damage in trapDamages) { trapDamagesFactory.Add(damage.RollUpperBound, new SimpleFactory(damage.DamageDescription)); } foreach (var mechanism in mechanismTypes) { mechanismFactory.Add(mechanism.Key, new SimpleFactory(mechanism.Value)); } foreach (var trapBase in trapBases) { if (trapBase.MechanismTypeSpecified) { trapBaseFactory.Add(trapBase.RollUpperBound, new MechanizedBaseFactory(mechanismFactory, mechanismTableDie, trapBase.TrappedObjectOrArea)); } else { trapBaseFactory.Add(trapBase.RollUpperBound, new SimpleFactory(trapBase.TrappedObjectOrArea)); } } foreach (var content in pitContents) { pitContentEffectFactory.Add(content.RollUpperBound, new SimpleFactory(content.PitContent)); } foreach (var gas in gasTypes) { gasTrapContentFactory.Add(gas.RollUpperBound, new SimpleFactory(gas.GasName)); } foreach (var trapEffect in trapEffects) { if (trapEffect.RollAgain && trapEffect.NumberOfReRolls == 1) { effectFactory.Add(trapEffect.RollUpperBound, new ComplexTrapEffectFactory(effectFactory, effectPrimaryTableDie, trapEffect.EffectDescription)); } else if (trapEffect.RollAgain && trapEffect.NumberOfReRolls > 1) { effectFactory.Add(trapEffect.RollUpperBound, new MultiRollEffectFactory(effectFactory, effectPrimaryTableDie, trapEffect.NumberOfReRolls, trapEffect.EffectDescription)); } else if (trapEffect.HasSubtable && trapEffect.SubtableName == "PitContents") { effectFactory.Add(trapEffect.RollUpperBound, new PitTrapEffectFactory(pitContentEffectFactory, pitTrapTableDie, trapEffect.EffectDescription)); } else if (trapEffect.HasSubtable && trapEffect.SubtableName == "GasType") { effectFactory.Add(trapEffect.RollUpperBound, new GasTrapEffectFactory(gasTrapContentFactory, gasTrapTableDie, trapEffect.EffectDescription)); } else { effectFactory.Add(trapEffect.RollUpperBound, new SimpleFactory(trapEffect.EffectDescription)); } } } catch (Exception ex) { throw; } }