Skip to content

Commit

Permalink
Deploying to documentation from @ f602ff3 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
Torwent committed Jan 25, 2024
1 parent 9174b04 commit 8bfb311
Show file tree
Hide file tree
Showing 80 changed files with 1,622 additions and 265 deletions.
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/index.doctree
Binary file not shown.
Binary file added .doctrees/pohhandler.doctree
Binary file not shown.
320 changes: 320 additions & 0 deletions _sources/consumablehandler(optional_handlers).rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,320 @@

ConsumableHandlers
==================

ConsumableHandlers are responsible for handle all kinds of consumables in WaspLib.
For a list of the consumable types check `ERSConsumable`, there's a TConsumableHandler for each one.


------------

type TConsumableHandler
~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
TConsumableHandler = record(TSRLBaseRecord)
ConsumableType: ERSConsumable;
ConsumableArray: TRSConsumableArray;
Amount, MinInvPoints: Int32;
Timer, Delay: TCountDown;
IsSetup: Boolean;
end;
Consumable handler is the record responsible to handle `TRSConsumables <https://torwent.github.io/WaspLib/consumables.html>`_.
This will handle caching all found consumables to this point, bank withdraw amounts, timer if the last consumable had a timer, etc.


------------

type PConsumableHandler
~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
PConsumableHandler = ^TConsumableHandler;
Wrapper type of a TConsumableHandler pointer.


------------

ConsumableHandler.Setup()
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TConsumableHandler.Setup(Item: TRSItem): TRSConsumable;
Used internally to add a TRSConumable to TConsumableHandler.ConsumableArray.

Example
-------
.. code-block:: pascal
FoodHandler.Setup('Shark');
------------

ConsumableHandler.FindInBank()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TConsumableHandler.FindInBank(): TRSConsumableArray;
Returns an TRSConsumableArray of all TRSConsumables of **TConsumableHandler.consumableType** found in the bank window.


------------

ConsumableHandler.FindInInventory()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TConsumableHandler.FindInInventory(): TRSConsumableArray;
Returns an TRSConsumableArray of all TRSConsumables of **TConsumableHandler.ConsumableType** found in the inventory.


------------

ConsumableHandler.NeedToConsume()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TConsumableHandler.NeedToConsume(): Boolean;
Returns an **True** if there's a timer setup and it has ran out.


------------

ConsumableHandler.Setup()
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
procedure TConsumableHandler.Setup(consumableType: ERSConsumable); overload;
Overloaded function used to setup TConsumableHandler.ConsumableArray by TConsumableHandler.ConsumableType.
This will use TConsumableHandler.FindInInventory() or TConsumableHandler.FindInBank() by that order to setup
found TRSConsumables.


------------

var Handlers
~~~~~~~~~~~~
.. code-block:: pascal
FoodHandler: TConsumableHandler;
PrayerHandler: TConsumableHandler;
EnergyHandler: TConsumableHandler;
PoisonHandler: TConsumableHandler;
VenomHandler: TConsumableHandler;
AntifireHandler: TConsumableHandler;
BoostHandler: TConsumableHandler;
StrengthBoostHandler: TConsumableHandler;
AttackBoostHandler: TConsumableHandler;
DefenceBoostHandler: TConsumableHandler;
RangingBoostHandler: TConsumableHandler;
MagicBoostHandler: TConsumableHandler;
CONSUMABLE_HANDLER_ARRAY: array [ERSConsumable] of PConsumableHandler := [
@FoodHandler, @PrayerHandler, @EnergyHandler, @PoisonHandler, @VenomHandler,
@AntifireHandler, @BoostHandler, @StrengthBoostHandler, @AttackBoostHandler,
@DefenceBoostHandler, @RangingBoostHandler, @MagicBoostHandler
];
Global handler variables. This handlers are the ones responsible for handling consumables.


------------

ConsumableHandler.GetHandler()
~~~~~~~~~~~~
.. code-block:: pascal
function TConsumableHandler.GetHandler(consumableType: ERSConsumable): PConsumableHandler; static;
Static method to return a pointer to the right handler for each consumableType passed in.


------------

Inventory.FindItems()
~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSInventory.FindItems(Items: TRSConsumableArray; out FoundItems: TRSConsumableArray; out Slots: TIntegerArray): Boolean; overload;
Method used to find consumables in the inventory. Can be used directly but in most cases is used internally.


------------

