public static void Load() { try { Datas.Clear(); int[] tableIDs = DB.runReadColumn("SELECT id FROM zombies;", 0, null); for (int i = 0; i < tableIDs.Length; i++) { string[] Datasa = DB.runReadRow("SELECT * FROM `zombies` WHERE id=" + tableIDs[i]); int type = Convert.ToInt32(Datasa[1]); string name = Datasa[2]; int health = Convert.ToInt32(Datasa[3]); int points = Convert.ToInt32(Datasa[4]); int damage = Convert.ToInt32(Datasa[5]); int skillpoints = Convert.ToInt32(Datasa[6]); ZombieData Data = new ZombieData(type, name, health, points, damage, skillpoints > 0 ? true : false); if (!Datas.ContainsKey(type)) { Datas.Add(type, Data); } else { Log.AppendText("Duplicate Zombie Type [" + type + "]"); } } Log.AppendText("Succesful loaded [ " + ZombieManager.Datas.Count + " ] Zombies"); } catch { } }
public static void GetZombieData(virtualZombie Zombie) { ZombieData Data = GetZombieDataByType(Zombie.Type); if (Data != null) { Zombie.name = Data.Name; Zombie.Health = Data.Health; Zombie.Points = Data.Points; Zombie.doDamage = Data.Damage; Zombie.givesSkillPoints = Data.SkillPoint; } }