コード例 #1
0
ファイル: Settings.xaml.cs プロジェクト: PimentelM/extibiabot
        private void TargetingAddMonsterbtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(TargetingAddMonsterTxt.Text))
                {
                    TargetinRule targetingRule = new TargetinRule();
                    targetingRule.MonsterName = TargetingAddMonsterTxt.Text;

                    TargetSetting settingOne = new TargetSetting();

                    settingOne.Name = String.Format("Settings {0}", targetingRule.Settings.Count + 1);

                    targetingRule.Settings.Add(settingOne);

                    Targeting.Instance.TargetingRules.Add(targetingRule);

                    TargetingAddMonsterTxt.Text = "";
                }
            }
            catch
            {

            }
        }
コード例 #2
0
ファイル: EventArgs.cs プロジェクト: PimentelM/extibiabot
 public TargetingEventArgs(TargetinRule TargetingRule, Creature Creature, Collection<Creature> Creatures)
 {
     _targetingRule = TargetingRule;
     _creature = Creature;
     _creatures = Creatures;
 }
コード例 #3
0
ファイル: Targeting.cs プロジェクト: PimentelM/extibiabot
        public void ExecuteRule(Creature creature, TargetinRule targetingRule, int settingID)
        {
            OnTargetingRuleExecute(new TargetingEventArgs(null, creature));

            Targeter.Instance.Target = creature;
            Targeter.Instance.Rule = targetingRule.Settings[settingID];
            Targeter.Instance.Attack();  
        }
コード例 #4
0
ファイル: EventArgs.cs プロジェクト: PimentelM/extibiabot
 public TargetingEventArgs(TargetinRule TargetingRule, Creature Creature)
 {
     _targetingRule = TargetingRule;
     _creature = Creature;
 }
コード例 #5
0
ファイル: Targeting.cs プロジェクト: PimentelM/extibiabot
        public bool RuleMatch(ref Collection<Creature> creatures, TargetinRule targetingRule, out int settingID)
        {
            settingID = -1;

            try
            {

                TargetState = TargetingState.CheckingRule;

                if (creatures.Where(c => c.Name.ToLower() == targetingRule.MonsterName.ToLower()).Count() == 0)
                    return false;

                if (creatures.Where(c => c.Name.ToLower() == targetingRule.MonsterName.ToLower()).Count() < targetingRule.Count)
                    return false;

                List<Creature> creaturesToCheck = creatures.Where(c => c.Name.ToLower() == targetingRule.MonsterName.ToLower()).ToList();

                foreach (TargetSetting t in targetingRule.Settings)
                {
                    if (creaturesToCheck.Any(c => c.HPBar >= t.HpRangeMin && c.HPBar <= t.HpRangeMax))
                    {
                        settingID = targetingRule.Settings.IndexOf(t);
                        break;
                    }
                }
                if (settingID == -1)
                    return false;

                return true;
            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }

            return false;
        }