Change copyright, consts, and net events prefix
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
// ===========================================================================
|
||||
// Asshat Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/agrp_main
|
||||
// (c) 2022 Asshat Gaming
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/v-roleplay
|
||||
// ===========================================================================
|
||||
// FILE: business.js
|
||||
// DESC: Provides business functions and usage
|
||||
@@ -9,34 +8,34 @@
|
||||
// ===========================================================================
|
||||
|
||||
// Business Types
|
||||
const AGRP_BIZ_TYPE_NONE = 0; // None (invalid)
|
||||
const AGRP_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
|
||||
const AGRP_BIZ_TYPE_BANK = 2; // Bank
|
||||
const AGRP_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
|
||||
const AGRP_BIZ_TYPE_PAINTBALL = 4; // Paintball arena. Player joins paintball/airsoft when they enter
|
||||
const AGRP_BIZ_TYPE_DEALERSHIP = 5; // Vehicle Dealership (also for airplane, boat, etc)
|
||||
const V_BIZ_TYPE_NONE = 0; // None (invalid)
|
||||
const V_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
|
||||
const V_BIZ_TYPE_BANK = 2; // Bank
|
||||
const V_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
|
||||
const V_BIZ_TYPE_PAINTBALL = 4; // Paintball arena. Player joins paintball/airsoft when they enter
|
||||
const V_BIZ_TYPE_DEALERSHIP = 5; // Vehicle Dealership (also for airplane, boat, etc)
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Business Location Types
|
||||
const AGRP_BIZ_LOC_NONE = 0; // None
|
||||
const AGRP_BIZ_LOC_GATE = 1; // Center of any moveable gate that belongs to the biz
|
||||
const AGRP_BIZ_LOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
|
||||
const AGRP_BIZ_LOC_FUEL = 3; // Fuel pump
|
||||
const AGRP_BIZ_LOC_DRIVETHRU = 4; // Drivethrough
|
||||
const AGRP_BIZ_LOC_VENDMACHINE = 5; // Vending machine
|
||||
const AGRP_BIZ_LOC_ATM = 6; // ATM
|
||||
const AGRP_BIZ_LOC_PAYPHONE = 7; // Payphone
|
||||
const V_BIZ_LOC_NONE = 0; // None
|
||||
const V_BIZ_LOC_GATE = 1; // Center of any moveable gate that belongs to the biz
|
||||
const V_BIZ_LOC_GARAGE = 2; // Location for attached garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
|
||||
const V_BIZ_LOC_FUEL = 3; // Fuel pump
|
||||
const V_BIZ_LOC_DRIVETHRU = 4; // Drivethrough
|
||||
const V_BIZ_LOC_VENDMACHINE = 5; // Vending machine
|
||||
const V_BIZ_LOC_ATM = 6; // ATM
|
||||
const V_BIZ_LOC_PAYPHONE = 7; // Payphone
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Business Owner Types
|
||||
const AGRP_BIZ_OWNER_NONE = 0; // Not owned
|
||||
const AGRP_BIZ_OWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const AGRP_BIZ_OWNER_JOB = 2; // Owned by a job
|
||||
const AGRP_BIZ_OWNER_CLAN = 3; // Owned by a clan
|
||||
const AGRP_BIZ_OWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const AGRP_BIZ_OWNER_PUBLIC = 5; // Public Business. Used for goverment/official places like police, fire, city hall, DMV, etc
|
||||
const V_BIZ_OWNER_NONE = 0; // Not owned
|
||||
const V_BIZ_OWNER_PLAYER = 1; // Owned by a player (character/subaccount)
|
||||
const V_BIZ_OWNER_JOB = 2; // Owned by a job
|
||||
const V_BIZ_OWNER_CLAN = 3; // Owned by a clan
|
||||
const V_BIZ_OWNER_FACTION = 4; // Owned by a faction (not used at the moment)
|
||||
const V_BIZ_OWNER_PUBLIC = 5; // Public Business. Used for goverment/official places like police, fire, city hall, DMV, etc
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -50,7 +49,7 @@ class BusinessData {
|
||||
constructor(dbAssoc = false) {
|
||||
this.databaseId = 0;
|
||||
this.name = "";
|
||||
this.ownerType = AGRP_BIZ_OWNER_NONE;
|
||||
this.ownerType = V_BIZ_OWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
this.buyPrice = 0;
|
||||
this.locked = false;
|
||||
@@ -58,8 +57,8 @@ class BusinessData {
|
||||
this.index = -1;
|
||||
this.needsSaved = false;
|
||||
this.interiorLights = true;
|
||||
this.type = AGRP_BIZ_TYPE_NONE;
|
||||
this.propertyType = AGRP_PROPERTY_TYPE_BUSINESS;
|
||||
this.type = V_BIZ_TYPE_NONE;
|
||||
this.propertyType = V_PROPERTY_TYPE_BUSINESS;
|
||||
|
||||
this.floorItemCache = [];
|
||||
this.storageItemCache = [];
|
||||
@@ -94,7 +93,7 @@ class BusinessData {
|
||||
|
||||
this.paintBallPlayers = [];
|
||||
|
||||
this.labelHelpType = AGRP_PROPLABEL_INFO_NONE;
|
||||
this.labelHelpType = V_PROPLABEL_INFO_NONE;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["biz_id"]);
|
||||
@@ -461,7 +460,7 @@ function setBusinessNameCommand(command, params, client) {
|
||||
|
||||
let oldBusinessName = getBusinessData(businessId).name;
|
||||
getBusinessData(businessId).name = newBusinessName;
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.name", getBusinessData(businessId).name, true);
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`, true);
|
||||
}
|
||||
@@ -501,7 +500,7 @@ function setBusinessOwnerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_PLAYER;
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PLAYER;
|
||||
getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
|
||||
@@ -543,7 +542,7 @@ function setBusinessJobCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_JOB;
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
||||
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
|
||||
@@ -576,7 +575,7 @@ function setBusinessClanCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getBusinessData(business).ownerType != AGRP_VEHOWNER_PLAYER) {
|
||||
if (getBusinessData(business).ownerType != V_VEHOWNER_PLAYER) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
|
||||
return false;
|
||||
}
|
||||
@@ -588,9 +587,9 @@ function setBusinessClanCommand(command, params, client) {
|
||||
|
||||
// Use confirm prompt
|
||||
showPlayerPrompt(client, getLocaleString(client, "SetBusinessClanConfirmMessage"), getLocaleString(client, "SetBusinessClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||
getPlayerData(client).promptType = AGRP_PROMPT_GIVEBIZTOCLAN;
|
||||
getPlayerData(client).promptType = V_PROMPT_GIVEBIZTOCLAN;
|
||||
|
||||
//getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_CLAN;
|
||||
//getBusinessData(businessId).ownerType = V_BIZ_OWNER_CLAN;
|
||||
//getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
|
||||
//getBusinessData(businessId).needsSaved = true;
|
||||
}
|
||||
@@ -621,7 +620,7 @@ function setBusinessRankCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getVehicleData(vehicle).ownerType == AGRP_VEHOWNER_CLAN) {
|
||||
if (getVehicleData(vehicle).ownerType == V_VEHOWNER_CLAN) {
|
||||
let clanId = getClanIndexFromDatabaseId(getBusinessData(businessId).ownerId);
|
||||
rankId = getClanRankFromParams(clanId, params);
|
||||
if (!getClanRankData(clanId, rankId)) {
|
||||
@@ -630,7 +629,7 @@ function setBusinessRankCommand(command, params, client) {
|
||||
}
|
||||
getBusinessData(businessId).rank = getClanRankData(clanId, rankId).databaseId;
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${getClanRankData(clanId, rankId).name} {MAINCOLOUR}of the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`);
|
||||
} else if (getBusinessData(businessId).ownerType == AGRP_VEHOWNER_JOB) {
|
||||
} else if (getBusinessData(businessId).ownerType == V_VEHOWNER_JOB) {
|
||||
getBusinessData(businessId).rank = rankId;
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}rank to {ALTCOLOUR}${rankId} {MAINCOLOUR}of the {jobYellow}${getJobData(getJobIdFromDatabaseId(getBusinessData(businessId).ownerId)).name} {MAINCOLOUR}job!`);
|
||||
}
|
||||
@@ -727,7 +726,7 @@ function setBusinessJobCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_JOB;
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
||||
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
@@ -757,7 +756,7 @@ function setBusinessPublicCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_PUBLIC;
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PUBLIC;
|
||||
getBusinessData(businessId).ownerId = 0;
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
@@ -787,7 +786,7 @@ function removeBusinessOwnerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).ownerType = AGRP_BIZ_OWNER_NONE;
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_NONE;
|
||||
getBusinessData(businessId).ownerId = -1;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
|
||||
@@ -880,7 +879,7 @@ function setBusinessPaintBallCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).type = AGRP_BIZ_TYPE_PAINTBALL;
|
||||
getBusinessData(businessId).type = V_BIZ_TYPE_PAINTBALL;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "BusinessIsNowPaintBall"));
|
||||
}
|
||||
@@ -912,24 +911,24 @@ function getBusinessInfoCommand(command, params, client) {
|
||||
|
||||
let ownerName = "Unknown";
|
||||
switch (businessData.ownerType) {
|
||||
case AGRP_BIZ_OWNER_CLAN:
|
||||
case V_BIZ_OWNER_CLAN:
|
||||
ownerName = getClanData(businessData.ownerId).name;
|
||||
break;
|
||||
|
||||
case AGRP_BIZ_OWNER_JOB:
|
||||
case V_BIZ_OWNER_JOB:
|
||||
ownerName = getJobData(businessData.ownerId).name;
|
||||
break;
|
||||
|
||||
case AGRP_BIZ_OWNER_PLAYER:
|
||||
case V_BIZ_OWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(businessData.ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
|
||||
break;
|
||||
|
||||
case AGRP_BIZ_OWNER_PUBLIC:
|
||||
case V_BIZ_OWNER_PUBLIC:
|
||||
ownerName = "Public";
|
||||
break;
|
||||
|
||||
case AGRP_BIZ_OWNER_NONE:
|
||||
case V_BIZ_OWNER_NONE:
|
||||
//submitBugReport(client, `[AUTOMATED REPORT] getBusinessInfoCommand() - Invalid ownerType for business ${businessId}/${getBusinessData(businessId).databaseId}`);
|
||||
ownerName = "None";
|
||||
break;
|
||||
@@ -1295,7 +1294,7 @@ function giveDefaultItemsToBusinessCommand(command, params, client) {
|
||||
let itemTypeId = getItemTypeFromParams(getGameConfig().defaultBusinessItems[getGame()][typeParam][i][0]);
|
||||
let itemTypeData = getItemTypeData(itemTypeId);
|
||||
if (itemTypeData) {
|
||||
let newItemIndex = createItem(itemTypeId, itemTypeData.orderValue, AGRP_ITEM_OWNER_BIZFLOOR, getBusinessData(businessId).databaseId, getGameConfig().defaultBusinessItems[getGame()][typeParam][i][1]);
|
||||
let newItemIndex = createItem(itemTypeId, itemTypeData.orderValue, V_ITEM_OWNER_BIZFLOOR, getBusinessData(businessId).databaseId, getGameConfig().defaultBusinessItems[getGame()][typeParam][i][1]);
|
||||
getItemData(newItemIndex).buyPrice = applyServerInflationMultiplier(itemTypeData.orderPrice) * getGameConfig().defaultBusinessItems[getGame()][typeParam][i][2];
|
||||
}
|
||||
}
|
||||
@@ -1324,8 +1323,8 @@ function setBusinessDealershipCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).labelHelpType == AGRP_PROPLABEL_INFO_ENTERVEHICLE;
|
||||
getBusinessData(businessId).type = AGRP_BIZ_TYPE_DEALERSHIP;
|
||||
getBusinessData(businessId).labelHelpType == V_PROPLABEL_INFO_ENTERVEHICLE;
|
||||
getBusinessData(businessId).type = V_BIZ_TYPE_DEALERSHIP;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the type of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`, true);
|
||||
}
|
||||
@@ -1469,7 +1468,7 @@ function setBusinessBuyPriceCommand(command, params, client) {
|
||||
}
|
||||
|
||||
getBusinessData(businessId).buyPrice = amount;
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}${getCurrencyString(amount)}`);
|
||||
@@ -1569,7 +1568,7 @@ function orderItemForBusinessCommand(command, params, client) {
|
||||
|
||||
let orderTotalCost = pricePerItem * amount;
|
||||
|
||||
//getPlayerData(client).promptType = AGRP_PROMPT_BIZORDER;
|
||||
//getPlayerData(client).promptType = V_PROMPT_BIZORDER;
|
||||
getPlayerData(client).businessOrderAmount = amount;
|
||||
getPlayerData(client).businessOrderBusiness = businessId;
|
||||
getPlayerData(client).businessOrderItem = itemType;
|
||||
@@ -1577,7 +1576,7 @@ function orderItemForBusinessCommand(command, params, client) {
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
showPlayerPrompt(client, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} will cost a total of ${getCurrencyString(orderTotalCost)}`, "Business Order Cost");
|
||||
getPlayerData(client).promptType = AGRP_PROMPT_BIZORDER;
|
||||
getPlayerData(client).promptType = V_PROMPT_BIZORDER;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1664,7 +1663,7 @@ function buyBusinessCommand(command, params, client) {
|
||||
}
|
||||
|
||||
showPlayerPrompt(client, getLocaleString(client, "BuyBusinessConfirmMessage"), getLocaleString(client, "BuyBusinessConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||
getPlayerData(client).promptType = AGRP_PROMPT_BUYBIZ;
|
||||
getPlayerData(client).promptType = V_PROMPT_BUYBIZ;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2022,7 +2021,7 @@ function createBusinessEntrancePickup(businessId) {
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
|
||||
|
||||
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
|
||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||
let entrancePickup = null;
|
||||
if (isGameFeatureSupported("pickup")) {
|
||||
let pickupModelId = getGameConfig().pickupModels[getGame()].Business;
|
||||
@@ -2099,7 +2098,7 @@ function createBusinessEntranceBlip(businessId) {
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
|
||||
|
||||
if (areServerElementsSupported() && getGame() != AGRP_GAME_MAFIA_ONE && getGame() != AGRP_GAME_GTA_IV) {
|
||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
|
||||
if (entranceBlip != null) {
|
||||
if (businessData.entranceDimension != -1) {
|
||||
@@ -2350,17 +2349,17 @@ function exitBusiness(client) {
|
||||
*/
|
||||
function getBusinessOwnerTypeText(ownerType) {
|
||||
switch (ownerType) {
|
||||
case AGRP_BIZ_OWNER_CLAN:
|
||||
case V_BIZ_OWNER_CLAN:
|
||||
return "clan";
|
||||
|
||||
case AGRP_BIZ_OWNER_JOB:
|
||||
case V_BIZ_OWNER_JOB:
|
||||
return "job";
|
||||
|
||||
case AGRP_BIZ_OWNER_PLAYER:
|
||||
case V_BIZ_OWNER_PLAYER:
|
||||
return "player";
|
||||
|
||||
case AGRP_BIZ_OWNER_NONE:
|
||||
case AGRP_BIZ_OWNER_PUBLIC:
|
||||
case V_BIZ_OWNER_NONE:
|
||||
case V_BIZ_OWNER_PUBLIC:
|
||||
return "not owned";
|
||||
|
||||
default:
|
||||
@@ -2538,7 +2537,7 @@ function setBusinessDataIndexes() {
|
||||
//}
|
||||
|
||||
for (let j in getServerData().businesses[i].locations) {
|
||||
if (getServerData().businesses[i].locations[j].type == AGRP_BIZ_LOC_ATM) {
|
||||
if (getServerData().businesses[i].locations[j].type == V_BIZ_LOC_ATM) {
|
||||
getServerData().atmLocationCache.push([i, j, getServerData().businesses[i].locations[j].position]);
|
||||
}
|
||||
}
|
||||
@@ -2554,7 +2553,7 @@ function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
|
||||
tempItemData.buyPrice = buyPrice;
|
||||
tempItemData.itemType = getItemTypeData(itemType).databaseId;
|
||||
tempItemData.ownerId = getBusinessData(business).databaseId;
|
||||
tempItemData.ownerType = AGRP_ITEMOWNER_BIZ;
|
||||
tempItemData.ownerType = V_ITEMOWNER_BIZ;
|
||||
tempItemData.ownerIndex = businessId;
|
||||
tempItemData.itemTypeIndex = itemType;
|
||||
saveItemToDatabase(tempItemData);
|
||||
@@ -2646,7 +2645,7 @@ function buyFromBusinessCommand(command, params, client) {
|
||||
}
|
||||
|
||||
takePlayerCash(client, totalCost);
|
||||
createItem(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex, getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).value, AGRP_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
|
||||
createItem(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex, getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).value, V_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId, amount);
|
||||
cachePlayerHotBarItems(client);
|
||||
getBusinessData(businessId).till = getBusinessData(businessId).till + totalCost;
|
||||
|
||||
@@ -2656,7 +2655,7 @@ function buyFromBusinessCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let useType = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).useType;
|
||||
if (useType == AGRP_ITEM_USE_TYPE_WEAPON || AGRP_ITEM_USE_TYPE_TAZER || useType == AGRP_ITEM_USE_TYPE_AMMO_CLIP) {
|
||||
if (useType == V_ITEM_USE_TYPE_WEAPON || V_ITEM_USE_TYPE_TAZER || useType == V_ITEM_USE_TYPE_AMMO_CLIP) {
|
||||
if (isPlayerWeaponBanned(client) && !isPlayerExemptFromAntiCheat(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "WeaponBanned"));
|
||||
return false;
|
||||
@@ -2759,7 +2758,7 @@ function storeItemInBusinessStorageCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZSTORAGE;
|
||||
getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).ownerType = V_ITEM_OWNER_BIZSTORAGE;
|
||||
getBusinessData(businessId).storageItemCache[firstSlot] = getBusinessData(businessId).floorItemCache[itemSlot - 1];
|
||||
getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
|
||||
messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} to the business storage in slot ${firstSlot}`);
|
||||
@@ -2803,7 +2802,7 @@ function stockItemOnBusinessFloorCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getItemData(getBusinessData(businessId).storageItemCache[itemSlot - 1]).ownerType = AGRP_ITEM_OWNER_BIZFLOOR;
|
||||
getItemData(getBusinessData(businessId).storageItemCache[itemSlot - 1]).ownerType = V_ITEM_OWNER_BIZFLOOR;
|
||||
getBusinessData(businessId).floorItemCache[firstSlot] = getBusinessData(businessId).storageItemCache[itemSlot - 1];
|
||||
getBusinessData(businessId).storageItemCache[itemSlot - 1] = -1;
|
||||
messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot]).itemTypeIndex).name}s in slot ${itemSlot} of the business storage to the business floor slot ${firstSlot}`);
|
||||
@@ -2843,14 +2842,14 @@ function cacheBusinessItems(businessId) {
|
||||
|
||||
//let businessData = getBusinessData(businessId);
|
||||
//logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
|
||||
//getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == AGRP_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
|
||||
//getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == AGRP_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
|
||||
//getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
|
||||
//getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
|
||||
for (let i in getServerData().items) {
|
||||
if (getItemData(i).ownerType == AGRP_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
||||
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
||||
getBusinessData(businessId).floorItemCache.push(i);
|
||||
} else if (getItemData(i).ownerType == AGRP_ITEM_OWNER_BIZSTORAGE && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
||||
} else if (getItemData(i).ownerType == V_ITEM_OWNER_BIZSTORAGE && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
||||
getBusinessData(businessId).storageItemCache.push(i);
|
||||
}
|
||||
}
|
||||
@@ -2869,57 +2868,57 @@ function getBusinessIdFromDatabaseId(databaseId) {
|
||||
|
||||
// Updates all pickup data for a business by businessId
|
||||
function updateBusinessPickupLabelData(businessId) {
|
||||
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE || getGame() == AGRP_GAME_GTA_IV) {
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
sendBusinessToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, getBusinessEntranceBlipModelForNetworkEvent(businessId), getBusinessEntrancePickupModelForNetworkEvent(businessId), getBusinessData(businessId).buyPrice, getBusinessData(businessId).rentPrice, getBusinessData(businessId).hasInterior, getBusinessData(businessId).locked, doesBusinessHaveAnyItemsToBuy(businessId));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).exitPickup != null) {
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_EXIT, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "agrp.owner.id", businessId, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "agrp.label.type", AGRP_LABEL_EXIT, true);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "v.rp.owner.type", V_PICKUP_BUSINESS_EXIT, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "v.rp.owner.id", businessId, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "v.rp.label.type", V_LABEL_EXIT, true);
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).entrancePickup != null) {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.type", AGRP_PICKUP_BUSINESS_ENTRANCE, false);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.owner.id", businessId, false);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.type", AGRP_LABEL_BUSINESS, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.name", getBusinessData(businessId).name, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.locked", getBusinessData(businessId).locked, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_NONE, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.owner.type", V_PICKUP_BUSINESS_ENTRANCE, false);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.owner.id", businessId, false);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.type", V_LABEL_BUSINESS, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.name", getBusinessData(businessId).name, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.locked", getBusinessData(businessId).locked, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.help", V_PROPLABEL_INFO_NONE, true);
|
||||
|
||||
switch (getBusinessData(businessId).labelHelpType) {
|
||||
case AGRP_PROPLABEL_INFO_ENTERVEHICLE: {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTERVEHICLE, true);
|
||||
case V_PROPLABEL_INFO_ENTERVEHICLE: {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.help", V_PROPLABEL_INFO_ENTERVEHICLE, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case AGRP_PROPLABEL_INFO_ENTER: {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
|
||||
case V_PROPLABEL_INFO_ENTER: {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.help", V_PROPLABEL_INFO_ENTER, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case AGRP_PROPLABEL_INFO_REPAIR: {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_REPAIR, true);
|
||||
case V_PROPLABEL_INFO_REPAIR: {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.help", V_PROPLABEL_INFO_REPAIR, true);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
if (getBusinessData(businessId).hasInterior) {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_ENTER, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.help", V_PROPLABEL_INFO_ENTER, true);
|
||||
} else {
|
||||
if (doesBusinessHaveAnyItemsToBuy(businessId)) {
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help", AGRP_PROPLABEL_INFO_BUY, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.help", V_PROPLABEL_INFO_BUY, true);
|
||||
} else {
|
||||
removeEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.help");
|
||||
removeEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.help");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.fee", getBusinessData(businessId).entranceFee, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.fee", getBusinessData(businessId).entranceFee, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2997,7 +2996,7 @@ function doesBusinessHaveAnyItemsToBuy(businessId) {
|
||||
|
||||
//function clearPlayerBusinessGameScripts(client, businessId) {
|
||||
// for(let i in getBusinessData(businessId).gameScripts) {
|
||||
// sendPlayerGameScriptState(client, AGRP_GAMESCRIPT_DENY);
|
||||
// sendPlayerGameScriptState(client, V_GAMESCRIPT_DENY);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -3019,11 +3018,11 @@ function canPlayerWithdrawFromBusinessTill(client, businessId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
|
||||
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
|
||||
return true;
|
||||
}
|
||||
@@ -3039,11 +3038,11 @@ function canPlayerSetBusinessInteriorLights(client, businessId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
|
||||
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
|
||||
return true;
|
||||
}
|
||||
@@ -3059,11 +3058,11 @@ function canPlayerLockUnlockBusiness(client, businessId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_PLAYER && getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_CLAN && getBusinessData(businessId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
|
||||
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
|
||||
return true;
|
||||
}
|
||||
@@ -3081,13 +3080,13 @@ function canPlayerManageBusiness(client, businessId, exemptAdminFlag = false) {
|
||||
}
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_PLAYER) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_PLAYER) {
|
||||
if (getBusinessData(businessId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId).ownerType == AGRP_BIZ_OWNER_CLAN) {
|
||||
if (getBusinessData(businessId).ownerType == V_BIZ_OWNER_CLAN) {
|
||||
if (getBusinessData(businessId).ownerId == getPlayerClan(client)) {
|
||||
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageBusinesses"))) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user