private void AddSkill(ISkill skill) { if (AllSkills.FirstOrDefault(x => x.SkillName().Equals(skill.SkillName())) == null) { AllSkills.Add(skill); } }
private void RemoveAllSkillsCommand_Execute(object parameter) { foreach (var item in MemeberSkills) { AllSkills.Add(item); } MemeberSkills.Clear(); }
private void RemoveSkillCommand_Execute(object parameter) { foreach (var item in SelectedMemberSkills) { AllSkills.Add(item); } SelectedMemberSkills.Clear(); foreach (var item in AllSkills) { MemeberSkills.Remove(item); } }
public Game(Player saved, int level) { Map = new Map(this, level); foreach (var type in typeof(Skill).Assembly.GetTypes().Where(t => typeof(Skill).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface)) { AllSkills.Add((Skill)Activator.CreateInstance(type, this)); } Player = Player.Create(saved, this, Map.SpawnPoint); for (int i = 0; i < Map.Rooms * 2; i++) { Monsters.Add(new Monster(this, Map.GetRandomFreeLocation(), level)); } }
private void Update_PowerView() { Dictionary <ActorCommonData, List <Monster_ActivePower> > MonstersPlayersInRangePowers = new Dictionary <ActorCommonData, List <Monster_ActivePower> >(); List <ACD> InRange; lock (A_Collection.Environment.Actors.AllActors) InRange = A_Collection.Environment.Actors.AllActors.Where(x => x.Distance <= 100).ToList(); foreach (var acd in InRange) { if ((acd.IsMonster || acd._ACD.x184_ActorType == ActorType.Player) && acd._ACD.x000_Id != A_Collection.Me.HeroGlobals.LocalACD.x000_Id) { List <Monster_ActivePower> ActivePowers = A_Tools.T_ACD.get_MonsterActivePowers(acd._ACD); MonstersPlayersInRangePowers.Add(acd._ACD, ActivePowers); } } List <ActivePower> AllPowers; lock (A_Collection.Me.HeroDetails.ActivePowers) AllPowers = A_Collection.Me.HeroDetails.ActivePowers.Where(x => A_Tools.T_LocalPlayer.PowerCollection.isBuffCount(x.AttribId) || A_Tools.T_LocalPlayer.PowerCollection.isBuffStartTick(x.AttribId) || A_Tools.T_LocalPlayer.PowerCollection.isBuffEndTick(x.AttribId) || A_Tools.T_LocalPlayer.PowerCollection.isSkillOverride(x.AttribId)).ToList(); Dictionary <int, int> AllSkills; lock (A_Collection.Me.HeroDetails.ActiveSkills) AllSkills = A_Collection.Me.HeroDetails.ActiveSkills.ToDictionary(x => x.Key, y => y.Value); //-- adds Potion to EquippedSkills AllSkills.Add(30211, 0); // TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.BeginUpdate())); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Clear())); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Add("ActivePowers"))); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Add("EquippedSkills"))); TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.Add("MonstersAndPlayersInRange"))); //-- add Active Powers foreach (var power in AllPowers) { if (TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.PowerSnoId.ToString())) == null) { string powertext = getPowerName(power.PowerSnoId); TreeNode newNode = new TreeNode(); newNode.Text = "PowerSNO: " + power.PowerSnoId.ToString() + " " + powertext; if (Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId) == null || Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId) == null || Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId && x.Value == power.Value) == null) { newNode.ForeColor = Color.Green; } TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.Add(newNode))); } TreeNode newSubNode = new TreeNode(); string powervalue = "Value"; if (A_Tools.T_LocalPlayer.PowerCollection.isSkillOverride(power.AttribId)) { powervalue = "SkillOverride"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffCount(power.AttribId)) { powervalue = "BuffCount"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffStartTick(power.AttribId)) { powervalue = "BuffStartTick"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffEndTick(power.AttribId)) { powervalue = "BuffEndTick"; } newSubNode.Text = "AttribID: " + power.AttribId.ToString() + " || " + powervalue + ": " + power.Value.ToString(); if (Buffer.FirstOrDefault(x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId) == null || Buffer.FirstOrDefault( x => x.PowerSnoId == power.PowerSnoId && x.AttribId == power.AttribId && x.Value == power.Value) == null) { newSubNode.ForeColor = Color.Green; TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.PowerSnoId.ToString())).ForeColor = Color.Green)); } TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "ActivePowers").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.PowerSnoId.ToString())).Nodes.Add(newSubNode))); } // //-- add Equipped Skill foreach (var power in AllSkills) { if (TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "EquippedSkills").Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text.Contains(power.Key.ToString())) == null) { string powertext = A_Collection.Presets.SNOPowers.AllPowers.FirstOrDefault(x => x.Key == power.Key).Value; TreeNode newNode = new TreeNode(); newNode.Text = "PowerSNO: " + power.Key.ToString() + " " + powertext; TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "EquippedSkills").Nodes.Add(newNode))); } } // //-- add SelectedMonster Active Powers foreach (var monster in MonstersPlayersInRangePowers) { TreeNode MonsterNode = new TreeNode(); MonsterNode.Text = monster.Key.x004_Name; TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.Nodes.OfType <TreeNode>().FirstOrDefault(x => x.Text == "MonstersAndPlayersInRange").Nodes.Add(MonsterNode))); foreach (var power in monster.Value) { if ( MonsterNode.Nodes.OfType <TreeNode>() .FirstOrDefault(x => x.Text.Contains(power.Modifier.ToString())) == null) { string powertext = getPowerName(power.Modifier); TreeNode PowerNode = new TreeNode(); PowerNode.Text = "PowerSNO: " + power.Modifier.ToString() + " " + powertext; MonsterNode.Nodes.Add(PowerNode); } TreeNode AttribNode = new TreeNode(); string powervalue = "Value"; if (A_Tools.T_LocalPlayer.PowerCollection.isSkillOverride(power.AttribID)) { powervalue = "SkillOverride"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffCount(power.AttribID)) { powervalue = "BuffCount"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffStartTick(power.AttribID)) { powervalue = "BuffStartTick"; } else if (A_Tools.T_LocalPlayer.PowerCollection.isBuffEndTick(power.AttribID)) { powervalue = "BuffEndTick"; } AttribNode.Text = "AttribID: " + power.AttribID.ToString() + " || " + powervalue + ": " + power.Value.ToString(); MonsterNode.Nodes.OfType <TreeNode>() .FirstOrDefault(x => x.Text.Contains(power.Modifier.ToString())) .Nodes.Add(AttribNode); } } // TV_PowerView.Invoke((MethodInvoker)(() => TV_PowerView.EndUpdate())); Buffer = AllPowers; }