From 485812e0c823f87e7bf4024e0edd9de24cef681b Mon Sep 17 00:00:00 2001 From: Ghostrider-DbD- Date: Wed, 18 Oct 2017 22:12:47 -0400 Subject: [PATCH] Added an optional check if items are in the pricelist --- changelog.hpp | 6 ++- testConfig.Altis/Readme.hpp | 19 ++++++--- testConfig.Altis/description.ext | 2 + testConfig.Altis/help.sqf | 71 ++++++++++++++++++++++++++++++++ testConfig.Altis/init.sqf | 3 +- testConfig.Altis/items.sqf | 41 +++++++++++++++--- testConfig.Altis/magazines.sqf | 41 +++++++++++++++--- testConfig.Altis/vehicles.sqf | 49 ++++++++++++++++++---- testConfig.Altis/weapons.sqf | 54 +++++++++++++++++++----- testConfig.Altis/wearables.sqf | 41 +++++++++++++++--- 10 files changed, 282 insertions(+), 45 deletions(-) create mode 100644 testConfig.Altis/description.ext create mode 100644 testConfig.Altis/help.sqf diff --git a/changelog.hpp b/changelog.hpp index 014406a..5a2d781 100644 --- a/changelog.hpp +++ b/changelog.hpp @@ -1,4 +1,8 @@ - +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. Did some bug fixing and optimization. diff --git a/testConfig.Altis/Readme.hpp b/testConfig.Altis/Readme.hpp index da09eb6..aef4e83 100644 --- a/testConfig.Altis/Readme.hpp +++ b/testConfig.Altis/Readme.hpp @@ -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 diff --git a/testConfig.Altis/description.ext b/testConfig.Altis/description.ext new file mode 100644 index 0000000..395499e --- /dev/null +++ b/testConfig.Altis/description.ext @@ -0,0 +1,2 @@ + +#include "config_altis_mil.cpp" diff --git a/testConfig.Altis/help.sqf b/testConfig.Altis/help.sqf new file mode 100644 index 0000000..43e5836 --- /dev/null +++ b/testConfig.Altis/help.sqf @@ -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 + "General rules:

"; +_message = _message + "We ask that you follow just a few basic rules.

"; +_message = _message + "
"; +_message = _message + "* There is NO PVP allowed except in designated PVP Zones, should these be present on the server.

"; +_message = _message + "* STEALING from players, vehicles, bases or corpses is not allowed.

"; +_message = _message + "* Please be respectful toward other players
"; +_message = _message + "* Foul language will result in an automatick kick.
"; +_message = _message + "* Hacking, taking advantage of glitches or dupping is just a no-no.
"; +_message = _message + "* Please Respect Admins: They work hard to keep order and help players with issues.


"; +_message = _message + "* To keep language respectful you will be kicked for using certain words in chat.
"; +_message = _message + "* This is not intended to stiffle play but to maintain a polite decorum.
"; + +_message = _message + "Base Building Rules:

"; +_message = _message + "* Please do not build closer thaan 150 meeters from the nearest building or structure.
"; +_message = _message + "* Your flag or frequency jammer may block spawning of loot for other players.
"; +_message = _message + "* Please do Not block roads.

"; +_message = _message + "* Do Not build in airfields or place safes at these locations.

"; +_message = _message + "* Please do not build snipping towers at strongholds.
"; + +_message = _message + "Mission Rules:

"; +_message = _message + "* Call Missions in Side Chat AND place a marker with your name on the map in Side Chat.

"; +_message = _message + "* Call missions once you are ready to go there.

"; +_message = _message + "* Each player or group may only claim one mission at a time.

"; + +_message = _message + "PVP Zone Rules:

"; +_message = _message + "* Anything goes in PVP Zones.

"; + +_message = _message + "Player Tips:

"; +_message = _message + "* AI are sneaky and the last few AI at a mission often lay hidden and waiting for unwary players

"; +_message = _message + "* Grenades and HE rounds are your friend, especially at town invasions

"; +_message = _message + "* You can starve or die of thrist in Exile - never leave home without snacks

"; +_message = _message + "* You can die of hypothermia on Namalsk - bundle up, light fires, bring thermal buddies

"; +_message = _message + "* Missions tend to spawn in certain locations. If you build there do not be surprised if AI are waiting

"; +_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

"; +_message = _message + "* Arma and Exile are glitchy. Do not park vehicles/aircraft on roofs if you are not prepared for them to go Boom

"; +_message = _message + "* Use the grid function to place pieces oriented north/south and park vehicles headed North to reduce issues with them going Boom

"; +_message = _message + "* Remember that players and AI share the same roads.

"; +_message = _message + "* Admins are here to keep order and enforce rules. They volunteer their time based on a love of Arma. Please respect them.

"; + +_message = _message + "Roles of our Admins:

"; +_message = _message + "* Our Admins volunteer their time to keep our servers running smoothly

"; +_message = _message + "* Please treat them with the respect you would ask if you fulfilled their roles

"; +_message = _message + "* Admins are responsible for ensuring that players adhere to our rules as stated above

"; +_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

"; +_message = _message + "* Admins MAY offer assistance to players who are getting started, or who lost gear or vehicles.

"; +_message = _message + "* However, we are not responsible for damaged or destroyed vehicles, missing gear or lost tabs or respect

"; + +_message = _message + "Have fun and play fair.

"; + +_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; diff --git a/testConfig.Altis/init.sqf b/testConfig.Altis/init.sqf index 73e74f2..6c74a58 100644 --- a/testConfig.Altis/init.sqf +++ b/testConfig.Altis/init.sqf @@ -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\"; diff --git a/testConfig.Altis/items.sqf b/testConfig.Altis/items.sqf index 50d7733..97c1df4 100644 --- a/testConfig.Altis/items.sqf +++ b/testConfig.Altis/items.sqf @@ -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 (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) && _process) then + 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]; diff --git a/testConfig.Altis/magazines.sqf b/testConfig.Altis/magazines.sqf index a1f3116..3fa8ad0 100644 --- a/testConfig.Altis/magazines.sqf +++ b/testConfig.Altis/magazines.sqf @@ -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}; diff --git a/testConfig.Altis/vehicles.sqf b/testConfig.Altis/vehicles.sqf index 7f7c51c..e50e207 100644 --- a/testConfig.Altis/vehicles.sqf +++ b/testConfig.Altis/vehicles.sqf @@ -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 { diff --git a/testConfig.Altis/weapons.sqf b/testConfig.Altis/weapons.sqf index 727104d..d054fc7 100644 --- a/testConfig.Altis/weapons.sqf +++ b/testConfig.Altis/weapons.sqf @@ -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 && _process) then + 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 + + } 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; diff --git a/testConfig.Altis/wearables.sqf b/testConfig.Altis/wearables.sqf index ab5d4c4..e8320be 100644 --- a/testConfig.Altis/wearables.sqf +++ b/testConfig.Altis/wearables.sqf @@ -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;