/// <summary> /// Get Player Skills list /// </summary> /// <param name="playerId"></param> /// <returns></returns> public static Skills GetPlayerSkill(int playerId, SkillType skillType) { using (MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); Skills skills = new Skills(); using (MySqlCommand command = connection.CreateCommand()) { command.CommandText = "GAME_PLAYER_SKILL_GET"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@in_PlayerId", playerId); command.Parameters.AddWithValue("@in_SkillType", skillType); var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { int skillId = reader.GetInt32(1); int skillLevel = reader.GetInt32(2); skills.AddSkill(skillId, skillLevel); } } } connection.Close(); return skills; } }
/// <summary> /// Get Player Skills list /// </summary> /// <param name="playerId"></param> /// <returns></returns> public static Skills GetPlayerSkill(int playerId, SkillType skillType) { using (MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); Skills skills = new Skills(); using (MySqlCommand command = connection.CreateCommand()) { command.CommandText = "GAME_PLAYER_SKILL_GET"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@in_PlayerId", playerId); command.Parameters.AddWithValue("@in_SkillType", skillType); var reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { int skillId = reader.GetInt32(1); int skillLevel = reader.GetInt32(2); skills.AddSkill(skillId, skillLevel); } } } connection.Close(); return(skills); } }
public void InitTemplate() { int i = 0; foreach (Skill templateSkill in Template.TemplateSkills) { // vytvorit novy objekt skillu Skill newSkill = SkillTable.Instance.CreateSkill(templateSkill.GetSkillId()); newSkill.SetOwner(this); Skills.AddSkill(newSkill); i++; //Debug.Log("adding to monster skill to " + i + ": " + newSkill.GetVisibleName()); } if (Template.MeleeSkill != null) { Skill newSkill = SkillTable.Instance.CreateSkill(Template.MeleeSkill.GetSkillId()); newSkill.SetOwner(this); MeleeSkill = (ActiveSkill)newSkill; } Template.InitSkillsOnMonster(Skills, MeleeSkill, Level); Template.InitMonsterStats(this, Level); Template.InitAppearanceData(this, GetData()); HealMe(); GroupTemplate gt = Template.GetGroupTemplate(); if (!isMinion && gt != null) { AI.CreateGroup(); foreach (KeyValuePair <MonsterId, int> e in gt.MembersToSpawn) { for (i = 0; i < e.Value; i++) { Vector3 rndPos = Utils.GenerateRandomPositionAround(GetData().GetBody().transform.position, GetData().distanceToFollowLeader / 2f); //TODO cannot change level of minions - add a parameter Monster mon = GameSystem.Instance.SpawnMonster(e.Key, rndPos, true, 1); mon.AI.JoinGroup(this); } } } AI.InitModules(); AI.AnalyzeSkills(); if (Template.ShowNameInGame) { GetData().showObjectName = true; } }
public void SkillPage() { test = extent.StartTest("Skills test started"); Skills skills = new Skills(); skills.AddSkill(); skills.UpdateSkill(); skills.DeleteSkill(); }
/// <summary> /// Inicializuje sablonu hrace /// </summary> public void InitTemplate() { ItemStash = new Stash(this, 50); DnaPoints = 100; Lifes = 3; AvailableSkills = new List <Skill>(); AvailableAutoattacks = new List <Skill>(); SkillSlotLevels = new Dictionary <int, int>(); if (GameSession.skipTutorial) // player starts with level 2 { UpgradePoints = 10; } else { UpgradePoints = 0; } for (int ii = 0; ii < 9; ii++) { SkillSlotLevels.Add(ii, 1); } //TODO temp reseni, prida vsechny skilly foreach (SkillId id in Enum.GetValues(typeof(SkillId))) { Skill sk = SkillTable.Instance.GetSkill(id); if (sk == null) { continue; } if (sk.AvailableToPlayer) { AvailableSkills.Add(sk); } if (sk.AvailableToDeveloper && GameSession.getAllSkills) { AvailableSkills.Add(sk); } if (sk.AvailableToPlayerAsAutoattack) { AvailableAutoattacks.Add(sk); } } int i = 0; foreach (Skill templateSkill in Template.TemplateSkills) { // vytvorit novy objekt skillu Skill newSkill = SkillTable.Instance.CreateSkill(templateSkill.GetSkillId()); newSkill.SetOwner(this); newSkill.InitIcon(); //newSkill.IsLocked = true; Skills.AddSkill(newSkill); i++; //Debug.Log("adding skill to " + i + ": " + newSkill.Name); } if (Template.MeleeSkill != null) { Skill newSkill = SkillTable.Instance.CreateSkill(Template.MeleeSkill.GetSkillId()); newSkill.SetOwner(this); newSkill.InitIcon(); MeleeSkill = (ActiveSkill)newSkill; } Template.InitSkillsOnPlayer(Skills, MeleeSkill); Inventory.ActiveCapacity = Template.ActiveUpgradesCapacity; Inventory.Capacity = Template.InventoryCapacity; Inventory.BasestatUpgrades.Add(new HpUpgradeAdd(0).Init().SetOwner(this) as EquippableItem); Inventory.BasestatUpgrades.Add(new SpeedUpgrade(0).Init().SetOwner(this) as EquippableItem); Inventory.BasestatUpgrades.Add(new DamageUpgrade(0).Init().SetOwner(this) as EquippableItem); Inventory.BasestatUpgrades.Add(new ShieldUpgrade(0).Init().SetOwner(this) as EquippableItem); Inventory.BasestatUpgrades.Add(new CriticalRateUpgrade(0).Init().SetOwner(this) as EquippableItem); Data.UpdateInventory(Inventory); Inventory.LoadUpgrades(); UpdateStats(); }