RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Resource icon

Captcha! Anti-AFK checker 0.51

No permission to download
Introduction
This captcha system allows admins to reduce afk resource gathering or other automated activities on their shards.

It is setup so that it prompts a player maximum of once an hour when they use a skill tool or try to harvest something. This one hour minimum delay can be customized.

Features
Designed to be minimally invasive to players
Adjustable minimum delay (defaults to an hour, which means players will only see it once an hour and only if they harvest or use a skill tool)
Passive, using no timers
Character rotations degrees can be modified
Includes a very rudimentary font editor

Limitations
The font editor is really minimal. It lacks a save function. To update fonts, you use the [dumpfonts command and copy the updated array from the console and paste it into the script.

Character Rotation
By default the system selects three random letters and rotates them -30 to +30 degrees.This can be customized as needed.

It also randomizes the hue of the letters

Screenshots






Minimal Font Editor




Installation

PlayerMobile.cs must be modified. Right under the line:
Code:
public partial class PlayerMobile : Mobile, IHonorTarget
    {

Add this code:
Code:
  /* Begin Captcha Mod */
    private DateTime _NextCaptchaTime;
 
    public DateTime NextCaptchaTime
    {
        get { return _NextCaptchaTime;}
        set { _NextCaptchaTime = value; }
    }
 
    [CommandProperty(AccessLevel.Seer)]
    public TimeSpan CaptchaDelay
    {
        get
        {
            if (DateTime.Now >= _NextCaptchaTime)
                return TimeSpan.FromSeconds(0);
 
            return (_NextCaptchaTime - DateTime.Now);
        }
        set { _NextCaptchaTime = DateTime.Now + value; }
    }
  /* End Captcha Mod */

Add the following statement to the top of each of the files that need to be modified:

Code:
using Server.Gumps


The following files should be modified as follows:

basefolder\Scripts\Engines\BulkOrders\LargeBOD.cs double click method:

Code:
        public override void OnDoubleClick( Mobile from )
        {
        if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
      {
        Gump bod_gump = new LargeBODGump(from, this);
        CaptchaGump.sendCaptcha(from, CaptchaGump.SendGumpAfterCaptcha, bod_gump);
      }
      else
        from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
        }

basefolder\Scripts\Engines\BulkOrders\SmallBOD.cs double click method:
Code:
            public override void OnDoubleClick(Mobile from)
    {
      CaptchaGump.sendCaptcha(from, BaseTool.OnDoubleClickRedirected, this);
    }
 
    public static void OnDoubleClickRedirected(Mobile from, object o)
    {
      if (o == null || (!(o is BaseTool)))
        return;
 
      BaseTool tool = (BaseTool)o;
 
      if (tool.IsChildOf(from.Backpack) || tool.Parent == from)
      {
        CraftSystem system = tool.CraftSystem;
 
        int num = system.CanCraft(from, tool, null);
 
        if (num > 0 && (num != 1044267 || !Core.SE)) // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
        {
          from.SendLocalizedMessage(num);
        }
        else
        {
          CraftContext context = system.GetContext(from);
 
          from.SendGump(new CraftGump(from, system, tool, null));
        }
      }
      else
      {
        from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
      }
    }


basefolder\Scripts\Engines\Harvest\Core\HarvestSystem.cs BeginHarvesting method:

Code:
        public virtual bool BeginHarvesting( Mobile from, Item tool )
        {
            if ( !CheckHarvest( from, tool ) )
                return false;
 
            CaptchaGump.sendCaptcha(from, HarvestSystem.SendHarvestTarget, new object[]{tool, this});
            //from.Target = new HarvestTarget( tool, this );
            return true;
        }
 
        public static void SendHarvestTarget(Mobile from, object o)
        {
            if (!(o is object[]))
                return;
            object[] arglist = (object[])o;
 
            if (arglist.Length != 2)
                return;
 
            if (!(arglist[0] is Item))
                return;
 
            if (!(arglist[1] is HarvestSystem))
                return;
               
            from.Target = new HarvestTarget((Item)arglist[0], (HarvestSystem)arglist[1] );
        }

basefolder\Scripts\Items\Skill Items\Tools\BaseTool.cs
Code:
        public override void OnDoubleClick( Mobile from )
        {
            CaptchaGump.sendCaptcha(from, BaseTool.OnDoubleClickRedirected, this);
            //OnDoubleClickRedirected(from, this);
 
        }

Credits
Hank for background fix

Changelog
v.0.51
Added Hank's background fix
Added additional null checks

v.0.50
Initial Release
Author
Praxiiz
Downloads
55
Views
623
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from Praxiiz

Latest updates

  1. Bug fixes

    Added Hank's background fix Added additional null check Added Hank's background fix Added...

Latest reviews

Perfect! I would have people macro-mine to big, big savings and buy a house for themselves. This squashes that!
Top