Show confirm GUI on bizorder, fix set pickup cmd

This commit is contained in:
Vortrex
2021-01-19 04:41:13 -06:00
parent e7bc28255a
commit cbfb6180c6

View File

@@ -514,7 +514,7 @@ function withdrawFromBusinessCommand(command, params, client) {
getServerData().businesses[businessId].till -= amount; getServerData().businesses[businessId].till -= amount;
getPlayerCurrentSubAccount(client).cash += amount; getPlayerCurrentSubAccount(client).cash += amount;
updatePlayerCash(client); updatePlayerCash(client);
messagePlayerSuccess(client, `You withdrew $${amount} from business '${tempBusinessData.name}''s till'`); messagePlayerSuccess(client, `You withdrew $${amount} from business [#0099FF]${tempBusinessData.name} till'`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -543,7 +543,7 @@ function depositIntoBusinessCommand(command, params, client) {
getServerData().businesses[businessId].till += amount; getServerData().businesses[businessId].till += amount;
getPlayerCurrentSubAccount(client).cash -= amount; getPlayerCurrentSubAccount(client).cash -= amount;
updatePlayerCash(client); updatePlayerCash(client);
messagePlayerSuccess(client, `You deposited $${amount} into business '${tempBusinessData.name}''s till'`); messagePlayerSuccess(client, `You deposited $${amount} into business [#0099FF]${tempBusinessData.name} [#FFFFFF]till'`);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -556,9 +556,9 @@ function orderItemForBusinessCommand(command, params, client) {
let splitParams = params.split(" "); let splitParams = params.split(" ");
let itemType = getItemTypeFromParams(splitParams[0]); let itemType = getItemTypeFromParams(splitParams.slice(0,-2).join(" "));
let amount = toInteger(splitParams[1]) || 1; let amount = toInteger(splitParams.slice(-2,-1)) || 1;
let sellPrice = toInteger(splitParams[2]) || 0; let sellPrice = toInteger(splitParams.slice(-1)) || 0;
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)); let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
if(!getBusinessData(businessId)) { if(!getBusinessData(businessId)) {
@@ -572,8 +572,20 @@ function orderItemForBusinessCommand(command, params, client) {
return false; return false;
} }
let orderTotalCost = getItemTypeData(itemType).orderPrice*getServerConfig().inflationMultiplier*getItemTypeData(itemType).demandMultiplier*getItemTypeData(itemType).supplyMultiplier*getItemTypeData(itemType).riskMultiplier*amount; let pricePerItem = getItemTypeData(itemType).orderPrice*getServerConfig().inflationMultiplier*getItemTypeData(itemType).demandMultiplier*getItemTypeData(itemType).supplyMultiplier*getItemTypeData(itemType).riskMultiplier;
let orderTotalCost = pricePerItem*amount;
getPlayerData(client).promptType = AG_PROMPT_BIZORDER;
getPlayerData(client).businessOrderAmount = amount;
getPlayerData(client).businessOrderBusiness = businessId;
getPlayerData(client).businessOrderItem = itemType;
showPlayerPromptGUI(client, `This order will cost [#AAAAAA]$${orderTotalCost} (${amount} at $${pricePerItem} each)`, "Business Order Cost");
}
// ---------------------------------------------------------------------------
function orderItemForBusiness(businessId, itemType, amount, sellPrice) {
if(getBusinessData(businessId).till < orderTotalCost) { if(getBusinessData(businessId).till < orderTotalCost) {
let neededAmount = orderTotalCost-getBusinessData(businessId).till; let neededAmount = orderTotalCost-getBusinessData(businessId).till;
messagePlayerError(client, `The business doesn't have enough money (needs [#AAAAAA]$${neededAmount} [#FFFFFF]more)! Use [#AAAAAA]/bizdeposit [#FFFFFF]to add money to the business.`); messagePlayerError(client, `The business doesn't have enough money (needs [#AAAAAA]$${neededAmount} [#FFFFFF]more)! Use [#AAAAAA]/bizdeposit [#FFFFFF]to add money to the business.`);
@@ -942,7 +954,7 @@ function deleteBusinessEntrancePickup(businessId) {
if(getBusinessData(businessId).entrancePickup != null) { if(getBusinessData(businessId).entrancePickup != null) {
//removeFromWorld(getBusinessData(businessId).entrancePickup); //removeFromWorld(getBusinessData(businessId).entrancePickup);
destroyElement(getBusinessData(businessId).entrancePickup); destroyElement(getBusinessData(businessId).entrancePickup);
getBusinessData(businessId).entrancePickup = false; getBusinessData(businessId).entrancePickup = null;
} }
} }
@@ -952,7 +964,7 @@ function deleteBusinessExitPickup(businessId) {
if(getBusinessData(businessId).exitPickup != null) { if(getBusinessData(businessId).exitPickup != null) {
//removeFromWorld(getBusinessData(businessId).exitPickup); //removeFromWorld(getBusinessData(businessId).exitPickup);
destroyElement(getBusinessData(businessId).exitPickup); destroyElement(getBusinessData(businessId).exitPickup);
getBusinessData(businessId).exitPickup = false; getBusinessData(businessId).exitPickup = null;
} }
} }
@@ -962,7 +974,7 @@ function deleteBusinessEntranceBlip(businessId) {
if(getBusinessData(businessId).entranceBlip != null) { if(getBusinessData(businessId).entranceBlip != null) {
//removeFromWorld(getBusinessData(businessId).entranceBlip); //removeFromWorld(getBusinessData(businessId).entranceBlip);
destroyElement(getBusinessData(businessId).entranceBlip); destroyElement(getBusinessData(businessId).entranceBlip);
getBusinessData(businessId).entranceBlip = false; getBusinessData(businessId).entranceBlip = null;
} }
} }
@@ -972,7 +984,7 @@ function deleteBusinessExitBlip(businessId) {
if(getBusinessData(businessId).exitBlip != null) { if(getBusinessData(businessId).exitBlip != null) {
//removeFromWorld(getBusinessData(businessId).exitBlip); //removeFromWorld(getBusinessData(businessId).exitBlip);
destroyElement(getBusinessData(businessId).exitBlip); destroyElement(getBusinessData(businessId).exitBlip);
getBusinessData(businessId).exitBlip = false; getBusinessData(businessId).exitBlip = null;
} }
} }