Added an optional check if items are in the pricelist

This commit is contained in:
Ghostrider-DbD- 2017-10-18 22:12:47 -04:00
parent 6c2475b18d
commit 485812e0c8
10 changed files with 282 additions and 45 deletions

View File

@ -1,3 +1,7 @@
10/18/17
0.41
Added an optional check to see if the class name has a price.
This should be helpful when screening for new classnames after a mod is updated.
10/4/2017
0.4 Added an option whereby setting GRG_Root = "STR" will only include classnames beginning with STR.

View File

@ -16,15 +16,22 @@ For each category (e.g., uniforms, weapons, vehicles) the tools will generate th
- pricelists formated in either Epoch or Exile format (which, of course need prices adjusted).
- a list suitable for addition to either the loot tables in Epoch or the loot table compiler in Exile.
Configuration:
Read the comments in init.sqf for more on how to adjust configuration overall.
Edit the excluded classnames files to block the extractor from including specific classnames in the output.
For example, you could run the tool once to search for all "Exile" vehicles then past this list into the _excludedVehicles array in exludedVehicles.sqf to prevent these vehicles from being included in the future.
You can determine which format of price list will be generated by changing GRG_mod in init.sqf.
Settings:
GRG_mod: set to "Epoch" or "Exile"
GRG_Root: Use this to process only class names with a certain name such as "CUP" or "RHS".
GRG_addIttemsMissingFromPricelistOnly (true/false).
When true, the tool will search for a price for that class name in either CfgPricing (epoch) or CfgExileArsenal (Exile).
The idea behind this is to list only those items that you have not already added to traders. this should be handy when dealing with mod updates.
To use this requires a bit of extra setup.
- add a description.ext to the mission folder.
- add an #include to the description.ext so as to include CfgPricing.hpp or your exile_config.hpp and be sure any included files these use are also in the mission folder in the appropriate subfolder or commented out.
- The tool will check for a price for each item and if no price is found add that item to the output.
Credits:
The algorithm for extracting weapons class names is derived from one posted by KiloSwiss on EpochMod:
The original algorithm for extracting weapons class names is derived from one posted by KiloSwiss on EpochMod although it has more recently been updated:
https://epochmod.com/forum/topic/32239-howto-get-available-weapons-mod-independent/
License

View File

@ -0,0 +1,2 @@
#include "config_altis_mil.cpp"

71
testConfig.Altis/help.sqf Normal file
View File

