Sign in to follow this  
Dr_Ranzigesau

Base Upgrade mit Respect bezahlen

12 posts in this topic

Wie die Überschrift schon sagt suche ich wie das geht oder das umstellt wird, das man das Base Upgrade mit Respect bezahlen kann. Kann mir da einer weiter helfen?

Edited by Dr_Ranzigesau

Share this post


Link to post
Share on other sites

Sind 2-3 Files abzuändern, hab es leider nicht mehr vorliegen aber so grob (texte für gui und logs müsstest auch noch anpassen):

 

/**
 * ExileClient_gui_payTerritoryProtectionMoneyDialog_event_onTerritoryDropDownSelectionChanged
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * Modded to pay protection money with respect
 * by WURSTKETTE
 *
 * 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", "_popTabAmountPerObject", "_totalPopTabAmount", "_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];
_objectsInTerritory = _flagObject getVariable ["ExileTerritoryNumberOfConstructions", 0];
_popTabAmountPerObject = getNumber (missionConfigFile >> "CfgTerritories" >> "popTabAmountPerObject");
_totalPopTabAmount = _level * _popTabAmountPerObject * _objectsInTerritory;
_costControl = _display displayCtrl 4000;
_costControl ctrlSetStructuredText (parseText format["<t size='1.4'>%1 Respect</t>", _totalPopTabAmount]);
_payButton = _display displayCtrl 4002;
_playerMoney = player getVariable ["ExileScore", 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
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * Modded to pay protection money with respect
 * by WURSTKETTE
 *
 * 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 ["ExileScore", 0];
	if (_playerPopTabs < _totalPopTabAmount) then
	{
		throw "You do not have enough respect!";
	};
	_playerPopTabs = _playerPopTabs - _totalPopTabAmount;
	_playerObject setVariable ["ExileScore", _playerPopTabs, true];
format["setAccountScore:%1:%2", _playerPopTabs, (getPlayerUID _playerObject)] 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 RESPECT TO PROTECT TERRITORY #%4 | PLAYER TOTAL RESPECT: %5",getPlayerUID _playerObject,_playerObject,_totalPopTabAmount,_territoryDatabaseID,_playerPopTabs];
		"extDB2" 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;
};

 

Wie gesagt, nicht getetestet - versuch es lieber erstmal auf ner Testbüchse. Wenn ich dazu komme, schau ich später nochmal genauer.

 

Grüße

Edited by WURSTKETTE
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

 

32 minutes ago, Dr_Ranzigesau said:

für das upgrate

Der Code war für Baseprotection bezahlen, hatte ich nicht gesehen :P Sollte wohl aufmerksamer lesen.

Ich kuck mal was für Baseupgrade geht...

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites

@Dr_Ranzigesau Bitteschön - hab es auch direkt getestet - läuft.

Die Preise zieht er aus der config.cpp:

class CfgTerritories
{
	// Base Cost / Radius
	// Level 1 is allways for Pop Tabs, >= 2 for Respect
	prices[] = 
	{
		// Purchase Price 		Radius 		Number of Objects
		{5000,					15,			30 					}, // Level 1
		{10000,					30,			60 					}, // Level 2 
		{15000,					45,			90 					}, // Level 3
		{20000,					60,			120					}, // Level 4
		{25000,					75,			150					}, // Level 5
		{30000,					90,			180					}, // Level 6
		{35000,					105,		210					}, // Level 7
		{40000,					120,		240					}, // Level 8
		{45000,					135,		270					}, // Level 9
		{50000,					150,		300					}  // Level 10
	};
};

 

/**
 * ExileClient_gui_upgradeTerritoryDialog_event_onTerritoryDropDownSelectionChanged
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * Modded to upgrade base for respect 
 * by WURSTKETTE
 *
 * 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", "_level", "_territoryConfig", "_territoryLevels", "_territoryPrice", "_territoryRange", "_costControl", "_radiusControl", "_levelControl", "_upgradeButton"];
disableSerialization;
_display = uiNameSpace getVariable ["RscExileUpgradeTerritoryDialog", displayNull];
_territoryDropDown = _this select 0;
_index = _this select 1;
_flagObject = objectFromNetId (_territoryDropDown lbData _index);
_level = _flagObject getVariable ["ExileTerritoryLevel", 1];
_territoryConfig = getArray(missionConfigFile >> "CfgTerritories" >> "Prices");
_territoryLevels = count _territoryConfig;
if((_level + 1) > _territoryLevels)then
{
	_territoryPrice = (_territoryConfig select (_territoryLevels - 1)) select 0;
	_territoryRange = (_territoryConfig select (_territoryLevels - 1)) select 1;
}
else
{
	_territoryPrice = (_territoryConfig select _level) select 0;
	_territoryRange = (_territoryConfig select _level) select 1;	
};
_costControl = _display displayCtrl 4002;
_costControl ctrlSetStructuredText(parseText format["<t size='1.4'>%1 Respect</t>", _territoryPrice]);
_radiusControl = _display displayCtrl 4003;
_radiusControl ctrlSetStructuredText parseText format ["<t size='1.4'>%1m</t>",_territoryRange];
_levelControl = _display displayCtrl 4004;
_levelControl ctrlSetStructuredText parseText format ["<t size='1.4'>%1/%2</t>",_level + 1,_territoryLevels];
_upgradeButton = _display displayCtrl 4001;
_upgradeButton ctrlEnable true;
/**
 * ExileServer_system_territory_network_territoryUpgradeRequest
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * Modded to upgrade base for respect 
 * by WURSTKETTE
 *
 * 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 ["ExileScore",0];
	if (_playerMoney < _territoryPrice) then
	{
		throw "Not enough respect!";
	};
	_playerMoney = _playerMoney - _territoryPrice;
	_playerObject setVariable ["ExileScore", _playerMoney, true];
	format["setAccountScore:%1:%2", _playerMoney, (getPlayerUID _playerObject)] 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 RESPECT TO UPGRADE TERRITORY #%4 TO LEVEL %5 | PLAYER TOTAL RESPECT: %6",getPlayerUID _playerObject,_playerObject,_territoryPrice,_databaseID,(_level + 1),_playerMoney];
		"extDB2" callExtension format["1:TERRITORY:%1",_territoryLog];
	};
}
catch
{
	[_sessionID, "toastRequest", ["ErrorTitleAndText", ["Failed to upgrade!", _exception]]] call ExileServer_system_network_send_to;
};
true

 

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites
46 minutes ago, Dr_Ranzigesau said:

Weißt du auch wo ich paa dateien finde das ich da auch das Respekt Eintrage

Wie meinst du genau, paa dateien finden? Respekt eintragen? Ne *.paa die anstelle des Poptabsymbol für Respekt steht? I

n oben genannten Code hab ich das Poptabsymbol komplett entfernt.

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites

ach so ok dann ist gut

aber etwas stimmt bei mir jetzt nicht.

Kann Fahne setzen, dann aber nichts bauen. Er sagt ich währe nicht in meinem Territorium.?????

Habe deine Sachen jetzt noch nicht Eingefügt.

Nur das erste von oben ist eingefügt, habe es auch wieder zurück gesetzt aber trotzdem bleibt das so.

weiss jetzt aber auch nicht ob das schon vorher so war

 

Edited by Dr_Ranzigesau

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.