UNPKG

alclient

Version:

A node client for interacting with Adventure Land - The Code MMORPG. This package extends the functionality of 'alclient' by managing a mongo database.

917 lines (915 loc) 33.6 kB
import type { BankInfo, SlotType, IPosition, TradeSlotType, SlotInfo, StatusInfo, TokenType } from "./definitions/adventureland.js"; import type { BankPackName, CharacterType, CXData, DamageType, EmotionName, GData, ItemName, MapName, MonsterName, NPCName, SkillName } from "./definitions/adventureland-data.js"; import type { AchievementProgressData, CharacterData, ServerData, ChestOpenedData, ChestData, EntitiesData, EvalData, GameResponseData, NewMapData, PartyData, PQData, TrackerData, PlayersData, ItemData, ItemDataTrade, PlayerData, FriendData, GameResponseDataUpgradeChance, QInfo, ProjectileSkillGRDataObject, ChannelInfo, TradeHistoryData } from "./definitions/adventureland-server.js"; import type { Entity } from "./Entity.js"; import { Item } from "./Item.js"; import { Observer } from "./Observer.js"; import type { Player } from "./Player.js"; import type { GetEntitiesFilters, GetEntityFilters, GetPlayerFilters, GetPlayersFilters, LocateItemFilters, LocateItemsFilters, SmartMoveOptions } from "./definitions/alclient.js"; import { TradeItem } from "./TradeItem.js"; export declare class Character extends Observer implements CharacterData { userAuth: string; characterID: string; timeouts: Map<string, NodeJS.Timeout>; achievements: Map<string, AchievementProgressData>; get bank(): BankInfo; chests: Map<string, ChestData>; nextSkill: Map<SkillName, Date>; partyData: PartyData; ready: boolean; /** Because of game server limitations, if your character disconnects you need make a new Character object, you can't call `connect()` again. */ noReconnect: boolean; afk: "code"; age: number; apiercing: number; blast: number; controller: string; name: string; id: string; ctype: CharacterType; abs: boolean; angle: number; armor: number; attack: number; c: ChannelInfo; cid: number; cx: CXData; damage_type: DamageType; focus?: string; frequency: number; going_x: number; going_y: number; gold: number; heal: number; home: string; hp: number; level: number; m: number; mp_cost: number; max_hp: number; max_mp: number; move_num: number; moving: boolean; mp: number; npc?: NPCName; owner: string; party?: string; pdps: number; q: QInfo; range: number; resistance: number; rip: boolean; rpiercing: number; s: StatusInfo; skin: string; slots: SlotInfo; speed: number; stand?: boolean | "cstand" | "stand0"; tp: boolean; emx: { [T in EmotionName]?: number; }; explosion: number; incdmgamp: number; firesistance: number; fzresistance: number; mp_reduction: number; phresistance: number; pnresistance: number; stresistance: number; stun: number; int: number; str: number; dex: number; vit: number; for: number; max_xp: number; goldm: number; xpm: number; xp: number; luckm: number; isize: number; esize: number; cash: number; targets: number; target?: string; team?: string; evasion: number; miss: number; reflection: number; lifesteal: number; manasteal: number; crit: number; critdamage: number; dreturn: number; tax: number; xrange: number; items: (ItemData | null)[]; cc: number; ipass?: string; friends?: string[]; acx?: object; xcx?: string[]; hitchhikers?: [string, GameResponseData | EvalData][]; user: BankInfo; fear: number; courage: number; mcourage: number; pcourage: number; width: number; height: number; constructor(userID: string, userAuth: string, characterID: string, g: GData, serverData: ServerData); protected updateLoop(): Promise<void>; parseCharacter(data: CharacterData | PlayerData): void; protected parseEntities(data: EntitiesData): void; protected parseEval(data: EvalData): void; protected parseGameResponse(data: GameResponseData): void; protected parseNewMap(data: NewMapData): void; protected parseQData(data: PQData): void; protected setNextSkill(skill: SkillName, next: Date): void; protected updatePositions(): void; /** * TODO: Add fail check for logging in with too many characters to one server * * @return {*} {Promise<void>} * @memberof Character */ connect(): Promise<void>; /** * Disconnects your bot from the server, cancels all timeouts that have been registered, and turns off all socket listeners. */ disconnect(): void; private getTime; /** * Logs a debug message to the console */ debug(msg: string, military?: boolean): void; error(e: Error | string, trace?: boolean, military?: boolean): void; /** * This function will request all nearby entities and players from the server. You can use it to make sure we have the latest data. * NOTE: There is a rather high code call cost to this, don't call it too often. */ requestEntitiesData(): Promise<EntitiesData>; /** * This function is a hack to get the server to respond with a player data update. It will respond with two... */ requestPlayerData(): Promise<CharacterData>; /** * Accepts a friend request. * * @param {string} id * @return {*} {Promise<FriendData>} * @memberof Character */ acceptFriendRequest(id: string): Promise<FriendData>; /** * Accepts a magiport request from another character * @param name ID of the character that offered a magiport. */ acceptMagiport(name: string): Promise<IPosition>; /** * Accepts another character's party invite. * @param id The ID of the character's party you want to accept the invite for. */ acceptPartyInvite(id: string): Promise<PartyData>; acceptPartyRequest(id: string): Promise<PartyData>; /** * Performs a basic attack on the given target. * * NOTE: We can't name this function `attack` because of the property `attack` that tells us how much damage we do. * @param id The ID of the entity or player to attack */ basicAttack(id: string): Promise<ProjectileSkillGRDataObject>; buy(itemName: ItemName, quantity?: number): Promise<number>; /** * Buy an item from an NPC (e.g. monsterhunter) with tokens * @param itemName The item you wish to purchase with tokens * @param useToken If set, we will only use this token to purchase the item, otherwise we will use any available token. */ buyWithTokens(itemName: ItemName, useToken?: keyof GData["tokens"]): Promise<void>; buyFromMerchant(id: string, slot: TradeSlotType, rid: string, quantity?: number): Promise<ItemData>; /** * Buys an item from Ponty. Get items from `getPontyItems()` * * @param {ItemDataTrade} item * @return {*} {Promise<void>} * @memberof Character */ buyFromPonty(item: ItemDataTrade): Promise<void>; /** * Calculates the type of targets attacking you. * * The first element is the current number of targets of the given damage type. * * The second element is our character's courage * * @return {*} {{ * magical: [number, number]; * physical: [number, number]; * pure: [number, number]; * }} * @memberof Character */ calculateTargets(): { magical: number; physical: number; pure: number; }; /** * Calculates the compound chance for the given item using the given scroll and offering. * * You need to be near the upgrade NPC, or have a computer, in order to calculate the compound chance. */ calculateCompound(item1Pos: number, item2Pos: number, item3Pos: number, cscrollPos: number, offeringPos?: number): Promise<GameResponseDataUpgradeChance>; /** * Calculates the upgrade chance for the given item using the given scroll and offering. * * You need to be near the upgrade NPC, or have a computer, in order to calculate the upgrade chance. * * @param itemPos The position of the item to upgrade in your inventory * @param scrollPos The position of the scroll to use to upgrade the item in your inventory * @param offeringPos The position of the offering to use to upgrade the item in your inventory * @returns */ calculateUpgrade(itemPos: number, scrollPos?: number, offeringPos?: number): Promise<GameResponseDataUpgradeChance>; calculateDamageRange(defender: Character | Entity | Player, skill?: SkillName): [number, number]; /** * Returns the *minimum* gold required to obtain the given item. * @deprecated use `Item.calculateMinimumCost()` * * @param {ItemData} item - The item to calculate the minimum cost for * @return {*} {number} - The cost of the item * @memberof Character */ calculateItemCost(item: ItemData): number; /** * @deprecated use `Item.calculateGrade()` */ calculateItemGrade(item: ItemData): number; canBuy(item: ItemName, options?: { ignoreLocation?: boolean; quantity?: number; }): boolean; canBuyWithTokens(item: ItemName, token: TokenType, options?: { ignoreLocation?: boolean; quantity?: number; }): boolean; /** * Returns true if you have the required items and gold to craft the item, you have * enough space in your inventory to craft the item, and you are near the NPC where you * can craft this item. * * @param {ItemName} itemToCraft * @return {*} {boolean} * @memberof Character */ canCraft(itemToCraft: ItemName, options?: { /** If true, we won't check if we're near the NPC that crafts this item */ ignoreLocation?: boolean; /** If true, we will consider it craftable if we can buy the remaining items from an NPC */ ignoreNpcItems?: boolean; }): boolean; /** * Returns true if you have the required gold to dismantle the item, and you * are near the craftsman NPC (or have a computer/supercomputer). * * NOTE: We currently lack the ability to calculate the cost of dismantling * compounded items; so although these items /can/ be dismantled, they will * return false until we get the necessary info. * * @param itemToDismantle ItemName id of item to be dismantled * @param options * @param options.ignoreInventory whether to ignore whether we have the item or not * @returns true or false */ canDismantle(itemToDismantle: ItemName, options?: { ignoreInventory?: boolean; ignoreLocation?: boolean; }): boolean; /** * Returns true if you have enough of the exchangeable items, and you are * near the NPC where you can exchange this item. * * @param {ItemName} itemToExchange * @param {{ * ignoreLocation?: boolean * }} [options] * @return {*} {boolean} * @memberof Character */ canExchange(itemToExchange: ItemName, options?: { ignoreLocation?: boolean; }): boolean; /** * Returns true if we can 100% kill the entity in one shot. * * @param {Entity} entity * @param {SkillName} [skill="attack"] * @return {*} {boolean} * @memberof Character */ canKillInOneShot(entity: Entity, skill?: SkillName): boolean; /** * Returns true if we can sell items from where we are standing * * @return {*} {boolean} * @memberof Character */ canSell(): boolean; /** * Returns true if you can compound the given combination of items from where you're standing * * @param {number} itemPos1 * @param {number} itemPos2 * @param {number} itemPos3 * @param {number} scrollPos * @param {number} [offeringPos] * @return {*} {boolean} * @memberof Character */ canCompound(itemPos1: number, itemPos2: number, itemPos3: number, scrollPos?: number, offeringPos?: number): boolean; /** * Returns true if you can upgrade the given combination of items from where you're standing * * @param {number} itemPos * @param {number} scrollPos * @param {number} [offeringPos] * @return {*} {boolean} * @memberof Character */ canUpgrade(itemPos: number, scrollPos?: number, offeringPos?: number): boolean; /** * Returns true if we can use the skill. * This function checks various requirements, such as level, having a required item equipped, etc. * If you only want to check the cooldown, use isOnCooldown(skill) or getCooldown(skill). * * @param {SkillName} skill * @param {{ * ignoreCooldown?: boolean, * ignoreEquipped?: boolean, * ignoreLocation?: boolean, * ignoreMP?: boolean, * }} [options] * @return {*} {boolean} * @memberof Character */ canUse(skill: SkillName, options?: { ignoreCooldown?: boolean; ignoreEquipped?: boolean; ignoreLocation?: boolean; ignoreMP?: boolean; }): boolean; closeMerchantStand(): Promise<void>; /** * Combines 3 items to 1 at a higher level * * @param item1Pos * @param item2Pos * @param item3Pos * @param cscrollPos * @param offeringPos * @returns */ compound(item1Pos: number, item2Pos: number, item3Pos: number, cscrollPos: number, offeringPos?: number): Promise<boolean>; /** * Crafts the given item name using items in the character's inventory. * * @param {ItemName} item * @return {*} {Promise<void>} * @memberof Character */ craft(item: ItemName): Promise<void>; depositGold(gold: number): Promise<void>; /** * Deposits an item in your bank. * * @param {number} inventoryPos * @param {BankPackName} [bankPack] * @param {*} [bankSlot=-1] * @return {*} {unknown} * @memberof Character */ depositItem(inventoryPos: number, bankPack?: BankPackName, bankSlot?: number): Promise<unknown>; /** * Destroys an item * * NOTE: Currently (as of 2024-02-15) gives a 1/1,000,000 chance to get a level 13 item * if the item is upgradable * * @param num The inventory slot for the item we should destroy */ destroy(num: number, quantity?: number): Promise<unknown>; dismantle(slot: number): Promise<void>; donateGold(amount: number): Promise<void>; /** * Perform an emotion * * @param {EmotionName} emotionName * @return {*} {Promise<void>} * @memberof Character */ emote(emotionName: EmotionName): Promise<void>; /** * Use this function to enter dungeons. * * See `transport` for traveling through normal doors. * * @param {MapName} map * @param {string} [instance] Instance ID string. If not set, a key will be consumed from your inventory to create a new one. * @return {*} {Promise<void>} * @memberof Character */ enter(map: MapName, instance?: string): Promise<void>; /** * Equip a single item. * * @see equip_batch Optimized for equipping multiple items (i.e. a loadout) at once * * @param inventoryPos * @param equipSlot * @returns */ equip(inventoryPos: number, equipSlot?: SlotType): Promise<void>; /** * Equip a defined set of items * * @see equip Equipping a single item */ equipBatch(toEquip: { num: number; slot: SlotType; }[]): Promise<unknown>; exchange(inventoryPos: number): Promise<string>; finishMonsterHuntQuest(): Promise<void>; /** * Returns a list of nearby entities, with optional filters * * @param {GetEntitiesFilters} [filters={}] * @return {*} {Entity[]} * @memberof Character */ getEntities(filters?: GetEntitiesFilters): Entity[]; /** * Returns a nearby entity, with optional filters. * Note the filters with the returnX pattern, as they are specific to `getEntity()`. * * @param {GetEntityFilters} [filters={}] * @return {*} {Entity} * @memberof Character */ getEntity(filters?: GetEntityFilters): Entity; /** * Returns a list of empty inventory slot indexes * * @param items The inventory to look in */ getEmptyInventorySlots(items?: ItemData[]): number[]; /** * Returns the index of the first empty slot in the given inventory * * @param {*} [items=this.items] The inventory to look in * @return {*} {number} The index of the first empty slot * @memberof Character */ getFirstEmptyInventorySlot(items?: ItemData[]): number; /** * Get the holidayspirit buff. NOTE: You can only get this buff if the `holidayseason` event is active. * * NOTE: It might be the case that you can get a fun token when getting holidayspirit, but only if you currently * don't have holidayspirit (i.e. you don't top it up, and only get it again once it's completely run out). * * TODO: Add promises */ getHolidaySpirit(): void; /** * Returns a nested map of items that the player has in their bank. */ getBankItems(): Map<BankPackName, Map<number, Item>>; /** * Returns a map of items that the player has in their inventory. * * The key is the slot that the item is located, the value is an Item object with the * item data */ getItems(): Map<number, Item>; /** * Returns the items that we are selling in our trade slots. * * @see getWantedItems for items the player is buying */ getItemsForSale(): Map<TradeSlotType, TradeItem>; /** * Returns the items that we are purchasing in our trade slots * * @see getItemsForSale for items the player is selling */ getWantedItems(): Map<TradeSlotType, TradeItem>; getLostAndFoundItems(): Promise<ItemDataTrade[]>; getMonsterHuntQuest(): Promise<void>; getPlayer(filters?: GetPlayerFilters): Player; getPlayers(filters?: GetPlayersFilters): Player[]; /** * Returns a list of the players that are online on the server * * @return {*} {Promise<PlayersData>} * @memberof Character */ getServerPlayers(): Promise<PlayersData>; getPontyItems(): Promise<ItemDataTrade[]>; getServerReserveGold(): Promise<number>; /** * A helper function for creating promises for skills * @param skill The skill we're checking the success or failure for * @param options Overrides * @returns A promise that will resolve or reject according to the server response */ protected getResponsePromise(skill: SkillName | "buy" | "destroy" | "equip_batch" | "imove" | "join" | "set_home", response?: string, options?: { extraGameResponseCheck?: (data: GameResponseData) => boolean; timeoutMs?: number; }): Promise<unknown>; /** * Retrieves the entity our character is currently targeting. * * @return {*} {Entity} * @memberof Character */ getTargetEntity(): Entity; /** * Retrieves tracker data * * @return {*} {Promise<TrackerData>} * @memberof Character */ getTrackerData(): Promise<TrackerData>; getTradeHistory(): Promise<TradeHistoryData>; /** * If we are disabled, we cannot move or attack * @returns If we are disabled */ isDisabled(): boolean; /** * Returns true if our inventory is full, false otherwise * * @return {*} {boolean} * @memberof Character */ isFull(): boolean; /** * Returns true if our character is scared, false otherwise * * @return {*} {boolean} * @memberof Character */ isScared(): boolean; /** * Joins a daily event. * * @param eventName */ join(eventName: MapName | MonsterName): Promise<unknown>; /** * Removes a party member * * @param {string} toKick * @return {*} {Promise<void>} * @memberof Character */ kickPartyMember(toKick: string): Promise<void>; /** * For use on 'cyberland' and 'jail' to leave the map. You will be transported to the spawn on "main". * * @return {*} {Promise<void>} * @memberof Character */ leaveMap(): Promise<void>; leaveParty(): Promise<void>; /** * * @param {number} x * @param {number} y * @param {{ disableSafetyCheck: boolean }} [options] * * * @return {*} {Promise<IPosition>} * @memberof Character */ /** * Moves the character to a given location. If the character can not move there safely, * i.e. there's a wall in the way, then we will move to the closest we can walk there in * a straight line. * * If you want this function to return after we complete the move, use `await`. * * If you start a new move before the last move is finished, the last move's promise will resolve. * * @param {number} x * @param {number} y * @param {{ disableSafetyCheck?: boolean, disableArrivalCheck?: boolean }} [options] * * disableSafetyCheck - If set to true, move() will not check map bounds * * resolveOnStart - If set to true, move() will resolve the promise when the move is confirmed, and not when it finishes * * @return {*} {Promise<IPosition>} * @memberof Character */ move(x: number, y: number, options?: { disableAlreadyThereCheck?: boolean; disableSafetyCheck?: boolean; disableErrorLogs?: boolean; resolveOnStart?: boolean; }): Promise<IPosition>; openChest(id: string): Promise<ChestOpenedData>; openMerchantStand(): Promise<void>; playSlots(bet?: number, num?: number, dir?: "up" | "down"): Promise<boolean>; regenHP(): Promise<void>; regenMP(): Promise<void>; /** * If you are dead, you can call this function to respawn. * * @param {boolean} [safe] If set, you will spawn in Wizard's cave instead of near the goos. * @return {*} {Promise<IPosition>} * @memberof Character */ respawn(safe?: boolean): Promise<IPosition>; scare(): Promise<string[]>; sell(itemPos: number, quantity?: number): Promise<boolean>; sellToMerchant(id: string, slot: TradeSlotType, rid: string, q: number): Promise<void>; sendCM(to: string[], message: unknown): Promise<void>; sendMail(to: string, subject: string, message: string, item?: boolean): Promise<void>; /** * Sends a PM to another character. * NOTE: This function's promise will only resolve after 5 seconds due to game limitations. * Use caution when awaiting the promises! * * @param to The character ID to send a PM to * @param message The message * @returns true if we are pretty sure the PM was sent */ sendPM(to: string, message: string): Promise<boolean>; /** * Sends a message to the server chat * @param message The message to send * @returns */ say(message: string): Promise<void>; sendFriendRequest(id: string): Promise<void>; sendGold(to: string, amount: number): Promise<number>; sendItem(to: string, inventoryPos: number, quantity?: number): Promise<void>; /** * Invites the given character to our party. * @param id The character ID to invite to our party. */ sendPartyInvite(id: string): Promise<void>; /** * Requests to join another character's party. * @param id The character ID to request a party invite from. */ sendPartyRequest(id: string): Promise<void>; /** * Sets the home server to the current server you're on */ setHome(): Promise<unknown>; /** * Shifts a booster to the given type * * @param {number} booster the inventory position of the booster * @param {("goldbooster" | "luckbooster" | "xpbooster")} to the type you want to shift it to * @memberof Character */ shiftBooster(booster: number, to: "goldbooster" | "luckbooster" | "xpbooster"): Promise<void>; protected lastSmartMove: number; smartMoving: IPosition & { map: MapName; }; /** * Used to move long distances strategically, i.e. avoiding walking through walls. * You can use this function to move between maps, too. * * @param {(IPosition | ItemName | MapName | MonsterName | NPCName)} to * @param {SmartMoveOptions} [options] * @return {*} {Promise<IPosition>} * @memberof Character */ smartMove(to: IPosition | ItemName | MapName | MonsterName | NPCName | BankPackName, options?: SmartMoveOptions): Promise<IPosition>; /** * Splits a stack of items in to two stacks * * @param pos The stack to split items from * @param q The number of items to split in to the new stack * @returns The slot number of the new stack */ splitItem(pos: number, q: number): Promise<number>; /** * Starts "Konami" mode. * * In Konami mode, you can only attack the monster it specifies. * * You have a (very low) chance to get a special item in this mode. * * To exit Konami mode, you need to disconnect and reconnect * * @return {*} {Promise<MonsterName>} The type of monster you need to target * @memberof Character */ startKonami(): Promise<MonsterName>; stopSmartMove(): Promise<IPosition>; stopWarpToTown(): Promise<void>; /** * Swaps two items in your bank * * @param {number} itemPosA * @param {number} itemPosB * @param {BankPackName} pack * @return {*} {Promise<void>} * @memberof Character */ swapBankItems(itemPosA: number, itemPosB: number, pack: BankPackName): Promise<void>; /** * Swaps or two items in your inventory * * @param {number} itemPosA * @param {number} itemPosB * @return {*} {Promise<void>} * @memberof Character */ swapItems(itemPosA: number, itemPosB: number): Promise<unknown>; takeMailItem(mailID: string): Promise<void>; throwSnowball(target: string, snowball?: number): Promise<string>; /** * Use this function to travel through normal doors. * * See `enter` for entering dungeons. * * @param {MapName} map The map to move to * @param {number} spawn The spawn to move to for the given map * @return {*} {Promise<void>} * @memberof Character */ transport(map: MapName, spawn: number): Promise<void>; /** * Unequips the item in the given slot. * Also used to remove items from the merchant stand. * * @param {(SlotType | TradeSlotType)} slot * @return {*} {Promise<number>} The position of the unequipped item in the inventory * @memberof Character */ unequip(slot: SlotType | TradeSlotType): Promise<number>; /** * Unfriend another player. * NOTE: `data.name` may not equal `id`. The event uses the player's 1st character's name. * * @param {string} id * @return {*} {Promise<FriendData>} * @memberof Character */ unfriend(id: string): Promise<FriendData>; /** * Upgrades the given item using the given scroll and offering. * * You need to be near the upgrade NPC, or have a computer, in order to upgrade. * * @param itemPos The position of the item to upgrade in your inventory * @param scrollPos The position of the scroll to use to upgrade the item in your inventory * @param offeringPos The position of the offering to use to upgrade the item in your inventory * @returns */ upgrade(itemPos: number, scrollPos: number, offeringPos?: number): Promise<boolean>; usePotion(itemPos: number): Promise<void>; warpToJail(): Promise<IPosition>; warpToTown(): Promise<IPosition>; withdrawGold(gold: number): Promise<void>; withdrawItem(bankPack: BankPackName, bankPos: number, inventoryPos?: number): Promise<unknown>; /** * Performs the zapperzap skill you can use if you have a zapper equipped. * * @param id The ID of the entity or player to attack */ zapperZap(id: string): Promise<unknown>; /** * Returns true if the entity has a >0% chance to die from projectiles already cast. * * @return {*} {boolean} * @memberof Entity */ couldDieToProjectiles(): boolean; /** * Returns the number of items that match the given parameters * @param itemName The item to look for * @param inventory Where to look for the item * @param filters Filters to help search for specific properties on items */ countItem(item: ItemName, inventory?: ItemData[], filters?: LocateItemsFilters): number; getCooldown(skill: SkillName): number; /** * Returns a boolean corresponding to whether or not we have a PvP marked item in our inventory * @param inv The inventory to look in */ hasPvPMarkedItem(inv?: ItemData[]): boolean; /** * Check if we have the given item in the given inventory * * @param {ItemName | ItemName[]} iN The item(s) to look for. If given an array, it will check if we have *any* item in that list, not *all* items. * @param {*} [inv=this.items] Where to look for the item(s) * @param {LocateItemsFilters} [filters] * @return {*} {boolean} * @memberof Character */ hasItem(iN: ItemName | ItemName[], inv?: ItemData[], filters?: LocateItemsFilters): boolean; /** * Returns true if we are compounding something, false otherwise. * * NOTE: `Compounding`, `Upgrading`, and `Exchanging` are separate things and can be performed simultaneously. * @returns true if we are compounding something */ isCompounding(): boolean; /** * Returns a boolean corresponding to whether or not we have a given item equipped. * @param iN The item(s) to look for. If given an array, this will check if *one* of the items is equipped, **not all**. * @param filters Extra parameters to make sure the item has */ isEquipped(iN: ItemName | ItemName[], filters?: LocateItemsFilters): boolean; /** * Returns true if we are exchanging something, false otherwise. * * NOTE: `Exchanging`, `Upgrading`, and `Compounding` are separate things and can be performed simultaneously. * @returns true if we are exchanging something */ isExchanging(): boolean; /** * Returns a boolean corresponding to whether or not we have the given item listed for purchase. * @param itemName The item to look for * @returns */ isListedForPurchase(itemName: ItemName): boolean; /** * Returns a boolean corresponding to whether or not we have the given item listed for sale. * @param itemName The item to look for * @returns */ isListedForSale(itemName: ItemName): boolean; /** * Returns true if our skill is on cooldown, false otherwise. * This function does not check if you can use the skill. * If you want to check if you have all the requirements to use it, see canUse(skill). * * @param {SkillName} skill * @return {*} {boolean} * @memberof Character */ isOnCooldown(skill: SkillName): boolean; /** * Returns true if we are upgrading something, false otherwise. * * NOTE: `Upgrading`, `Compounding`, and `Exchanging` are separate things and can be performed simultaneously. * @returns true if we are upgrading something */ isUpgrading(): boolean; /** * Can we attack other players? * * @return {*} {boolean} * @memberof Character */ isPVP(): boolean; /** * Returns the index of the item in the given inventory * @param iN The item(s) to look for * @param inv Where to look for the item * @param filters Filters to help search for specific properties on items */ locateItem(iN: ItemName | ItemName[], inv?: ItemData[], filters?: LocateItemFilters): number; /** * Returns a list of indexes of the items in the given inventory * @param iN The item(s) to look for. If given an array, this will check if *one* of the items is equipped, **not all**. * @param inv Where to look for the item * @param filters Filters to help search for specific properties on items */ locateItems(iN: ItemName | ItemName[], inv?: ItemData[], filters?: LocateItemsFilters): number[]; /** * Returns an object with keys for each item name. * Each item object has keys for each level. * Each level object is an array of item positions. * * Set `minAmount` to 2 to find duplicate items. Set `minAmount` to 3 to find triplicate items. * * @param {*} [inventory=this.items] * @param {{ minAmount?: number }} [options] * @return {*} {{ * [name in ItemName]?: { * [level in number]?: number[]; * } * }} * @memberof Character */ locateItemsByLevel(inventory?: ItemData[], options?: { excludeLockedItems?: boolean; excludeSpecialItems?: boolean; minAmount?: number; }): { [name in ItemName]?: { [level in number]?: number[]; }; }; }