Jump to content
Sign in to follow this  
El' Rabito

Territory Member Count Base Protection Multiplicator

Recommended Posts

What it does: The amount of the territory protection is affected by the number of members in the territory.

Installation: Make two customcode overrides.

ExileClient_gui_payTerritoryProtectionMoneyDialog_event_onTerritoryDropDownSelectionChanged.sqf

/**
 * ExileClient_gui_payTerritoryProtectionMoneyDialog_event_onTerritoryDropDownSelectionChanged
 *
 * 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["_display", "_territoryDropDown", "_index", "_flagObject", "_radius", "_level", "_objectsInTerritory", "_ETBR", "_ETTPC", "_popTabAmountPerObject", "_totalPopTabAmount","_totalPopTabAmountD", "_costControl", "_payButton", "_playerMoney"];
disableSerialization;
_display = uiNameSpace getVariable ["RscExilePayTerritoryProtectionMoneyDialog", displayNull];
_territoryDropDown = _this select 0;
_index = _this select 1;
_flagObject = objectFromNetId (_territoryDropDown lbData _index);
_radius = _flagObject getVariable ["ExileTerritorySize", 15];
_level = _flagObject getVariable ["ExileTerritoryLevel", 1];
_popTabAmountPerObject = getNumber (missionConfigFile >> "CfgTerritories" >> "popTabAmountPerObject");
_objectsInTerritory = _flagObject getVariable ["ExileTerritoryNumberOfConstructions", 0];
_ETBR = _flagObject getVariable ["ExileTerritoryBuildRights", []];
_ETTPC = count (_ETBR);

_case = {};
if (_ETTPC == 4) then {_case = 1};  
if (_ETTPC == 5) then {_case = 2}; 
if (_ETTPC == 6) then {_case = 3}; 
if (_ETTPC == 7) then {_case = 4}; 
if (_ETTPC == 8) then {_case = 5}; 
if (_ETTPC == 9) then {_case = 6}; 
if (_ETTPC == 10) then {_case = 7}; 
if (_ETTPC == 11) then {_case = 8}; 
if (_ETTPC == 12) then {_case = 9}; 
if (_ETTPC == 13) then {_case = 10};
if (_ETTPC == 14) then {_case = 11};
if (_ETTPC == 15) then {_case = 12};
if (_ETTPC >= 16) then {_case = 13};


switch (_case) do {
	default		{_totalPopTabAmount = _level * _popTabAmountPerObject * _objectsInTerritory;};											  
	case 1: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 2.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 2: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 3.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 3: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 3.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 4: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 4.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 5: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 4.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 6: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 5.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 7: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 6.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 8: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 7.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 9: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 7.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 10: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 8.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 11: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 8.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 12: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 9.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
	case 13: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 9.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;};
};                                                                                              

_costControl = _display displayCtrl 4000;
_costControl ctrlSetStructuredText (parseText format["<t size='1.4'>%1<img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='1' shadow='true' /></t>", _totalPopTabAmount]);
_payButton = _display displayCtrl 4002;
_playerMoney = player getVariable ["ExileMoney", 0];
if (_playerMoney >= _totalPopTabAmount) then 
{
	_payButton ctrlEnable true;
	_costControl ctrlSetTextColor [1, 1, 1, 1];
}
else 
{
	_payButton ctrlEnable false;
	_costControl ctrlSetTextColor [0.91, 0, 0, 1];
};

ExileServer_system_territory_network_payTerritoryProtectionMoneyRequest.sqf

/**
 * 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/.
 * 64Bit Conversion File Header (Extdb3) - Validatior
 */
 
private["_sessionID","_parameters","_flagNetID","_playerObject","_flagObject","_flagStolen","_territoryDatabaseID","_radius","_level","_objectsInTerritory","_popTabAmountPerObject","_totalPopTabAmount","_totalPopTabAmountD", "_ETBR", "_ETTPC", "_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");
	_ETBR = _flagObject getVariable ["ExileTerritoryBuildRights", []];
	_ETTPC = count (_ETBR);
	
	_case = {};
	if (_ETTPC == 4) then {_case = 1};  
	if (_ETTPC == 5) then {_case = 2}; 
	if (_ETTPC == 6) then {_case = 3}; 
	if (_ETTPC == 7) then {_case = 4}; 
	if (_ETTPC == 8) then {_case = 5}; 
	if (_ETTPC == 9) then {_case = 6}; 
	if (_ETTPC == 10) then {_case = 7}; 
	if (_ETTPC == 11) then {_case = 8}; 
	if (_ETTPC == 12) then {_case = 9}; 
	if (_ETTPC == 13) then {_case = 10};
	if (_ETTPC == 14) then {_case = 11};
	if (_ETTPC == 15) then {_case = 12};
	if (_ETTPC >= 16) then {_case = 13};
	
	
	switch (_case) do {
		default		{_totalPopTabAmount = _level * _popTabAmountPerObject * _objectsInTerritory;}; //45.000 (250 objects lvl 10 / config popTabAmountPerObject = 18;)	//Poptabs	//Players
		case 1: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 2.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 112.000 	//>=4
		case 2: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 3.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 135.000   //5
		case 3: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 3.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 157.500   //6
		case 4: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 4.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 180.000   //7
		case 5: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 4.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 202.500   //8
		case 6: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 5.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 225.000   //9
		case 7: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 6.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 292.500  	//10
		case 8: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 7.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 315.000   //11
		case 9: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 7.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 337.000  	//12
		case 10: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 8.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 360.000   //13
		case 11: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 8.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 382.500   //14
		case 12: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 9.00; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 405.000   //15
		case 13: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 9.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 427.500   //>16
	};                                                            
		
	_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;
};



Like you see below a territory with less than 4 players is not affected by the multiplier. (default case).
But with 4 members in your territory you pay 45.000 * 2.50 (Lvl 10 base max objects) = 112.000 poptabs.

default		{_totalPopTabAmount = _level * _popTabAmountPerObject * _objectsInTerritory;}; //45.000 (250 objects lvl 10 / config popTabAmountPerObject = 18;) 		//Poptabs	//Players
case 1: 	{_totalPopTabAmountD = _level * _popTabAmountPerObject * _objectsInTerritory * 2.50; _totalPopTabAmount = [_totalPopTabAmountD, 0] call BIS_fnc_cutDecimals;}; // 112.000 	//>4

Adjust the multipliers to your likings but remember to change them in both files!

  • Like 3

Share this post


Link to post
Share on other sites

Updated.
Removed some unnecessary code....

Share this post


Link to post
Share on other sites
Sign in to follow this  

×