Inventory.FindConsumable()
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSInventory.FindConsumable(consumableType: ERSConsumable; out FoundConsumables: TRSConsumableArray; out Slots: TIntegerArray): Boolean;
function TRSInventory.FindConsumable(consumableType: ERSConsumable): Boolean; overload;
Method used to find already setup consumables in the inventory. Can be used directly but in most cases is used internally.


------------

Inventory.Consume
~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSInventory.Consume(consumableType: ERSConsumable; out Slots: TIntegerArray): Boolean;
function TRSInventory.Consume(consumableType: ERSConsumable): Boolean; overload;
Methods used to consume consumables.

Example
-------
.. code-block:: pascal
Inventory.Consume(ERSConsumable.FOOD);
------------

Inventory.CountConsumable()
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSInventory.CountConsumable(consumableType: ERSConsumable): Int32;
Method used to count each slot that has a consumable of **consumableType**.

Example
-------
.. code-block:: pascal
WriteLn Inventory.CountConsumable(ERSConsumable.FOOD);
------------

Inventory.CountEachConsumable()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSInventory.CountEachConsumable(consumableType: ERSConsumable): TIntegerArray;
Method used to count each type of consumable of **consumableType**.

Example
-------
.. code-block:: pascal
WriteLn Inventory.CountEachConsumable(ERSConsumable.FOOD);
------------

Inventory.CountPoints()
~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSInventory.CountPoints(Consumable: TRSConsumable): Int32;
function TRSInventory.CountPoints(consumableType: ERSConsumable): Int32; overload;
Method used to count the total points value of a **Consumable** or **consumableType**.

Example
-------
.. code-block:: pascal
WriteLn Inventory.CountPoints(ERSConsumable.FOOD); //Assumind you have 3 sharks in your inventory, 60 will be printed.
------------

Inventory.HasEnoughConsumable()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSInventory.HasEnoughConsumable(consumableType: ERSConsumable): Boolean;
Method used to figure out if we are low on a type of consumable.

Example
-------
.. code-block:: pascal
if not Inventory.HasEnoughConsumable(ERSConsumable.FOOD) then
Bank.WithdrawItem(['Shark', 5, False], False);
------------

Bank.FindConsumable()
~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSBank.FindConsumable(ConsumableArray: TRSConsumableArray; out Consumable: TRSConsumable): Boolean;
function TRSBank.FindConsumable(ConsumableArray: TRSConsumableArray): Boolean; overload;
function TRSBank.FindConsumable(consumableType: ERSConsumable; out Consumable: TRSConsumable): Boolean; overload;
function TRSBank.FindConsumable(consumableType: ERSConsumable): Boolean; overload;
Method used to find already setup consumables in the bank. Can be used directly but in most cases is used internally.

Example
-------
.. code-block:: pascal
WriteLn Bank.FindConsumable(ERSConsumable.FOOD);
------------

Bank.CountPoints()
~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSBank.CountPoints(Consumable: TRSConsumable): Int32;
Method used to count the points of the first dose/portion of a consumable found in bank.
This prioritizes higher dosage visible ones first and returns only just that one.


------------

Bank.WithdrawConsumableAmount()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSBank.WithdrawConsumableAmount(consumableType: ERSConsumable): Int32;
function TRSBank.WithdrawConsumableAmount(consumableType: ERSConsumable; consumable: TRSConsumable): Int32; overload;
Method used to return the amount we need to withdraw to meet the TRSConsumable.MinInvPoints.


------------

Bank.WithdrawConsumable()
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function TRSBank.WithdrawConsumable(consumableType: ERSConsumable): Boolean;
Method used to withdraw a consumable type.

Example
-------
.. code-block:: pascal
FoodHandler.MinInvPoints := 100;
Bank.WithdrawConsumable(ERSConsumable.FOOD); //This will withdraw FOODs until we have 100 points value of food in our inventory.
------------
16 changes: 13 additions & 3 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ Welcome to WaspLib documentation!

:caption: OSR -> HANDLERS

rsfishinghandler
combathandler
consumablehandler
loothandler

-----------

Expand Down Expand Up @@ -122,6 +119,19 @@ Welcome to WaspLib documentation!

-----------

.. toctree::
:maxdepth: 2

:caption: OPTIONAL -> HANDLERS

pohhandler
rsfishinghandler
combathandler
consumablehandler(optional_handlers)
loothandler

-----------

.. toctree::
:maxdepth: 2

Expand Down
6 changes: 6 additions & 0 deletions _sources/pohhandler.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

POHHandler
==========


------------
Loading

0 comments on commit 8bfb311

Please sign in to comment.