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
Instancegetter. - Action Creation: Generates
GameActionobjects with specificGameActionsEnumtypes 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
GameActionFactoryif_gameActionFactoryis undefined.
Generic Action Creation¶
createGameAction(e, t):- Creates a generic
GameActionwith typee(GameActionsEnum) and datat.
Game State and Updates¶
createGameStateUpdateAction(e):- Creates a
GameStateUpdateaction 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) withEntityIDe. createNPCMoveToAction(e, t, i):- Moves an NPC to coordinates (
t,i) withEntityIDe. 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 typesand optionalSpellIDa.
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
eand 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 damagesand confusion statea.
Inventory and Item Actions¶
createUseItemOnEntityAction(e, t, i):- Uses item
eon entity (i, typet). createCreateItemAction(e, t, i):- Creates item
ewith amounttin menui. createCreatedItemAction(e, t, i):- Confirms creation of item
ewith amounttand recipe removalsi. createInvokeInventoryItemActionAction(e, t, i, n, r, s):- Invokes item action
eon item (n, amountr, IOUs) in menutat sloti. createInvokedInventoryItemActionAction(e, t, i, n, r, s, a, o):- Confirms invoked item action with success
aand optional datao. createUseItemOnItemAction(e, t, i, n, r, s, a, o, l):- Uses item (
i, IOUn) at slotton item (s, IOUa) at slotrin menuewith result indexoand 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 slottin menuewith remaining amounts. createAddedItemAtInventorySlotAction(e, t, i, n, r, s):- Adds item (
i, amountn, IOUr) to slottin menuewith previous amounts. createReorganizeInventorySlotsAction(e, t, i, n, r, s, a, o):- Reorganizes inventory slots (
ttor) with items (i, IOUn;s, IOUa) in menuewith 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 playerewith exhaustion flagi. createObtainedResourceAction(e):- Notifies obtaining resource
e. createEntityExhaustedResourcesAction(e, t, i):- Notifies exhaustion of resources (
e) with chunk snapshot flagtand optional chunk centeri. createEntityReplenishedResourcesAction(e):- Notifies replenishment of resource
e. createGainedExpAction(e, t):- Grants experience
tfor skille.
Spell Casting¶
createCastTeleportSpellAction(e):- Casts teleport spell
e. createCastedTeleportSpellAction(e, t, i):- Confirms teleport spell
icast by entity (e, typet). createCastInventorySpellAction(e, t, i, n, r):- Casts inventory spell
eon item (n, IOUr) in menutat sloti. createCastedInventorySpellAction(e, t, i, n):- Confirms inventory spell
icast by entity (e, typet) on itemn. createCastSingleCombatOrStatusSpellAction(e, t, i):- Casts combat or status spell
eon target (t, typei). createCastedSingleCombatOrStatusSpellAction(e, t, i, n, r, s, a):- Confirms combat/status spell
ecast by (t, typei) on target (n, typer) with damagesand confusiona. createToggleAutoCastAction(e):- Toggles auto-casting for spell
e(ornullto disable). createToggledAutoCastAction(e):- Confirms auto-cast toggle for spell
e.
Trading and Banking¶
createStartedBankingAction(e, t):- Starts banking for player
eat bankt. createStoppedBankingAction(e):- Stops banking for player
e. createReceivedBankitemsAction(e):- Updates bank items with array
e. createTradeRequestedAction(e, t):- Requests trade between players
eandt. createPlayerAcceptedAction(e):- Confirms player
eaccepted a trade. createTradeStartedAction(e, t):- Starts trade between players
eandt. createTradeCancelledAction(e, t, i):- Cancels trade between players
eandtwith reasoni. createTradeCompletedAction(e, t, i):- Completes trade between players
eandtwith inventoryi. createTradeStatusResetAction():- Resets trade status.
createTradeGoToFinalStepAction():- Advances trade to the final step.
createInsertAtBankStorageSlotAction(e, t):- Inserts item at bank slot
etot. createInsertedAtBankStorageSlotAction(e):- Confirms bank slot insertion with result
e.
Other Actions¶
createPlayerSkillLevelIncreasedAction(e, t, i, n):- Notifies skill
tlevel increase for playerewith levels gainediand new leveln. createPlayerCombatLevelIncreasedAction(e, t):- Notifies combat level increase for player
eto levelt. createCookedItemAction(e):- Notifies cooking item
e. createOvercookedItemAction(e):- Notifies overcooking item
e. createChangeCombatStyleAction(e, t):- Changes combat style to
ewith 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
eand rare flagt. createOpenedSkillingMenuAction(e, t):- Opens skilling menu for target
ewith menu typet. createWentThroughDoorAction(e, t):- Notifies entity
tgoing through doore. createSkillCurrentLevelChangedAction(e, t):- Notifies skill
ecurrent level change tot. createServerInfoMessageAction(e, t):- Displays server message
ewith stylet. createForcePublicMessageAction(e, t, i):- Forces public message
ifrom entity (e, typet). createQuestProgressedAction(e, t):- Notifies quest
eprogress 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
eminutes. createCanLoginAction():- Notifies login permission.
createReconnectToServerAction(e, t):- Reconnects with username
eand session IDt. createEntityStunnedAction(e, t, i):- Notifies entity (
e, typet) stunned foriticks. createGlobalPublicMessageAction(e, t, i, n):- Sends global public message
ifrom entityewith nametand player typen. createHealthRestoredAction(e, t, i):- Restores health to
ifor entity (t, typee). createPlayerCountChangedAction(e):- Notifies player count change to
e. createForcedSkillCurrentLevelChangedAction(e, t, i):- Forces skill
ecurrent level totwith 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
ewith 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
efromttoi. createMutedPlayerAction(e, t):- Mutes or unmutes player
ewith 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.