POH Handler

The POH Handler is a handler responsible for making sense of a player’s POH (Player Owned House) without knowing any info about it’s setup in advance.

Several rooms in a POH are unique on the minimap, with windows and/or doors of several sizes and different places. By having this rooms saved in the following format:

_images/poh.png

Most relevant rooms for a POH stripped of their floor colors

We can attempt to match what we have on the minimap to those rooms and slowly build a map of the POH.

Some rooms share the same room layout or are very similar to others and for those we use some mainscreen information to make up what the room is, e.g., Nexus room, Combat Hall and Quest Hall are all identical.


type THouseHandler

THouseHandler = record(TSRLBaseRecord)
  Loader: THouseLoader;
  Walker: TRSWalkerV2;

  Objects: array [EHouseObject] of TRSObjectV2;

  Downscale: Int32;
  Similarity: Double;

  Sample: TRSMapSample;
  Cache: TMatchTemplateRGBCache;

  Graph: TWebGraphV2;
  IsSetup: Boolean;
end;

The core record used to handle navigating a POH.


POH.Setup()

procedure THouseHandler.Setup();

Method you need to use at the start of your script after the user has already configured his house with TScriptForm.CreateHouseBuilder().


House.ScaledSearch

function THouseHandler.ScaledSearch(bitmap: TMufasaBitmap; samples: Int32): TPointArray;

Internal THouseHandler method used to get an initial TPointArray of possible positions. This is performed in a downscaled map with a downscaled minimap. This is very innacurate by itself but by ruling down most of the map in a downscaled search before doing a full sized search speed has a dramatic boost. You probably won’t ever need to call this directly.


House.FullSearch

function THouseHandler.FullSearch(template, world: TMufasaBitmap; position: TPoint; out match: Single): TPoint;

Internal THouseHandler method used to get the player position. This is used by THouseHandler.Position() to determine how likely is the Position passed in, our actual position. This likelyhood is returned with Match which ranges from 0 to 1. You probably won’t ever need to call this directly.


House.Position

function THouseHandler.Position(): TPoint;

Returns the players current position on the loaded house map.

Example:

WriteLn(House.Position());
WriteLn(House.Similarity); // Check to see the match percentage if needed

House.DebugPosition

function THouseHandler.DebugPosition(): TPoint;

Debugs the player position in the currently loaded house map.

Example:

//setup your house and house.loader
while True do
  Map.DebugPosition();

var House

var House

Global variable to use the type THouseHandler.