Sign in to follow this  
??

[FIX]Sell items with calculations in CfgExileArsenal

4 posts in this topic

HI!

Today i spent about 5hrs to totally rebuild CfgExileArsenal to be able to set all prices with few constans values. Then i noticed that items with calculations in price are unsaleable :((

So, here is fix for this if anyone want it.

class CfgExileCustomCode
{
	ExileClient_util_gear_calculateSellPrice = "Exile_Client_Overrides\ExileClient_util_gear_calculateSellPrice.sqf";
};

ExileClient_util_gear_calculateSellPrice.sqf: (v2)

/**
 * ExileClient_util_gear_calculateSellPrice
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 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["_className", "_amount"];
_className = _this;
_amount = 0;
if(!isNull (missionConfigFile >> "CfgExileArsenal" >> _className >> "sellPrice"))then
{
	_amount = getNumber (missionConfigFile >> "CfgExileArsenal" >> _className >> "sellPrice");
}
else 
{
	if(!isNull (missionConfigFile >> "CfgExileArsenal" >> _className >> "price")) then
	{
		_amount = getNumber (missionConfigFile >> "CfgExileArsenal" >> _className >> "price");
		_amount = _amount * (getNumber (missionConfigFile >> "CfgTrading" >> "sellPriceFactor"));
		_amount = (floor _amount) max 1;
	};
};
_amount

Enjoy!

PS. Sorry if it's wrong forum to post it :(

Edited by ??

Share this post


Link to post
Share on other sites

The original code is fine
This also has potential to break in future version of arma, if getNumber returns something besides zero if entry doesn't exist (i.e this behaviour isn't in the spec)


Nevermind you mentioned calculcations in the configs, should give people examples ;) 

Share this post


Link to post
Share on other sites
Advertisement

Example :

#define GUN556_PRICE_BASE 1000
#define GUN_GL 500
class arifle_Mk20_GL_F												{ quality = 1; price = GUN556_PRICE_BASE + GUN_GL; };

With something like this we can buy this weapon (there is no isNumber there), but instead of selling price we have 'unsaleable'

Edited by ??

Share this post


Link to post
Share on other sites

Updated to safier version (i think).

Only "downside" of this solution is if you have

class arifle_Mk20_GL_F	{ quality = 1; price = GUN556_PRICE_BASE + GUN_GL; sellPrice = asda; };

it will be unsaleable insted of counting price * sellPriceFactor. But i think it will make spotting ExileArsenal config typos easier.

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.