What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[Plugin] Disconnect when someone target your char

LordManzana

New Member
Joined
May 2, 2015
Messages
207
Reaction score
0
Hello!

Some user want that plugin to my main thread (see my signature) so, there we go!

It's simple, if someone target your char, you will be disconnected your desired time (1 minute by default).

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using ArcheBuddy.Bot.Classes;
using System.Media;

namespace DontTargetMe4Free
{
    /*
     * That Plugin is being under the Creative Commons BY-NC-SA v4.0
     * More information about licence here: https://creativecommons.org/licenses/by-nc-sa/4.0/
     */
    public class DontTargetMe : Core
    {
        // START EDIT ZONE

        int minutes = 1; //Set how much minutes you want wait before relog
        string world = "Aier"; //Set your world
        int characterSlot = 1; //Set your character slot. First one = 0

        //END EDIT ZONE - DON'T EDIT NOTHING MORE

        public static string GetPluginAuthor()
        {
            return "LordManzana";
        }

        public static string GetPluginVersion()
        {
            return "1.0.0.1";
        }

        public static string GetPluginDescription()
        {
            return "Don't target me 4 free";
        }

        public void PluginStop()
        {
            Log("Don't target me 4 free closed");
        }

        public string Time()
        {
            return DateTime.Now.ToString("[hh:mm:ss] ");
        }

        public void WaitOnCharacterSelectionScreenForAWhile(string name)
        {
            int mseconds = minutes * 60 * 1000;
            int seconds = mseconds / 1000;

            Log(String.Format("{0} {1} target your char, moving to character selection.", Time(), name));
            LeaveWorldToCharacterSelect();
            Log(String.Format("{0} Waiting {1} seconds to reenter.", Time(), seconds.ToString()));
            Thread.Sleep(mseconds);

            //Get our character (in this example first character from all that you have on this game world
            var myWorld = getWorlds().Find(w => w.name == world);
            var chararcters = myWorld.getCharacters();
            if (chararcters.Count == 0 || (chararcters.Count > 0 && !chararcters[characterSlot].EnterGame()))
            {
                Log("Invalid game world name or error while we try to enter game server!");
                return;
            }
            else
            {
                Log("Entering...");
            }

            //Wait while loading world
            while(gameState != GameState.Ingame)
                Thread.Sleep(500);
        }

        public void targetChanged(Creature obj, Creature obj2)
        {
            if (obj.type == BotTypes.Player && obj2 == me)
                WaitOnCharacterSelectionScreenForAWhile(obj.name);
        }

        public void PluginRun()
        {
            ClearLogs();
            onTargetChanged += targetChanged;
            while (true)
                Thread.Sleep(1000);
        }
    }
}
 
Back
Top