forked from MagicBane/Server
Start mobequip refactor
This commit is contained in:
@@ -310,7 +310,7 @@ public enum LootManager {
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||
mob.charItemManager.addItemToInventory(goldAmount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public enum LootManager {
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
|
||||
if (toAdd != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
mob.charItemManager.addItemToInventory(toAdd);
|
||||
|
||||
} catch (Exception e) {
|
||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||
@@ -336,24 +336,24 @@ public enum LootManager {
|
||||
return; // safehold guards don't drop their equipment
|
||||
//do equipment here
|
||||
int dropCount = 0;
|
||||
if (mob.getEquip() != null)
|
||||
for (Item me : mob.getEquip().values()) {
|
||||
if (mob.charItemManager.equipped.isEmpty() == false)
|
||||
for (Item item : mob.charItemManager.equipped.values()) {
|
||||
|
||||
if (me.getDropChance() == 0)
|
||||
if (item.drop_chance == 0)
|
||||
continue;
|
||||
|
||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
float dropChance = me.getDropChance() * 100;
|
||||
float dropChance = item.drop_chance * 100;
|
||||
|
||||
if (equipmentRoll > dropChance)
|
||||
continue;
|
||||
|
||||
MobLoot ml = new MobLoot(mob, me.template, false);
|
||||
MobLoot ml = new MobLoot(mob, item.template, false);
|
||||
|
||||
if (ml != null && dropCount < 1) {
|
||||
ml.setIsID(true);
|
||||
ml.setDurabilityCurrent((short) ((short) ml.durabilityCurrent - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||
mob.getCharItemManager().addItemToInventory(ml);
|
||||
mob.charItemManager.addItemToInventory(ml);
|
||||
dropCount = 1;
|
||||
//break; // Exit on first successful roll.
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public enum LootManager {
|
||||
MobLoot lootItem = new MobLoot(mob, ItemTemplate.templates.get(bse.templateID), true);
|
||||
|
||||
if (lootItem != null)
|
||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||
mob.charItemManager.addItemToInventory(lootItem);
|
||||
}
|
||||
|
||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||
@@ -389,7 +389,7 @@ public enum LootManager {
|
||||
|
||||
//get the character item manager
|
||||
|
||||
CharacterItemManager itemMan = playerCharacter.getCharItemManager();
|
||||
CharacterItemManager itemMan = playerCharacter.charItemManager;
|
||||
|
||||
if (itemMan == null)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user