From 17e6bef100b64605acc1d9d37dc77c68121a2f2c Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Wed, 8 Mar 2023 12:10:06 -0600 Subject: [PATCH] Who/when added business --- scripts/server/business.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/server/business.js b/scripts/server/business.js index 2dc73fab..0bfab887 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -95,6 +95,9 @@ class BusinessData { this.labelHelpType = V_PROPLABEL_INFO_NONE; + this.whoAdded = 0; + this.whenAdded = 0; + if (dbAssoc) { this.databaseId = toInteger(dbAssoc["biz_id"]); this.name = toString(dbAssoc["biz_name"]); @@ -124,9 +127,10 @@ class BusinessData { this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]); this.till = toInteger(dbAssoc["biz_till"]); - this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]); this.streamingRadioStation = toInteger(dbAssoc["biz_radio_station"]); + this.whoAdded = toInteger(dbAssoc["biz_who_added"]); + this.whenAdded = toInteger(dbAssoc["biz_when_added"]); } }; }; @@ -315,7 +319,9 @@ function createBusinessCommand(command, params, client) { -1, getPlayerInterior(client), getPlayerDimension(client), - getPlayerData(client).interiorScene); + getPlayerData(client).interiorScene, + getPlayerData(client).accountData.databaseId + ); messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`, true); } @@ -357,7 +363,7 @@ function createBusinessLocationCommand(command, params, client) { // =========================================================================== -function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1) { +function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1, whoAdded = defaultNoAccountId) { let tempBusinessData = new BusinessData(false); tempBusinessData.name = name; @@ -377,6 +383,9 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode tempBusinessData.exitDimension = 0; tempBusinessData.exitScene = -1; + tempBusinessData.whoAdded = whoAdded; + tempBusinessData.whenAdded = getCurrentUnixTimestamp(); + tempBusinessData.needsSaved = true; let businessId = getServerData().businesses.push(tempBusinessData); setBusinessDataIndexes(); @@ -1933,6 +1942,8 @@ function saveBusinessToDatabase(businessId) { ["biz_radio_station", (getRadioStationData(tempBusinessData.streamingRadioStationIndex) != false) ? toInteger(getRadioStationData(tempBusinessData.streamingRadioStationIndex).databaseId) : -1], ["biz_custom_interior", boolToInt(tempBusinessData.customInterior)], ["biz_buy_price", tempBusinessData.buyPrice], + ["biz_who_added", tempBusinessData.whoAdded], + ["biz_when_added", tempBusinessData.whenAdded], //["biz_rent_price", tempBusinessData.rentPrice], ];