public static void CacheRaces() { Console.WriteLine("Caching Races.."); hotEntities he = new hotEntities(); foreach (race r in he.races) { CachedRace cr = new CachedRace(); cr.Accuracy = r.Accuracy; cr.Attack = r.Attack; cr.BludgeoningResistance = r.BludgeoningResistance; cr.Dodge = r.Dodge; cr.FireResistance = r.FireResistance; cr.HitPoints = r.HitPoints; cr.Magic = r.Magic; cr.MagicResistance = r.MagicResistance; cr.MovementSpeed = r.MovementSpeed; cr.PiercingResistance = r.PiercingResistance; cr.SlashResistance = r.SlashResistance; cr.Description = r.Description; cr.Name = r.Name; CachedRaces.Add(cr); } Console.WriteLine("Races Cached: " + CachedRaces.Count.ToString()); }
public static Agent CreateAgentFromVaultUnit(int id) { Agent agent = new Agent(); hotEntities he = new hotEntities(); unitvault uv = he.unitvaults.First(a => a.ID == id); CachedCatalogueUnit cachedUnit = CachedObjectContainer.GetCachedCatUnitByID(int.Parse(uv.CatalogueID)); CachedRace cachedRace = CachedObjectContainer.GetCachedRaceByName(cachedUnit.Race); agent.ID = uv.ID; agent.CATID = cachedUnit.CatalogueID; agent.Name = cachedUnit.Name; agent.UnitType = cachedUnit.UnitType; agent.Faction = cachedUnit.Faction; agent.Rarity = cachedUnit.Rarity; agent.Collection = cachedUnit.Collection; agent.Race = cachedUnit.Race; agent.DamageType = cachedUnit.DamageType; agent.BaseAttack = cachedUnit.Attack + int.Parse(uv.Attack) + cachedRace.Attack; agent.BaseAccuracy = cachedUnit.Accuracy + int.Parse(uv.Accuracy) + cachedRace.Accuracy; agent.BaseDodge = cachedUnit.Dodge + int.Parse(uv.Dodge) + cachedRace.Dodge; agent.BaseHitPoints = cachedUnit.HitPoints + int.Parse(uv.HitPoints) + cachedRace.HitPoints; agent.BaseMagic = cachedUnit.Magic + int.Parse(uv.Magic) + cachedRace.Magic; agent.BaseMagicResistance = cachedUnit.MagicResistance + int.Parse(uv.MagicResistance) + cachedRace.MagicResistance; agent.BaseFireResistance = cachedUnit.FireResistance + int.Parse(uv.FireResistance) + cachedRace.FireResistance; agent.BaseSlashResistance = cachedUnit.SlashResistance + int.Parse(uv.SlashResistance) + cachedRace.SlashResistance; agent.BasePiercingResistance = cachedUnit.PiercingResistance + int.Parse(uv.PiercingResistance) + cachedRace.PiercingResistance; agent.BaseBludgeoningResistance = cachedUnit.BludgeoningResistance + int.Parse(uv.BludgeoningResistance) + cachedRace.BludgeoningResistance; agent.BaseMovementSpeed = cachedUnit.MovementSpeed + int.Parse(uv.MovementSpeed) + cachedRace.MovementSpeed; agent.BaseMinAttackRange = cachedUnit.MinAttackRange + int.Parse(uv.MinAttRange); agent.BaseMaxAttackRange = cachedUnit.MaxAttackRange + int.Parse(uv.MaxAttRange); agent.BaseMinAttackRange = cachedUnit.MinAttackRange + int.Parse(uv.MinAttRange); agent.BaseMinAttackRange = cachedUnit.MinAttackRange + int.Parse(uv.MinAttRange); agent.Level = uv.Level; agent.Owner = uv.Owner; //players team id //hex to spawn on // agent.Abilities = uv.Abilities; string returnString = ""; // unit.iLevel.ToString().ToString() + ">" + // NetworkManager.Instance.cPlayer.sName + ">" + // GameManager.Instance.GetPlayersTeamID().ToString() + ">" + // hex.gameObject.name + ">" + // unit.Abilities; return(agent); }
public static CachedRace GetCachedRaceByName(string name) { CachedRace cr = null; foreach (CachedRace cachedRace in CachedRaces) { if (cachedRace.Name == name) { cr = cachedRace; } } return(cr); }