Add custom int prop to biz & house data
This commit is contained in:
@@ -860,6 +860,7 @@ function setBusinessInteriorTypeCommand(command, params, client) {
|
||||
getBusinessData(businessId).hasInterior = false;
|
||||
getBusinessData(businessId).interiorCutscene = "";
|
||||
getBusinessData(businessId).exitPickupModel = -1;
|
||||
getBusinessData(businessId).customInterior = false;
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} removed business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} interior`);
|
||||
return false;
|
||||
}
|
||||
@@ -880,10 +881,9 @@ function setBusinessInteriorTypeCommand(command, params, client) {
|
||||
getBusinessData(businessId).exitInterior = getGameConfig().interiors[getGame()][typeParam][1];
|
||||
getBusinessData(businessId).exitDimension = getBusinessData(businessId).databaseId+getGlobalConfig().businessDimensionStart;
|
||||
getBusinessData(businessId).exitPickupModel = getGameConfig().pickupModels[getGame()].Exit;
|
||||
if(getGameConfig().interiors[getGame()][typeParam].length == 3) {
|
||||
getBusinessData(businessId).interiorCutscene = getGameConfig().interiors[getGame()][typeParam][2];
|
||||
}
|
||||
getBusinessData(businessId).hasInterior = true;
|
||||
getBusinessData(businessId).customInterior = getGameConfig().interiors[getGame()][typeParam][2];
|
||||
getBusinessData(businessId).interiorCutscene = getGameConfig().interiors[getGame()][typeParam][3];
|
||||
}
|
||||
|
||||
//deleteBusinessExitPickup(businessId);
|
||||
@@ -1576,8 +1576,6 @@ function saveBusinessToDatabase(businessId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
|
||||
let safeExitCutscene = escapeDatabaseString(dbConnection, tempBusinessData.exitCustscene);
|
||||
let safeEntranceCutscene = escapeDatabaseString(dbConnection, tempBusinessData.entranceCutscene);
|
||||
|
||||
let data = [
|
||||
["biz_server", getServerId()],
|
||||
@@ -1595,7 +1593,7 @@ function saveBusinessToDatabase(businessId) {
|
||||
["biz_entrance_vw", tempBusinessData.entranceDimension],
|
||||
["biz_entrance_pickup", tempBusinessData.entrancePickupModel],
|
||||
["biz_entrance_blip", tempBusinessData.entranceBlipModel],
|
||||
["biz_entrance_cutscene", safeEntranceCutscene],
|
||||
["biz_entrance_cutscene", tempBusinessData.entranceCutscene],
|
||||
["biz_exit_pos_x", tempBusinessData.exitPosition.x],
|
||||
["biz_exit_pos_y", tempBusinessData.exitPosition.y],
|
||||
["biz_exit_pos_z", tempBusinessData.exitPosition.z],
|
||||
@@ -1604,11 +1602,12 @@ function saveBusinessToDatabase(businessId) {
|
||||
["biz_exit_vw", tempBusinessData.exitDimension],
|
||||
["biz_exit_pickup", tempBusinessData.exitPickupModel],
|
||||
["biz_exit_blip", tempBusinessData.exitBlipModel],
|
||||
["biz_exit_cutscene", safeExitCutscene],
|
||||
["biz_exit_cutscene", tempBusinessData.exitCutscene],
|
||||
["biz_has_interior", boolToInt(tempBusinessData.hasInterior)],
|
||||
["biz_interior_lights", boolToInt(tempBusinessData.interiorLights)],
|
||||
["biz_label_help_type", tempBusinessData.labelHelpType],
|
||||
["biz_radiostation", tempBusinessData.streamingRadioStation],
|
||||
["biz_custom_interior", boolToInt(tempBusinessData.customInterior)],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
|
||||
@@ -534,7 +534,6 @@ class BusinessData {
|
||||
this.entranceBlipModel = -1;
|
||||
this.entrancePickup = null;
|
||||
this.entranceBlip = null;
|
||||
this.entranceCutscene = "";
|
||||
|
||||
this.exitPosition = false;
|
||||
this.exitRotation = 0.0;
|
||||
@@ -555,6 +554,8 @@ class BusinessData {
|
||||
|
||||
this.triggers = [];
|
||||
|
||||
this.customInterior = false;
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["biz_id"]);
|
||||
this.name = toString(dbAssoc["biz_name"]);
|
||||
@@ -571,7 +572,6 @@ class BusinessData {
|
||||
this.entranceDimension = toInteger(dbAssoc["biz_entrance_vw"]);
|
||||
this.entrancePickupModel = toInteger(dbAssoc["biz_entrance_pickup"]);
|
||||
this.entranceBlipModel = toInteger(dbAssoc["biz_entrance_blip"]);
|
||||
this.entranceCutscene = toString(dbAssoc["biz_entrance_cutscene"]);
|
||||
|
||||
this.exitPosition = toVector3(dbAssoc["biz_exit_pos_x"], dbAssoc["biz_exit_pos_y"], dbAssoc["biz_exit_pos_z"]);
|
||||
this.exitRotation = toInteger(dbAssoc["biz_exit_rot_z"]);
|
||||
@@ -579,14 +579,13 @@ class BusinessData {
|
||||
this.exitDimension = toInteger(dbAssoc["biz_exit_vw"]);
|
||||
this.exitPickupModel = toInteger(dbAssoc["biz_exit_pickup"]);
|
||||
this.exitBlipModel = toInteger(dbAssoc["biz_exit_blip"]);
|
||||
this.exitCutscene = toString(dbAssoc["biz_exit_cutscene"]);
|
||||
|
||||
this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]);
|
||||
this.till = toInteger(dbAssoc["biz_till"]);
|
||||
|
||||
this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
|
||||
this.streamingRadioStation = toInteger(dbAssoc["biz_radiostation"]);
|
||||
|
||||
this.customInterior = intToBool(toInteger(dbAssoc["biz_custom_interior"]));
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -675,7 +674,6 @@ class HouseData {
|
||||
this.entranceBlipModel = -1;
|
||||
this.entrancePickup = null;
|
||||
this.entranceBlip = null;
|
||||
this.entranceCutscene = "";
|
||||
|
||||
this.exitPosition = false;
|
||||
this.exitRotation = 0.0;
|
||||
@@ -685,12 +683,13 @@ class HouseData {
|
||||
this.exitBlipModel = -1;
|
||||
this.exitPickup = null;
|
||||
this.exitBlip = null;
|
||||
this.exitCutscene = "";
|
||||
|
||||
this.streamingRadioStation = -1;
|
||||
|
||||
this.triggers = [];
|
||||
|
||||
this.customInterior = false;
|
||||
|
||||
if(dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["house_id"]);
|
||||
this.description = toString(dbAssoc["house_description"]);
|
||||
@@ -709,7 +708,7 @@ class HouseData {
|
||||
this.entranceDimension = toInteger(dbAssoc["house_entrance_vw"]);
|
||||
this.entrancePickupModel = toInteger(dbAssoc["house_entrance_pickup"]);
|
||||
this.entranceBlipModel = toInteger(dbAssoc["house_entrance_blip"]);
|
||||
this.entranceCutscene = toString(dbAssoc["house_entrance_cutscene"]);
|
||||
this.entranceCutscene = toInteger(dbAssoc["house_entrance_cutscene"]);
|
||||
|
||||
this.exitPosition = toVector3(toFloat(dbAssoc["house_exit_pos_x"]), toFloat(dbAssoc["house_exit_pos_y"]), toFloat(dbAssoc["house_exit_pos_z"]));
|
||||
this.exitRotation = toFloat(dbAssoc["house_exit_rot_z"]);
|
||||
@@ -717,7 +716,9 @@ class HouseData {
|
||||
this.exitDimension = toInteger(dbAssoc["house_exit_vw"]);
|
||||
this.exitPickupModel = toInteger(dbAssoc["house_exit_pickup"]);
|
||||
this.exitBlipModel = toInteger(dbAssoc["house_exit_blip"]);
|
||||
this.exitCutscene = toString(dbAssoc["house_exit_cutscene"]);
|
||||
this.exitCutscene = toInteger(dbAssoc["house_exit_cutscene"]);
|
||||
|
||||
this.customInterior = intToBool(toInteger(dbAssoc["house_custom_interior"]));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -723,12 +723,14 @@ function saveAllHousesToDatabase() {
|
||||
function saveHouseToDatabase(houseId) {
|
||||
let tempHouseData = getServerData().houses[houseId];
|
||||
|
||||
if(!tempHouseData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.House]: Saving house '${tempHouseData.databaseId}' to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
|
||||
let safeExitCutscene = escapeDatabaseString(dbConnection, tempHouseData.exitCutscene);
|
||||
let safeEntranceCutscene = escapeDatabaseString(dbConnection, tempHouseData.entranceCutscene);
|
||||
|
||||
let data = [
|
||||
["house_server", getServerId()],
|
||||
@@ -745,7 +747,7 @@ function saveHouseToDatabase(houseId) {
|
||||
["house_entrance_vw", tempHouseData.entranceDimension],
|
||||
["house_entrance_pickup", tempHouseData.entrancePickupModel],
|
||||
["house_entrance_blip", tempHouseData.entranceBlipModel],
|
||||
["house_entrance_cutscene", safeEntranceCutscene],
|
||||
["house_entrance_cutscene", tempHouseData.entranceCutscene],
|
||||
["house_exit_pos_x", tempHouseData.exitPosition.x],
|
||||
["house_exit_pos_y", tempHouseData.exitPosition.y],
|
||||
["house_exit_pos_z", tempHouseData.exitPosition.z],
|
||||
@@ -754,12 +756,12 @@ function saveHouseToDatabase(houseId) {
|
||||
["house_exit_vw", tempHouseData.exitDimension],
|
||||
["house_exit_pickup", tempHouseData.exitPickupModel],
|
||||
["house_exit_blip", tempHouseData.exitBlipModel],
|
||||
["house_exit_cutscene", safeExitCutscene],
|
||||
["house_exit_cutscene", tempHouseData.exitCutscene],
|
||||
["house_buy_price", tempHouseData.buyPrice],
|
||||
["house_rent_price", tempHouseData.rentPrice],
|
||||
["house_has_interior", boolToInt(tempHouseData.hasInterior)],
|
||||
["house_interior_lights", boolToInt(tempHouseData.interiorLights)],
|
||||
|
||||
["house_custom_interior", boolToInt(tempHouseData.customInterior)],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
@@ -788,6 +790,10 @@ function saveHouseToDatabase(houseId) {
|
||||
function saveHouseLocationToDatabase(houseId, locationId) {
|
||||
let tempHouseLocationData = getServerData().houses[houseId].locations[locationId];
|
||||
|
||||
if(!tempHouseLocationData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.House]: Saving house location '${locationId}' for house '${getHouseData(houseId).databaseId}' to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
|
||||
Reference in New Issue
Block a user