This commit is contained in:
DirtySanchez 2019-05-30 20:14:30 +00:00 committed by GitHub
commit 6b318802d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 197 additions and 1 deletions

View File

@ -138,4 +138,11 @@ class CfgTraders
{
#include "TRADERS\CfgTraders.hpp"
};
You can alternatively copy the cfgtraders file content over the traders in the main config, not recommended.
You can alternatively copy the cfgtraders file content over the traders in the main config, not recommended.
---------------------------------------------------------------------------------------------------------------------------
5. IN CONFIG.CPP IN MISSION PBO: Add to the "class CfgExileCustomCode" these lines
ExileClient_gui_traderDialog_updateStoreListBox = "overrides\ExileClient_gui_traderDialog_updateStoreListBox.sqf";
ExileClient_gui_vehicleTraderDialog_updateVehicleListBox = "overrides\ExileClient_gui_vehicleTraderDialog_updateVehicleListBox.sqf";

View File

@ -0,0 +1,113 @@
/**
* ExileClient_gui_traderDialog_updateStoreListBox
*
* 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["_dialog","_categoryDropdown","_currentCategoryIndex","_currentCategory","_storeListBox","_traderConfig","_applyItemClassFilter","_filterToItemClasses","_primaryWeaponCheckbox","_handgunCheckbox","_categoryClass","_categoryItemClassNames","_itemClassName","_showItem","_configName","_indexEntryIndex","_quality","_salesPrice","_requiredRespect","_qualityColor","_popTabColor","_imageColor","_playerMoney","_missingPopTabs","_missingRespect"];
disableSerialization;
_dialog = uiNameSpace getVariable ["RscExileTraderDialog", displayNull];
_categoryDropdown = _dialog displayCtrl 4008;
_currentCategoryIndex = lbCurSel _categoryDropdown;
_currentCategory = _categoryDropdown lbData _currentCategoryIndex;
_storeListBox = _dialog displayCtrl 4009;
lbClear _storeListBox;
_traderConfig = missionConfigFile >> "CfgTraders" >> ExileClientCurrentTrader;
_applyItemClassFilter = false;
_filterToItemClasses = [];
if !((primaryWeapon player) isEqualTo "") then
{
_primaryWeaponCheckbox = _dialog displayCtrl 4044;
if (cbChecked _primaryWeaponCheckbox) then
{
_applyItemClassFilter = true;
_filterToItemClasses append ((primaryWeapon player) call ExileClient_util_item_getCompatibleWeaponItems);
};
};
if !((handgunWeapon player) isEqualTo "") then
{
_handgunCheckbox = _dialog displayCtrl 4045;
if (cbChecked _handgunCheckbox) then
{
_applyItemClassFilter = true;
_filterToItemClasses append ((handgunWeapon player) call ExileClient_util_item_getCompatibleWeaponItems);
};
};
{
_categoryClass = _x;
if (_currentCategoryIndex isEqualTo 0 || _currentCategory isEqualTo _categoryClass) then
{
_categoryItemClassNames = getArray(missionConfigFile >> "CfgTraderCategories" >> _categoryClass >> "items");
{
_itemClassName = _x;
_showItem = false;
_cfgWeapons = isClass(configFile >> "cfgWeapons" >> _itemClassName);
_cfgMagazines = isClass(configFile >> "cfgMagazines" >> _itemClassName);
if(_cfgMagazines || _cfgWeapons)then
{
_showItem = true;
};
if (_applyItemClassFilter) then
{
_showItem = _itemClassName in _filterToItemClasses;
};
if (_showItem) then
{
_configName = _x call ExileClient_util_gear_getConfigNameByClassName;
_indexEntryIndex = _storeListBox lbAdd getText(configFile >> _configName >> _itemClassName >> "displayName");
_quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "quality");
_salesPrice = getNumber(missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "price");
_requiredRespect = getNumber(missionConfigFile >> "CfgTrading" >> "requiredRespect" >> format["Level%1",_quality]);
_qualityColor = [1, 1, 1, 1];
_popTabColor = [1, 1, 1, 1];
_imageColor = [1, 1, 1, 1];
switch (_quality) do
{
case 2: { _qualityColor = [0.62, 0.87 ,0.23, 1]; };
case 3: { _qualityColor = [0, 0.78, 0.92, 1]; };
case 4: { _qualityColor = [0.62, 0.27, 0.58, 1]; };
case 5: { _qualityColor = [1, 0.7, 0.09, 1]; };
case 6: { _qualityColor = [0.93, 0, 0.48, 1]; };
};
_playerMoney = player getVariable ["ExileMoney", 0];
if (_salesPrice > _playerMoney) then
{
_popTabColor = [0.91, 0, 0, 0.6];
_missingPopTabs = _salesPrice - _playerMoney;
_storeListBox lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs", _missingPopTabs]];
};
if (_requiredRespect > ExileClientPlayerScore) then
{
_qualityColor set [3, 0.3];
_popTabColor set [3, 0.3];
_imageColor set [3, 0.3];
_missingRespect = _requiredRespect - ExileClientPlayerScore;
_storeListBox lbSetTooltip [_indexEntryIndex, format["Missing %1 Respect", _missingRespect]];
};
if ((_salesPrice > _playerMoney) && (_requiredRespect > ExileClientPlayerScore)) then
{
_storeListBox lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs & %2 Respect", _missingPopTabs, _missingRespect]];
};
_storeListBox lbSetData [_indexEntryIndex, _itemClassName];
_storeListBox lbSetColor [_indexEntryIndex, _qualityColor];
_storeListBox lbSetPicture [_indexEntryIndex, getText(configFile >> _configName >> _itemClassName >> "picture")];
_storeListBox lbSetPictureColor [_indexEntryIndex, _imageColor];
_storeListBox lbSetTextRight [_indexEntryIndex, format["%1", _salesPrice]];
_storeListBox lbSetColorRight [_indexEntryIndex, _popTabColor];
_storeListBox lbSetPictureRight [_indexEntryIndex, "exile_assets\texture\ui\poptab_trader_ca.paa"];
_storeListBox lbSetPictureRightColor [_indexEntryIndex, _popTabColor];
_storeListBox lbSetValue [_indexEntryIndex, _quality * 100000 + _salesPrice];
};
}
forEach _categoryItemClassNames;
};
}
forEach getArray(_traderConfig >> "categories");
lbSortByValue _storeListBox;
true

View File

@ -0,0 +1,76 @@
/**
* ExileClient_gui_vehicleTraderDialog_updateVehicleListBox
*
* 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["_dialog","_categoryClasses","_itemListControl","_categoryClass","_categoryVehicleClassNames","_className","_salesPrice","_indexEntryIndex","_playerMoney","_quality","_requiredRespect","_qualityColor","_popTabColor","_missingPopTabs","_missingRespect"];
disableSerialization;
_dialog = uiNameSpace getVariable ["RscExileVehicleTraderDialog", displayNull];
_categoryClasses = _this;
if (_categoryClasses select 0 == "") then
{
_categoryClasses = getArray(missionConfigFile >> "CfgTraders" >> ExileClientCurrentTrader >> "categories");
};
_itemListControl = _dialog displayCtrl 4001;
lbClear _itemListControl;
{
_categoryClass = _x;
_categoryVehicleClassNames = getArray(missionConfigFile >> "CfgTraderCategories" >> _categoryClass >> "items");
{
_className = _x;
_showVehicle = false;
_showVehicle = isClass(configFile >> "cfgVehicles" >> _className);
if(_showVehicle)then
{
_salesPrice = getNumber(missionConfigFile >> "CfgExileArsenal" >> _className >> "price");
_indexEntryIndex = _itemListControl lbAdd getText(configFile >> "CfgVehicles" >> _className >> "displayName");
_playerMoney = player getVariable ["ExileMoney", 0];
_quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _className >> "quality");
_requiredRespect = getNumber(missionConfigFile >> "CfgTrading" >> "requiredRespect" >> format["Level%1",_quality]);
_qualityColor = [1, 1, 1, 1];
_popTabColor = [1, 1, 1, 1];
switch (_quality) do
{
case 2: { _qualityColor = [0.62, 0.87 ,0.23, 1]; };
case 3: { _qualityColor = [0, 0.78, 0.92, 1]; };
case 4: { _qualityColor = [0.62, 0.27, 0.58, 1]; };
case 5: { _qualityColor = [1, 0.7, 0.09, 1]; };
case 6: { _qualityColor = [0.93, 0, 0.48, 1]; };
};
if (_salesPrice > _playerMoney) then
{
_popTabColor = [0.91, 0, 0, 0.6];
_missingPopTabs = _salesPrice - _playerMoney;
_itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs", _missingPopTabs]];
};
if (_requiredRespect > ExileClientPlayerScore) then
{
_qualityColor set [3, 0.3];
_popTabColor set [3, 0.3];
_missingRespect = _requiredRespect - ExileClientPlayerScore;
_itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Respect", _missingRespect]];
};
if ((_salesPrice > _playerMoney) && (_requiredRespect > ExileClientPlayerScore)) then
{
_itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs & %2 Respect", _missingPopTabs, _missingRespect]];
};
_itemListControl lbSetData [_indexEntryIndex, _className];
_itemListControl lbSetTextRight [_indexEntryIndex, format["%1", _salesPrice]];
_itemListControl lbSetPictureRight [_indexEntryIndex, "exile_assets\texture\ui\poptab_trader_ca.paa"];
_itemListControl lbSetColor [_indexEntryIndex, _qualityColor];
_itemListControl lbSetColorRight [_indexEntryIndex, _popTabColor];
_itemListControl lbSetPictureRightColor [_indexEntryIndex, _popTabColor];
_itemListControl lbSetValue [_indexEntryIndex, _quality * 100000 + _salesPrice];
};
}
forEach _categoryVehicleClassNames;
}
forEach _categoryClasses;
lbSortByValue _itemListControl;
true