Browse Source

fate peddler conversion of LootManager methods

master
FatBoy-DOTC 1 year ago
parent
commit
47eb4cd536
  1. 47
      src/engine/gameManager/LootManager.java
  2. 2
      src/engine/net/client/handlers/ObjectActionMsgHandler.java

47
src/engine/gameManager/LootManager.java

@ -141,7 +141,7 @@ public enum LootManager {
} }
} }
public static MobLoot getGenTableItem(int genTableID, Mob mob, Boolean inHotzone) { public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
if (mob == null || _genTables.containsKey(genTableID) == false) if (mob == null || _genTables.containsKey(genTableID) == false)
return null; return null;
@ -182,33 +182,27 @@ public enum LootManager {
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
Enum.ItemType outType = outItem.getItemBase().getType(); Enum.ItemType outType = outItem.getItemBase().getType();
if (outType.ordinal() == Enum.ItemType.WEAPON.ordinal() || outType.ordinal() == Enum.ItemType.ARMOR.ordinal() || outType.ordinal() == Enum.ItemType.JEWELRY.ordinal()) {
if (outItem.getItemBase().isGlass() == false) {
try { if(selectedRow.pModTable != 0){
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone); try {
} catch (Exception e) { outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName()); outItem.setIsID(false);
} } catch (Exception e) {
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
try { }
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone); }
} catch (Exception e) { if(selectedRow.sModTable != 0){
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName()); try {
} outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
outItem.setIsID(false);
} catch (Exception e) {
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
} }
} }
if (outItem.getPrefix() != null && outItem.getPrefix().isEmpty() == false)
outItem.setIsID(false);
if (outItem.getSuffix() != null && outItem.getSuffix().isEmpty() == false)
outItem.setIsID(false);
return outItem; return outItem;
} }
private static MobLoot GeneratePrefix(Mob mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) { private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll); GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll);
@ -235,7 +229,7 @@ public enum LootManager {
return inItem; return inItem;
} }
private static MobLoot GenerateSuffix(Mob mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) { private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll); GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll);
@ -367,5 +361,12 @@ public enum LootManager {
if (lootItem != null) if (lootItem != null)
mob.getCharItemManager().addItemToInventory(lootItem); mob.getCharItemManager().addItemToInventory(lootItem);
} }
public static void peddleFate(AbstractCharacter character, int giftID){
int tableID = LootManager._bootySetMap.get(giftID).get(ThreadLocalRandom.current().nextInt(1,LootManager._bootySetMap.get(giftID).size() - 1)).genTable;
MobLoot gamblingResult= getGenTableItem(tableID,character,false);
if(gamblingResult != null){
gamblingResult.promoteToItem((PlayerCharacter)character);
}
}
} }

2
src/engine/net/client/handlers/ObjectActionMsgHandler.java

@ -442,7 +442,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
} }
// Garbage method removed until rewritten. // Garbage method removed until rewritten.
// LootTable.CreateGamblerItem(item, player); // LootTable.CreateGamblerItem(item, player);
LootManager.peddleFate(player,item.getItemBaseID());
break; break;
case 30: //water bucket case 30: //water bucket

Loading…
Cancel
Save