Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private["_cfgCount","_config","_configCustomMod","_i","_itemChances","_itemCount","_weighted","_j","_weight","_l","_k","_g","_type","_canZombie","_canLoot"];
- dayz_CBLChances = [];
- dayz_CBLBase = [];
- _configCustomMod = configFile >> dayzNam_buildingLoot;
- _config = missionConfigFile >> "CfgBuildingLootNamalsk";
- for "_i" from 0 to ((count _config) - 1) do {
- _classname = configName (_config select _i);
- _itemChances = getArray (_config >> _classname >> "lootType");
- _itemCount = count _itemChances;
- //diag_log format["Classname: %1, Array: %2, Amount: %3", _classname, _itemChances, _itemCount];
- _found = false;
- if (dayzNam_buildingLoot != "CfgBuildingLootNamalsk") then {
- for "_g" from 0 to ((count _configCustomMod) - 1) do {
- _classnameMod = configName (_configCustomMod select _g);
- if (_classnameMod == _classname) then {
- _found = true;
- _classname = configName (_configCustomMod select _g);
- _itemChances = [] + getArray (_configCustomMod >> _classname >> "lootType");
- _itemCount = count _itemChances;
- };
- };
- };
- if (_itemCount > 0) then {
- if (dayz_CBLBase find _classname < 0) then {
- _weighted = [];
- _j = 0;
- for "_l" from 0 to ((count _itemChances) - 1) do {
- _weight = round (((_itemChances select _l) select 2) * 100);
- for "_k" from 0 to (_weight - 1) do {
- _weighted set [_j + _k, _l];
- };
- _j = _j + _weight;
- };
- dayz_CBLChances set [count dayz_CBLChances, _weighted];
- dayz_CBLBase set [count dayz_CBLBase, _classname];
- };
- } else {
- dayz_CBLChances set [count dayz_CBLChances, [0]];
- dayz_CBLBase set [count dayz_CBLBase, _classname];
- };
- };
- dayz_CLChances = [];
- dayz_CLBase = [];
- _config = configFile >> "cfgLoot";
- for "_i" from 0 to ((count (_config)) - 1) do {
- _classname = configName (_config select _i);
- _itemChances = getArray (_config select _i);
- //diag_log format["CFGLoot: %1, Array: %2", _classname, _itemChances];
- _weighted = [];
- _j = 0;
- for "_l" from 0 to ((count _itemChances) - 1) do {
- _weight = round (((_itemChances select _l) select 1) * 100);
- for "_k" from 0 to (_weight - 1) do {
- _weighted set [_j + _k, _l];
- };
- _j = _j + _weight;
- };
- dayz_CLBase set [count dayz_CLBase, _classname];
- dayz_CLChances set [count dayz_CLChances, _weighted];
- };
- //diag_log ("BaseLoot: " +str(dayz_CLBase));
- private["_i","_type","_config","_canZombie","_canLoot"];
- dayz_ZombieBuildings = [];
- dayz_LootBuildings = [];
- for "_i" from 0 to (count (configFile >> "CfgBuildingLootNamalsk") - 1) do {
- _type = (configFile >> "CfgBuildingLootNamalsk") select _i;
- _canZombie = getNumber (_type >> "zombieChance") > 0;
- _canLoot = getNumber (_type >> "lootChance") > 0;
- if(_canZombie) then {
- if(!((configName _type) in dayz_ZombieBuildings)) then {
- dayz_ZombieBuildings set [count dayz_ZombieBuildings, configName _type];
- };
- };
- if(_canLoot) then {
- if(!((configName _type) in dayz_LootBuildings)) then {
- dayz_LootBuildings set [count dayz_LootBuildings, configName _type];
- };
- };
- };
- //diag_log format["ZombieBuildings: %1", dayz_ZombieBuildings];
- //diag_log format["LootBuildings: %1", dayz_LootBuildings];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement