Beispiel #1
0
        private void FollowRest()
        {
            ChatterBotFactory factory = new ChatterBotFactory();

            ChatterBot        CleverBot      = factory.Create(ChatterBotType.CLEVERBOT);
            ChatterBotSession ChatBotSession = CleverBot.CreateSession();
            string            s;
            string            a;
            string            b;
            string            from;
            int marker;

            while (Globals.gamedata.running)
            {
                breaktotop = false;
                //moved sleep to the top for when breaking to top
                Thread.Sleep(Globals.SLEEP_FollowRestThread); //500, this thread don't need to be very responsive.


                //check if botting is on, and we are in game by having sent the EW packet.
                if (Globals.gamedata.BOTTING && Globals.enterworld_sent)
                {
                    if (!breaktotop && Script_Ops.COUNT("NPC_TARGETME") == 0 && Script_Ops.COUNT("NPC_PARTYTARGETED") == 0 && (Globals.gamedata.botoptions.FollowRest == 1) && (Globals.gamedata.botoptions.FollowRestID != 0))
                    {
                        FollowRestInternal();
                    }

                    if (!breaktotop && Globals.gamedata.botoptions.SendParty == 1)
                    {
                        AutoInvitePartyMembers();
                    }
                    if (!breaktotop && Globals.gamedata.botoptions.LeavePartyOnLeader == 1)
                    {
                        CheckPartyLeader();
                    }
                }


                if (Globals.gamedata.LocalChatQueue.Count > 0)
                {
                    if (Globals.gamedata.autoreply)
                    {
                        s      = Globals.gamedata.LocalChatQueue.Dequeue().ToString();
                        marker = s.IndexOf(':');
                        try
                        {
                            from = s.Substring(0, marker);
                        }
                        catch
                        {
                            from = "";
                        }

                        if (from.CompareTo(Globals.gamedata.my_char.Name) != 0)
                        {
                            s = s.Remove(0, marker + 2); //string message = from + ": " + text;

                            a = ChatBotSession.Think(s);

                            b = a.ToUpperInvariant();


                            if ((!String.IsNullOrEmpty(a)) && !b.Contains("CLEVERBOT"))
                            {
                                ServerPackets.Send_Text(0, ChatBotSession.Think(s));
                            }
                        }
                    }
                    else
                    {
                        //clear queue in case it wasn't empty when toggle autoreply button was clicked
                        Globals.gamedata.LocalChatQueue.Dequeue();
                    }
                }

                if (Globals.gamedata.PrivateMsgQueue.Count > 0)
                {
                    try
                    {
                        if (Globals.gamedata.autoreplyPM)
                        {
                            s      = Globals.gamedata.PrivateMsgQueue.Dequeue().ToString();
                            marker = s.IndexOf(':');
                            try
                            {
                                from = s.Substring(0, marker);
                            }
                            catch
                            {
                                from = "";
                            }
                            if (from.CompareTo(Globals.gamedata.my_char.Name) != 0)
                            {
                                s = s.Remove(0, marker + 2);

                                a = ChatBotSession.Think(s);

                                b = a.ToUpperInvariant();

                                if ((!String.IsNullOrEmpty(a)) && !b.Contains("CLEVERBOT"))
                                {
                                    ServerPackets.Send_Text(2, from + " " + a);
                                }
                            }
                        }
                        else
                        {
                            //clear queue in case it wasn't empty when toggle autoreply button was clicked
                            Globals.gamedata.PrivateMsgQueue.Dequeue();
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Beispiel #2
0
        private void FollowRest()
        {

            ChatterBotFactory factory = new ChatterBotFactory();

            ChatterBot CleverBot = factory.Create(ChatterBotType.CLEVERBOT);
            ChatterBotSession ChatBotSession = CleverBot.CreateSession();
            string s;
            string a;
            string b;
            string from;
            int marker;
          
            while (Globals.gamedata.running)
            {
                breaktotop = false;
                //moved sleep to the top for when breaking to top
                System.Threading.Thread.Sleep(Globals.SLEEP_FollowRestThread); //500, this thread don't need to be very responsive.


                //check if botting is on, and we are in game by having sent the EW packet.
                if (Globals.gamedata.BOTTING && Globals.enterworld_sent)
                {
                    if (!breaktotop && (Script_Ops.COUNT("NPC_TARGETME") == 0 && Script_Ops.COUNT("NPC_PARTYTARGETED") == 0) && (Globals.gamedata.botoptions.FollowRest == 1) && (Globals.gamedata.botoptions.FollowRestID != 0))
                    {
                        FollowRestInternal();
                    }

                    if (!breaktotop && Globals.gamedata.botoptions.SendParty == 1)
                    {
                        AutoInvitePartyMembers();
                    }
                    if (!breaktotop && Globals.gamedata.botoptions.LeavePartyOnLeader == 1)
                    {
                        CheckPartyLeader();
                    }
                }


                if (Globals.gamedata.LocalChatQueue.Count > 0)
                {
                    if (Globals.gamedata.autoreply)
                    {
                        s = (Globals.gamedata.LocalChatQueue.Dequeue()).ToString();
                        marker = s.IndexOf(':');
                        try
                        {
                            from = s.Substring(0, marker);
                        }
                        catch
                        {
                            from = "";
                        }

                        if (from.CompareTo(Globals.gamedata.my_char.Name) != 0)
                        {
                            s = s.Remove(0, marker + 2); //string message = from + ": " + text;

                            a = ChatBotSession.Think(s);

                            b = a.ToUpperInvariant();


                            if ((!String.IsNullOrEmpty(a))&& !b.Contains("CLEVERBOT"))
                            {
                                ServerPackets.Send_Text(0, ChatBotSession.Think(s));
                            }
                        }
                    }
                    else
                    {
                        //clear queue in case it wasn't empty when toggle autoreply button was clicked
                        Globals.gamedata.LocalChatQueue.Dequeue();
                    }
                }

                if (Globals.gamedata.PrivateMsgQueue.Count > 0)
                {
                    try
                    {
                        if (Globals.gamedata.autoreplyPM)
                        {
                            s = (Globals.gamedata.PrivateMsgQueue.Dequeue()).ToString();
                            marker = s.IndexOf(':');
                            try
                            {
                                from = s.Substring(0, marker);
                            }
                            catch
                            {
                                from = "";
                            }
                            if (from.CompareTo(Globals.gamedata.my_char.Name) != 0)
                            {
                                s = s.Remove(0, marker + 2);

                                a = ChatBotSession.Think(s);

                                b = a.ToUpperInvariant();

                                if ((!String.IsNullOrEmpty(a))&& !b.Contains("CLEVERBOT"))
                                {
                                    ServerPackets.Send_Text(2, from + " " + a);
                                }

                            }
                        }
                        else
                        {
                            //clear queue in case it wasn't empty when toggle autoreply button was clicked
                            Globals.gamedata.PrivateMsgQueue.Dequeue();
                        }
                    }
                    catch
                    {

                    }
                }
            }
        }