GameActionFactory Documentation¶
Overview¶
The GameActionFactory
class is a static utility singleton in the HighSpell game responsible for creating GameAction
objects that encapsulate various game events, such as player movement, spell casting, inventory interactions, and server-client communications. Each action is associated with a specific GameActionsEnum
value and structured data, which is sent via SocketManager
to the server for validation and processing. This class is central to the game’s client-server architecture, ensuring standardized action payloads.
Usefulness for Botting¶
The GameActionFactory
class is a critical component for bot development due to its role in generating standardized network packets for nearly all player actions, from movement (createPlayerMoveToAction
) to spell casting (createCastTeleportSpellAction
, createCastInventorySpellAction
) and inventory management (createInvokeInventoryItemActionAction
). By replicating these method calls with appropriate parameters (e.g., entity IDs, coordinates, or item IDs), bots can simulate complex player behaviors, such as navigating to specific locations, interacting with entities, or manipulating inventory. The class’s integration with SocketManager
allows bots to send these actions to the server, mimicking legitimate client behavior. A vast majority of the creation methods are for packets that are recieved rather than sent and as such are never used in the code. However, they show how the packet should be structured. Such automation uses very little of the clients input controls, making it more complex and easier to make mangled packets that don't work. Depending on your ease of use and risk tolerance you could create packets and use the emitpacket
directly, or use the clients input management.
Key Features¶
- Singleton Pattern: Ensures a single instance via the
Instance
getter. - Action Creation: Generates
GameAction
objects with specificGameActionsEnum
types and structured data arrays. - Network Integration: Produces packets for server communication via
SocketManager
. - Comprehensive Coverage: Supports actions for movement, combat, skilling, inventory, trading, and more.
Static Methods¶
Singleton Access¶
Instance
(getter):- Returns the singleton instance, creating a new
GameActionFactory
if_gameActionFactory
is undefined.
Generic Action Creation¶
createGameAction(e, t)
:- Creates a generic
GameAction
with typee
(GameActionsEnum
) and datat
.
Game State and Updates¶
createGameStateUpdateAction(e)
:- Creates a
GameStateUpdate
action with an array of game actions (Name
,Data
). createInGameHourChangedAction(e)
:- Notifies a change in the in-game hour (
CurrentHour
).
Movement and Positioning¶
createPlayerMoveToAction(e, t, i)
:- Moves a player to coordinates (
t
,i
) withEntityID
e
. createNPCMoveToAction(e, t, i)
:- Moves an NPC to coordinates (
t
,i
) withEntityID
e
. createSendMovementPathAction(e, t)
:- Sends a movement path to coordinates (
e
,t
). createTeleportToAction(e, t, i, n, r, s, a)
:- Teleports an entity (
e
, typet
) to coordinates (i
,n
, map levelr
) with types
and optionalSpellID
a
.
Entity Chunk Management¶
createPlayerEnteredChunkAction(e, t, i, n, r, s, a, o, l, h, c, u, d, p)
:- Notifies a player entering a chunk, including appearance (
c
), position, and stats. createNPCEnteredChunkAction(e, t, i, n, r, s, a, o)
:- Notifies an NPC entering a chunk with position and hitpoints.
createItemEnteredChunkAction(e, t, i, n, r, s, a)
:- Notifies a ground item entering a chunk with
ItemID
,Amount
, and position. createEntityExitedChunkAction(e, t)
:- Notifies an entity exiting a chunk.
createIEnteredChunkAction(e, t)
:- Notifies the main player entering a chunk at center coordinates (
e
,t
).
Combat and Damage¶
createShowDamageAction(e, t, i)
:- Displays damage (
i
) from sender (e
) to receiver (t
). createIncreasedCombatExpAction(e, t)
:- Grants combat experience for style
e
and damaget
. createPlayerDiedAction(e, t)
:- Notifies a player’s death with optional PKer ID
t
. createFiredProjectileAction(e, t, i, n, r, s, a)
:- Fires a projectile (
e
) from ranger (t
, typei
) to target (n
, typer
) with damages
and confusion statea
.
Inventory and Item Actions¶
createUseItemOnEntityAction(e, t, i)
:- Uses item
e
on entity (i
, typet
). createCreateItemAction(e, t, i)
:- Creates item
e
with amountt
in menui
. createCreatedItemAction(e, t, i)
:- Confirms creation of item
e
with amountt
and recipe removalsi
. createInvokeInventoryItemActionAction(e, t, i, n, r, s)
:- Invokes item action
e
on item (n
, amountr
, IOUs
) in menut
at sloti
. createInvokedInventoryItemActionAction(e, t, i, n, r, s, a, o)
:- Confirms invoked item action with success
a
and optional datao
. createUseItemOnItemAction(e, t, i, n, r, s, a, o, l)
:- Uses item (
i
, IOUn
) at slott
on item (s
, IOUa
) at slotr
in menue
with result indexo
and amountl
. createUsedItemOnItemAction(e, t, i, n, r, s, a, o, l, h)
:- Confirms item-on-item action with success
h
. createRemovedItemAtInventorySlotAction(e, t, i, n, r, s)
:- Removes item (
i
, amountn
, IOUr
) from slott
in menue
with remaining amounts
. createAddedItemAtInventorySlotAction(e, t, i, n, r, s)
:- Adds item (
i
, amountn
, IOUr
) to slott
in menue
with previous amounts
. createReorganizeInventorySlotsAction(e, t, i, n, r, s, a, o)
:- Reorganizes inventory slots (
t
tor
) with items (i
, IOUn
;s
, IOUa
) in menue
with typeo
. createReorganizedInventorySlotsAction(e, t, i, n, r, s, a, o, l)
:- Confirms slot reorganization with success
l
.
Skilling and Resources¶
createStartedSkillingAction(e, t, i, n)
:- Starts skilling (
i
) on targett
(typen
) by playere
. createStoppedSkillingAction(e, t, i)
:- Stops skilling (
t
) by playere
with exhaustion flagi
. createObtainedResourceAction(e)
:- Notifies obtaining resource
e
. createEntityExhaustedResourcesAction(e, t, i)
:- Notifies exhaustion of resources (
e
) with chunk snapshot flagt
and optional chunk centeri
. createEntityReplenishedResourcesAction(e)
:- Notifies replenishment of resource
e
. createGainedExpAction(e, t)
:- Grants experience
t
for skille
.
Spell Casting¶
createCastTeleportSpellAction(e)
:- Casts teleport spell
e
. createCastedTeleportSpellAction(e, t, i)
:- Confirms teleport spell
i
cast by entity (e
, typet
). createCastInventorySpellAction(e, t, i, n, r)
:- Casts inventory spell
e
on item (n
, IOUr
) in menut
at sloti
. createCastedInventorySpellAction(e, t, i, n)
:- Confirms inventory spell
i
cast by entity (e
, typet
) on itemn
. createCastSingleCombatOrStatusSpellAction(e, t, i)
:- Casts combat or status spell
e
on target (t
, typei
). createCastedSingleCombatOrStatusSpellAction(e, t, i, n, r, s, a)
:- Confirms combat/status spell
e
cast by (t
, typei
) on target (n
, typer
) with damages
and confusiona
. createToggleAutoCastAction(e)
:- Toggles auto-casting for spell
e
(ornull
to disable). createToggledAutoCastAction(e)
:- Confirms auto-cast toggle for spell
e
.
Trading and Banking¶
createStartedBankingAction(e, t)
:- Starts banking for player
e
at bankt
. createStoppedBankingAction(e)
:- Stops banking for player
e
. createReceivedBankitemsAction(e)
:- Updates bank items with array
e
. createTradeRequestedAction(e, t)
:- Requests trade between players
e
andt
. createPlayerAcceptedAction(e)
:- Confirms player
e
accepted a trade. createTradeStartedAction(e, t)
:- Starts trade between players
e
andt
. createTradeCancelledAction(e, t, i)
:- Cancels trade between players
e
andt
with reasoni
. createTradeCompletedAction(e, t, i)
:- Completes trade between players
e
andt
with inventoryi
. createTradeStatusResetAction()
:- Resets trade status.
createTradeGoToFinalStepAction()
:- Advances trade to the final step.
createInsertAtBankStorageSlotAction(e, t)
:- Inserts item at bank slot
e
tot
. createInsertedAtBankStorageSlotAction(e)
:- Confirms bank slot insertion with result
e
.
Other Actions¶
createPlayerSkillLevelIncreasedAction(e, t, i, n)
:- Notifies skill
t
level increase for playere
with levels gainedi
and new leveln
. createPlayerCombatLevelIncreasedAction(e, t)
:- Notifies combat level increase for player
e
to levelt
. createCookedItemAction(e)
:- Notifies cooking item
e
. createOvercookedItemAction(e)
:- Notifies overcooking item
e
. createChangeCombatStyleAction(e, t)
:- Changes combat style to
e
with selectiont
. createCombatStyleChangedAction(e)
:- Confirms combat style change to
e
. createChangeAutoRetaliateAction(e)
:- Toggles auto-retaliate to
e
. createAutoRetaliateChangedAction(e)
:- Confirms auto-retaliate change to
e
. createToggleSprintAction(e)
:- Toggles sprinting to
e
. createToggledSprintAction(e, t, i)
:- Confirms sprint toggle for entity (
e
, typet
) with statei
. createRestoredStatsAction(e)
:- Restores stats for skills
e
. createShookTreeAction(e, t, i)
:- Notifies tree shaking by entity (
e
, typet
) on treei
. createShakeTreeResultMessageAction(e, t)
:- Notifies tree shake result with item
e
and rare flagt
. createOpenedSkillingMenuAction(e, t)
:- Opens skilling menu for target
e
with menu typet
. createWentThroughDoorAction(e, t)
:- Notifies entity
t
going through doore
. createSkillCurrentLevelChangedAction(e, t)
:- Notifies skill
e
current level change tot
. createServerInfoMessageAction(e, t)
:- Displays server message
e
with stylet
. createForcePublicMessageAction(e, t, i)
:- Forces public message
i
from entity (e
, typet
). createQuestProgressedAction(e, t)
:- Notifies quest
e
progress to checkpointt
. createCreatedUseItemOnItemActionItemsAction(e, t, i)
:- Notifies item-on-item action with items
e
,t
, and result indexi
. createPathfindingFailedAction(e)
:- Notifies pathfinding failure for entity
e
. createServerShutdownCountdownAction(e)
:- Notifies server shutdown in
e
minutes. createCanLoginAction()
:- Notifies login permission.
createReconnectToServerAction(e, t)
:- Reconnects with username
e
and session IDt
. createEntityStunnedAction(e, t, i)
:- Notifies entity (
e
, typet
) stunned fori
ticks. createGlobalPublicMessageAction(e, t, i, n)
:- Sends global public message
i
from entitye
with namet
and player typen
. createHealthRestoredAction(e, t, i)
:- Restores health to
i
for entity (t
, typee
). createPlayerCountChangedAction(e)
:- Notifies player count change to
e
. createForcedSkillCurrentLevelChangedAction(e, t, i)
:- Forces skill
e
current level tot
with message flagi
. createReceivedNPCConversationDialogue(e, t, i, n, r, s)
:- Receives NPC conversation dialogue with ID
t
, dialogue IDi
, textr
, and optionss
. createSelectNPCConversationOption(e)
:- Selects NPC conversation option
e
. createEndedNPCConversationAction(e)
:- Ends NPC conversation for entity
e
. createPlayerInfoAction(e)
:- Sends player info
e
. createCaptchaActionAction(e, t)
:- Submits captcha action type
e
with guesst
. createOpenedCaptchaScreenAction(e)
:- Opens captcha screen for entity
e
. createReceivedCaptchaAction(e, t, i)
:- Receives captcha with image URL
e
, widtht
, and heighti
. createCaptchaActionResultAction(e)
:- Notifies captcha action result with type
e
. createMentalClarityChangedAction(e, t, i)
:- Notifies mental clarity change for entity
e
fromt
toi
. createMutedPlayerAction(e, t)
:- Mutes or unmutes player
e
with statet
.
Technical Observations¶
- Dependencies: Relies on
GameAction
,SocketManager
,SkillEnum
, and various enum mappings for action data. - Data Structure: Uses fixed-size arrays with enum-indexed fields for efficient serialization.
- Network Integration: All actions are designed for server communication via
SocketManager
, ensuring client-server synchronization. - Comprehensive Action Set: Covers gameplay aspects like movement, combat, skilling, trading, and administrative functions (e.g., captcha, moderation).
Ethical and Legal Notes¶
Per the HighSpell Botting Resources ethos: - This documentation is for educational purposes, analyzing observable game client behavior. - Using this information to create bots violates HighSpell’s terms of service, risking account bans.