예제 #1
0
파일: Server.cs 프로젝트: Apletre/WoWBot
        // do1 - shield do2 - dispell do3 - abolish do4 - flash heal do5 - shadowform
        public void Do(ThreadSubscribersForThreat sbscr, bool under_attack, bool to_dispell, bool to_abolish_disease, bool assist)
        {
            toAssaultBotMsg msg = new toAssaultBotMsg();

            if (GCD == 0)
            {
                for (int i = 0; i < Party.Players.Length; i++)
                {
                    if (party_data.TryGetValue(Party.Players[i], out member))
                    {
                        if (to_dispell && toPurify(MagicToDispellArray, member.buff_arr))
                        {
                            msg.to_do_code = Request.do3;
                            msg.player_id = i;
                            SetGCD();

                            sw.WriteLine("Dispell "+Convert.ToString(i));

                            break;
                        }

                        if (to_abolish_disease && toPurify(DiseaseToDispellArray, member.buff_arr) && member.AbolishDisease == 0)
                        {
                            msg.to_do_code = Request.do2;
                            msg.player_id = i;
                            member.SetAbolishDisease();
                            SetGCD();

                            sw.WriteLine("AbolishDisease " + Convert.ToString(i));

                            break;
                        }

                        if (under_attack && assist)
                        {
                            if (i == 0 && member.hp > member.max_hp * 0.66)
                                to_heal = false;

                            if (i == 0 && member.hp < member.max_hp * 0.33)
                            {
                                to_heal = true;
                                tmp_to_heal = true;
                            }

                            if (to_heal == false && tmp_to_heal == true)
                            {
                                msg.to_do_code = Request.do5;
                                tmp_to_heal = false;
                                SetGCD();
                                break;
                            }

                            if (member.hp < member.max_hp * 0.40 && ShieldCD == 0 && member.Shield == 0 && member.hp > 0)
                            {
                                msg.to_do_code = Request.do1;
                                msg.player_id = i;
                                member.SetShield();
                                SetGCD();
                                ShieldCD = 4000 + delay;
                                break;
                            }

                            if (to_heal)
                            {
                                msg.to_do_code = Request.do4;
                                msg.player_id = 0;
                                SetGCD();
                                break;
                            }
                        }
                    }
                }
            }

            foreach (string item in Party.Players)
            {
                WowForPartyMemberHealerCD player_data;
                if(party_data.TryGetValue(item,out player_data))
                {
                    if (player_data.Shield < 0)
                        player_data.Shield = 0;
                    else
                        player_data.Shield -= delay;

                    if (player_data.AbolishDisease < 0)
                        player_data.AbolishDisease = 0;
                    else
                        player_data.AbolishDisease -= delay;
                }
            }

            CDdec();
            msg.under_attack = under_attack;
            sbscr.Send(msg);
        }
예제 #2
0
파일: Server.cs 프로젝트: Apletre/WoWBot
        // do1 - dispell curse
        public void Do(ThreadSubscribersForThreat sbscr, bool under_attack, bool to_dispell_curse)
        {
            WowForPartyMemberHealerCD member;
            toAssaultBotMsg msg = new toAssaultBotMsg();

            if (GCD == 0)
            {
                for (int i = 0; i < Party.Players.Length; i++)
                {
                    if (party_data.TryGetValue(Party.Players[i], out member))
                    {
                        if (to_dispell_curse && toPurify(CurseToDispellArray, member.buff_arr))
                        {
                            msg.to_do_code = Request.do1;
                            msg.player_id = i;
                            SetGCD();

                            sw.WriteLine("Curse " + Convert.ToString(i));

                            break;
                        }
                    }
                }

            }
            CDdec();
            msg.under_attack = under_attack;
            sbscr.Send(msg);
        }
예제 #3
0
파일: Server.cs 프로젝트: Apletre/WoWBot
 public SubscrbrsCleaner(ThreadSubscribersForThreat[] arr)
 {
     this.arr = arr;
 }
예제 #4
0
파일: Server.cs 프로젝트: Apletre/WoWBot
 public static void CleanSubsArray(ThreadSubscribersForThreat[] subs_arr)
 {
     for (int i = 0; i < subs_arr.Length; i++)
         if (subs_arr[i] != null && subs_arr[i].IsAlive() == false)
             subs_arr[i] = null;
 }
예제 #5
0
파일: Server.cs 프로젝트: Apletre/WoWBot
        void Listen_for_subscrbrs()
        {
            Socket_listener_publisher.Listen(max_connections);

            while (working.value)
            {
                Socket handle = null;
                SubscrbrsCleaner clnr = new SubscrbrsCleaner(subs_arr);

                try
                {
                    clnr.Start();
                    handle = Socket_listener_publisher.Accept();
                    clnr.Stop();
                }
                catch { }

                if (working.value)
                {
                    SubscrbrsCleaner.CleanSubsArray(subs_arr);

                    for (int i = 0; i < subs_arr.Length; i++)
                        if (subs_arr[i] == null)
                        {
                            subs_arr[i] = new ThreadSubscribersForThreat(handle);
                            break;
                        }
                }
            }
        }