public PlayerConfig(JToken playerData) { _playerData = playerData; try { var runes = _playerData.SelectToken("runes"); Runes = new RuneCollection(); foreach (JProperty runeCategory in runes) { Runes.Add(Convert.ToInt32(runeCategory.Name), Convert.ToInt32(runeCategory.Value)); } } catch (Exception) { // no runes set in config } }
public Champion(Game game, string model, uint playerId, uint playerTeamSpecialId, IRuneCollection runeList, ClientInfo clientInfo, uint netId = 0) : base(game, model, new Stats.Stats(), 30, 0, 0, 1200, netId) { _playerId = playerId; _playerTeamSpecialId = playerTeamSpecialId; RuneList = runeList; Spells = new Dictionary <short, ISpell>(); Inventory = InventoryManager.CreateInventory(); Shop = Items.Shop.CreateShop(this, game); Stats.Gold = _game.Map.MapProperties.StartingGold; Stats.GoldPerSecond.BaseValue = _game.Map.MapProperties.GoldPerSecond; Stats.IsGeneratingGold = false; //TODO: automaticaly rise spell levels with CharData.SpellLevelsUp for (short i = 0; i < CharData.SpellNames.Length; i++) { Console.WriteLine(CharData.SpellNames[i]); if (!string.IsNullOrEmpty(CharData.SpellNames[i])) { Spells[i] = new Spell(game, this, CharData.SpellNames[i], (byte)i); } } Spells[4] = new Spell(game, this, clientInfo.SummonerSkills[0], 4); Spells[5] = new Spell(game, this, clientInfo.SummonerSkills[1], 5); for (byte i = 6; i < 13; i++) { Spells[i] = new Spell(game, this, "BaseSpell", i); } Spells[13] = new Spell(game, this, "Recall", 13); for (byte i = 14; i < 45; i++) { Spells[i] = new Spell(game, this, "BaseSpell", i); } for (short i = 0; i < CharData.Passives.Length; i++) { if (!string.IsNullOrEmpty(CharData.Passives[i].PassiveAbilityName)) { Spells[(byte)(i + 14)] = new Spell(game, this, CharData.Passives[i].PassiveAbilityName, (byte)(i + 14)); } } for (short i = 0; i < CharData.ExtraSpells.Length; i++) { if (!string.IsNullOrEmpty(CharData.ExtraSpells[i])) { var spell = new Spell(game, this, CharData.ExtraSpells[i], (byte)(i + 45)); Spells[(byte)(i + 45)] = spell; spell.LevelUp(); } } Spells[4].LevelUp(); Spells[5].LevelUp(); Replication = new ReplicationHero(this); Stats.SetSpellEnabled(13, true); for (var i = 1; i < 18; i++) { Stats.Experience = _game.Map.MapProperties.ExpToLevelUp[i]; LevelUp(); } }