programming-game
Version:
The client for programming game, an mmorpg that you interact with entirely through code.
153 lines (152 loc) • 5.93 kB
TypeScript
import { Items, UsableItems, Equipments } from "./items";
import { recipes } from "./recipes";
import { Spells, CastIntent } from "./spells";
import { ClientSidePlayer, ROLES, SetRoleIntent, ClientSideUnit, AttackIntent, Tree, MiningNode, HarvestIntent, MoveIntent, RespawnIntent, SummonManaIntent, EatIntent, SellItemsIntent, BuyItemsIntent, UseIntent, SeekPartyIntent, InviteToPartyIntent, LeavePartyIntent, AcceptPartyInviteIntent, DeclinePartyInviteIntent, PlayerEquipment, EquipIntent, UnequipIntent, CraftIntent, WeaponSkillIntent, DropIntent, NewTrades, SetTradeIntent, ClientSideNPC, AcceptQuestIntent, AbandonQuestIntent, TurnInQuestIntent, Inventory, WithdrawIntent, DepositIntent, EquipSpellIntent, UnequipSpellIntent, Position } from "./types";
import { WeaponSkill, WeaponSkillSpecifics } from "./weapon-skills";
export declare const getHandlers: (player: ClientSidePlayer) => {
/**
* Update the role that you intend to play when grouping with other players.
*/
setRole: (role: ROLES) => SetRoleIntent;
/**
* Move to and attack a unit.
*/
attack: (target: ClientSideUnit) => AttackIntent;
/**
* Attempt to harvest resources from a tree or mining node.
*/
harvest: (target: Tree | MiningNode) => HarvestIntent;
/**
* Move to the specified position.
* @param position {Position} The position to move to.
*/
move: (position: Position) => MoveIntent;
/**
* Respawn a your character after death.
*
* Respawning will place your character at the nearest respawn point, but you'll lose all your items and equipment.
*/
respawn: () => RespawnIntent;
/**
* Concentrate and restore your mana more quickly than normal.
*/
summonMana: () => SummonManaIntent;
/**
* Attempt to eat an item from your inventory.
*/
eat: (item: Items) => EatIntent;
/**
* Cast a spell at an optional target.
*
* Spells require that the appropriate spell stone is equipped in your spellbook AND that you have enough spell slots in your equipment.
*/
cast: (spell: Spells, target?: ClientSideUnit) => CastIntent;
/**
* Sell items from your inventory to an NPC or player.
*/
sell: (opt: {
items: { [key in Items]?: number; };
to: ClientSideUnit;
}) => SellItemsIntent;
/**
* Buy items from an NPC or player.
*
* The target unit must have the items available to sell, and listed in their trades.
*/
buy: (opts: {
items: { [key in Items]?: number; };
from: ClientSideUnit;
}) => BuyItemsIntent;
/**
* Use an item from your inventory, optionally you can use the item on a target unit instead of yourself.
*/
use: (item: UsableItems, target?: ClientSideUnit) => UseIntent;
/**
* Announce to the world that you are seeking a party.
*/
seekParty: () => SeekPartyIntent;
/**
* Invite the specified player id to join your party.
*/
inviteToParty: (playerId: string) => InviteToPartyIntent;
/**
* Leave your current party.
*/
leaveParty: () => LeavePartyIntent;
/**
* Accept a party invitation from the specified player id.
*
* This is a noop if the player hasn't invited you to a party.
*/
acceptPartyInvite: (playerId: string) => AcceptPartyInviteIntent;
/**
* Decline a party invitation from the specified player id.
*/
declinePartyInvite: (playerId: string) => DeclinePartyInviteIntent;
/**
* Equip a piece of equipment into the specified slot.
*
* The item must be in your inventory.
*/
equip: (item: Equipments, slot: keyof PlayerEquipment) => EquipIntent;
/**
* Return a piece of equipment from your equipment back into your inventory.
*/
unequip: (slot: keyof PlayerEquipment) => UnequipIntent;
/**
* Attempt to craft an item using materials from your inventory.
*/
craft: (item: keyof typeof recipes, from: Partial<Record<Items, number>>) => CraftIntent;
/**
* Consumes TP to use a weapon skill on a target.
*
* Some weapon skills may require additional options.
*/
useWeaponSkill: <T extends WeaponSkill>(specifics: WeaponSkillSpecifics[T]["client"]) => WeaponSkillIntent<T>;
/**
* Drop items from your inventory onto the ground.
*/
drop: ({ item, amount }: {
item: Items;
amount: number;
}) => DropIntent;
/**
* Update the list of items that you are buying an selling as well as their prices.
*/
setTrade: (trades: NewTrades) => SetTradeIntent;
/**
* Accept a quest from an NPC.
*/
acceptQuest: (npc: ClientSideNPC, questId: string) => AcceptQuestIntent;
/**
* Remove a quest from your active quests and free up a slot in your quest log.
*/
abandonQuest: (questId: string) => AbandonQuestIntent;
/**
* Turn in a completed quest to an NPC.
*/
turnInQuest: (npc: ClientSideNPC, questId: string) => TurnInQuestIntent;
/**
* Withdraw items from a storage NPC to your inventory.
*
* The specified NPC MUST be a banker.
*/
withdraw: (npc: ClientSideNPC, items: Inventory) => WithdrawIntent;
/**
* Deposit items from your inventory into a storage NPC.
*
* The specified NPC MUST be a banker.
*/
deposit: (npc: ClientSideNPC, items: Inventory) => DepositIntent;
/**
* Equips the specified spell stone from your inventory into your spellbook.
*
* You MUST have an open slot if your spellbook, and the spell stone must be in your inventory.
*/
equipSpell: (spell: Spells) => EquipSpellIntent;
/**
* Unequips the first spell in the player's spellbook, and returns it to your inventory.
*/
unequipSpell: () => UnequipSpellIntent;
};
export type Handlers = ReturnType<typeof getHandlers>;