@ -0,0 +1,71 @@
disableSerialization;
["",0,0.2,10,0,0,8] spawn BIS_fnc_dynamicText;
createDialog "RscDisplayWelcome";
_display = findDisplay 999999;
_text1 = _display displayCtrl 1100;
_buttonSpoiler = _display displayCtrl 2400;
_textSpoiler = _display displayCtrl 1101;
_text2 = _display displayCtrl 1102;
_message = _message + "<t align='left' size='1' shadow='0'><t color='#ff9900'>General rules:</t><br/><br/>";
_message = _message + "We ask that you follow just a few basic rules.<br/><br/>";
_message = _message + "<br/>";
_message = _message + "* There is NO PVP allowed except in designated PVP Zones, should these be present on the server.<br/><br/>";
_message = _message + "* STEALING from players, vehicles, bases or corpses is not allowed.<br/><br/>";
_message = _message + "* Please be respectful toward other players<br/>";
_message = _message + "* Foul language will result in an automatick kick.<br/>";
_message = _message + "* Hacking, taking advantage of glitches or dupping is just a no-no.<br/>";
_message = _message + "* Please Respect Admins: They work hard to keep order and help players with issues.<br/><br/><br/>";
_message = _message + "* To keep language respectful you will be kicked for using certain words in chat. <br/>";
_message = _message + "* This is not intended to stiffle play but to maintain a polite decorum.<br/>";
_message = _message + "<a color='#ff9900'>Base Building Rules:</a><br/><br/>";
_message = _message + "* Please do not build closer thaan 150 meeters from the nearest building or structure.<br/>";
_message = _message + "* Your flag or frequency jammer may block spawning of loot for other players.<br/>";
_message = _message + "* Please do Not block roads.<br/><br/>";
_message = _message + "* Do Not build in airfields or place safes at these locations.<br/><br/>";
_message = _message + "* Please do not build snipping towers at strongholds.<br/>";
_message = _message + "<a color='#ff9900'>Mission Rules:</a><br/><br/>";
_message = _message + "* Call Missions in Side Chat AND place a marker with your name on the map in Side Chat.<br/><br/>";
_message = _message + "* Call missions once you are ready to go there.<br/><br/>";
_message = _message + "* Each player or group may only claim one mission at a time.<br/><br/>";
_message = _message + "<a color='#ff9900'>PVP Zone Rules:</a><br/><br/>";
_message = _message + "* Anything goes in PVP Zones.<br/><br/>";
_message = _message + "<a color='#ff9900'>Player Tips:</a><br/><br/>";
_message = _message + "* AI are sneaky and the last few AI at a mission often lay hidden and waiting for unwary players<br/><br/>";
_message = _message + "* Grenades and HE rounds are your friend, especially at town invasions<br/><br/>";
_message = _message + "* You can starve or die of thrist in Exile - never leave home without snacks<br/><br/>";
_message = _message + "* You can die of hypothermia on Namalsk - bundle up, light fires, bring thermal buddies<br/><br/>";
_message = _message + "* Missions tend to spawn in certain locations. If you build there do not be surprised if AI are waiting<br/><br/>";
_message = _message + "* If you build near missions or Mafia locations the AI may destroy any vehicles left outside even if you are not in-game<br/><br/>";
_message = _message + "* Arma and Exile are glitchy. Do not park vehicles/aircraft on roofs if you are not prepared for them to go Boom<br/><br/>";
_message = _message + "* Use the grid function to place pieces oriented north/south and park vehicles headed North to reduce issues with them going Boom<br/><br/>";
_message = _message + "* Remember that players and AI share the same roads.<br/><br/>";
_message = _message + "* Admins are here to keep order and enforce rules. They volunteer their time based on a love of Arma. Please respect them.<br/><br/>";
_message = _message + "<a color='#ff9900'>Roles of our Admins:</a><br/><br/>";
_message = _message + "* Our Admins volunteer their time to keep our servers running smoothly<br/><br/>";
_message = _message + "* Please treat them with the respect you would ask if you fulfilled their roles<br/><br/>";
_message = _message + "* Admins are responsible for ensuring that players adhere to our rules as stated above<br/><br/>";
_message = _message + "* If you have an issue with a player please check our teamspeak or post a report of the incident on our website or discord<br/><br/>";
_message = _message + "* Admins MAY offer assistance to players who are getting started, or who lost gear or vehicles. <br/><br/>";
_message = _message + "* However, we are not responsible for damaged or destroyed vehicles, missing gear or lost tabs or respect<br/><br/>";
_message = _message + "Have fun and play fair. <a color='#ff9900'></a><br/><br/><t/>";
_text1 ctrlSetStructuredText (parseText _message);
_positionText1 = ctrlPosition _text1;
_yText1 = _positionText1 select 1;
_hText1 = ctrlTextHeight _text1;
_text1 ctrlSetPosition [_positionText1 select 0, _yText1, _positionText1 select 2, _hText1];
_text1 ctrlCommit 0;
_buttonSpoiler ctrlSetFade 1;
_buttonSpoiler ctrlCommit 0;
_buttonSpoiler ctrlEnable false;
_textSpoiler ctrlSetFade 1;
_textSpoiler ctrlCommit 0;
_text2 ctrlSetFade 1;
_text2 ctrlCommit 0;

View File

@ -11,7 +11,8 @@
// load string library
//nul=[] execVM "KRON_Strings.sqf";
GRG_mod = "Exile"; // Options are "Exile" or "Epoch". This configuration pertains only to generating pre-formated price lists.
GRG_Root = ""; // Scripts will test if the leftmost N characters of a classname are equal to GRG_Root
GRG_Root = "CUP"; // Scripts will test if the leftmost N characters of a classname are equal to GRG_Root
GRG_addIttemsMissingFromPricelistOnly = true; // when true will process only class names for which there is not already a price listed for that mod time. for this to work you need to include the description.ext and any price lists for your server in this misison folder.
GRG_includedWeaponMagazines = false;
GRG_configuratorPathName = "ExcludedClassNames\";

