Browse Source

General Cleanup and drop rates

lakebane-new
FatBoy-DOTC 4 months ago
parent
commit
23e60b36b4
  1. 86
      src/engine/gameManager/LootManager.java
  2. 20
      src/engine/net/client/handlers/ObjectActionMsgHandler.java

86
src/engine/gameManager/LootManager.java

@ -85,6 +85,10 @@ public enum LootManager {
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet)) if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet))
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone); RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
//check for special gifts 1/100 to drop present
if(ThreadLocalRandom.current().nextInt(1,101) == 50)
DropPresent(mob);
//lastly, check mobs inventory for godly or disc runes to send a server announcement //lastly, check mobs inventory for godly or disc runes to send a server announcement
for (Item it : mob.getInventory()) { for (Item it : mob.getInventory()) {
@ -429,7 +433,7 @@ public enum LootManager {
//check if player owns the gift he is trying to open //check if player owns the gift he is trying to open
if (itemMan.doesCharOwnThisItem(gift.getObjectUUID()) == false) if (!itemMan.doesCharOwnThisItem(gift.getObjectUUID()))
return; return;
//roll 1-100 for the gen table selection //roll 1-100 for the gen table selection
@ -450,46 +454,57 @@ public enum LootManager {
//create the item from the table, quantity is always 1 //create the item from the table, quantity is always 1
MobLoot winnings = new MobLoot(playerCharacter, ItemBase.getItemBase(selectedItem.cacheID), 1, false); ItemBase ib = ItemBase.getItemBase(selectedItem.cacheID);
if(ib.getUUID() == Warehouse.coalIB.getUUID()){
//no more coal, give gold instead
if (itemMan.getGoldInventory().getNumOfItems() + 250000 > 10000000) {
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
return;
}
itemMan.addGoldToInventory(250000,false);
itemMan.updateInventory();
}else {
MobLoot winnings = new MobLoot(playerCharacter, ib, 1, false);
if (winnings == null) if (winnings == null)
return; return;
//early exit if the inventory of the player will not old the item //early exit if the inventory of the player will not hold the item
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) { if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21); ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
return; return;
} }
//determine if the winning item needs a prefix //determine if the winning item needs a prefix
if(selectedRow.pModTable != 0){ if (selectedRow.pModTable != 0) {
int prefixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1); int prefixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll); ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
if(prefix != null) if (prefix != null)
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true); winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
} }
//determine if the winning item needs a suffix //determine if the winning item needs a suffix
if(selectedRow.sModTable != 0){ if (selectedRow.sModTable != 0) {
int suffixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1); int suffixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll); ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
if (suffix != null) if (suffix != null)
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true); winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
} }
winnings.setIsID(true); winnings.setIsID(true);
//remove gift from inventory //remove gift from inventory
itemMan.consume(gift); itemMan.consume(gift);
//add winnings to player inventory //add winnings to player inventory
Item playerWinnings = winnings.promoteToItem(playerCharacter); Item playerWinnings = winnings.promoteToItem(playerCharacter);
itemMan.addItemToInventory(playerWinnings); itemMan.addItemToInventory(playerWinnings);
itemMan.updateInventory(); itemMan.updateInventory();
}
} }
public static int rollRandomItem(int itemTable){ public static int rollRandomItem(int itemTable){
@ -585,4 +600,15 @@ public enum LootManager {
return null; return null;
} }
public static void DropPresent(Mob mob){
int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
int presentID = ItemBase.AnniverseryGifts.get(random);
ItemBase presentBase = ItemBase.getItemBase(presentID);
if(presentBase != null){
MobLoot lootItem = new MobLoot(mob, presentBase, true);
mob.getCharItemManager().addItemToInventory(lootItem);
}
}
} }

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

@ -421,31 +421,12 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
itemMan.consume(item); itemMan.consume(item);
} }
break; break;
//ANNIVERSERY GIFT
case 31: case 31:
// *** Disabled for now: Needs bootyset created
//if (ib.getUUID() == 971012) {
// int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
// int annyID = ItemBase.AnniverseryGifts.get(random);
// ItemBase annyIB = ItemBase.getItemBase(annyID);
// if (annyIB != null) {
// Item gift = MobLoot.createItemForPlayer(player, annyIB);
// if (gift != null) {
// itemMan.addItemToInventory(gift);
// itemMan.consume(item);
// }
// }
// break;
//}
LootManager.peddleFate(player,item); LootManager.peddleFate(player,item);
break; break;
case 30: //water bucket case 30: //water bucket
case 8: //potions, tears of saedron case 8: //potions, tears of saedron
case 5: //runes, petition, warrant, scrolls case 5: //runes, petition, warrant, scrolls
if (uuid > 3000 && uuid < 3050) { //Discipline Runes if (uuid > 3000 && uuid < 3050) { //Discipline Runes
if (ApplyRuneMsg.applyRune(uuid, origin, player)) { if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
@ -528,7 +509,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
} }
// Send piss bucket animation // Send piss bucket animation
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323); VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
vum.configure(); vum.configure();
DispatchMessage.sendToAllInRange(player, vum); DispatchMessage.sendToAllInRange(player, vum);

Loading…
Cancel
Save