Merge branch 'nightly' into ragemp
This commit is contained in:
2
meta.xml
2
meta.xml
@@ -119,6 +119,7 @@
|
||||
<script src="scripts/client/afk.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/animation.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/business.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/core.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/chat.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/cursor.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/economy.js" type="client" language="javascript" />
|
||||
@@ -132,7 +133,6 @@
|
||||
<script src="scripts/client/label.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/locale.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/logo.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/main.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/messaging.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/mousecam.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/nametag.js" type="client" language="javascript" />
|
||||
|
||||
@@ -23,6 +23,7 @@ class BusinessData {
|
||||
this.blipId = -1;
|
||||
this.labelInfoType = 0;
|
||||
this.locked = false;
|
||||
this.entranceFee = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ function initBusinessScript() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems) {
|
||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) {
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Received business ${businessId} (${name}) from server`);
|
||||
|
||||
if (!areServerElementsSupported() || getGame() == AGRP_GAME_MAFIA_ONE || getGame() == AGRP_GAME_GTA_IV) {
|
||||
@@ -50,6 +51,7 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
||||
businessData.rentPrice = rentPrice;
|
||||
businessData.hasItems = hasItems;
|
||||
businessData.locked = locked;
|
||||
businessData.entranceFee = entranceFee;
|
||||
|
||||
if (hasInterior && !hasItems) {
|
||||
businessData.labelInfoType = AGRP_PROPLABEL_INFO_ENTER;
|
||||
|
||||
@@ -65,7 +65,7 @@ function initLabelJobHelpFont() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
|
||||
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType, fee) {
|
||||
if (localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -122,6 +122,15 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
||||
screenPosition.y -= propertyLabelPriceOffset;
|
||||
}
|
||||
|
||||
text = "";
|
||||
if (toInteger(fee) > 0) {
|
||||
text = getLocaleString("PropertyEntranceFeeLabel", getCurrencyString(fee));
|
||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||
propertyLabelLockedFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
||||
|
||||
screenPosition.y -= propertyLabelPriceOffset;
|
||||
}
|
||||
|
||||
if (isBusiness) {
|
||||
text = (locked) ? toUpperCase(getLocaleString("Closed")) : toUpperCase(getLocaleString("Open"));
|
||||
} else {
|
||||
@@ -318,7 +327,7 @@ function processLabelRendering() {
|
||||
}
|
||||
|
||||
if (getDistance(localPlayer.position, business.entrancePosition) <= propertyLabelRenderDistance) {
|
||||
renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, business.buyPrice, business.rentPrice, business.labelInfoType);
|
||||
renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, business.buyPrice, business.rentPrice, business.labelInfoType, business.entranceFee);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -371,9 +380,13 @@ function processLabelRendering() {
|
||||
labelInfoType = pickups[i].getData("agrp.label.help");
|
||||
}
|
||||
|
||||
if (pickups[i].getData("agrp.label.fee") != null) {
|
||||
fee = pickups[i].getData("agrp.label.fee");
|
||||
}
|
||||
|
||||
switch (pickups[i].getData("agrp.label.type")) {
|
||||
case AGRP_LABEL_BUSINESS: {
|
||||
renderPropertyEntranceLabel(pickups[i].getData("agrp.label.name"), pickups[i].position, pickups[i].getData("agrp.label.locked"), true, price, rentPrice, labelInfoType);
|
||||
renderPropertyEntranceLabel(pickups[i].getData("agrp.label.name"), pickups[i].position, pickups[i].getData("agrp.label.locked"), true, price, rentPrice, labelInfoType, fee);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ class BusinessData {
|
||||
this.streamingRadioStation = 0;
|
||||
//this.streamingRadioStationIndex = -1;
|
||||
|
||||
this.paintBallPlayers = [];
|
||||
|
||||
this.labelHelpType = AGRP_PROPLABEL_INFO_NONE;
|
||||
|
||||
if (dbAssoc) {
|
||||
@@ -850,6 +852,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
|
||||
|
||||
getBusinessData(businessId).entranceFee = entranceFee;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
|
||||
}
|
||||
|
||||
@@ -2914,6 +2917,7 @@ function updateBusinessPickupLabelData(businessId) {
|
||||
}
|
||||
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.fee", getBusinessData(businessId).entranceFee, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,19 +314,15 @@ function loadGlobalConfig() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
async function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM svr_main WHERE svr_game = ${gameId} AND svr_port = ${port} LIMIT 1;`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if (dbQuery) {
|
||||
if (dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
let dbAssoc = await fetchQueryAssoc(dbConnection, dbQueryString);
|
||||
if (dbAssoc.length > 0) {
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc[0]);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
return false;
|
||||
@@ -334,19 +330,16 @@ function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromGame(gameId) {
|
||||
async function loadServerConfigFromGame(gameId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM svr_main WHERE svr_game = ${gameId} LIMIT 1;`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if (dbQuery) {
|
||||
if (dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
let dbAssocArray = await fetchQueryAssoc(dbConnection, dbQueryString);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `${dbAssocArray[0]}`);
|
||||
if (dbAssocArray.length > 0) {
|
||||
let tempServerConfigData = new ServerConfigData(dbAssocArray[0]);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
return false;
|
||||
@@ -354,21 +347,17 @@ function loadServerConfigFromGame(gameId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromId(tempServerId) {
|
||||
async function loadServerConfigFromId(tempServerId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM svr_main WHERE svr_id = ${tempServerId} LIMIT 1;`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if (dbQuery) {
|
||||
if (dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
let dbAssoc = await fetchQueryAssoc(dbConnection, dbQueryString);
|
||||
if (dbAssoc.length > 0) {
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc[0]);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -917,8 +917,18 @@ function freeDatabaseQuery(dbQuery) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function fetchQueryAssoc(dbQuery) {
|
||||
return dbQuery.fetchAssoc();
|
||||
async function fetchQueryAssoc(dbConnection, dbQueryString) {
|
||||
//logToConsole(LOG_DEBUG, dbQueryString);
|
||||
let dbQuery = dbConnection.query(dbQueryString);
|
||||
let assocArray = [];
|
||||
let dbAssoc = null;
|
||||
|
||||
while (dbAssoc = dbQuery.fetchAssoc()) {
|
||||
assocArray.push(dbAssoc);
|
||||
//logToConsole(LOG_DEBUG | LOG_WARN, dbAssoc["svr_id"]);
|
||||
}
|
||||
|
||||
return assocArray;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -71,10 +71,15 @@ function startPaintBall(client) {
|
||||
|
||||
getPlayerData(client).inPaintBall = true;
|
||||
getPlayerData(client).paintBallBusiness = getPlayerBusiness(client);
|
||||
getPlayerData(client).paintBallKills = 0;
|
||||
getPlayerData(client).paintBallDeaths = 0;
|
||||
getBusinessData(getPlayerData(client).paintBallBusiness).paintBallPlayers.push(client.index);
|
||||
getBusinessData(getPlayerData(client).paintBallBusiness).paintBallPot += getBusinessData(getPlayerData(client).paintBallBusiness).entranceFee * 2;
|
||||
|
||||
givePlayerPaintBallItems(client);
|
||||
|
||||
messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
|
||||
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
}
|
||||
|
||||
@@ -90,7 +95,31 @@ function stopPaintBall(client) {
|
||||
deletePaintBallItems(client);
|
||||
restorePlayerTempLockerItems(client);
|
||||
|
||||
let tempBusiness = getPlayerData(client).paintBallBusiness;
|
||||
|
||||
messagePlayerAlert(client, getLocaleString(client, "LeftPaintBall"));
|
||||
|
||||
getBusinessData(tempBusiness).paintBallPlayers.splice(getBusinessData(tempBusiness).paintBallPlayers.indexOf(client.index), 1);
|
||||
|
||||
if (getBusinessData(tempBusiness).paintBallPlayers.length == 0) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "PaintBallEnded"));
|
||||
messagePlayerInfo(client, getLocaleString(client, "YourPaintBallResults", getPlayerData(client).paintBallKills, getPlayerData(client).paintBallDeaths));
|
||||
|
||||
//messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderEventWinners")));
|
||||
//messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderEventWinners")));
|
||||
|
||||
givePlayerCash(client, getBusinessData(tempBusiness).paintBallPot);
|
||||
getBusinessData(tempBusiness).paintBallPot = 0;
|
||||
}
|
||||
|
||||
getPlayerData(client).inPaintBall = false;
|
||||
getPlayerData(client).paintBallBusiness = false;
|
||||
getPlayerData(client).tempLockerType = AGRP_TEMP_LOCKER_TYPE_NONE;
|
||||
getPlayerData(client).paintBallKills = 0;
|
||||
getPlayerData(client).paintBallDeaths = 0;
|
||||
|
||||
//checkRemainingPaintBallPlayers(tempBusiness);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
}
|
||||
|
||||
@@ -165,3 +194,11 @@ function isPlayerInPaintBall(client) {
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkRemainingPaintBallPlayers(businessIndex) {
|
||||
//if (getBusinessData(businessIndex).paintBallPlayers.length == 0) {
|
||||
//
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user