View File

@ -108,24 +108,53 @@ _itemsList = _itemsList + _temp;
diag_log format["for Item %1 its ItemType [0] is %2",_x,_itemType select 0];
if ((_itemType select 0) in _allItemTypes) then
{
_process = true;
processItem = true;
if (GRG_Root isEqualTo "") then
{
_process = true;
processItem = true;
} else {
_leftSTR = [toLower _x,count GRG_Root] call KRON_StrLeft;
_process = ((toLower GRG_Root) isEqualTo _leftSTR);
//systemChat format["wearables.sqf:: _leftSTR = %1 and _process = %2",_leftSTR, _process];
processItem = ((toLower GRG_Root) isEqualTo _leftSTR);
//systemChat format["wearables.sqf:: _leftSTR = %1 and processItem = %2",_leftSTR, processItem];
};
if ([toLower _x,"base"] call KRON_StrInStr || [toLower _x,"abstract"] call KRON_StrInStr) then
{
if !(_x in _baseClasses) then {_baseClasses pushBack _x};
_process = false;
processItem = false;
_msg = format["base class %1 ignored",_x];
systemChat _msg;
//diag_log _msg;
};
if ( !(_x in _baseItems) && _process) then
if (processItem) then
{
if (GRG_addIttemsMissingFromPricelistOnly) then
{
if(GRG_mod isEqualTo "Exile") then
{
if (isNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price")) then
{
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
processItem = false; // Item already listed and assumed to be included in both trader lists and price lists
diag_log format["Item %1 already has a price: Not processing item %1",_x];
} else {
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
diag_log format["Item %1 has no price: processing item %1",_x];
processItem = true;
};
};
if (GRG_mod isEqualTo "Epoch") then
{
if (isNumber (missionConfigFile >> "CfgPricing" >> _x >> "price")) then
{
processItem = false; // Item already listed and assumed to be included in both trader lists and price lists
} else {
processItem = true;
};
};
};
};
if ( !(_x in _baseItems) && processItem) then
{
_baseItems pushBack _x;
systemChat format["classname = %1, _itemType [0] = %2 _itemType[1] = %3",_x, _itemType select 0, _itemType select 1];

View File

@ -28,24 +28,53 @@ _scannedMags = [];
_isKindOf = (_x isKindOF ["CA_Magazine", configFile >> "CfgMagazines"]);
if (_isKindOf) then
{
_process = true;
processMagazine = true;
if (GRG_Root isEqualTo "") then
{
_process = true;
processMagazine = true;
} else {
_leftSTR = [toLower _x,count GRG_Root] call KRON_StrLeft;
_process = ((toLower GRG_Root) isEqualTo _leftSTR);
//systemChat format["wearables.sqf:: _leftSTR = %1 and _process = %2",_leftSTR, _process];
processMagazine = ((toLower GRG_Root) isEqualTo _leftSTR);
//systemChat format["wearables.sqf:: _leftSTR = %1 and processMagazine = %2",_leftSTR, processMagazine];
};
if ([toLower _x,"base"] call KRON_StrInStr || [toLower _x,"abstract"] call KRON_StrInStr) then
{
if !(_x in _excludedMagazines) then {_excludedMagazines pushBack _x};
_process = false;
processMagazine = false;
_msg = format["base class %1 ignored",_x];
systemChat _msg;
//diag_log _msg;
};
if (_process && !(_x in _baseMagazines)) then
if (processWearable) then
{
if (GRG_addIttemsMissingFromPricelistOnly) then
{
if(GRG_mod isEqualTo "Exile") then
{
if (isNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price")) then
{
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
processWearable = false; // Item already listed and assumed to be included in both trader lists and price lists
diag_log format["Item %1 already has a price: Not processing item %1",_x];
} else {
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
diag_log format["Item %1 has no price: processing item %1",_x];
processWearable = true;
};
};
if (GRG_mod isEqualTo "Epoch") then
{
if (isNumber (missionConfigFile >> "CfgPricing" >> _x >> "price")) then
{
processWearable = false; // Item already listed and assumed to be included in both trader lists and price lists
} else {
processWearable = true;
};
};
};
};
if (processMagazine && !(_x in _baseMagazines)) then
{
systemChat format["Evaluated Magazine = %1",_x];
//if (!(_x isKindOF ["CA_LauncherMagazine", configFile >> "CfgMagazines"]) && !(_x isKindOF ["HandGrenade", configFile >> "CfgMagazines"]) && !(_x isKindOf ["VehicleMagazine", configFile >> "CfgMagazines"]) && !(_x isKindOf ["Exile_AbstractItem", configFile >> "CfgMagazines"])) then {_wpnMagazines pushBack _x};

View File

@ -20,31 +20,64 @@ _boats = [];
_air = [];
_helis = [];
_planes = [];
_process = true;
processVehicle = true;
_n = count _veh;
_index = 0;
_counter = 1;
_interval = 25;
systemChat "Classname Extraction tool for vehicles initialized";
{
_process = true;
processVehicle = true;
if (GRG_Root isEqualTo "") then
{
_process = true;
} else {
processVehicle = true;
};
if (count GRG_Root > 0) then
{
_leftSTR = [toLower _x,count GRG_Root] call KRON_StrLeft;
_process = ((toLower GRG_Root) isEqualTo _leftSTR);
//systemChat format["vehicles.sqf:: _leftSTR = %1 and _process = %2",_leftSTR, _process];
processVehicle = ((toLower GRG_Root) isEqualTo _leftSTR);
_msg = format["vehicles.sqf:: _leftSTR = %1 and processVehicle = %2",_leftSTR, processVehicle];
//systemChat _msg;
diag_log _msg;
};
if (processVehicle) then
{
if (GRG_addIttemsMissingFromPricelistOnly) then
{
if(GRG_mod isEqualTo "Exile") then
{
if (isNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price")) then
{
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
processVehicle = false; // Item already listed and assumed to be included in both trader lists and price lists
diag_log format["Item %1 already has a price: Not processing item %1",_x];
} else {
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
diag_log format["Item %1 has no price: processing item %1",_x];
processVehicle = true;
};
};
if (GRG_mod isEqualTo "Epoch") then
{
if (isNumber (missionConfigFile >> "CfgPricing" >> _x >> "price")) then
{
processVehicle = false; // Item already listed and assumed to be included in both trader lists and price lists
} else {
processVehicle = true;
};
};
};
};
if ([toLower _x,"base"] call KRON_StrInStr || [toLower _x,"abstract"] call KRON_StrInStr) then
{
if !(_x in _baseClasses) then {_baseClasses pushBack _x};
_process = false;
processVehicle = false;
_msg = format["base class %1 ignored",_x];
systemChat _msg;
//diag_log _msg;
};
if (_process && !(_x in _excludedVehicles)) then
if (processVehicle && !(_x in _excludedVehicles)) then
{
if (_index == 1) then
{

View File

@ -8,6 +8,7 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
private["_process"];
_weaponsBase = [];
_knownWeapons = [];
#include "ExcludedClassNames\excludedWeapons.sqf"
@ -34,14 +35,17 @@ _wpnOptics = [];
_wpnPointers = [];
_wpnMuzzles = [];
_baseClasses = [];
_process = false;
processWeapon = false;
_wpList = (configFile >> "cfgWeapons") call BIS_fnc_getCfgSubClasses;
//_wpList sort true;
diag_log"//////////////////////////////////////////////////////////////";
diag_log" /// START OF RUN //////////////////////////////////////////";
{
_item = _x;
_isWeap = false;
_isWeapon = false;
_process = false;
processWeapon = false;
{
_isWeapon = (_item isKindOF [_x, configFile >> "CfgWeapons"]);
if (_isWeapon) exitWith {};
@ -49,28 +53,56 @@ _wpList = (configFile >> "cfgWeapons") call BIS_fnc_getCfgSubClasses;
if (_isWeapon && GRG_Root isEqualTo "") then
{
_process = true;
processWeapon = true;
};
if (_isWeapon && (count GRG_Root > 0)) then
{
_leftSTR = [toLower _x,count GRG_Root] call KRON_StrLeft;
_process = ((toLower GRG_Root) isEqualTo _leftSTR);
//_msg = format["weaponss.sqf:: _leftSTR = %1 and _process = %2",_leftSTR, _process];
processWeapon = ((toLower GRG_Root) isEqualTo _leftSTR);
_msg = format["weapons.sqf:: _leftSTR = %1 and processWeapon = %2",_leftSTR, processWeapon];
//systemChat _msg;
//diag_log _msg;
diag_log _msg;
};
if (_isWeapon && processWeapon) then
{
if (GRG_addIttemsMissingFromPricelistOnly) then
{
if(GRG_mod isEqualTo "Exile") then
{
if (isNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price")) then
{
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
processWeapon = false; // Item already listed and assumed to be included in both trader lists and price lists
diag_log format["Item %1 already has a price: Not processing item %1",_x];
} else {
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
diag_log format["Item %1 has no price: processing item %1",_x];
processWeapon = true;
};
};
if (GRG_mod isEqualTo "Epoch") then
{
if (isNumber (missionConfigFile >> "CfgPricing" >> _x >> "price")) then
{
processWeapon = false; // Item already listed and assumed to be included in both trader lists and price lists
if (_isWeapon && _process) then
} else {
processWeapon = true;
};
};
};
};
if (_isWeapon && processWeapon) then
{
if ([toLower _x,"base"] call KRON_StrInStr || [toLower _x,"abstract"] call KRON_StrInStr) then
{
if !(_x in _baseClasses) then {_baseClasses pushBack _x};
_process = false;
processWeapon = false;
systemChat format["base class %1 ignored",_x];
};
};
if (_isWeapon && _process) then
diag_log format["for item %1, price of %2, root of %3, processWeapon = %4",_x, getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price"),[toLower _x,count GRG_Root] call KRON_StrLeft,processWeapon];
if (_isWeapon && processWeapon) then
{
//_msg = format["weapons classname extractor: _item = %1",_item];
//diag_log _msg;

View File

@ -110,24 +110,53 @@ _wearablesList sort true;
//diag_log format["for Item %1 its ItemType [0] is %2",_x,_itemType select 0];
if (_itemType select 0 isEqualTo "Equipment") then
{
_process = true;
processWearable = true;
if (GRG_Root isEqualTo "") then
{
_process = true;
processWearable = true;
} else {
_leftSTR = [toLower _x,count GRG_Root] call KRON_StrLeft;
_process = ((toLower GRG_Root) isEqualTo _leftSTR);
//systemChat format["wearables.sqf:: _leftSTR = %1 and _process = %2",_leftSTR, _process];
processWearable = ((toLower GRG_Root) isEqualTo _leftSTR);
//systemChat format["wearables.sqf:: _leftSTR = %1 and processWearable = %2",_leftSTR, processWearable];
};
if ([toLower _x,"base"] call KRON_StrInStr || [toLower _x,"abstract"] call KRON_StrInStr) then
{
if !(_x in _baseClasses) then {_baseClasses pushBack _x};
_process = false;
processWearable = false;
_msg = format["base class %1 ignored",_x];
systemChat _msg;
//diag_log _msg;
};
if ( !(_x in _excludedWearables) && _process) then
if (processWearable) then
{
if (GRG_addIttemsMissingFromPricelistOnly) then
{
if(GRG_mod isEqualTo "Exile") then
{
if (isNumber (missionConfigFile >> "CfgExileArsenal" >> _x >> "price")) then
{
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
processWearable = false; // Item already listed and assumed to be included in both trader lists and price lists
diag_log format["Item %1 already has a price: Not processing item %1",_x];
} else {
diag_log format["price for item %1 = %2 tabs",_x,getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price")];
diag_log format["Item %1 has no price: processing item %1",_x];
processWearable = true;
};
};
if (GRG_mod isEqualTo "Epoch") then
{
if (isNumber (missionConfigFile >> "CfgPricing" >> _x >> "price")) then
{
processWearable = false; // Item already listed and assumed to be included in both trader lists and price lists
} else {
processWearable = true;
};
};
};
};
if ( !(_x in _excludedWearables) && processWearable) then
{
_excludedWearables pushBack _x;