From 080e2616bb4081ad698fcb9ae3afd409556bda38 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Thu, 19 May 2022 18:56:23 -0500 Subject: [PATCH] Add get player in house/biz cmds --- scripts/server/staff.js | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/scripts/server/staff.js b/scripts/server/staff.js index 9c7d09cd..d83009b4 100644 --- a/scripts/server/staff.js +++ b/scripts/server/staff.js @@ -1751,4 +1751,66 @@ function forceFightStyleCommand(command, params, client) { return true; } +// =========================================================================== + +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ + function getPlayerCurrentHouseCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let targetClient = getPlayerFromParams(getParam(params, " ", 1)); + + let houseId = getPlayerHouse(targetClient); + + if(!houseId) { + messagePlayerAlert(client, `${getPlayerName(targetClient)} isn't in or at a house!`); + return false; + } + + let houseData = getHouseData(houseId); + messagePlayerInfo(client, `${getPlayerName(targetClient)}'s is at/in house '${houseData.description}' (ID ${houseId}/${houseData.databaseId})`); + return true; +} + +// =========================================================================== + +/** + * This is a command handler function. + * + * @param {string} command - The command name used by the player + * @param {string} params - The parameters/args string used with the command by the player + * @param {Client} client - The client/player that used the command + * @return {bool} Whether or not the command was successful + * + */ + function getPlayerCurrentBusinessCommand(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let targetClient = getPlayerFromParams(getParam(params, " ", 1)); + + let businessId = getPlayerBusiness(targetClient); + + if(!businessId) { + messagePlayerAlert(client, `${getPlayerName(targetClient)} isn't in or at a house!`); + return false; + } + + let businessData = getBusinessData(houseId); + messagePlayerInfo(client, `${getPlayerName(targetClient)}'s is at/in business '${businessData.name}' (ID ${businessId}/${businessData.databaseId})`); + return true; +} + // =========================================================================== \ No newline at end of file