mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Update Lootsystem to new cfg system
This commit is contained in:
@@ -1,28 +1,26 @@
|
|||||||
private ["_config","_itemChances","_itemCount","_weighted","_j","_weight","_type","_canZombie","_canLoot","_classname","_itemChancesSmall","_itemCountSmall"];
|
private ["_weighted","_j"];
|
||||||
dayz_CBLChances = [];
|
dayz_CBLChances = [];
|
||||||
dayz_CBLBase = [];
|
dayz_CBLBase = [];
|
||||||
|
_config = configFile >> "CfgBuildingLoot";
|
||||||
dayzE_CBLSChances = [];
|
|
||||||
dayzE_CBLSBase = [];
|
|
||||||
|
|
||||||
_config = [];
|
|
||||||
if (DZE_MissionLootTable) then {
|
if (DZE_MissionLootTable) then {
|
||||||
_config = missionConfigFile >> "CfgBuildingLoot";
|
_config = missionConfigFile >> "CfgBuildingLoot";
|
||||||
} else {
|
|
||||||
_config = configFile >> "CfgBuildingLoot";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for "_i" from 0 to ((count _config) - 1) do {
|
for "_i" from 0 to ((count _config) - 1) do {
|
||||||
_classname = toLower(configName (_config select _i));
|
_classname = configName (_config select _i);
|
||||||
_itemChances = [] + getArray (_config >> _classname >> "ItemChance");
|
_itemChances = getArray (_config >> _classname >> "lootType");
|
||||||
_itemCount = count _itemChances;
|
_itemCount = count _itemChances;
|
||||||
|
|
||||||
|
//diag_log format["Classname: %1, Array: %2, Amount: %3", _classname, _itemChances, _itemCount];
|
||||||
|
|
||||||
if (_itemCount > 0) then {
|
if (_itemCount > 0) then {
|
||||||
if (dayz_CBLBase find _classname < 0) then {
|
if (dayz_CBLBase find _classname < 0) then {
|
||||||
_weighted = [];
|
_weighted = [];
|
||||||
_j = 0;
|
_j = 0;
|
||||||
for "_l" from 0 to ((count _itemChances) - 1) do {
|
for "_l" from 0 to ((count _itemChances) - 1) do {
|
||||||
_weight = round ((_itemChances select _l) * 100);
|
_weight = round (((_itemChances select _l) select 2) * 100);
|
||||||
for "_k" from 0 to _weight - 1 do {
|
for "_k" from 0 to (_weight - 1) do
|
||||||
|
{
|
||||||
_weighted set [_j + _k, _l];
|
_weighted set [_j + _k, _l];
|
||||||
};
|
};
|
||||||
_j = _j + _weight;
|
_j = _j + _weight;
|
||||||
@@ -34,92 +32,41 @@ for "_i" from 0 to ((count _config) - 1) do {
|
|||||||
dayz_CBLChances set [count dayz_CBLChances, [0]];
|
dayz_CBLChances set [count dayz_CBLChances, [0]];
|
||||||
dayz_CBLBase set [count dayz_CBLBase, _classname];
|
dayz_CBLBase set [count dayz_CBLBase, _classname];
|
||||||
};
|
};
|
||||||
|
|
||||||
_itemChancesSmall = [] + getArray (_config >> _classname >> "ItemChanceSmall");
|
|
||||||
_itemCountSmall = count _itemChancesSmall;
|
|
||||||
if (_itemCountSmall > 0) then {
|
|
||||||
if (dayzE_CBLSBase find _classname < 0) then {
|
|
||||||
_weighted = [];
|
|
||||||
_j = 0;
|
|
||||||
for "_l" from 0 to ((count _itemChancesSmall) - 1) do {
|
|
||||||
_weight = round ((_itemChancesSmall select _l) * 100);
|
|
||||||
for "_k" from 0 to _weight - 1 do {
|
|
||||||
_weighted set [_j + _k, _l];
|
|
||||||
};
|
|
||||||
_j = _j + _weight;
|
|
||||||
};
|
|
||||||
dayzE_CBLSChances set [count dayzE_CBLSChances, _weighted];
|
|
||||||
dayzE_CBLSBase set [count dayzE_CBLSBase, _classname];
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
dayzE_CBLSChances set [count dayzE_CBLSChances, [0]];
|
|
||||||
dayzE_CBLSBase set [count dayzE_CBLSBase, _classname];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dayz_CLChances = [];
|
dayz_CLChances = [];
|
||||||
dayz_CLBase = [];
|
dayz_CLBase = [];
|
||||||
|
//dayz_CLItemNames = [];
|
||||||
|
|
||||||
_config = [];
|
_config = configFile >> "cfgLoot";
|
||||||
if (DZE_MissionLootTable) then {
|
if (DZE_MissionLootTable) then {
|
||||||
_config = missionConfigFile >> "cfgLoot";
|
_config = missionConfigFile >> "cfgLoot";
|
||||||
} else {
|
|
||||||
_config = configFile >> "cfgLoot";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for "_i" from 0 to ((count (_config)) - 1) do {
|
for "_i" from 0 to ((count (_config)) - 1) do {
|
||||||
_itemChances = (getArray (_config select _i)) select 1;
|
_classname = configName (_config select _i);
|
||||||
|
_itemChances = getArray (_config select _i);
|
||||||
_weighted = [];
|
_weighted = [];
|
||||||
_j = 0;
|
_j = 0;
|
||||||
for "_l" from 0 to ((count _itemChances) - 1) do {
|
for "_l" from 0 to ((count _itemChances) - 1) do {
|
||||||
_weight = round ((_itemChances select _l) * 100);
|
_weight = round (((_itemChances select _l) select 1) * 100);
|
||||||
for "_k" from 0 to _weight - 1 do {
|
for "_k" from 0 to (_weight - 1) do {
|
||||||
_weighted set [_j + _k, _l];
|
_weighted set [_j + _k, _l];
|
||||||
|
//_items set [count _items, ((_itemChances select _l) select 0)];
|
||||||
};
|
};
|
||||||
_j = _j + _weight;
|
_j = _j + _weight;
|
||||||
};
|
};
|
||||||
dayz_CLBase set [count dayz_CLBase, configName (_config select _i)];
|
dayz_CLBase set [count dayz_CLBase, _classname];
|
||||||
|
//dayz_CLItemNames set [count dayz_CLBase, _items];
|
||||||
dayz_CLChances set [count dayz_CLChances, _weighted];
|
dayz_CLChances set [count dayz_CLChances, _weighted];
|
||||||
|
|
||||||
|
//diag_log format["CFGLoot: %1, Array: %2", _classname, _items];
|
||||||
};
|
};
|
||||||
|
//diag_log ("BaseLoot: " +str(dayz_CLBase));
|
||||||
dayzE_CLSChances = [];
|
|
||||||
dayzE_CLSBase = [];
|
|
||||||
|
|
||||||
_config = [];
|
|
||||||
if (DZE_MissionLootTable) then {
|
|
||||||
_config = missionConfigFile >> "cfgLootSmall";
|
|
||||||
} else {
|
|
||||||
_config = configFile >> "cfgLootSmall";
|
|
||||||
};
|
|
||||||
|
|
||||||
for "_i" from 0 to ((count (_config)) - 1) do {
|
|
||||||
_itemChances = (getArray (_config select _i)) select 1;
|
|
||||||
_weighted = [];
|
|
||||||
_j = 0;
|
|
||||||
for "_l" from 0 to ((count _itemChances) - 1) do {
|
|
||||||
_weight = round ((_itemChances select _l) * 100);
|
|
||||||
for "_k" from 0 to _weight - 1 do {
|
|
||||||
_weighted set [_j + _k, _l];
|
|
||||||
};
|
|
||||||
_j = _j + _weight;
|
|
||||||
};
|
|
||||||
dayzE_CLSBase set [count dayzE_CLSBase, configName (_config select _i)];
|
|
||||||
dayzE_CLSChances set [count dayzE_CLSChances, _weighted];
|
|
||||||
};
|
|
||||||
|
|
||||||
private["_i","_type","_config","_canZombie","_canLoot"];
|
|
||||||
dayz_ZombieBuildings = [];
|
dayz_ZombieBuildings = [];
|
||||||
dayz_LootBuildings = [];
|
dayz_LootBuildings = [];
|
||||||
|
for "_i" from 0 to (count (configFile >> "CfgBuildingLoot") - 1) do {
|
||||||
_config = [];
|
_type = (configFile >> "CfgBuildingLoot") select _i;
|
||||||
if (DZE_MissionLootTable) then {
|
|
||||||
_config = missionConfigFile >> "CfgBuildingLoot";
|
|
||||||
} else {
|
|
||||||
_config = configFile >> "CfgBuildingLoot";
|
|
||||||
};
|
|
||||||
|
|
||||||
for "_i" from 0 to (count (_config) - 1) do {
|
|
||||||
_type = _config select _i;
|
|
||||||
_canZombie = getNumber (_type >> "zombieChance") > 0;
|
_canZombie = getNumber (_type >> "zombieChance") > 0;
|
||||||
_canLoot = getNumber (_type >> "lootChance") > 0;
|
_canLoot = getNumber (_type >> "lootChance") > 0;
|
||||||
if(_canZombie) then {
|
if(_canZombie) then {
|
||||||
@@ -133,3 +80,5 @@ for "_i" from 0 to (count (_config) - 1) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
//diag_log format["ZombieBuildings: %1", dayz_ZombieBuildings];
|
||||||
|
//diag_log format["LootBuildings: %1", dayz_LootBuildings];
|
||||||
Reference in New Issue
Block a user