Overrides added

For compliance with the ARMA 3 license
This commit is contained in:
Cloudhax23 2017-02-23 07:28:28 -06:00
parent 8708deddbe
commit 2481921256
26 changed files with 1449 additions and 0 deletions

View File

@ -0,0 +1,52 @@
/**
* ExileServer_object_construction_database_load
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_constructionID","_data","_position","_vectorDirection","_vectorUp","_constructionObject","_damageLevel","_public","_pinCode"];
_constructionID = _this;
_data = format ["loadConstruction:%1", _constructionID] call ExileServer_system_database_query_selectSingle;
_position = [_data select 4, _data select 5, _data select 6];
_vectorDirection = [_data select 7, _data select 8, _data select 9];
_vectorUp = [_data select 10, _data select 11, _data select 12];
_constructionObject = createVehicle [(_data select 1), _position, [], 0, "CAN_COLLIDE"];
_constructionObject setPosATL _position;
_constructionObject setVectorDirAndUp [_vectorDirection, _vectorUp];
_constructionObject setVariable ["ExileDatabaseID", (_data select 0)];
_constructionObject setVariable ["ExileOwnerUID", (_data select 2)];
_constructionObject setVariable ["ExileIsPersistent", true];
_constructionObject setVariable ["ExileTerritoryID", (_data select 15)];
_damageLevel = (_data select 17);
_public = _damageLevel > 0;
_constructionObject setVariable ["ExileConstructionDamage",_damageLevel,_public];
if(_public)then
{
_constructionObject call ExileServer_util_setDamageTexture;
};
_pinCode = _data select 14;
if !(_pinCode isEqualTo "000000") then
{
_constructionObject setVariable ["ExileAccessCode", _pinCode];
_constructionObject setVariable ["ExileIsLocked", (_data select 13), true];
};
if (getNumber(configFile >> "CfgVehicles" >> (_data select 1) >> "exileRequiresSimulation") isEqualTo 1) then
{
_constructionObject enableSimulationGlobal true;
_constructionObject call ExileServer_system_simulationMonitor_addVehicle;
}
else
{
_constructionObject enableSimulationGlobal false;
};
_constructionObject setVelocity [0, 0, 0];
_constructionObject setPosATL _position;
_constructionObject setVelocity [0, 0, 0];
_constructionObject setVectorDirAndUp [_vectorDirection, _vectorUp];
_constructionObject setVelocity [0, 0, 0];
_constructionObject

View File

@ -0,0 +1,46 @@
/**
* ExileServer_object_container_database_update
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_containerObject","_containerID","_position","_vectorDirection","_vectorUp","_territoryFlag","_territoryID","_data","_extDB2Message"];
_containerObject= _this;
_containerID = _containerObject getVariable ["ExileDatabaseID", -1];
if (_containerID > -1) then
{
_position = getPosATL _containerObject;
_vectorDirection = vectorDir _containerObject;
_vectorUp = vectorUp _containerObject;
_territoryFlag = _containerObject call ExileClient_util_world_getTerritoryAtPosition;
_territoryID = if (isNull _territoryFlag) then { 'NULL' } else { _territoryFlag getVariable ["ExileDatabaseID", 'NULL']};
_containerObject setVariable ["ExileTerritoryID", _territoryID];
_data =
[
_containerObject getVariable ["ExileIsLocked",-1],
_position select 0,
_position select 1,
_position select 2,
_vectorDirection select 0,
_vectorDirection select 1,
_vectorDirection select 2,
_vectorUp select 0,
_vectorUp select 1,
_vectorUp select 2,
_containerObject call ExileServer_util_getItemCargo,
magazinesAmmoCargo _containerObject,
weaponsItemsCargo _containerObject,
_containerObject call ExileServer_util_getObjectContainerCargo,
_territoryID,
_containerObject getVariable ["ExileMoney", 0],
_containerID
];
_extDB2Message = ["updateContainer", _data] call ExileServer_util_extDB2_createMessage;
_extDB2Message call ExileServer_system_database_query_fireAndForget;
};
true

View File

@ -0,0 +1,194 @@
/**
* ExileServer_object_player_event_onMpKilled
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_victim","_killer","_countDeath","_countKill","_killSummary","_killingPlayer","_killType","_oldVictimRespect","_newVictimRespect","_oldKillerRespect","_newKillerRespect","_systemChat","_modifyVictimRespect","_respectLoss","_perks","_minRespectTransfer","_respectTransfer","_perkNames","_killerStatsNeedUpdate","_newKillerFrags","_victimStatsNeedUpdate","_newVictimDeaths","_victimPosition"];
_victim = _this select 0;
_killer = _this select 1;
if (!isServer || hasInterface || isNull _victim) exitWith {};
_victim setVariable ["ExileDiedAt", time];
if !(isPlayer _victim) exitWith {};
_victim setVariable ["ExileIsDead", true];
_victim setVariable ["ExileName", name _victim, true];
_countDeath = false;
_countKill = false;
_killSummary = [];
_killingPlayer = _killer call ExileServer_util_getFragKiller;
_killType = [_victim, _killer, _killingPlayer] call ExileServer_util_getFragType;
_oldVictimRespect = _victim getVariable ["ExileScore", 0];
_newVictimRespect = _oldVictimRespect;
_oldKillerRespect = 0;
if !(isNull _killingPlayer) then
{
_oldKillerRespect = _killingPlayer getVariable ["ExileScore", 0];
};
_newKillerRespect = _oldKillerRespect;
switch (_killType) do
{
default
{
_countDeath = true;
_systemChat = format ["%1 died for an unknown reason!", name _victim];
_newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "unlucky")));
};
case 1:
{
_countDeath = true;
_modifyVictimRespect = true;
_systemChat = format ["%1 commited suicide!", name _victim];
_newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "suicide")));
};
case 2:
{
_countDeath = true;
_countKill = false;
_systemChat = format ["%1 died while playing Russian Roulette!", name _victim];
_newVictimRespect = _oldVictimRespect;
_victim call ExileServer_system_russianRoulette_event_onPlayerDied;
};
case 3:
{
_countDeath = true;
_countKill = false;
_systemChat = format ["%1 crashed to death!", name _victim];
_newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "crash")));
};
case 4:
{
_countDeath = true;
_countKill = false;
_systemChat = format ["%1 was killed by an NPC!", name _victim];
_newVictimRespect = _oldVictimRespect - round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "npc")));
};
case 5:
{
_countDeath = false;
_countKill = false;
_systemChat = format ["%1 was team-killed by %2!", name _victim, name _killingPlayer];
_respectLoss = round ((abs _oldKillerRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "friendyFire")));
_newKillerRespect = _oldKillerRespect - _respectLoss;
_killSummary pushBack ["FRIENDLY FIRE", -1 * _respectLoss];
};
case 6:
{
_countDeath = false;
_countKill = false;
_systemChat = format ["%1 was killed by %2! (BAMBI SLAYER)", name _victim, name _killingPlayer];
_respectLoss = round ((abs _oldKillerRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "bambiKill")));
_newKillerRespect = _oldKillerRespect - _respectLoss;
_killSummary pushBack ["BAMBI SLAYER", -1 * _respectLoss];
};
case 7:
{
_countDeath = true;
_countKill = true;
_perks = [_victim, _killer, _killingPlayer] call ExileServer_util_getFragPerks;
_minRespectTransfer = getNumber (configFile >> "CfgSettings" >> "Respect" >> "minRespectTransfer");
_respectTransfer = round ((abs _oldVictimRespect) / 100 * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Percentages" >> "frag")));
if (_respectTransfer < _minRespectTransfer) then
{
_respectTransfer = _minRespectTransfer;
};
_newVictimRespect = _oldVictimRespect - _respectTransfer;
_newKillerRespect = _oldKillerRespect + _respectTransfer;
_killSummary pushBack ["ENEMY FRAGGED", _respectTransfer];
if (_perks isEqualTo []) then
{
_systemChat = format ["%1 was killed by %2!", name _victim, name _killingPlayer];
}
else
{
_perkNames = [];
{
_perkNames pushBack (_x select 0);
_killSummary pushBack _x;
_newKillerRespect = _newKillerRespect + (_x select 1);
}
forEach _perks;
_systemChat = format ["%1 was killed by %2! (%3)", name _victim, name _killingPlayer, _perkNames joinString ", "];
};
};
};
if !(isNull _killingPlayer) then
{
if !(_killSummary isEqualTo []) then
{
[_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
};
};
if !(isNull _killingPlayer) then
{
_killerStatsNeedUpdate = false;
if (_countKill) then
{
_newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
_newKillerFrags = _newKillerFrags + 1;
_killerStatsNeedUpdate = true;
_killingPlayer setVariable ["ExileKills", _newKillerFrags];
format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
};
if !(_newKillerRespect isEqualTo _oldKillerRespect) then
{
_killingPlayer setVariable ["ExileScore", _newKillerRespect];
_killerStatsNeedUpdate = true;
format["setAccountScore:%1:%2", _newKillerRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
};
if (_killerStatsNeedUpdate) then
{
_killingPlayer call ExileServer_object_player_sendStatsUpdate;
};
};
_victimStatsNeedUpdate = false;
if (_countDeath) then
{
_newVictimDeaths = _victim getVariable ["ExileDeaths", 0];
_newVictimDeaths = _newVictimDeaths + 1;
_victim setVariable ["ExileDeaths", _newVictimDeaths];
_victimStatsNeedUpdate = true;
format["addAccountDeath:%1", getPlayerUID _victim] call ExileServer_system_database_query_fireAndForget;
};
if !(_newVictimRespect isEqualTo _oldVictimRespect) then
{
_victim setVariable ["ExileScore", _newVictimRespect];
_victimStatsNeedUpdate = true;
format["setAccountScore:%1:%2", _newVictimRespect, getPlayerUID _victim] call ExileServer_system_database_query_fireAndForget;
};
if (_victimStatsNeedUpdate) then
{
_victim call ExileServer_object_player_sendStatsUpdate;
};
if ((vehicle _victim) isEqualTo _victim) then
{
if !(underwater _victim) then
{
if !(_victim call ExileClient_util_world_isInTraderZone) then
{
_victim call ExileServer_object_flies_spawn;
};
};
};
if !(_systemChat isEqualTo "") then
{
if ((getNumber (configFile >> "CfgSettings" >> "KillFeed" >> "showKillFeed")) isEqualTo 1) then
{
["systemChatRequest", [_systemChat]] call ExileServer_system_network_send_broadcast;
};
};
if !(_systemChat isEqualTo "") then
{
if ((getNumber (configFile >> "CfgSettings" >> "Logging" >> "deathLogging")) isEqualTo 1) then
{
"extDB3" callExtension format["1:DEATH:%1", _systemChat];
};
};
_victimPosition = getPos _victim;
format["insertPlayerHistory:%1:%2:%3:%4:%5", getPlayerUID _victim, name _victim, _victimPosition select 0, _victimPosition select 1, _victimPosition select 2] call ExileServer_system_database_query_fireAndForget;
format["deletePlayer:%1", _victim getVariable ["ExileDatabaseId", -1]] call ExileServer_system_database_query_fireAndForget;
true

View File

@ -0,0 +1,57 @@
/**
* ExileServer_system_database_connect
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_isConnected","_error","_result"];
_isConnected = false;
_error_locked = false;
ExileServerDatabaseSessionId = "";
ExileServerRconSessionID = "";
try
{
_result = "extDB3" callExtension "9:VERSION";
format ["Installed extDB2 version: %1", _result] call ExileServer_util_log;
_result = call compile ("extDB3" callExtension "9:ADD_DATABASE:exile");
if (_result select 0 isEqualTo 0) then
{
throw format ["Could not add database: %1", _result];
};
"Connected to database!" call ExileServer_util_log;
ExileServerDatabaseSessionId = str(round(random(999999)));
_result = call compile ("extDB3" callExtension "9:ADD_DATABASE_PROTOCOL:exile:SQL_CUSTOM:SQL:exile.ini");
if ((_result select 0) isEqualTo 0) then
{
throw format ["Failed to initialize database protocol: %1", _result];
};
ExileServerStartTime = (call compile ("extDB3" callExtension "9:LOCAL_TIME")) select 1;
"Database protocol initialized!" call ExileServer_util_log;
"extDB3" callExtension "9:ADD_PROTOCOL:LOG:TRADING:Exile_TradingLog";
"extDB3" callExtension "9:ADD_PROTOCOL:LOG:DEATH:Exile_DeathLog";
"extDB3" callExtension "9:ADD_PROTOCOL:LOG:TERRITORY:Exile_TerritoryLog";
"extDB3" callExtension "9:LOCK";
_isConnected = true;
}
catch
{
if (!_error_locked) then
{
"MySQL connection error!" call ExileServer_util_log;
"Please have a look at @ExileServer/logs/ to find out what went wrong." call ExileServer_util_log;
format ["MySQL Error: %1", _exception] call ExileServer_util_log;
"Server will shutdown now :(" call ExileServer_util_log;
//"extDB3" callExtension "9:SHUTDOWN"; Not implemented in extDB3
}
else
{
format ["extDB3: %1", _exception] call ExileServer_util_log;
"Check your server rpt for errors, your mission might be stuck a loop restarting" call ExileServer_util_log;
};
};
_isConnected

View File

@ -0,0 +1,21 @@
/**
* ExileServer_system_database_handleBig
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_key","_result","_pipe"];
_key = _this;
_result = "";
while{true} do
{
_pipe = "extDB3" callExtension format["5:%1", _key];
if(_pipe isEqualTo "") exitWith {};
_result = _result + _pipe;
};
call (compile _result)

View File

@ -0,0 +1,16 @@
/**
* ExileServer_system_database_query_fireAndForget
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_parameters","_query"];
_parameters = _this;
_query = [1, "SQL",_parameters] joinString ":";
"extDB3" callExtension _query;
true

View File

@ -0,0 +1,16 @@
/**
* ExileServer_system_database_query_insertSingle
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_parameters","_query","_result"];
_parameters = _this;
_query = [0, "SQL",_parameters] joinString ":";
_result = call compile ("extDB3" callExtension _query);
(_result select 1) select 0

View File

@ -0,0 +1,27 @@
/**
* ExileServer_system_database_query_selectFull
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_parameters","_query","_result"];
_parameters = _this;
_query = [0, "SQL",_parameters] joinString ":";
_result = call compile ("extDB3" callExtension _query);
switch (_result select 0) do
{
case 0:
{
(format["Database Error: %1", (_result select 1)]) call ExileServer_util_log;
};
case 2:
{
_result = (_result select 1) call ExileServer_system_database_handleBig;
};
};
_result select 1

View File

@ -0,0 +1,27 @@
/**
* ExileServer_system_database_query_selectSingle
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_parameters","_query","_result"];
_parameters = _this;
_query = [0, "SQL",_parameters] joinString ":";
_result = call compile ("extDB3" callExtension _query);
switch (_result select 0) do
{
case 0:
{
(format["Database Error: %1", (_result select 1)]) call ExileServer_util_log;
};
case 2:
{
_result = (_result select 1) call ExileServer_system_database_handleBig;
};
};
(_result select 1) select 0

View File

@ -0,0 +1,27 @@
/**
* ExileServer_system_database_query_selectSingleField
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_parameters","_query","_result"];
_parameters = _this;
_query = [0,"SQL",_parameters] joinString ":";
_result = call compile ("extDB3" callExtension _query);
switch (_result select 0) do
{
case 0:
{
(format["Database Error: %1", (_result select 1)]) call ExileServer_util_log;
};
case 2:
{
_result = (_result select 1) call ExileServer_system_database_handleBig;
};
};
((_result select 1) select 0) select 0

View File

@ -0,0 +1,39 @@
/**
* ExileServer_system_territory_database_insert
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_flagObject","_territoryName","_flagTexture","_territorySize","_owner","_position","_build","_moderators","_data","_extDB2Message","_territoryID"];
_flagObject = _this select 0;
_territoryName = _this select 1;
_flagTexture = _this select 2;
_territorySize = ((getArray(missionConfigFile >> "CfgTerritories" >> "prices")) select 0)select 1;
_owner = _flagObject getVariable ["ExileOwnerUID",""];
_position = getPosATL _flagObject;
_build_rights = _flagObject getVariable ["ExileTerritoryBuildRights",[]];
_moderators = _flagObject getVariable ["ExileTerritoryModerators",[]];
_data =
[
_owner,
_territoryName,
_position select 0,
_position select 1,
_position select 2,
_territorySize,
1,
_flagTexture,
0,
_build_rights,
_moderators
];
_extDB2Message = ["createTerritory", _data] call ExileServer_util_extDB2_createMessage;
_territoryID = _extDB2Message call ExileServer_system_database_query_insertSingle;
_flagObject setVariable ["ExileDatabaseID",_territoryID];
_flagObject setVariable ["ExileFlagTexture",_flagTexture];
true

View File

@ -0,0 +1,19 @@
/**
* ExileServer_system_territory_maintenance_recalculateDueDate
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_flag","_currentTimestamp","_flagBuild","_maintenancePeriod","_maintenancePeriodDueDate"];
_flag = _this;
_currentTimestamp = call ExileServer_util_time_currentTime;
_flagBuild = _flag getVariable ["ExileTerritoryLastPayed", _currentTimestamp];
_maintenancePeriod = getNumber(configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "territoryLifeTime");
_maintenancePeriodDueDate = call compile ("extDB3" callExtension format["9:DATEADD:%1:[%2,0,0,0]",_flagBuild,_maintenancePeriod]);
_flag setVariable ["ExileTerritoryMaintenanceDue", _maintenancePeriodDueDate select 1, true];
true

View File

@ -0,0 +1,54 @@
/**
* ExileServer_system_territory_network_flagStolenRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_flag","_playerObject","_databaseID","_level","_flagPosition","_spawnRadius","_weaponHolderPosition","_weaponHolder","_logging","_territoryLog"];
_sessionID = _this select 0;
_parameters = _this select 1;
_flag = _parameters select 0;
try
{
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw "Player Object NULL";
};
if ((_flag getVariable ["ExileFlagStolen", 0]) isEqualTo 1) then
{
throw "Flag already stolen!";
};
if ((_playerObject distance2D _flag) > 5) then
{
throw "You are too far away!";
};
_databaseID = _flag getVariable ["ExileDatabaseID",0];
_level = _flag getVariable ["ExileTerritoryLevel",_level];
_flagPosition = getPosATL _flag;
_flagPosition set[2, 0];
_spawnRadius = 3;
_weaponHolderPosition = getPosATL _playerObject;
_weaponHolder = createVehicle ["GroundWeaponHolder", _weaponHolderPosition, [], 0, "CAN_COLLIDE"];
_weaponHolder setPosATL _weaponHolderPosition;
_weaponHolder addMagazineCargoGlobal [format["Exile_Item_FlagStolen%1", _level], 1];
_flag setVariable ["ExileFlagStolen", 1, true];
format["flagStolen:%1:%2",getPlayerUID _playerObject,_databaseID] call ExileServer_system_database_query_fireAndForget;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "territoryLogging");
if (_logging isEqualTo 1) then
{
_territoryLog = format ["PLAYER ( %1 ) %2 STOLE A LEVEL %3 FLAG FROM TERRITORY #%4",getPlayerUID _playerObject,_playerObject,_level,_databaseID];
"extDB3" callExtension format["1:TERRITORY:%1",_territoryLog];
};
_flag call ExileServer_system_xm8_sendFlagStolen;
}
catch
{
[_sessionID, "toastRequest", ["ErrorTitleAndText", ["Failed to steal!", _exception]]] call ExileServer_system_network_send_to;
};
true

View File

@ -0,0 +1,79 @@
/**
* ExileServer_system_territory_network_payFlagRansomRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_flagNetID","_flag","_playerObject","_buildRights","_playerUID","_level","_itemClassName","_flagFee","_playerMoney","_logging","_databaseID","_territoryLog"];
_sessionID = _this select 0;
_parameters = _this select 1;
_flagNetID = _parameters select 0;
try
{
_flag = objectFromNetid _flagNetID;
if (isNull _flag) then
{
throw "Territory not found!";
};
if ((_flag getVariable ["ExileFlagStolen", 1]) isEqualTo 0) then
{
throw "Flag not stolen!";
};
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw "You do not exist!";
};
if !(alive _playerObject) then
{
throw "You are dead!";
};
_buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
_playerUID = getPlayerUID _playerObject;
if !(_playerUID in _buildRights) then
{
throw "Missing build rights!";
};
_level = _flag getVariable ["ExileTerritoryLevel", 0];
_itemClassName = format["Exile_Item_FlagStolen%1", _level];
if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _itemClassName) ) then
{
throw "Flag price not found!";
};
_flagFee = getNumber (missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "price");
if (_flagFee <= 0) then
{
throw "Invalid flag price!";
};
_playerMoney = _playerObject getVariable ["ExileMoney", 0];
if (_playerMoney < _flagFee) then
{
throw "You are too poor!";
};
if !(_playerObject canAdd _itemClassName) then
{
throw "Inventory is full!";
};
_playerMoney = _playerMoney - _flagFee;
_playerObject setVariable ["ExileMoney", _playerMoney, true];
format ["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
_playerObject addItem _itemClassName;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "territoryLogging");
if (_logging isEqualTo 1) then
{
_databaseID = _flag getVariable ["ExileDatabaseID",0];
_territoryLog = format ["PLAYER ( %1 ) %2 PAID %3 POP TABS FOR THE RANSOM OF TERRITORY #%4 | PLAYER TOTAL POP TABS: %5", _playerUID, _playerObject, _flagFee, _databaseID, _playerMoney];
"extDB3" callExtension format["1:TERRITORY:%1", _territoryLog];
};
[_sessionID, "toastRequest", ["SuccessTitleOnly", ["Random paid!"]]] call ExileServer_system_network_send_to;
}
catch
{
[_sessionID, "toastRequest", ["ErrorTitleAndText", ["Failed to pay!", _exception]]] call ExileServer_system_network_send_to;
};
true

View File

@ -0,0 +1,64 @@
/**
* ExileServer_system_territory_network_payTerritoryProtectionMoneyRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_flagNetID","_playerObject","_flagObject","_flagStolen","_territoryDatabaseID","_radius","_level","_objectsInTerritory","_popTabAmountPerObject","_totalPopTabAmount","_playerPopTabs","_currentTimestamp","_logging","_territoryLog"];
_sessionID = _this select 0;
_parameters = _this select 1;
_flagNetID = _parameters select 0;
try
{
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw "Invalid player object";
};
_flagObject = objectFromNetId _flagNetID;
if (isNull _flagObject) then
{
throw "Invalid flag object";
};
_flagStolen = _flagObject getVariable ["ExileFlagStolen", 0];
if (_flagStolen isEqualTo 1) then
{
throw "Flag stolen!";
};
_territoryDatabaseID = _flagObject getVariable ["ExileDatabaseID", 0];
_radius = _flagObject getVariable ["ExileTerritorySize", 15];
_level = _flagObject getVariable ["ExileTerritoryLevel", 1];
_objectsInTerritory = _flagObject getVariable ["ExileTerritoryNumberOfConstructions", 0];
_popTabAmountPerObject = getNumber (missionConfigFile >> "CfgTerritories" >> "popTabAmountPerObject");
_totalPopTabAmount = _level * _popTabAmountPerObject * _objectsInTerritory;
_playerPopTabs = _playerObject getVariable ["ExileMoney", 0];
if (_playerPopTabs < _totalPopTabAmount) then
{
throw "You do not have enough pop tabs!";
};
_playerPopTabs = _playerPopTabs - _totalPopTabAmount;
_playerObject setVariable ["ExileMoney", _playerPopTabs, true];
format["setPlayerMoney:%1:%2", _playerPopTabs, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
_currentTimestamp = call ExileServer_util_time_currentTime;
_flagObject setVariable ["ExileTerritoryLastPayed", _currentTimestamp];
_flagObject call ExileServer_system_territory_maintenance_recalculateDueDate;
format["maintainTerritory:%1", _territoryDatabaseID] call ExileServer_system_database_query_fireAndForget;
[_sessionID, "toastRequest", ["SuccessTitleOnly", ["Protection money paid!"]]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "territoryLogging");
if (_logging isEqualTo 1) then
{
_territoryLog = format ["PLAYER ( %1 ) %2 PAID %3 POP TABS TO PROTECT TERRITORY #%4 | PLAYER TOTAL POP TABS: %5",getPlayerUID _playerObject,_playerObject,_totalPopTabAmount,_territoryDatabaseID,_playerPopTabs];
"extDB3" callExtension format["1:TERRITORY:%1",_territoryLog];
};
_flagObject call ExileServer_system_xm8_sendProtectionMoneyPaid;
}
catch
{
[_sessionID, "toastRequest", ["ErrorTitleAndText", ["Failed to pay!", _exception]]] call ExileServer_system_network_send_to;
_exception call ExileServer_util_log;
};

View File

@ -0,0 +1,46 @@
/**
* ExileServer_system_territory_network_purchaseTerritory
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_player","_price","_playerMoney","_logging","_territoryLog"];
_sessionID = _this select 0;
try
{
_player = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _player) then
{
throw 1;
};
if !(alive _player) then
{
throw 2;
};
_price = ((getArray(missionConfigFile >> "CfgTerritories" >> "prices")) select 0) select 0;
_playerMoney = _player getVariable ["ExileMoney", 0];
if (_price > _playerMoney) then
{
throw 3;
};
_playerMoney = _playerMoney - _price;
_player setVariable ["ExileMoney", _playerMoney, true];
format["setPlayerMoney:%1:%2", _playerMoney, _player getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
[_sessionID, "purchaseTerritoryResponse" , [0]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "territoryLogging");
if (_logging isEqualTo 1) then
{
_territoryLog = format ["PLAYER ( %1 ) %2 PAID %3 POP TABS TO PURCHASE A TERRITORY FLAG | PLAYER TOTAL POP TABS: %4",getPlayerUID _player,_player,_price,_playerMoney];
"extDB3" callExtension format["1:TERRITORY:%1",_territoryLog];
};
}
catch
{
[_sessionID, "purchaseTerritoryResponse" , [_exception]] call ExileServer_system_network_send_to;
};
true

View File

@ -0,0 +1,71 @@
/**
* ExileServer_system_territory_network_restoreFlagRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_flagNetID","_flag","_playerObject","_buildRights","_playerUID","_level","_itemClassName","_territoryDatabaseID","_flagTexture","_logging"];
_sessionID = _this select 0;
_parameters = _this select 1;
_flagNetID = _parameters select 0;
try
{
_flag = objectFromNetid _flagNetID;
if (isNull _flag) then
{
throw "Territory not found!";
};
if ((_flag getVariable ["ExileFlagStolen", 1]) isEqualTo 0) then
{
throw "Flag is not stolen!";
};
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw "You do not exist!";
};
if !(alive _playerObject) then
{
throw "You are dead! Didn't you know that?";
};
if ((_playerObject distance2D _flag) > 4) then
{
throw "You are too far away.";
};
_buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
_playerUID = getPlayerUID _playerObject;
if !(_playerUID in _buildRights) then
{
throw "Missing build rights.";
};
_level = _flag getVariable ["ExileTerritoryLevel", 0];
_itemClassName = format["Exile_Item_FlagStolen%1", _level];
if !(_itemClassName in (magazines _playerObject)) then
{
throw format ["You need a level %1 flag.", _level];
};
_playerObject removeItem _itemClassName;
_territoryDatabaseID = _flag getVariable ["ExileDatabaseID", 0];
format["flagRestore:%1", _territoryDatabaseID] call ExileServer_system_database_query_fireAndForget;
_flag setVariable ["ExileFlagStolen", 0, true];
_flag setFlagOwner objNull;
_flagTexture = _flag getVariable "ExileFlagTexture";
_flag setFlagTexture _flagTexture;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "territoryLogging");
if (_logging isEqualTo 1) then
{
"extDB3" callExtension format ["1:TERRITORY:PLAYER ( %1 ) %2 RESTORED THE FLAG OF TERRITORY #%3", _playerUID, _playerObject, _territoryDatabaseID];
};
[_sessionID, "toastRequest", ["SuccessTitleAndText", ["Flag has been restored!", "You can now maintain and build on our territory again."]]] call ExileServer_system_network_send_to;
_flag call ExileServer_system_xm8_sendFlagRestored;
}
catch
{
[_sessionID, "toastRequest", ["ErrorTitleAndText", ["Failed to restore!", _exception]]] call ExileServer_system_network_send_to;
};
true

View File

@ -0,0 +1,72 @@
/**
* ExileServer_system_territory_network_territoryUpgradeRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_flag","_playerObject","_databaseID","_moderators","_level","_territoryConfig","_territoryLevels","_territoryPrice","_territoryRange","_playerMoney","_logging","_territoryLog"];
_sessionID = _this select 0;
_parameters = _this select 1;
_flag = _parameters select 0;
try
{
if (isNull _flag) then
{
throw "Invalid flag object";
};
if ((_flag getVariable ["ExileFlagStolen", 0]) isEqualTo 1) then
{
throw "Flag is stolen!";
};
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw "Player Object NULL";
};
_databaseID = _flag getVariable ["ExileDatabaseID",0];
_moderators = _flag getVariable ["ExileTerritoryModerators",[]];
if !((getPlayerUID _playerObject) in _moderators) then
{
throw "No upgrade Access!";
};
_level = _flag getVariable ["ExileTerritoryLevel",_level];
_territoryConfig = getArray(missionConfigFile >> "CfgTerritories" >> "Prices");
_territoryLevels = count _territoryConfig;
if (_territoryLevels < (_level + 1)) then
{
throw "This territory has already the highest level.";
};
_territoryPrice = (_territoryConfig select _level) select 0;
_territoryRange = (_territoryConfig select _level) select 1;
_playerMoney = _playerObject getVariable ["ExileMoney",0];
if (_playerMoney < _territoryPrice) then
{
throw "Not enough pop tabs!";
};
_playerMoney = _playerMoney - _territoryPrice;
_playerObject setVariable ["ExileMoney", _playerMoney, true];
format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
_flag setVariable ["ExileTerritoryLevel",_level + 1, true];
_flag setVariable ["ExileTerritorySize",_territoryRange, true];
format ["setTerritoryLevel:%1:%2",_level + 1,_databaseID] call ExileServer_system_database_query_fireAndForget;
format ["setTerritorySize:%1:%2",_territoryRange,_databaseID] call ExileServer_system_database_query_fireAndForget;
_flag call ExileServer_system_territory_updateNearContainers;
_flag call ExileServer_system_territory_updateNearConstructions;
[_sessionID, "toastRequest", ["SuccessTitleAndText", ["Territory upgraded!", format ["Your territory has reached level %1 and now has a new radius of %2 meters.", _level + 1, _territoryRange]]]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "territoryLogging");
if (_logging isEqualTo 1) then
{
_territoryLog = format ["PLAYER ( %1 ) %2 PAID %3 POP TABS TO UPGRADE TERRITORY #%4 TO LEVEL %5 | PLAYER TOTAL POP TABS: %6",getPlayerUID _playerObject,_playerObject,_territoryPrice,_databaseID,(_level + 1),_playerMoney];
"extDB3" callExtension format["1:TERRITORY:%1",_territoryLog];
};
}
catch
{
[_sessionID, "toastRequest", ["ErrorTitleAndText", ["Failed to upgrade!", _exception]]] call ExileServer_system_network_send_to;
};
true

View File

@ -0,0 +1,82 @@
/**
* ExileServer_system_trading_network_purchaseItemRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_itemClassName","_quantity","_containerType","_containerNetID","_playerObject","_vehicleObject","_salesPrice","_playerMoney","_playerRespect","_quality","_requiredRespect","_logging","_traderLog","_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_itemClassName = _parameters select 0;
_quantity = _parameters select 1;
_containerType = _parameters select 2;
_containerNetID = _parameters select 3;
try
{
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (_playerObject getVariable ["ExileMutex",false]) then
{
throw 12;
};
_playerObject setVariable ["ExileMutex",true];
_vehicleObject = objNull;
if (isNull _playerObject) then
{
throw 1;
};
if !(alive _playerObject) then
{
throw 2;
};
if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _itemClassName) ) then
{
throw 3;
};
_salesPrice = getNumber (missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "price");
if (_salesPrice <= 0) then
{
throw 4;
};
_playerMoney = _playerObject getVariable ["ExileMoney", 0];
if (_playerMoney < _salesPrice) then
{
throw 5;
};
_playerRespect = _playerObject getVariable ["ExileScore", 0];
_quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "quality");
_requiredRespect = getNumber(missionConfigFile >> "CfgTrading" >> "requiredRespect" >> format["Level%1",_quality]);
if (_playerRespect < _requiredRespect) then
{
throw 14;
};
_playerMoney = _playerMoney - _salesPrice;
_playerObject setVariable ["ExileMoney", _playerMoney, true];
format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
[_sessionID, "purchaseItemResponse", [0, _salesPrice, _itemClassName, 1, _containerType, _containerNetID]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
if (_logging isEqualTo 1) then
{
_traderLog = format ["PLAYER: ( %1 ) %2 PURCHASED ITEM %3 FOR %4 POPTABS | PLAYER TOTAL MONEY: %5",getPlayerUID _playerObject,_playerObject,_itemClassName,_salesPrice,_playerMoney];
"extDB3" callExtension format["1:TRADING:%1",_traderLog];
};
if !(_vehicleObject isEqualTo objNull) then
{
_vehicleObject call ExileServer_object_vehicle_database_update;
}
else
{
_playerObject call ExileServer_object_player_database_update;
};
}
catch
{
_responseCode = _exception;
[_sessionID, "purchaseItemResponse", [_responseCode, 0, "", 0, 0, ""]] call ExileServer_system_network_send_to;
};
_playerObject setVariable ["ExileMutex",false];
true

View File

@ -0,0 +1,90 @@
/**
* ExileServer_system_trading_network_purchaseVehicleRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_vehicleClass","_pinCode","_playerObject","_salesPrice","_playerMoney","_position","_vehicleObject","_logging","_traderLog","_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_vehicleClass = _parameters select 0;
_pinCode = _parameters select 1;
try
{
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw 1;
};
if !(alive _playerObject) then
{
throw 2;
};
if (_playerObject getVariable ["ExileMutex",false]) then
{
throw 12;
};
_playerObject setVariable ["ExileMutex", true];
if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _vehicleClass) ) then
{
throw 3;
};
_salesPrice = getNumber (missionConfigFile >> "CfgExileArsenal" >> _vehicleClass >> "price");
if (_salesPrice <= 0) then
{
throw 4;
};
_playerMoney = _playerObject getVariable ["ExileMoney", 0];
if (_playerMoney < _salesPrice) then
{
throw 5;
};
if !((count _pinCode) isEqualTo 4) then
{
throw 11;
};
if (_vehicleClass isKindOf "Ship") then
{
_position = [(getPosATL _playerObject), 100, 20] call ExileClient_util_world_findWaterPosition;
_vehicleObject = [_vehicleClass, _position, (random 360), false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
}
else
{
_position = (getPos _playerObject) findEmptyPosition [10, 250, _vehicleClass];
if (_position isEqualTo []) then
{
throw 13;
};
_vehicleObject = [_vehicleClass, _position, (random 360), true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
};
_vehicleObject setVariable ["ExileOwnerUID", (getPlayerUID _playerObject)];
_vehicleObject setVariable ["ExileIsLocked",0];
_vehicleObject lock 0;
_vehicleObject call ExileServer_object_vehicle_database_insert;
_vehicleObject call ExileServer_object_vehicle_database_update;
_playerMoney = _playerMoney - _salesPrice;
_playerObject setVariable ["ExileMoney", _playerMoney, true];
format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
[_sessionID, "purchaseVehicleResponse", [0, netId _vehicleObject, _salesPrice]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
if (_logging isEqualTo 1) then
{
_traderLog = format ["PLAYER: ( %1 ) %2 PURCHASED VEHICLE %3 FOR %4 POPTABS | PLAYER TOTAL MONEY: %5",getPlayerUID _playerObject,_playerObject,_vehicleClass,_salesPrice,_playerMoney];
"extDB3" callExtension format["1:TRADING:%1",_traderLog];
};
}
catch
{
_responseCode = _exception;
[_sessionID, "purchaseVehicleResponse", [_responseCode, "", 0]] call ExileServer_system_network_send_to;
};
if !(isNull _playerObject) then
{
_playerObject setVariable ["ExileMutex", false];
};
true

View File

@ -0,0 +1,93 @@
/**
* ExileServer_system_trading_network_purchaseVehicleSkinRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_vehicleNetID","_skinTextures","_playerObject","_vehicleObject","_vehicleParentClass","_salesPrice","_skinVariations","_availableSkinTexture","_playerMoney","_skinMaterials","_skinClassName","_vehicleID","_logging","_traderLog","_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_vehicleNetID = _parameters select 0;
_skinTextures = _parameters select 1;
try
{
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw 1;
};
if !(alive _playerObject) then
{
throw 2;
};
if(_playerObject getVariable ["ExileMutex",false]) then
{
throw 12;
};
_playerObject setVariable ["ExileMutex",true];
_vehicleObject = objectFromNetId _vehicleNetID;
if (isNull _vehicleObject) then
{
throw 6;
};
_vehicleParentClass = configName (inheritsFrom (configFile >> "CfgVehicles" >> (typeOf _vehicleObject)));
if !(isClass (missionConfigFile >> "CfgVehicleCustoms" >> _vehicleParentClass) ) then
{
throw 7;
};
_salesPrice = -1;
_skinVariations = getArray(missionConfigFile >> "CfgVehicleCustoms" >> _vehicleParentClass >> "skins");
{
_availableSkinTexture = _x select 3;
if (_availableSkinTexture isEqualTo _skinTextures) exitWith
{
_salesPrice = _x select 1;
};
}
forEach _skinVariations;
if (_salesPrice <= 0) then
{
throw 4;
};
_playerMoney = _playerObject getVariable ["ExileMoney", 0];
if (_playerMoney < _salesPrice) then
{
throw 5;
};
_skinMaterials = getArray(configFile >> "CfgVehicles" >> _skinClassName >> "hiddenSelectionsMaterials");
{
_vehicleObject setObjectTextureGlobal [_forEachIndex, _skinTextures select _forEachIndex];
}
forEach _skinTextures;
{
_vehicleObject setObjectMaterial [_forEachIndex, _x];
}
forEach _skinMaterials;
_vehicleID = _vehicleObject getVariable ["ExileDatabaseID", -1];
format["updateVehicleSkin:%1:%2", _skinTextures, _vehicleID] call ExileServer_system_database_query_fireAndForget;
_playerMoney = _playerMoney - _salesPrice;
_playerObject setVariable ["ExileMoney", _playerMoney, true];
format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
[_sessionID, "purchaseVehicleSkinResponse", [0, _salesPrice]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
if (_logging isEqualTo 1) then
{
_traderLog = format ["PLAYER: ( %1 ) %2 PURCHASED VEHICLE SKIN %3 (%4) FOR %5 POPTABS | PLAYER TOTAL MONEY: %6",getPlayerUID _playerObject,_playerObject,_skinTextures,_vehicleParentClass,_salesPrice,_playerMoney];
"extDB3" callExtension format["1:TRADING:%1",_traderLog];
};
}
catch
{
_responseCode = _exception;
[_sessionID, "purchaseVehicleSkinResponse", [_responseCode, 0]] call ExileServer_system_network_send_to;
};
if !(isNull _playerObject) then
{
_playerObject setVariable ["ExileMutex", false];
};
true

View File

@ -0,0 +1,133 @@
/**
* ExileServer_system_trading_network_sellItemRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_itemClassName","_quantity","_containerType","_containerNetID","_playerObject","_vehicleObject","_sellPrice","_playerMoney","_noRespectItems","_playerRespect","_respectGain","_logging","_playerMoneyString","_traderLog","_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_itemClassName = _parameters select 0;
_quantity = _parameters select 1;
_containerType = _parameters select 2;
_containerNetID = _parameters select 3;
try
{
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw 1;
};
if !(alive _playerObject) then
{
throw 2;
};
if(_playerObject getVariable ["ExileMutex",false]) then
{
throw 12;
};
_playerObject setVariable ["ExileMutex",true];
_vehicleObject = objNull;
if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _itemClassName) ) then
{
throw 3;
};
_sellPrice = _itemClassName call ExileClient_util_gear_calculateSellPrice;
if (_containerType isEqualTo 1) then
{
if (_itemClassName isEqualTo (primaryWeapon _playerObject)) then
{
{
{
if !(_x isEqualTo "") then
{
_sellPrice = _sellPrice + (_x call ExileClient_util_gear_calculateSellPrice);
};
}
forEach _x;
}
forEach
[
primaryWeaponItems _playerObject,
primaryWeaponMagazine _playerObject
];
};
if (_itemClassName isEqualTo (handgunWeapon _playerObject)) then
{
{
{
if !(_x isEqualTo "") then
{
_sellPrice = _sellPrice + (_x call ExileClient_util_gear_calculateSellPrice);
};
}
forEach _x;
}
forEach
[
handgunItems _playerObject,
handgunMagazine _playerObject
];
};
};
if (_sellPrice <= 0) then
{
throw 4;
};
_playerMoney = _playerObject getVariable ["ExileMoney", 0];
_playerMoney = _playerMoney + _sellPrice;
_playerObject setVariable ["ExileMoney", _playerMoney, true];
format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
_noRespectItems =
[
"Exile_Item_FlagStolen1",
"Exile_Item_FlagStolen2",
"Exile_Item_FlagStolen3",
"Exile_Item_FlagStolen4",
"Exile_Item_FlagStolen5",
"Exile_Item_FlagStolen6",
"Exile_Item_FlagStolen7",
"Exile_Item_FlagStolen8",
"Exile_Item_FlagStolen9",
"Exile_Item_FlagStolen10"
];
_playerRespect = _playerObject getVariable ["ExileScore", 0];
if !(_itemClassName in _noRespectItems) then
{
_respectGain = _sellPrice * getNumber (configFile >> "CfgSettings" >> "Respect" >> "tradingRespectFactor");
_playerRespect = floor (_playerRespect + _respectGain);
_playerObject setVariable ["ExileScore", _playerRespect];
format["setAccountScore:%1:%2", _playerRespect, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget;
};
[_sessionID, "sellItemResponse", [0, _sellPrice, _itemClassName, 1, _containerType, _containerNetID, str _playerRespect]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
if (_logging isEqualTo 1) then
{
_playerMoneyString = _playerMoney call ExileClient_util_string_exponentToString;
_traderLog = format ["PLAYER: ( %1 ) %2 SOLD ITEM %3 FOR %4 POPTABS AND %5 RESPECT | PLAYER TOTAL MONEY: %6",getPlayerUID _playerObject,_playerObject,_itemClassName,_sellPrice,_respectGain,_playerMoneyString];
"extDB3" callExtension format["1:TRADING:%1",_traderLog];
};
if !(_vehicleObject isEqualTo objNull) then
{
_vehicleObject call ExileServer_object_vehicle_database_update;
}
else
{
_playerObject call ExileServer_object_player_database_update;
};
}
catch
{
_responseCode = _exception;
[_sessionID, "sellItemResponse", [_responseCode, 0, "", 0, 0, "", ""]] call ExileServer_system_network_send_to;
};
if !(isNull _playerObject) then
{
_playerObject setVariable ["ExileMutex", false];
};
true

View File

@ -0,0 +1,85 @@
/**
* ExileServer_system_trading_network_wasteDumpRequest
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_sessionID","_parameters","_vehicleNetID","_mode","_vehicleObject","_vehicleDBID","_playerObject","_cargo","_revenue","_playerMoney","_respectGain","_playerRespect","_logging","_traderLog","_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_vehicleNetID = _parameters select 0;
_mode = _parameters select 1;
try
{
_vehicleObject = objectFromNetId _vehicleNetID;
_vehicleDBID = _vehicleObject getVariable "ExileDatabaseID";
if (isNull _vehicleObject) then
{
throw 6;
};
if (_vehicleObject getVariable ["ExileMutex", false]) then
{
throw 12;
};
_vehicleObject setVariable ["ExileMutex", true];
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
if (isNull _playerObject) then
{
throw 1;
};
if !(alive _playerObject) then
{
throw 2;
};
if !((owner _vehicleObject) isEqualTo (owner _playerObject)) then
{
throw 6;
};
_cargo = _vehicleObject call ExileClient_util_containerCargo_list;
_revenue = _cargo call ExileClient_util_gear_calculateTotalSellPrice;
clearBackpackCargoGlobal _vehicleObject;
clearItemCargoGlobal _vehicleObject;
clearMagazineCargoGlobal _vehicleObject;
clearWeaponCargoGlobal _vehicleObject;
if (_mode isEqualTo 2) then
{
_revenue = _revenue + ([(typeOf _vehicleObject)] call ExileClient_util_gear_calculateTotalSellPrice);
_vehicleObject call ExileServer_object_vehicle_remove;
deleteVehicle _vehicleObject;
}
else
{
_vehicleObject call ExileServer_object_vehicle_database_update;
};
_playerMoney = _playerObject getVariable ["ExileMoney", 0];
_playerMoney = _playerMoney + _revenue;
_playerObject setVariable ["ExileMoney", _playerMoney, true];
format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
_respectGain = _revenue * getNumber (configFile >> "CfgSettings" >> "Respect" >> "tradingRespectFactor");
_playerRespect = _playerObject getVariable ["ExileScore", 0];
_playerRespect = floor (_playerRespect + _respectGain);
_playerObject setVariable ["ExileScore", _playerRespect];
format["setAccountScore:%1:%2", _playerRespect, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget;
[_sessionID, "wasteDumpResponse", [0, _revenue, str _playerRespect]] call ExileServer_system_network_send_to;
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
if (_logging isEqualTo 1) then
{
_traderLog = format ["PLAYER: ( %1 ) %2 SOLD ITEM: %3 (ID# %4) with Cargo %5 FOR %6 POPTABS AND %7 RESPECT | PLAYER TOTAL MONEY: %8",getPlayerUID _playerObject,_playerObject,typeOf _vehicleObject,_vehicleDBID,_cargo,_revenue,_respectGain,_playerMoney];
"extDB3" callExtension format["1:TRADING:%1",_traderLog];
};
}
catch
{
_responseCode = _exception;
[_sessionID, "wasteDumpResponse", [_responseCode, 0, ""]] call ExileServer_system_network_send_to;
};
if (!isNull _vehicleObject) then
{
_vehicleObject setVariable ["ExileMutex", false];
};
true

View File

@ -0,0 +1,15 @@
/**
* ExileServer_util_time_addTime
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_time1","_time2"];
_time1 = _this select 0;
_time2 = _this select 1;
(call compile ("extDB3" callExtension format ["9:TIMEDIFF:MINUTES:%1:%2",_time1,_time2])) select 1

View File

@ -0,0 +1,12 @@
/**
* ExileServer_util_time_currentTime
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
(call compile ("extDB3" callExtension "9:LOCAL_TIME")) select 1

View File

@ -0,0 +1,12 @@
/**
* ExileServer_util_time_uptime
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
(call compile ("extDB3" callExtension "9:UPTIME:MINUTES")) select 1