From 39badd110621dd1f83157224b1b56192e15bd37d Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 3 May 2022 12:03:28 -0500 Subject: [PATCH] Use confirmation prompt for buying business --- scripts/server/business.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/server/business.js b/scripts/server/business.js index 7006081a..7cfe2137 100644 --- a/scripts/server/business.js +++ b/scripts/server/business.js @@ -402,16 +402,22 @@ function setBusinessClanCommand(command, params, client) { return false; } - if(!canPlayerManageBusiness(client, businessId)) { - messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); + if(getBusinessData(business).ownerType != VRR_VEHOWNER_PLAYER) { + messagePlayerError(client, getLocaleString(client, "MustOwnBusiness")); return false; } - getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN; - getBusinessData(businessId).ownerId = getClanData(clanId).databaseId; - getBusinessData(businessId).needsSaved = true; + if(getBusinessData(business).ownerId != getPlayerCurrentSubAccount(client).databaseId) { + messagePlayerError(client, getLocaleString(client, "MustOwnBusiness")); + return false; + } - messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`); + showPlayerPrompt(client, getLocaleString(client, "SetBusinessClanConfirmMessage"), getLocaleString(client, "SetBusinessClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No")); + getPlayerData(client).promptType = VRR_PROMPT_GIVEBIZTOCLAN; + + //getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN; + //getBusinessData(businessId).ownerId = getClanData(clanId).databaseId; + //getBusinessData(businessId).needsSaved = true; } // =========================================================================== @@ -1343,14 +1349,8 @@ function buyBusinessCommand(command, params, client) { return false; } - getBusinessData(businessId).ownerType = VRR_BIZOWNER_PLAYER; - getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(client).databaseId; - getBusinessData(businessId).buyPrice = 0; - - updateBusinessPickupLabelData(businessId); - getBusinessData(businessId).needsSaved = true; - - messagePlayerSuccess(client, `You are now the owner of {businessBlue}${getBusinessData(businessId).name}`); + showPlayerPrompt(client, getLocaleString(client, "BuyBusinessConfirmMessage"), getLocaleString(client, "BuyBusinessConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No")); + getPlayerData(client).promptType = VRR_PROMPT_BUYBIZ; } // ===========================================================================