- VJ -

Sell Price Modifier!

107 posts in this topic

Ok, so I wanted more control over the trader buy and sell price range to allow for a lower or higher sell price to the buy price per item.

This allows you to change from the default of 50% sell price to the buy price in the mission config and set a new ratio per item.

Enjoy.
 

1. In config.cpp in your mission folder (exile.altis) :

Change ALL items under: class CfgExileArsenal {}; >> class ITEM from:

class ITEM { quality = 2; price = 10; };
to
class ITEM { quality = 2; price = 100; spm = 0.5; };  

Note: 
Price * tax =  sell price [e.g 100 * 0.5 = 50] spm = Sell Price Modifier

Still in config.cpp, add between the brackets:
class CfgExileCustomCode { 

ExileClient_util_gear_calculateTotalPrice = "spm\ExileClient_util_gear_calculateTotalPrice.sqf";
ExileClient_gui_traderDialog_updateInventoryListBox = "spm\ExileClient_gui_traderDialog_updateInventoryListBox.sqf";
ExileClient_gui_wasteDumpDialog_event_onModeDropDownSelectionChanged = "spm\ExileClient_gui_wasteDumpDialog_event_onModeDropDownSelectionChanged.sqf";
}; 


2. Extract and copy these files from exile_client\code\ to a folder named "spm" in your mission folder (exile.altis):
ExileClient_util_gear_calculateTotalPrice.sqf
ExileClient_gui_traderDialog_updateInventoryListBox.sqf  ExileClient_gui_wasteDumpDialog_event_onModeDropDownSelectionChanged.sqf 


3. In your custom folder (SPM) open: 
ExileClient_util_gear_calculateTotalPrice.sqf


replace line 10:
private["_items","_price"];
with
private["_items","_price","_spm","_totalCost"];


replace line 14:
    _price = _price + (getNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price"));
with
    _spm = (getNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "spm"));
    _totalCost = (getNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price"));
    _price = _price + round(_totalCost * _spm);

4. In your custom folder (SPM) open: 
ExileClient_gui_traderDialog_updateInventoryListBox.sqf

Line 56 above (_inventoryLoadProgress) add:
_spm = getNumber(missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "spm");

Replace line 132-133:
 _sellPrice = floor ( _salesPrice * 0.5);
with
_sellPrice = floor ( _salesPrice * _spm);
 
5. In your custom folder (SPM) open: ExileClient_gui_wasteDumpDialog_event_onModeDropDownSelectionChanged.sqf

Delete line 29:
_revenue = _revenue * 0.5; 

 
6. Extract exile_server\code\ExileServer_system_trading_network_sellItemRequest.sqf

Add under line 38 (_salesPrice):
_spm = getNumber (missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "spm");


 Change line 76-77:
_sellPrice = floor ( _salesPrice * 0.5);
to
_sellPrice = floor ( _salesPrice * _spm);


7. Extract exile_server\code\ExileServer_system_trading_network_wasteDumpRequest.sqf
Delete line 52:
_revenue = _revenue * 0.5; 


8. Repack exile_server

(Thanks to @CassiusMaximus for the rewrite)

Any problems just ask or P.M.
Good Luck!

- VJ -

Q&A:

Q. How does exile handle the sell price?
A. It takes the buy price in the mission config and times it by 0.5 making it 50% of the buy price.

Q. So how did you overcome this?
A. I replaced the 0.5 with a spm creating the new sell price which is set by you in the mission config.

Q. Do I need to add spm="0.5"; to all the prices?
A. Yes if you don't the item will throw an error 0.5 is exiles default.

spm="0.01"; = 1% of the buy price.

spm="0.5"; = 50% of the buy price.

spm="1"; = 100% of the buy price.

Anything set above 1 will cause the item to sell more than what it buys for.

I'll add some code to prevent this in the future.

 

Edited by - VJ -
(Thanks to @CassiusMaximus for the rewrite)
7 people like this

Share this post


Link to post
Share on other sites

if i want to put this in and only use it for special vehicles..can it be done?

i want to put gunner choppers in but want them high price and tax..but nothing else in game i want to cost tax

Share this post


Link to post
Share on other sites
Advertisement

I belive so :

class ITEM { quality = 2; price = 10; };

to

class ITEM { quality = 2; price = 100; tax = 0.5; }; // Price * tax =  sell price [e.g 100 * 0.5 = 50]

 

Just dont add tax to every item, but only to vehicles. If it doesnt work i suggest set all prices tax to 0.0 and then just raise the vehicle tax to whatever you want it to be.

BTW Awesome addition @- VJ - !

Share this post


Link to post
Share on other sites

@[OMG]Slim Thanks

@humpabry class ITEM { quality = 2; price = 100; tax = 0.5; }; // 0.5 is default 0.2 would be 20% of the buy price 0.8 would be 80% of the buy price 2.0 = 200% you should get the point.

BUT you need the tax in the prices or the item will throw an error.

Share this post


Link to post
Share on other sites

copy ExileClient_gui_traderDialog_updateInventoryListBox.sqf from  exile_client\code copy to the root or a folder in exile.altis

where is this file? dont see it anywhere :/

got it...morning goggles gone so my eyes open now ;p

Edited by humpabry

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

  • Recently Browsing   0 members

    No registered users viewing this page.