Const naming

This commit is contained in:
Vortrex
2022-06-26 13:32:13 -05:00
parent 43e41a1139
commit 7883d3503a

View File

@@ -8,19 +8,19 @@
// =========================================================================== // ===========================================================================
// House Location Types // House Location Types
const VRR_HOUSELOC_NONE = 0; // None const VRR_HOUSE_LOC_NONE = 0; // None
const VRR_HOUSELOC_GATE = 1; // Center of any moveable gate that belongs to the house const VRR_HOUSE_LOC_GATE = 1; // Center of any moveable gate that belongs to the house
const VRR_HOUSELOC_GARAGE = 2; // Location for garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped const VRR_HOUSE_LOC_GARAGE = 2; // Location for garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
// =========================================================================== // ===========================================================================
// House Owner Types // House Owner Types
const VRR_HOUSEOWNER_NONE = 0; // Not owned const VRR_HOUSE_OWNER_NONE = 0; // Not owned
const VRR_HOUSEOWNER_PLAYER = 1; // Owner is a player (character/subaccount) const VRR_HOUSE_OWNER_PLAYER = 1; // Owner is a player (character/subaccount)
const VRR_HOUSEOWNER_JOB = 2; // Owned by a job const VRR_HOUSE_OWNER_JOB = 2; // Owned by a job
const VRR_HOUSEOWNER_CLAN = 3; // Owned by a clan const VRR_HOUSE_OWNER_CLAN = 3; // Owned by a clan
const VRR_HOUSEOWNER_FACTION = 4; // Owned by a faction const VRR_HOUSE_OWNER_FACTION = 4; // Owned by a faction
const VRR_HOUSEOWNER_PUBLIC = 5; // Is a public house. Technically not owned. This probably won't be used. const VRR_HOUSE_OWNER_PUBLIC = 5; // Is a public house. Technically not owned. This probably won't be used.
// =========================================================================== // ===========================================================================
@@ -31,7 +31,7 @@ class HouseData {
constructor(dbAssoc = false) { constructor(dbAssoc = false) {
this.databaseId = 0 this.databaseId = 0
this.description = ""; this.description = "";
this.ownerType = VRR_HOUSEOWNER_NONE; this.ownerType = VRR_HOUSE_OWNER_NONE;
this.ownerId = 0; this.ownerId = 0;
this.buyPrice = 0; this.buyPrice = 0;
this.rentPrice = 0; this.rentPrice = 0;
@@ -297,7 +297,7 @@ function setHouseOwnerCommand(command, params, client) {
} }
if (!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) { if (!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) {
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
messagePlayerError(client, getLocaleString(client, "CantModifyHouse")); messagePlayerError(client, getLocaleString(client, "CantModifyHouse"));
return false; return false;
} }
@@ -305,7 +305,7 @@ function setHouseOwnerCommand(command, params, client) {
getHouseData(houseId).needsSaved = true; getHouseData(houseId).needsSaved = true;
getHouseData(houseId).ownerType = VRR_HOUSEOWNER_PLAYER; getHouseData(houseId).ownerType = VRR_HOUSE_OWNER_PLAYER;
getHouseData(houseId).ownerId = getPlayerCurrentSubAccount(newHouseOwner).databaseId; getHouseData(houseId).ownerId = getPlayerCurrentSubAccount(newHouseOwner).databaseId;
messagePlayerSuccess(`{MAINCOLOUR}You gave house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} to {ALTCOLOUR}${newHouseOwner.name}`); messagePlayerSuccess(`{MAINCOLOUR}You gave house {houseGreen}${getHouseData(houseId).description}{MAINCOLOUR} to {ALTCOLOUR}${newHouseOwner.name}`);
} }
@@ -328,13 +328,13 @@ function removeHouseOwnerCommand(command, params, client) {
} }
if (!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) { if (!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) {
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
messagePlayerError(client, getLocaleString(client, "CantModifyHouse")); messagePlayerError(client, getLocaleString(client, "CantModifyHouse"));
return false; return false;
} }
} }
getHouseData(houseId).ownerType = VRR_HOUSEOWNER_NONE; getHouseData(houseId).ownerType = VRR_HOUSE_OWNER_NONE;
getHouseData(houseId).ownerId = -1; getHouseData(houseId).ownerId = -1;
getHouseData(houseId).needsSaved = true; getHouseData(houseId).needsSaved = true;
@@ -1216,22 +1216,22 @@ function createHouseExitBlip(houseId) {
function getHouseOwnerTypeText(ownerType) { function getHouseOwnerTypeText(ownerType) {
switch (ownerType) { switch (ownerType) {
case VRR_HOUSEOWNER_CLAN: case VRR_HOUSE_OWNER_CLAN:
return "clan"; return "clan";
case VRR_HOUSEOWNER_PLAYER: case VRR_HOUSE_OWNER_PLAYER:
return "player"; return "player";
case VRR_HOUSEOWNER_NONE: case VRR_HOUSE_OWNER_NONE:
return "not owned"; return "not owned";
case VRR_HOUSEOWNER_PUBLIC: case VRR_HOUSE_OWNER_PUBLIC:
return "not owned"; return "not owned";
case VRR_HOUSEOWNER_JOB: case VRR_HOUSE_OWNER_JOB:
return "job"; return "job";
case VRR_HOUSEOWNER_BIZ: case VRR_HOUSE_OWNER_BIZ:
return "business"; return "business";
default: default:
@@ -1266,28 +1266,28 @@ function getHouseInfoCommand(command, params, client) {
let ownerName = "Unknown"; let ownerName = "Unknown";
switch (getHouseData(houseId).ownerType) { switch (getHouseData(houseId).ownerType) {
case VRR_HOUSEOWNER_CLAN: case VRR_HOUSE_OWNER_CLAN:
ownerName = getClanData(houseData).name; ownerName = getClanData(houseData).name;
break; break;
case VRR_HOUSEOWNER_PLAYER: case VRR_HOUSE_OWNER_PLAYER:
let subAccountData = loadSubAccountFromId(houseData.ownerId); let subAccountData = loadSubAccountFromId(houseData.ownerId);
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`; ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
break; break;
case VRR_HOUSEOWNER_NONE: case VRR_HOUSE_OWNER_NONE:
ownerName = "None"; ownerName = "None";
break; break;
case VRR_HOUSEOWNER_PUBLIC: case VRR_HOUSE_OWNER_PUBLIC:
ownerName = "Public"; ownerName = "Public";
break; break;
case VRR_HOUSEOWNER_BIZ: case VRR_HOUSE_OWNER_BIZ:
ownerName = getBusinessDataFromDatabaseId(houseData.ownerId).name; ownerName = getBusinessDataFromDatabaseId(houseData.ownerId).name;
break; break;
case VRR_HOUSEOWNER_JOB: case VRR_HOUSE_OWNER_JOB:
ownerName = getJobData(houseData.ownerId).name; ownerName = getJobData(houseData.ownerId).name;
break; break;
} }
@@ -1632,11 +1632,11 @@ function canPlayerSetHouseInteriorLights(client, houseId) {
return true; return true;
} }
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true; return true;
} }
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_CLAN && getHouseData(houseId).ownerId == getClanData(getPlayerClan(client)).databaseId) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_CLAN && getHouseData(houseId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) { if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) {
return true; return true;
} }
@@ -1652,11 +1652,11 @@ function canPlayerLockUnlockHouse(client, houseId) {
return true; return true;
} }
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_PLAYER && getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true; return true;
} }
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_CLAN && getHouseData(houseId).ownerId == getClanData(getPlayerClan(client)).databaseId) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_CLAN && getHouseData(houseId).ownerId == getClanData(getPlayerClan(client)).databaseId) {
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) { if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) {
return true; return true;
} }
@@ -1706,13 +1706,13 @@ function canPlayerManageHouse(client, houseId) {
return true; return true;
} }
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_PLAYER) {
if (getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) { if (getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
return true; return true;
} }
} }
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_CLAN) { if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_CLAN) {
if (getHouseData(houseId).ownerId == getPlayerClan(client)) { if (getHouseData(houseId).ownerId == getPlayerClan(client)) {
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) { if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) {
return true; return true;