From d9f4ec7c6f8045b3c6c99586afb8128d4418bd0d Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 16 Oct 2022 17:08:52 -0500 Subject: [PATCH 01/37] Fix biz/house price not being shown --- scripts/client/label.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/client/label.js b/scripts/client/label.js index df01f09a..8721c13c 100644 --- a/scripts/client/label.js +++ b/scripts/client/label.js @@ -318,7 +318,7 @@ function processLabelRendering() { } if (getDistance(localPlayer.position, business.entrancePosition) <= propertyLabelRenderDistance) { - renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, getCurrencyString(business.buyPrice), getCurrencyString(business.rentPrice), business.labelInfoType); + renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, business.buyPrice, business.rentPrice, business.labelInfoType); } } }); @@ -330,7 +330,7 @@ function processLabelRendering() { } if (getDistance(localPlayer.position, house.entrancePosition) <= propertyLabelRenderDistance) { - renderPropertyEntranceLabel(house.description, house.entrancePosition, house.locked, true, getCurrencyString(house.buyPrice), getCurrencyString(house.rentPrice), house.labelInfoType); + renderPropertyEntranceLabel(house.description, house.entrancePosition, house.locked, true, house.buyPrice, house.rentPrice, house.labelInfoType); } } }); @@ -360,11 +360,11 @@ function processLabelRendering() { let rentPrice = "0"; let labelInfoType = AGRP_PROPLABEL_INFO_NONE; if (pickups[i].getData("agrp.label.price") != null) { - price = getCurrencyString(pickups[i].getData("agrp.label.price")); + price = pickups[i].getData("agrp.label.price"); } if (pickups[i].getData("agrp.label.rentprice") != null) { - rentPrice = getCurrencyString(pickups[i].getData("agrp.label.rentprice")); + rentPrice = pickups[i].getData("agrp.label.rentprice"); } if (pickups[i].getData("agrp.label.help") != null) { From 79893be66f972ccd9fe84a88ff536f3c1daf53db Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 16 Oct 2022 17:11:54 -0500 Subject: [PATCH 02/37] Announce more things to discord --- scripts/server/business.js | 32 ++++++++++++++++---------------- scripts/server/command.js | 18 +++++++++--------- scripts/server/developer.js | 12 ++++++------ scripts/server/event.js | 15 +++++++++------ scripts/server/house.js | 16 ++++++++-------- scripts/server/messaging.js | 8 ++++++-- scripts/server/npc.js | 18 ++---------------- scripts/server/staff.js | 6 +++--- scripts/server/vehicle.js | 32 ++++++++++++++++++-------------- 9 files changed, 77 insertions(+), 80 deletions(-) diff --git a/scripts/server/business.js b/scripts/server/business.js index 75b7a0e1..33da7fec 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -327,7 +327,7 @@ function createBusinessCommand(command, params, client) { getPlayerDimension(client), getPlayerData(client).interiorScene); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`, true); } // =========================================================================== @@ -362,7 +362,7 @@ function createBusinessLocationCommand(command, params, client) { let tempBusinessLocationData = createBusinessLocation(locationType, businessId); getServerData().businesses[businessId].push(tempBusinessLocationData); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created location {businessBlue}${params}{MAINCOLOUR} for business {businessBlue}${tempBusinessData.name}`, true); } // =========================================================================== @@ -422,7 +422,7 @@ function deleteBusinessCommand(command, params, client) { } deleteBusiness(businessId, getPlayerData(client).accountData.databaseId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted business {businessBlue}${getBusinessData(businessId).name}`, true); } // =========================================================================== @@ -472,7 +472,7 @@ function setBusinessNameCommand(command, params, client) { getBusinessData(businessId).name = newBusinessName; setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true); getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`, true); } // =========================================================================== @@ -556,7 +556,7 @@ function setBusinessJobCommand(command, params, client) { getBusinessData(businessId).ownerId = getJobData(jobId).databaseId; getBusinessData(businessId).needsSaved = true; - messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to the {jobYellow}${getJobData(jobId).name}`); + messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to the {jobYellow}${getJobData(jobId).name}`); } // =========================================================================== @@ -1075,7 +1075,7 @@ function setBusinessPickupCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup display to {ALTCOLOUR}${typeParam}!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} pickup to {ALTCOLOUR}${typeParam}!`, true); } // =========================================================================== @@ -1113,7 +1113,7 @@ function setBusinessInteriorTypeCommand(command, params, client) { getBusinessData(businessId).exitScene = ""; getBusinessData(businessId).exitPickupModel = -1; getBusinessData(businessId).customInterior = false; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`, true); return false; } @@ -1154,7 +1154,7 @@ function setBusinessInteriorTypeCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -1213,7 +1213,7 @@ function addBusinessPropertyTemplateEntities(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} property template to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -1258,7 +1258,7 @@ function setBusinessBlipCommand(command, params, client) { resetBusinessBlips(businessId); getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip display to {ALTCOLOUR}${typeParam}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} blip to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -1309,7 +1309,7 @@ function giveDefaultItemsToBusinessCommand(command, params, client) { cacheBusinessItems(businessId); updateBusinessPickupLabelData(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${typeParam}`, true); } // =========================================================================== @@ -1334,7 +1334,7 @@ function setBusinessDealershipCommand(command, params, client) { getBusinessData(businessId).labelHelpType == AGRP_PROPLABEL_INFO_ENTERVEHICLE; getBusinessData(businessId).type = AGRP_BIZ_TYPE_DEALERSHIP; updateBusinessPickupLabelData(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the business type of {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the type of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`, true); } // =========================================================================== @@ -1363,7 +1363,7 @@ function deleteBusinessFloorItemsCommand(command, params, client) { cacheBusinessItems(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all on-sale items for business {businessBlue}${getBusinessData(businessId).name}`, true); } // =========================================================================== @@ -1392,7 +1392,7 @@ function deleteBusinessStorageItemsCommand(command, params, client) { cacheBusinessItems(businessId); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all stored items for business {businessBlue}${getBusinessData(businessId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted all storage items for business {businessBlue}${getBusinessData(businessId).name}`, true); } // =========================================================================== @@ -1710,7 +1710,7 @@ function moveBusinessEntranceCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance to their position`, true); } // =========================================================================== @@ -1748,7 +1748,7 @@ function moveBusinessExitCommand(command, params, client) { getBusinessData(businessId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR}exit to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} exit to their position`, true); } // =========================================================================== diff --git a/scripts/server/command.js b/scripts/server/command.js index 6b45fe5a..d05449f8 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -634,7 +634,7 @@ function loadCommands() { new CommandData("vehowner", setVehicleOwnerCommand, "", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehpublic", setVehiclePublicCommand, "", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehclan", setVehicleClanCommand, "", getStaffFlagValue(""), true, true), - new CommandData("vehbiz", setVehicleToBusinessCommand, "", getStaffFlagValue(""), true, true), + new CommandData("vehbiz", setVehicleBusinessCommand, "", getStaffFlagValue(""), true, true), new CommandData("vehjob", setVehicleJobCommand, "[job id/name]", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehdelowner", removeVehicleOwnerCommand, "", getStaffFlagValue("ManageVehicles"), true, true), new CommandData("vehrank", setVehicleRankCommand, "", getStaffFlagValue("None"), true, true), @@ -785,12 +785,12 @@ function disableCommand(command, params, client) { params = toLowerCase(params); if (!getCommand(params)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`); + messagePlayerError(client, `The command {ALTCOLOUR}/${params}{MAINCOLOUR} does not exist!`); return false; } getCommand(params).enabled = false; - messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been disabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} disabled the {ALTCOLOUR}${params}{MAINCOLOUR} command!`, true); return true; } @@ -805,12 +805,12 @@ function enableCommand(command, params, client) { params = toLowerCase(params); if (!getCommand(params)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${params} {MAINCOLOUR} does not exist!`); + messagePlayerError(client, `The command {ALTCOLOUR}/${params}{MAINCOLOUR} does not exist!`); return false; } getCommand(params).enabled = true; - messagePlayerSuccess(client, `Command {ALTCOLOUR}/${params} {MAINCOLOUR}has been enabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} enabled the {ALTCOLOUR}${params}{MAINCOLOUR} command!`, true); return true; } @@ -825,7 +825,7 @@ function disableAllCommandsByType(command, params, client) { params = toLowerCase(params); if (isNull(getServerData().commands[params])) { - messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`); + messagePlayerError(client, `Command type {ALTCOLOUR}${params}{MAINCOLOUR} does not exist!`); return false; } @@ -833,7 +833,7 @@ function disableAllCommandsByType(command, params, client) { getServerData().commands[params][i].enabled = false; } - messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been disabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} disabled all {ALTCOLOUR}${params}{MAINCOLOUR} commands!`, true); return true; } @@ -848,7 +848,7 @@ function enableAllCommandsByType(command, params, client) { params = toLowerCase(params); if (isNull(getServerData().commands[params])) { - messagePlayerError(client, `Command type {ALTCOLOUR}${params} {MAINCOLOUR}does not exist!`); + messagePlayerError(client, `Command type {ALTCOLOUR}${params}{MAINCOLOUR} does not exist!`); return false; } @@ -856,7 +856,7 @@ function enableAllCommandsByType(command, params, client) { getServerData().commands[params][i].enabled = true; } - messagePlayerSuccess(client, `{clanOrange}All {ALTCOLOUR}${params} {MAINCOLOUR}commands have been enabled!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} enabled all {ALTCOLOUR}${params}{MAINCOLOUR} commands!`, true); return true; } diff --git a/scripts/server/developer.js b/scripts/server/developer.js index 72734180..7483736f 100644 --- a/scripts/server/developer.js +++ b/scripts/server/developer.js @@ -152,7 +152,7 @@ function addLogLevelCommand(command, params, client) { } sendPlayerLogLevel(null, logLevel); - messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}enabled log level {ALTCOLOUR}${toLowerCase(params)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} enabled log level {ALTCOLOUR}${toLowerCase(params)}`); return true; } @@ -219,7 +219,7 @@ function removeLogLevelCommand(command, params, client) { } sendPlayerLogLevel(null, logLevel); - messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}disabled log level {ALTCOLOUR}${toLowerCase(params)}`); + messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} disabled log level {ALTCOLOUR}${toLowerCase(params)}`); return true; } @@ -254,7 +254,7 @@ function simulateCommandForPlayerCommand(command, params, client) { } if (!getCommand(tempCommand)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} does not exist! Use /help for commands and information.`); return false; } @@ -288,7 +288,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) { let tempParams = splitParams.slice(1).join(" "); if (!getCommand(tempCommand)) { - messagePlayerError(client, `The command {ALTCOLOUR}/${command} {MAINCOLOUR}does not exist! Use /help for commands and information.`); + messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} does not exist! Use /help for commands and information.`); return false; } @@ -441,9 +441,9 @@ function testErrorGUICommand(command, params, client) { // =========================================================================== function saveServerDataCommand(command, params, client) { - messageAdmins(`{adminOrange}Vortrex{MAINCOLOUR} has forced a manual save of all data. Initiating ...`); + messageAdmins(`{adminOrange}Vortrex{MAINCOLOUR} has forced a manual save of all data. Initiating ...`, true); saveServerDataToDatabase(); - messageAdmins(`{MAINCOLOUR}All server data saved to database successfully!`); + messageAdmins(`{MAINCOLOUR}All server data saved to database successfully!`, true); return true; } diff --git a/scripts/server/event.js b/scripts/server/event.js index aeb89cc1..7b7a3bc0 100644 --- a/scripts/server/event.js +++ b/scripts/server/event.js @@ -133,7 +133,7 @@ function onPlayerQuit(event, client, quitReasonId) { logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (quitReasonId - ${reasonTextEnglish})`); //messageDiscordEventChannel(`👋 ${clientName} has left the server (${reasonTextEnglish})`); - messageDiscordEventChannel(getLanguageLocaleString(englishLocale, "PlayerLeftServer", clientName, reasonTextEnglish)); + messageDiscordEventChannel(`👋 ${getLanguageLocaleString(englishLocale, "PlayerLeftServer", clientName, reasonTextEnglish)}`); getClients().filter(c => c != client).forEach(forClient => { messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", clientName, getGroupedLocaleString(forClient, "DisconnectReasons", disconnectName))); @@ -218,9 +218,10 @@ function onPedExitingVehicle(event, ped, vehicle) { function onResourceStart(event, resource) { logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} started!`); - //if(resource != thisResource) { - // messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`); - //} + if (resource == thisResource) { + //messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`); + messageDiscordEventChannel(`✅ Server is starting up!`); + } } // =========================================================================== @@ -237,6 +238,8 @@ function onResourceStop(event, resource) { saveServerDataToDatabase(); disconnectFromDatabase(persistentDatabaseConnection, true); collectAllGarbage(); + + messageDiscordEventChannel(`⛔ Server is shutting down!`); } } @@ -731,7 +734,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) { setEntityData(vehicle, "agrp.engine", getVehicleData(vehicle).engine, true); //vehicle.netFlags.sendSync = getVehicleData(vehicle).engine; - if (getVehicleData(vehicle).buyPrice > 0 && !doesPlayerHaveVehicleKeys(client, vehicle)) { + if (getVehicleData(vehicle).buyPrice > 0) { messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}${getCurrencyString(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`)); resetVehiclePosition(vehicle); } else if (getVehicleData(vehicle).rentPrice > 0) { @@ -763,7 +766,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) { break; case AGRP_VEHOWNER_BIZ: - ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name; + ownerName = getBusinessData(getBusinessIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name; ownerType = getLocaleString(client, "Business"); break; diff --git a/scripts/server/house.js b/scripts/server/house.js index 92e44614..9bb63d24 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -217,7 +217,7 @@ function createHouseCommand(command, params, client) { } createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getGame()].House, -1, getPlayerInterior(client), getPlayerDimension(client), getPlayerData(client).interiorScene); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created house: {houseGreen}${params}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created house: {houseGreen}${params}`, true); } // =========================================================================== @@ -275,7 +275,7 @@ function setHouseDescriptionCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed house {houseGreen}${oldDescription}{MAINCOLOUR} to {houseGreen}${getHouseData(houseId).description}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed house {houseGreen}${oldDescription}{MAINCOLOUR} to {houseGreen}${getHouseData(houseId).description}`, true); } // =========================================================================== @@ -468,7 +468,7 @@ function setHousePickupCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} pickup display to {ALTCOLOUR}${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} pickup to {ALTCOLOUR}${toLowerCase(typeParam)}`, true); } // =========================================================================== @@ -504,7 +504,7 @@ function setHouseInteriorTypeCommand(command, params, client) { tempHouseLocation.exitInterior = -1; getHouseData(houseId).exitPickupModel = -1; getHouseData(houseId).hasInterior = false; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior`, true); return false; } @@ -534,7 +534,7 @@ function setHouseInteriorTypeCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior type to {ALTCOLOUR}${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} interior type to {ALTCOLOUR}${typeParam}`, true); } // =========================================================================== @@ -585,7 +585,7 @@ function setHouseBlipCommand(command, params, client) { resetHouseBlips(houseId); getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} blip display to {ALTCOLOUR}${toLowerCase(typeParam)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} blip to {ALTCOLOUR}${toLowerCase(typeParam)}`, true); } // =========================================================================== @@ -621,7 +621,7 @@ function moveHouseEntranceCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} entrance to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} entrance to their position`, true); } // =========================================================================== @@ -661,7 +661,7 @@ function moveHouseExitCommand(command, params, client) { getHouseData(houseId).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} exit to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} moved house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} exit to their position`, true); } // =========================================================================== diff --git a/scripts/server/messaging.js b/scripts/server/messaging.js index 483fc1fe..5ab1efa8 100644 --- a/scripts/server/messaging.js +++ b/scripts/server/messaging.js @@ -62,16 +62,20 @@ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) { // =========================================================================== -function messageAdmins(messageText, colour = getColourByName("softRed")) { +function messageAdmins(messageText, announceToEventChannel = false) { let clients = getClients(); for (let i in clients) { if (doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) { - messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour); + messagePlayerNormal(clients[i], `🛡️ ${messageText}`, getColourByName("white")); } } let plainMessage = removeColoursInMessage(messageText); messageDiscordAdminChannel(plainMessage); + + if (announceToEventChannel == true) { + messageDiscordEventChannel(`🛡️ ${plainMessage}`); + } } // =========================================================================== diff --git a/scripts/server/npc.js b/scripts/server/npc.js index e9e4df44..d476607c 100644 --- a/scripts/server/npc.js +++ b/scripts/server/npc.js @@ -515,7 +515,7 @@ function deleteNPCCommand(command, params, client) { let npcName = getNPCData(closestNPC).name; deleteNPC(closestNPC); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted NPC {npcPink}${npcName}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} deleted NPC {npcPink}${npcName}`, true); } // =========================================================================== @@ -619,7 +619,7 @@ function setNPCClanCommand(command, params, client) { getNPCData(closestNPC).ownerId = getClanData(clanId).databaseId; getNPCData(closestNPC).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`, true); } // =========================================================================== @@ -631,25 +631,11 @@ function addNPCTriggerCommand(command, params, client) { } let closestNPC = getClosestNPC(getPlayerPosition(client), getPlayerDimension(client), getPlayerInterior(client)); - let clanId = getClanFromParams(params); if (!getNPCData(closestNPC)) { messagePlayerError(client, getLocaleString(client, "InvalidNPC")); return false; } - - if (!getClanData(clanId)) { - messagePlayerError(client, getLocaleString(client, "InvalidClan")); - return false; - } - - //let triggerData = new TriggerData(); - - getNPCData(closestNPC).ownerType = AGRP_NPC_OWNER_CLAN; - getNPCData(closestNPC).ownerId = getClanData(clanId).databaseId; - getNPCData(closestNPC).needsSaved = true; - - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set {npcPink}${getNPCData(closestNPC).name}${MAINCOLOUR}'s clan to {clanOrange}${getClanData(clanId).name}`); } // =========================================================================== diff --git a/scripts/server/staff.js b/scripts/server/staff.js index 0c96796c..dff13093 100644 --- a/scripts/server/staff.js +++ b/scripts/server/staff.js @@ -394,7 +394,7 @@ function getVehicleCommand(command, params, client) { setElementInterior(vehicle, getPlayerInterior(client)); setElementDimension(vehicle, getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported a {vehiclePurple}${getVehicleName(vehicle)}{ALTCOLOUR} (ID ${vehicle.id}){MAINCOLOUR} to their position`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported a {vehiclePurple}${getVehicleName(vehicle)}{ALTCOLOUR} (ID ${vehicle.id}){MAINCOLOUR} to their position`, true); } // =========================================================================== @@ -888,7 +888,7 @@ function getPlayerCommand(command, params, client) { setPlayerInterior(targetClient, getPlayerInterior(client)); setPlayerDimension(targetClient, getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their position.`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} teleported {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their position.`, true); messagePlayerAlert(targetClient, `An admin has teleported you to their location`); } @@ -935,7 +935,7 @@ function returnPlayerCommand(command, params, client) { getPlayerData(targetClient).returnToBusiness = null; getPlayerData(targetClient).returnToType = AGRP_RETURNTO_TYPE_NONE; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} returned {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their previous position.`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} returned {ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR} to their previous position.`, true); messagePlayerAlert(targetClient, `An admin has returned you to your previous location`); } diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js index b7189b92..ebe14652 100644 --- a/scripts/server/vehicle.js +++ b/scripts/server/vehicle.js @@ -375,7 +375,7 @@ function createVehicleCommand(command, params, client) { let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance); let vehicle = createPermanentVehicle(modelIndex, frontPos, heading, getPlayerInterior(client), getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a {vehiclePurple}${getVehicleName(vehicle)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a {vehiclePurple}${getVehicleName(vehicle)}`, true); } // =========================================================================== @@ -396,7 +396,7 @@ function createTemporaryVehicleCommand(command, params, client) { let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance); let vehicle = createTemporaryVehicle(modelIndex, frontPos, getPlayerHeading(client), getPlayerInterior(client), getPlayerDimension(client)); - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a temporary {vehiclePurple}${getVehicleName(vehicle)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created a temporary {vehiclePurple}${getVehicleName(vehicle)}`, true); } // =========================================================================== @@ -902,7 +902,7 @@ function setVehicleJobCommand(command, params, client) { getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job! (Job ID ${jobId})`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job! (Job ID ${jobId})`, true); } // =========================================================================== @@ -933,10 +933,10 @@ function setVehicleRankCommand(command, params, client) { return false; } getVehicleData(vehicle).rank = getClanRankData(getVehicleData(vehicle).ownerId, rankId).databaseId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rank to {ALTCOLOUR}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name}{MAINCOLOUR} of the {clanOrange}${getClanData(getVehicleData(vehicle).ownerId).name}{MAINCOLOUR} clan!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} minimum rank to {ALTCOLOUR}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name}{MAINCOLOUR} of the {clanOrange}${getClanData(getVehicleData(vehicle).ownerId).name}{MAINCOLOUR} clan!`, true); } else if (getVehicleData(vehicle).ownerType == AGRP_VEHOWNER_JOB) { getVehicleData(vehicle).rank = rankId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rank to {ALTCOLOUR}${rankId}{MAINCOLOUR} of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name}{MAINCOLOUR} job!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} minimum rank to {ALTCOLOUR}${rankId}{MAINCOLOUR} of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name}{MAINCOLOUR} job!`, true); } getVehicleData(vehicle).needsSaved = true; @@ -981,14 +981,18 @@ function setVehicleClanCommand(command, params, client) { // =========================================================================== -function setVehicleToBusinessCommand(command, params, client) { +function setVehicleBusinessCommand(command, params, client) { if (!isPlayerInAnyVehicle(client)) { messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle")); return false; } let vehicle = getPlayerVehicle(client); - let businessId = getPlayerBusiness(client); + let businessId = getClosestBusinessEntrance(client); + + if (doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses")) && !isNull(params)) { + businessId = getBusinessFromParams(params); + } if (!getVehicleData(vehicle)) { messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled")); @@ -1003,7 +1007,7 @@ function setVehicleToBusinessCommand(command, params, client) { getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_BIZ; getVehicleData(vehicle).ownerId = getBusinessData(businessId).databaseId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}business`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to the {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}business`, true); getVehicleData(vehicle).needsSaved = true; } @@ -1032,7 +1036,7 @@ function setVehicleOwnerCommand(command, params, client) { getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_PLAYER; getVehicleData(vehicle).ownerId = getPlayerCurrentSubAccount(targetClient).databaseId; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to {ALTCOLOUR}${getClientSubAccountName(targetClient)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to {ALTCOLOUR}${getClientSubAccountName(targetClient)}`, true); getVehicleData(vehicle).needsSaved = true; } @@ -1055,7 +1059,7 @@ function setVehiclePublicCommand(command, params, client) { getVehicleData(vehicle).ownerType = AGRP_VEHOWNER_PUBLIC; getVehicleData(vehicle).ownerId = 0; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to a public vehicle!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to a public vehicle!`, true); getVehicleData(vehicle).needsSaved = true; } @@ -1086,7 +1090,7 @@ function setVehicleRentPriceCommand(command, params, client) { getVehicleData(vehicle).rentPrice = amount; getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rent price to {ALTCOLOUR}${getCurrencyString(amount)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} rent price to {ALTCOLOUR}${getCurrencyString(amount)}`, true); } // =========================================================================== @@ -1115,7 +1119,7 @@ function setVehicleBuyPriceCommand(command, params, client) { getVehicleData(vehicle).buyPrice = amount; getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}'s{MAINCOLOUR} buy price to {ALTCOLOUR}${getCurrencyString(amount)}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}'s{MAINCOLOUR} buy price to {ALTCOLOUR}${getCurrencyString(amount)}`, true); } // =========================================================================== @@ -1144,7 +1148,7 @@ function removeVehicleOwnerCommand(command, params, client) { getVehicleData(vehicle).needsSaved = true; - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to nobody!`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} owner to nobody!`, true); messagePlayerInfo(client, `Nobody will be able to use this vehicle until it receives a new owner (either bought or set by admin).`); } @@ -1296,7 +1300,7 @@ function toggleVehicleSpawnLockCommand(command, params, client) { getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle); } - messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to spawn {ALTCOLOUR}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`); + messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set their {vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR} to spawn {ALTCOLOUR}${(getVehicleData(vehicle).spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`, true); getVehicleData(vehicle).needsSaved = true; } From 0aacfdd818d75e7a2f371f3b744c077e99a39fba Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 17 Oct 2022 15:53:40 -0500 Subject: [PATCH 03/37] GUI fixes --- scripts/client/gui.js | 48 ++++++++++++++++++++++++ scripts/client/gui/games/5-card-poker.js | 9 ----- scripts/client/gui/games/5cardpoker.js | 40 ++++++++++++++++++++ scripts/client/gui/games/blackjack.js | 4 +- scripts/client/gui/inventory.js | 45 ++++++++++++++++++++++ scripts/client/gui/inventorybulk.js | 45 ++++++++++++++++++++++ scripts/client/gui/localechooser.js | 5 +-- 7 files changed, 181 insertions(+), 15 deletions(-) delete mode 100644 scripts/client/gui/games/5-card-poker.js create mode 100644 scripts/client/gui/games/5cardpoker.js create mode 100644 scripts/client/gui/inventory.js create mode 100644 scripts/client/gui/inventorybulk.js diff --git a/scripts/client/gui.js b/scripts/client/gui.js index 2093a6d6..f5c4b549 100644 --- a/scripts/client/gui.js +++ b/scripts/client/gui.js @@ -62,6 +62,14 @@ function initGUI() { initResetPasswordGUI(); initChangePasswordGUI(); initLocaleChooserGUI(); + initInventoryGUI(); + initInventoryBulkGUI(); + //initClanManagerGUI(); + //initBusinessManagerGUI(); + //initHouseManagerGUI(); + initFiveCardPokerGUI(); + initBettingGUI(); + initBlackJackGUI(); closeAllWindows(); guiReady = true; @@ -87,6 +95,14 @@ function closeAllWindows() { passwordReset.window.shown = false; passwordChange.window.shown = false; localeChooser.window.shown = false; + //houseManager.window.shown = false; + //businessManager.window.shown = false; + //clanManager.window.shown = false; + inventoryGUI.window.shown = false; + inventoryBulkGUI.window.shown = false; + bettingGUI.window.shown = false; + blackJackGUI.window.shown = false; + fiveCardPokerGUI.window.shown = false; mexui.setInput(false); mexui.focusedControl = false; @@ -155,6 +171,38 @@ function isAnyGUIActive() { return true; } + //if (clanManager.window.shown == true) { + // return true; + //} + + //if (businessManager.window.shown == true) { + // return true; + //} + + //if (houseManager.window.shown == true) { + // return true; + //} + + if (inventorGUI.window.shown == true) { + return true; + } + + if (inventoryBulkGUI.window.shown == true) { + return true; + } + + if (bettingGUI.window.shown == true) { + return true; + } + + if (blackJackGUI.window.shown == true) { + return true; + } + + if (fiveCardPokerGUI.window.shown == true) { + return true; + } + return false; } diff --git a/scripts/client/gui/games/5-card-poker.js b/scripts/client/gui/games/5-card-poker.js deleted file mode 100644 index d254829b..00000000 --- a/scripts/client/gui/games/5-card-poker.js +++ /dev/null @@ -1,9 +0,0 @@ -// =========================================================================== -// Asshat Gaming Roleplay -// https://github.com/VortrexFTW/agrp_main -// (c) 2022 Asshat Gaming -// =========================================================================== -// FILE: 5cardpoker.js -// DESC: Provides 5-card poker games GUI -// TYPE: Client (JavaScript) -// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/games/5cardpoker.js b/scripts/client/gui/games/5cardpoker.js new file mode 100644 index 00000000..47ecbfa0 --- /dev/null +++ b/scripts/client/gui/games/5cardpoker.js @@ -0,0 +1,40 @@ +// =========================================================================== +// Asshat Gaming Roleplay +// https://github.com/VortrexFTW/agrp_main +// (c) 2022 Asshat Gaming +// =========================================================================== +// FILE: 5cardpoker.js +// DESC: Provides 5-card poker games GUI +// TYPE: Client (JavaScript) +// =========================================================================== + +let fiveCardPokerGUI = { + window: null, +} + +function initFiveCardPokerGUI() { + // Render a five card poker game in MexUI + //logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating five-card poker GUI ...`); + fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', { + main: { + backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0), + }, + title: { + textSize: 11.0, + textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255), + backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha), + }, + icon: { + textSize: 0.0, + textColour: toColour(0, 0, 0, 0), + backgroundColour: toColour(0, 0, 0, 0), + }, + }); + fiveCardPokerGUI.window.titleBarShown = false; + + fiveCardPokerGUI.window.shown = false; + + logToConsole(LOG_DEBUG, `[AGRP.GUI] Created five card poker GUI`); +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/games/blackjack.js b/scripts/client/gui/games/blackjack.js index ee0e7ad3..5d65747a 100644 --- a/scripts/client/gui/games/blackjack.js +++ b/scripts/client/gui/games/blackjack.js @@ -23,7 +23,7 @@ let dealerCards = []; function initBlackJackGUI() { // Render a blackjack game in MexUI - //logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`); blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', { main: { backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0), @@ -43,7 +43,7 @@ function initBlackJackGUI() { blackJackGUI.window.shown = false; - //logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`); } // =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/inventory.js b/scripts/client/gui/inventory.js new file mode 100644 index 00000000..fcfd1a45 --- /dev/null +++ b/scripts/client/gui/inventory.js @@ -0,0 +1,45 @@ +// =========================================================================== +// Asshat Gaming Roleplay +// https://github.com/VortrexFTW/agrp_main +// (c) 2022 Asshat Gaming +// =========================================================================== +// FILE: inventory.js +// DESC: Provides inventory dialog box GUI +// TYPE: Client (JavaScript) +// =========================================================================== + +let inventoryGUI = [ + { + window: null, + }, + { + window: null, + }, +]; + +// =========================================================================== + +function initInventoryGUI() { + +} + +// =========================================================================== + +function closeAllInventoryGUI() { + logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all inventory GUI`); + for (let i in inventoryGUI) { + inventoryGUI[i].window.shown = false; + } + mexui.setInput(false); +} + +// =========================================================================== + +function showInventoryGUI(inventoryIndex, items) { + closeAllWindows(); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing inventory window. Index: ${inventoryIndex}`); + inventoryGUI[inventoryIndex].window.shown = true; + mexui.setInput(true); +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/inventorybulk.js b/scripts/client/gui/inventorybulk.js new file mode 100644 index 00000000..d311a5d9 --- /dev/null +++ b/scripts/client/gui/inventorybulk.js @@ -0,0 +1,45 @@ +// =========================================================================== +// Asshat Gaming Roleplay +// https://github.com/VortrexFTW/agrp_main +// (c) 2022 Asshat Gaming +// =========================================================================== +// FILE: inventorybulk.js +// DESC: Provides bulk inventory box GUI +// TYPE: Client (JavaScript) +// =========================================================================== + +let inventoryBulkGUI = [ + { + window: null, + }, + { + window: null, + }, +]; + +// =========================================================================== + +function initInventoryBulkGUI() { + +} + +// =========================================================================== + +function closeAllInventoryBulkGUI() { + logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all bulk inventory GUI`); + for (let i in inventoryBulkGUI) { + inventoryBulkGUI[i].window.shown = false; + } + mexui.setInput(false); +} + +// =========================================================================== + +function showInventoryBulkGUI(inventoryIndex, items) { + closeAllWindows(); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`); + inventoryBulkGUI[inventoryIndex].window.shown = true; + mexui.setInput(true); +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/localechooser.js b/scripts/client/gui/localechooser.js index dc7dcdb5..db3b26e1 100644 --- a/scripts/client/gui/localechooser.js +++ b/scripts/client/gui/localechooser.js @@ -57,9 +57,6 @@ function closeLocaleChooserGUI() { // =========================================================================== function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) { - // Disabled for now until image loading crash can be fixed - //return false; - if (position.x != 0.0 && position.y != 0.0) { localeChooser.window.position = position; } else { @@ -79,7 +76,7 @@ function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) { // =========================================================================== function toggleLocaleChooserGUI() { - if (localeChooser.window.shown) { + if (localeChooser.window.shown == true) { closeLocaleChooserGUI(); } else { showLocaleChooserGUI(); From 583e4c525221b7144376acfc8cdb2b73489ae372 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 17 Oct 2022 15:53:54 -0500 Subject: [PATCH 04/37] Add GUI stuff to meta.xml --- meta.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/meta.xml b/meta.xml index 087714c1..db939fa6 100644 --- a/meta.xml +++ b/meta.xml @@ -10,7 +10,7 @@