Const naming
This commit is contained in:
@@ -8,19 +8,19 @@
|
||||
// ===========================================================================
|
||||
|
||||
// House Location Types
|
||||
const VRR_HOUSELOC_NONE = 0; // None
|
||||
const VRR_HOUSELOC_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_NONE = 0; // None
|
||||
const VRR_HOUSE_LOC_GATE = 1; // Center of any moveable gate that belongs to the house
|
||||
const VRR_HOUSE_LOC_GARAGE = 2; // Location for garage (pos1 = outside, pos2 = inside). Use pos to teleport or spawn veh/ped
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// House Owner Types
|
||||
const VRR_HOUSEOWNER_NONE = 0; // Not owned
|
||||
const VRR_HOUSEOWNER_PLAYER = 1; // Owner is a player (character/subaccount)
|
||||
const VRR_HOUSEOWNER_JOB = 2; // Owned by a job
|
||||
const VRR_HOUSEOWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_HOUSEOWNER_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_NONE = 0; // Not owned
|
||||
const VRR_HOUSE_OWNER_PLAYER = 1; // Owner is a player (character/subaccount)
|
||||
const VRR_HOUSE_OWNER_JOB = 2; // Owned by a job
|
||||
const VRR_HOUSE_OWNER_CLAN = 3; // Owned by a clan
|
||||
const VRR_HOUSE_OWNER_FACTION = 4; // Owned by a faction
|
||||
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) {
|
||||
this.databaseId = 0
|
||||
this.description = "";
|
||||
this.ownerType = VRR_HOUSEOWNER_NONE;
|
||||
this.ownerType = VRR_HOUSE_OWNER_NONE;
|
||||
this.ownerId = 0;
|
||||
this.buyPrice = 0;
|
||||
this.rentPrice = 0;
|
||||
@@ -297,7 +297,7 @@ function setHouseOwnerCommand(command, params, client) {
|
||||
}
|
||||
|
||||
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"));
|
||||
return false;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ function setHouseOwnerCommand(command, params, client) {
|
||||
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
getHouseData(houseId).ownerType = VRR_HOUSEOWNER_PLAYER;
|
||||
getHouseData(houseId).ownerType = VRR_HOUSE_OWNER_PLAYER;
|
||||
getHouseData(houseId).ownerId = getPlayerCurrentSubAccount(newHouseOwner).databaseId;
|
||||
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 (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"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
getHouseData(houseId).ownerType = VRR_HOUSEOWNER_NONE;
|
||||
getHouseData(houseId).ownerType = VRR_HOUSE_OWNER_NONE;
|
||||
getHouseData(houseId).ownerId = -1;
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
@@ -1216,22 +1216,22 @@ function createHouseExitBlip(houseId) {
|
||||
|
||||
function getHouseOwnerTypeText(ownerType) {
|
||||
switch (ownerType) {
|
||||
case VRR_HOUSEOWNER_CLAN:
|
||||
case VRR_HOUSE_OWNER_CLAN:
|
||||
return "clan";
|
||||
|
||||
case VRR_HOUSEOWNER_PLAYER:
|
||||
case VRR_HOUSE_OWNER_PLAYER:
|
||||
return "player";
|
||||
|
||||
case VRR_HOUSEOWNER_NONE:
|
||||
case VRR_HOUSE_OWNER_NONE:
|
||||
return "not owned";
|
||||
|
||||
case VRR_HOUSEOWNER_PUBLIC:
|
||||
case VRR_HOUSE_OWNER_PUBLIC:
|
||||
return "not owned";
|
||||
|
||||
case VRR_HOUSEOWNER_JOB:
|
||||
case VRR_HOUSE_OWNER_JOB:
|
||||
return "job";
|
||||
|
||||
case VRR_HOUSEOWNER_BIZ:
|
||||
case VRR_HOUSE_OWNER_BIZ:
|
||||
return "business";
|
||||
|
||||
default:
|
||||
@@ -1266,28 +1266,28 @@ function getHouseInfoCommand(command, params, client) {
|
||||
|
||||
let ownerName = "Unknown";
|
||||
switch (getHouseData(houseId).ownerType) {
|
||||
case VRR_HOUSEOWNER_CLAN:
|
||||
case VRR_HOUSE_OWNER_CLAN:
|
||||
ownerName = getClanData(houseData).name;
|
||||
break;
|
||||
|
||||
case VRR_HOUSEOWNER_PLAYER:
|
||||
case VRR_HOUSE_OWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(houseData.ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
|
||||
break;
|
||||
|
||||
case VRR_HOUSEOWNER_NONE:
|
||||
case VRR_HOUSE_OWNER_NONE:
|
||||
ownerName = "None";
|
||||
break;
|
||||
|
||||
case VRR_HOUSEOWNER_PUBLIC:
|
||||
case VRR_HOUSE_OWNER_PUBLIC:
|
||||
ownerName = "Public";
|
||||
break;
|
||||
|
||||
case VRR_HOUSEOWNER_BIZ:
|
||||
case VRR_HOUSE_OWNER_BIZ:
|
||||
ownerName = getBusinessDataFromDatabaseId(houseData.ownerId).name;
|
||||
break;
|
||||
|
||||
case VRR_HOUSEOWNER_JOB:
|
||||
case VRR_HOUSE_OWNER_JOB:
|
||||
ownerName = getJobData(houseData.ownerId).name;
|
||||
break;
|
||||
}
|
||||
@@ -1632,11 +1632,11 @@ function canPlayerSetHouseInteriorLights(client, houseId) {
|
||||
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;
|
||||
}
|
||||
|
||||
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"))) {
|
||||
return true;
|
||||
}
|
||||
@@ -1652,11 +1652,11 @@ function canPlayerLockUnlockHouse(client, houseId) {
|
||||
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;
|
||||
}
|
||||
|
||||
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"))) {
|
||||
return true;
|
||||
}
|
||||
@@ -1706,13 +1706,13 @@ function canPlayerManageHouse(client, houseId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_PLAYER) {
|
||||
if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_PLAYER) {
|
||||
if (getHouseData(houseId).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (getHouseData(houseId).ownerType == VRR_HOUSEOWNER_CLAN) {
|
||||
if (getHouseData(houseId).ownerType == VRR_HOUSE_OWNER_CLAN) {
|
||||
if (getHouseData(houseId).ownerId == getPlayerClan(client)) {
|
||||
if (doesPlayerHaveClanPermission(client, getClanFlagValue("ManageHouses"))) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user