Refractor approach to special creature DNA loot

The point of this change is to get rid of all of the unnecessary DNA loot roll chance scripts located at script.item.dna.* and instead replace it with a proper implementation. There are 2 new columns in creatures.tab (dnaChancePct and dnaItemName) which are parsed during createCreature() and loot events to properly roll for loot chance of the DNA and to add it to a creature's inventory container.
This commit is contained in:
AconiteX
2021-07-13 02:29:08 -04:00
parent 6366bded0e
commit 8a35cd9085
12 changed files with 6788 additions and 7004 deletions
@@ -746,6 +746,13 @@ public class create extends script.base_script
setObjVar(creature, "loot.lootTable", strLootTable);
setObjVar(creature, "loot.numItems", intItems);
}
final float dnaLootPercentageChance = creatureDict.getFloat("dnaChancePct");
final String dnaLootItemName = creatureDict.getString("dnaItemName");
if(dnaLootPercentageChance > 0 && dnaLootItemName != null && static_item.isStaticItem(dnaLootItemName))
{
setObjVar(creature, loot.OBJVAR_DNA_LOOT_CHANCE, dnaLootPercentageChance);
setObjVar(creature, loot.OBJVAR_DNA_LOOT_ITEM_NAME, dnaLootItemName);
}
if (!initializeArmor(creature, creatureDict, dataTableGetInt(STAT_BALANCE_TABLE, armorLevel - 1, diffClassName + "Armor")))
{
LOG("create", "Unable to initialize armor on " + creatureName + "(" + creature + ")");