@ -17,9 +17,7 @@ import engine.objects.*;
import org.pmw.tinylog.Logger ;
import org.pmw.tinylog.Logger ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.List ;
import java.util.concurrent.ThreadLocalRandom ;
import java.util.concurrent.ThreadLocalRandom ;
/ * *
/ * *
@ -36,11 +34,6 @@ public enum LootManager {
public static HashMap < Integer , ArrayList < ModTableEntry > > _modTables = new HashMap < > ( ) ;
public static HashMap < Integer , ArrayList < ModTableEntry > > _modTables = new HashMap < > ( ) ;
public static HashMap < Integer , ArrayList < ModTypeTableEntry > > _modTypeTables = new HashMap < > ( ) ;
public static HashMap < Integer , ArrayList < ModTypeTableEntry > > _modTypeTables = new HashMap < > ( ) ;
public static final ArrayList < Integer > vorg_ha_uuids = new ArrayList < > ( Arrays . asList ( 27580 , 27590 , 188500 , 188510 , 188520 , 188530 , 188540 , 188550 , 189510 ) ) ;
public static final ArrayList < Integer > vorg_ma_uuids = new ArrayList < > ( Arrays . asList ( 27570 , 188900 , 188910 , 188920 , 188930 , 188940 , 188950 , 189500 ) ) ;
public static final ArrayList < Integer > vorg_la_uuids = new ArrayList < > ( Arrays . asList ( 27550 , 27560 , 189100 , 189110 , 189120 , 189130 , 189140 , 189150 ) ) ;
public static final ArrayList < Integer > vorg_cloth_uuids = new ArrayList < > ( Arrays . asList ( 27600 , 188700 , 188720 , 189550 , 189560 ) ) ;
// Drop Rates
// Drop Rates
public static float NORMAL_DROP_RATE ;
public static float NORMAL_DROP_RATE ;
@ -74,35 +67,17 @@ public enum LootManager {
}
}
public static void GenerateMobLoot ( Mob mob ) {
public static void GenerateMobLoot ( Mob mob ) {
//determine if mob is in hotzone
//determine if mob is in hotzone
boolean inHotzone = false ;
boolean inHotzone = ZoneManager . inHotZone ( mob . getLoc ( ) ) ;
//iterate the booty sets
//iterate the booty sets
if ( mob . mobBase = = null | | mob . getMobBaseID ( ) = = 253003 ) {
if ( mob . getMobBase ( ) . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . getMobBase ( ) . bootySet ) = = true )
int i = 0 ;
}
if ( mob . getMobBase ( ) . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . getMobBase ( ) . bootySet ) )
RunBootySet ( _bootySetMap . get ( mob . getMobBase ( ) . bootySet ) , mob , inHotzone ) ;
RunBootySet ( _bootySetMap . get ( mob . getMobBase ( ) . bootySet ) , mob , inHotzone ) ;
if ( mob . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . bootySet ) ) {
if ( mob . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . bootySet ) = = true )
RunBootySet ( _bootySetMap . get ( mob . bootySet ) , mob , inHotzone ) ;
RunBootySet ( _bootySetMap . get ( mob . bootySet ) , mob , inHotzone ) ;
} else if ( mob . bootySet ! = 0 & & ItemBase . getItemBase ( mob . bootySet ) ! = null ) {
MobLoot specialDrop = null ;
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( mob . bootySet ) , true ) ;
if ( specialDrop ! = null ) {
ChatSystemMsg chatMsg = new ChatSystemMsg ( null , mob . getName ( ) + " in " + mob . getParentZone ( ) . getName ( ) + " has found the " + specialDrop . getName ( ) + ". Are you tough enough to take it?" ) ;
chatMsg . setMessageType ( 10 ) ;
chatMsg . setChannel ( Enum . ChatChannelType . SYSTEM . getChannelID ( ) ) ;
DispatchMessage . dispatchMsgToAll ( chatMsg ) ;
mob . getCharItemManager ( ) . addItemToInventory ( specialDrop ) ;
mob . setResists ( new Resists ( "Dropper" ) ) ;
if ( ! Mob . discDroppers . contains ( mob ) )
Mob . AddDiscDropper ( 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 ( ) ) {
@ -123,30 +98,10 @@ public enum LootManager {
private static void RunBootySet ( ArrayList < BootySetEntry > entries , Mob mob , boolean inHotzone ) {
private static void RunBootySet ( ArrayList < BootySetEntry > entries , Mob mob , boolean inHotzone ) {
boolean hotzoneWasRan = false ;
boolean hotzoneWasRan = false ;
float dropRate ;
float dropRate = 1 . 0f ;
if ( ! mob . getSafeZone ( ) ) {
int specialCaseRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100000 ) ;
//Special Case Contract Drop
if ( specialCaseRoll < 100 ) {
SpecialCaseResourceDrop ( mob , entries ) ;
} else if ( specialCaseRoll > 100 & & specialCaseRoll < 500 ) {
SpecialCaseContractDrop ( mob , entries ) ;
} else if ( specialCaseRoll > 500 & & specialCaseRoll < 900 ) {
SpecialCaseRuneDrop ( mob , entries ) ;
} else if ( specialCaseRoll > 900 & & specialCaseRoll < 910 ) {
int glassID = rollRandomItem ( 126 ) ;
ItemBase glassItem = ItemBase . getItemBase ( glassID ) ;
if ( glassItem ! = null ) {
MobLoot toAddGlass = new MobLoot ( mob , glassItem , false ) ;
if ( toAddGlass ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( toAddGlass ) ;
}
}
}
// Iterate all entries in this bootySet and process accordingly
// Iterate all entries in this bootySet and process accordingly
for ( BootySetEntry bse : entries ) {
for ( BootySetEntry bse : entries ) {
switch ( bse . bootyType ) {
switch ( bse . bootyType ) {
case "GOLD" :
case "GOLD" :
@ -154,9 +109,7 @@ public enum LootManager {
break ;
break ;
case "LOOT" :
case "LOOT" :
if ( mob . getSafeZone ( ) )
if ( mob . getSafeZone ( ) = = false )
return ; // no loot to drop in safezones
dropRate = LootManager . NORMAL_DROP_RATE ;
dropRate = LootManager . NORMAL_DROP_RATE ;
if ( inHotzone = = true )
if ( inHotzone = = true )
@ -182,109 +135,6 @@ public enum LootManager {
}
}
}
}
public static void SpecialCaseContractDrop ( Mob mob , ArrayList < BootySetEntry > entries ) {
int lootTableID = 0 ;
for ( BootySetEntry entry : entries ) {
if ( entry . bootyType . equals ( "LOOT" ) ) {
lootTableID = entry . genTable ;
break ;
}
}
if ( lootTableID = = 0 )
return ;
int ContractTableID = 0 ;
for ( GenTableEntry entry : _genTables . get ( lootTableID ) ) {
try {
if ( ItemBase . getItemBase ( _itemTables . get ( entry . itemTableID ) . get ( 0 ) . cacheID ) . getType ( ) . equals ( Enum . ItemType . CONTRACT ) ) {
ContractTableID = entry . itemTableID ;
break ;
}
} catch ( Exception e ) {
}
}
if ( ContractTableID = = 0 )
return ;
ItemBase ib = ItemBase . getItemBase ( rollRandomItem ( ContractTableID ) ) ;
if ( ib ! = null ) {
MobLoot toAdd = new MobLoot ( mob , ib , false ) ;
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
}
}
public static void SpecialCaseRuneDrop ( Mob mob , ArrayList < BootySetEntry > entries ) {
int lootTableID = 0 ;
for ( BootySetEntry entry : entries ) {
if ( entry . bootyType . equals ( "LOOT" ) ) {
lootTableID = entry . genTable ;
break ;
}
}
if ( lootTableID = = 0 )
return ;
int RuneTableID = 0 ;
for ( GenTableEntry entry : _genTables . get ( lootTableID ) ) {
try {
if ( ItemBase . getItemBase ( _itemTables . get ( entry . itemTableID ) . get ( 0 ) . cacheID ) . getType ( ) . equals ( Enum . ItemType . RUNE ) ) {
RuneTableID = entry . itemTableID ;
break ;
}
} catch ( Exception e ) {
}
}
if ( RuneTableID = = 0 )
return ;
ItemBase ib = ItemBase . getItemBase ( rollRandomItem ( RuneTableID ) ) ;
if ( ib ! = null ) {
MobLoot toAdd = new MobLoot ( mob , ib , false ) ;
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
}
}
public static void SpecialCaseResourceDrop ( Mob mob , ArrayList < BootySetEntry > entries ) {
int lootTableID = 0 ;
for ( BootySetEntry entry : entries ) {
if ( entry . bootyType . equals ( "LOOT" ) ) {
lootTableID = entry . genTable ;
break ;
}
}
if ( lootTableID = = 0 )
return ;
int ResourceTableID = 0 ;
for ( GenTableEntry entry : _genTables . get ( lootTableID ) ) {
try {
if ( ItemBase . getItemBase ( _itemTables . get ( entry . itemTableID ) . get ( 0 ) . cacheID ) . getType ( ) . equals ( Enum . ItemType . RESOURCE ) ) {
ResourceTableID = entry . itemTableID ;
break ;
}
} catch ( Exception e ) {
}
}
if ( ResourceTableID = = 0 )
return ;
ItemBase ib = ItemBase . getItemBase ( rollRandomItem ( ResourceTableID ) ) ;
if ( ib ! = null ) {
MobLoot toAdd = new MobLoot ( mob , ib , false ) ;
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
}
}
public static MobLoot getGenTableItem ( int genTableID , AbstractCharacter 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 )
@ -306,10 +156,11 @@ public enum LootManager {
//gets the 1-320 roll for this mob
//gets the 1-320 roll for this mob
int itemTableRoll = 0 ;
int itemTableRoll = 0 ;
int objectType = mob . getObjectType ( ) . ordinal ( ) ;
if ( mob . getObjectType ( ) . ordinal ( ) = = 52 ) { //52 = player character
if ( mob . getObjectType ( ) . ordinal ( ) = = 52 ) { //52 = player character
itemTableRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 320 + 1 ) ;
itemTableRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 320 + 1 ) ;
} else {
} else {
itemTableRoll = TableRoll ( mob . level ) ;
itemTableRoll = TableRoll ( mob . level , inHotzone ) ;
}
}
ItemTableEntry tableRow = ItemTableEntry . rollTable ( itemTableId , itemTableRoll ) ;
ItemTableEntry tableRow = ItemTableEntry . rollTable ( itemTableId , itemTableRoll ) ;
if ( tableRow = = null )
if ( tableRow = = null )
@ -321,23 +172,13 @@ public enum LootManager {
return null ;
return null ;
if ( ItemBase . getItemBase ( itemUUID ) . getType ( ) . ordinal ( ) = = Enum . ItemType . RESOURCE . ordinal ( ) ) {
if ( ItemBase . getItemBase ( itemUUID ) . getType ( ) . ordinal ( ) = = Enum . ItemType . RESOURCE . ordinal ( ) ) {
if ( ThreadLocalRandom . current ( ) . nextInt ( 1 , 101 ) < 91 )
return null ; // cut down world drops rates of resources by 90%
int amount = ThreadLocalRandom . current ( ) . nextInt ( tableRow . minSpawn , tableRow . maxSpawn + 1 ) ;
int amount = ThreadLocalRandom . current ( ) . nextInt ( tableRow . minSpawn , tableRow . maxSpawn + 1 ) ;
return new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , amount , false ) ;
return new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , amount , false ) ;
}
}
if ( ItemBase . getItemBase ( itemUUID ) . getType ( ) . equals ( Enum . ItemType . RUNE ) ) {
int randomRune = rollRandomItem ( itemTableId ) ;
if ( randomRune ! = 0 ) {
itemUUID = randomRune ;
}
} else if ( ItemBase . getItemBase ( itemUUID ) . getType ( ) . equals ( Enum . ItemType . CONTRACT ) ) {
int randomContract = rollRandomItem ( itemTableId ) ;
if ( randomContract ! = 0 ) {
itemUUID = randomContract ;
}
}
outItem = new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , false ) ;
outItem = new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , false ) ;
Enum . ItemType outType = outItem . getItemBase ( ) . getType ( ) ;
if ( selectedRow . pModTable ! = 0 ) {
if ( selectedRow . pModTable ! = 0 ) {
try {
try {
@ -355,12 +196,6 @@ public enum LootManager {
Logger . error ( "Failed to GenerateSuffix for item: " + outItem . getName ( ) ) ;
Logger . error ( "Failed to GenerateSuffix for item: " + outItem . getName ( ) ) ;
}
}
}
}
if ( outItem . getItemBase ( ) . getType ( ) . equals ( Enum . ItemType . CONTRACT ) | | outItem . getItemBase ( ) . getType ( ) . equals ( Enum . ItemType . RUNE ) ) {
if ( ThreadLocalRandom . current ( ) . nextInt ( 1 , 101 ) < 66 )
return null ; // cut down world drops rates of resources by 65%
}
return outItem ;
return outItem ;
}
}
@ -381,7 +216,7 @@ public enum LootManager {
if ( mob . getObjectType ( ) . ordinal ( ) = = 52 ) {
if ( mob . getObjectType ( ) . ordinal ( ) = = 52 ) {
prefixTableRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 320 + 1 ) ;
prefixTableRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 320 + 1 ) ;
} else {
} else {
prefixTableRoll = TableRoll ( mob . level ) ;
prefixTableRoll = TableRoll ( mob . level , inHotzone ) ;
}
}
ModTableEntry prefixMod = ModTableEntry . rollTable ( prefixTable . modTableID , prefixTableRoll ) ;
ModTableEntry prefixMod = ModTableEntry . rollTable ( prefixTable . modTableID , prefixTableRoll ) ;
@ -413,7 +248,7 @@ public enum LootManager {
if ( mob . getObjectType ( ) . ordinal ( ) = = 52 ) {
if ( mob . getObjectType ( ) . ordinal ( ) = = 52 ) {
suffixTableRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 320 + 1 ) ;
suffixTableRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 320 + 1 ) ;
} else {
} else {
suffixTableRoll = TableRoll ( mob . level ) ;
suffixTableRoll = TableRoll ( mob . level , inHotzone ) ;
}
}
ModTableEntry suffixMod = ModTableEntry . rollTable ( suffixTable . modTableID , suffixTableRoll ) ;
ModTableEntry suffixMod = ModTableEntry . rollTable ( suffixTable . modTableID , suffixTableRoll ) ;
@ -428,36 +263,23 @@ public enum LootManager {
return inItem ;
return inItem ;
}
}
public static int TableRoll ( int mobLevel ) {
public static int TableRoll ( int mobLevel , Boolean inHotzone ) {
int rank = ( int ) ( mobLevel * 0 . 1f ) ;
if ( mobLevel > 65 )
int min = 50 ;
mobLevel = 65 ;
int max = 100 ;
switch ( rank ) {
int max = ( int ) ( 4 . 882 * mobLevel + 127 . 0 ) ;
case 1 :
min = 200 ;
if ( max > 319 )
max = 250 ;
max = 319 ;
break ;
case 2 :
int min = ( int ) ( 4 . 469 * mobLevel - 3 . 469 ) ;
min = 210 ;
max = 275 ;
if ( min < 70 )
break ;
min = 70 ;
case 3 :
min = 220 ;
if ( inHotzone )
max = 300 ;
min + = mobLevel ;
break ;
case 4 :
min = 230 ;
max = 320 ;
break ;
case 5 :
case 6 :
case 7 :
case 8 :
min = 240 ;
max = 320 ;
break ;
}
int roll = ThreadLocalRandom . current ( ) . nextInt ( min , max + 1 ) ;
int roll = ThreadLocalRandom . current ( ) . nextInt ( min , max + 1 ) ;
@ -477,7 +299,12 @@ public enum LootManager {
int high = bse . highGold ;
int high = bse . highGold ;
int low = bse . lowGold ;
int low = bse . lowGold ;
int gold = ( int ) ( ThreadLocalRandom . current ( ) . nextInt ( low , high + 1 ) * NORMAL_GOLD_RATE ) ;
int gold = ThreadLocalRandom . current ( ) . nextInt ( low , high + 1 ) ;
if ( inHotzone = = true )
gold = ( int ) ( gold * HOTZONE_GOLD_RATE ) ;
else
gold = ( int ) ( gold * NORMAL_GOLD_RATE ) ;
if ( gold > 0 ) {
if ( gold > 0 ) {
MobLoot goldAmount = new MobLoot ( mob , gold ) ;
MobLoot goldAmount = new MobLoot ( mob , gold ) ;
@ -488,61 +315,43 @@ public enum LootManager {
public static void GenerateLootDrop ( Mob mob , int tableID , Boolean inHotzone ) {
public static void GenerateLootDrop ( Mob mob , int tableID , Boolean inHotzone ) {
try {
MobLoot toAdd = getGenTableItem ( tableID , mob , inHotzone ) ;
MobLoot toAdd = getGenTableItem ( tableID , mob , inHotzone ) ;
if ( toAdd ! = null ) {
ItemBase ib = toAdd . getItemBase ( ) ;
if ( toAdd ! = null )
switch ( ib . getType ( ) ) {
case CONTRACT :
case RUNE :
case RESOURCE :
return ;
}
toAdd . setIsID ( true ) ;
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
} catch ( Exception e ) {
//TODO chase down loot generation error, affects roughly 2% of drops
int i = 0 ;
}
}
}
}
public static void GenerateEquipmentDrop ( Mob mob ) {
public static void GenerateEquipmentDrop ( Mob mob ) {
if ( mob = = null | | mob . getSafeZone ( ) )
return ; // no equipment to drop in safezones
if ( mob . StrongholdGuardian | | mob . StrongholdCommander | | mob . StrongholdEpic )
return ; // stronghold mobs don't drop equipment
//do equipment here
//do equipment here
if ( mob . getEquip ( ) ! = null ) {
int dropCount = 0 ;
boolean isVorg = false ;
if ( mob . getEquip ( ) ! = null )
for ( MobEquipment me : mob . getEquip ( ) . values ( ) ) {
for ( MobEquipment me : mob . getEquip ( ) . values ( ) ) {
if ( me . getDropChance ( ) = = 0 )
if ( me . getDropChance ( ) = = 0 )
continue ;
continue ;
String name = me . getItemBase ( ) . getName ( ) . toLowerCase ( ) ;
if ( name . contains ( "vorgrim legionnaire's" ) | | name . contains ( "vorgrim auxiliary's" ) | | name . contains ( "bellugh nuathal" ) | | name . contains ( "crimson circle" ) )
isVorg = true ;
if ( isVorg & & ! mob . isDropper ) {
continue ;
}
float equipmentRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
float equipmentRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
float dropChance = me . getDropChance ( ) * 100 ;
float dropChance = me . getDropChance ( ) * 100 ;
ItemBase itemBase = me . getItemBase ( ) ;
if ( isVorg ) {
mob . spawnTime = ThreadLocalRandom . current ( ) . nextInt ( 300 , 2700 ) ;
dropChance = 10 ;
itemBase = getRandomVorg ( itemBase ) ;
}
if ( equipmentRoll > dropChance )
if ( equipmentRoll > dropChance )
continue ;
continue ;
MobLoot ml = new MobLoot ( mob , itemBase , false ) ;
MobLoot ml = new MobLoot ( mob , me . getItemBase ( ) , false ) ;
if ( ml ! = null & & dropCount < 1 ) {
ml . setIsID ( true ) ;
ml . setIsID ( true ) ;
ml . setDurabilityCurrent ( ( short ) ( ml . getDurabilityCurrent ( ) - ThreadLocalRandom . current ( ) . nextInt ( 5 ) + 1 ) ) ;
ml . setDurabilityCurrent ( ( short ) ( ml . getDurabilityCurrent ( ) - ThreadLocalRandom . current ( ) . nextInt ( 5 ) + 1 ) ) ;
mob . getCharItemManager ( ) . addItemToInventory ( ml ) ;
mob . getCharItemManager ( ) . addItemToInventory ( ml ) ;
dropCount = 1 ;
//break; // Exit on first successful roll.
}
}
}
}
}
}
@ -558,11 +367,8 @@ public enum LootManager {
MobLoot lootItem = new MobLoot ( mob , ItemBase . getItemBase ( bse . itemBase ) , true ) ;
MobLoot lootItem = new MobLoot ( mob , ItemBase . getItemBase ( bse . itemBase ) , true ) ;
if ( lootItem ! = null ) {
if ( lootItem ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( lootItem ) ;
mob . getCharItemManager ( ) . addItemToInventory ( lootItem ) ;
if ( lootItem . getItemBase ( ) . isDiscRune ( ) & & ! Mob . discDroppers . contains ( mob ) )
Mob . AddDiscDropper ( mob ) ;
}
}
}
public static void peddleFate ( PlayerCharacter playerCharacter , Item gift ) {
public static void peddleFate ( PlayerCharacter playerCharacter , Item gift ) {
@ -586,12 +392,12 @@ 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 ( ) ) )
if ( itemMan . doesCharOwnThisItem ( gift . getObjectUUID ( ) ) = = false )
return ;
return ;
//roll 1-100 for the gen table selection
//roll 1-100 for the gen table selection
int genRoll = ThreadLocalRandom . current ( ) . nextInt ( 94 , 100 ) + 1 ;
int genRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
GenTableEntry selectedRow = GenTableEntry . rollTable ( tableID , genRoll , LootManager . NORMAL_DROP_RATE ) ;
GenTableEntry selectedRow = GenTableEntry . rollTable ( tableID , genRoll , LootManager . NORMAL_DROP_RATE ) ;
if ( selectedRow = = null )
if ( selectedRow = = null )
@ -607,22 +413,12 @@ public enum LootManager {
//create the item from the table, quantity is always 1
//create the item from the table, quantity is always 1
ItemBase ib = ItemBase . getItemBase ( selectedItem . cacheID ) ;
MobLoot winnings = new MobLoot ( playerCharacter , ItemBase . getItemBase ( selectedItem . cacheID ) , 1 , false ) ;
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 h old the item
//early exit if the inventory of the player will not old the item
if ( itemMan . hasRoomInventory ( winnings . getItemBase ( ) . getWeight ( ) ) = = false ) {
if ( itemMan . hasRoomInventory ( winnings . getItemBase ( ) . getWeight ( ) ) = = false ) {
ErrorPopupMsg . sendErrorPopup ( playerCharacter , 21 ) ;
ErrorPopupMsg . sendErrorPopup ( playerCharacter , 21 ) ;
@ -659,224 +455,3 @@ public enum LootManager {
itemMan . updateInventory ( ) ;
itemMan . updateInventory ( ) ;
}
}
}
}
public static int rollRandomItem ( int itemTable ) {
int returnedID = ItemTableEntry . getRandomItem ( itemTable ) ;
return returnedID ;
}
public static ItemBase getRandomVorg ( ItemBase itemBase ) {
int roll = 0 ;
if ( vorg_ha_uuids . contains ( itemBase . getUUID ( ) ) ) {
roll = ThreadLocalRandom . current ( ) . nextInt ( 0 , 10 ) ;
switch ( roll ) {
case 1 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 0 ) ) ;
case 2 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 1 ) ) ;
case 3 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 2 ) ) ;
case 4 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 3 ) ) ;
case 5 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 4 ) ) ;
case 6 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 5 ) ) ;
case 7 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 6 ) ) ;
case 8 :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 7 ) ) ;
default :
return ItemBase . getItemBase ( vorg_ha_uuids . get ( 8 ) ) ;
}
}
if ( vorg_ma_uuids . contains ( itemBase . getUUID ( ) ) ) {
roll = ThreadLocalRandom . current ( ) . nextInt ( 0 , 10 ) ;
switch ( roll ) {
case 1 :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 0 ) ) ;
case 2 :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 1 ) ) ;
case 3 :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 2 ) ) ;
case 4 :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 3 ) ) ;
case 5 :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 4 ) ) ;
case 6 :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 5 ) ) ;
case 7 :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 6 ) ) ;
default :
return ItemBase . getItemBase ( vorg_ma_uuids . get ( 7 ) ) ;
}
}
if ( vorg_la_uuids . contains ( itemBase . getUUID ( ) ) ) {
roll = ThreadLocalRandom . current ( ) . nextInt ( 0 , 10 ) ;
switch ( roll ) {
case 1 :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 0 ) ) ;
case 2 :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 1 ) ) ;
case 3 :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 2 ) ) ;
case 4 :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 3 ) ) ;
case 5 :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 4 ) ) ;
case 6 :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 5 ) ) ;
case 7 :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 6 ) ) ;
default :
return ItemBase . getItemBase ( vorg_la_uuids . get ( 7 ) ) ;
}
}
if ( vorg_cloth_uuids . contains ( itemBase . getUUID ( ) ) ) {
roll = ThreadLocalRandom . current ( ) . nextInt ( 0 , 10 ) ;
switch ( roll ) {
case 1 :
return ItemBase . getItemBase ( vorg_cloth_uuids . get ( 0 ) ) ;
case 2 :
return ItemBase . getItemBase ( vorg_cloth_uuids . get ( 1 ) ) ;
case 3 :
return ItemBase . getItemBase ( vorg_cloth_uuids . get ( 2 ) ) ;
case 4 :
return ItemBase . getItemBase ( vorg_cloth_uuids . get ( 3 ) ) ;
default :
return ItemBase . getItemBase ( vorg_cloth_uuids . get ( 4 ) ) ;
}
}
return null ;
}
public static void DropPresent ( Mob mob ) {
int random = 971049 + ThreadLocalRandom . current ( ) . nextInt ( 24 ) ;
if ( random > 971071 )
random = 971071 ;
ItemBase present = ItemBase . getItemBase ( random ) ;
if ( present ! = null ) {
MobLoot toAdd = new MobLoot ( mob , present , true ) ;
if ( toAdd ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
}
}
public static void GenerateStrongholdLoot ( Mob mob , boolean commander , boolean epic ) {
mob . getCharItemManager ( ) . clearInventory ( ) ;
int multiplier = 1 ;
if ( commander )
multiplier = 2 ;
if ( epic )
multiplier = 10 ;
int high = 125000 ;
int low = 50000 ;
int gold = ThreadLocalRandom . current ( ) . nextInt ( low , high + 1 ) * multiplier ;
if ( gold > 0 ) {
MobLoot goldAmount = new MobLoot ( mob , gold ) ;
mob . getCharItemManager ( ) . addItemToInventory ( goldAmount ) ;
}
//present drop chance for all
if ( ThreadLocalRandom . current ( ) . nextInt ( 100 ) < 35 )
DropPresent ( mob ) ;
//random contract drop chance for all
if ( ThreadLocalRandom . current ( ) . nextInt ( 100 ) < 40 ) {
int contractTableID = 250 ;
contractTableID + = ThreadLocalRandom . current ( ) . nextInt ( 0 , 11 ) ;
if ( contractTableID > 259 )
contractTableID = 659 ;
int id = rollRandomItem ( contractTableID ) ;
ItemBase ib = ItemBase . getItemBase ( id ) ;
if ( ib ! = null ) {
MobLoot contract = new MobLoot ( mob , ib , true ) ;
if ( contract ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( contract ) ;
}
}
//special commander drop chances
if ( commander )
GenerateCommanderLoot ( mob , false ) ;
//special epic drop chances
if ( epic ) {
GenerateCommanderLoot ( mob , true ) ;
GenerateCommanderLoot ( mob , false ) ;
}
}
public static void GenerateCommanderLoot ( Mob mob , boolean epic ) {
//present chance
if ( ThreadLocalRandom . current ( ) . nextInt ( 100 ) < 25 )
DropPresent ( mob ) ;
//present chance
if ( ThreadLocalRandom . current ( ) . nextInt ( 100 ) < 25 )
DropPresent ( mob ) ;
//chance for glass
if ( ThreadLocalRandom . current ( ) . nextInt ( 100 ) < 75 ) {
int glassID = rollRandomItem ( 126 ) ;
ItemBase glassItem = ItemBase . getItemBase ( glassID ) ;
if ( glassItem ! = null ) {
MobLoot toAdd2 = new MobLoot ( mob , glassItem , true ) ;
if ( toAdd2 ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( toAdd2 ) ;
}
}
//chance for disc
if ( ThreadLocalRandom . current ( ) . nextInt ( 100 ) < 75 ) {
int discID = rollRandomItem ( 3202 ) ;
ItemBase discItem = ItemBase . getItemBase ( discID ) ;
if ( discItem ! = null ) {
MobLoot toAdd3 = new MobLoot ( mob , discItem , true ) ;
if ( toAdd3 ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( toAdd3 ) ;
}
}
//chance for stat rune
if ( ThreadLocalRandom . current ( ) . nextInt ( 100 ) < 75 ) {
int runeID = rollRandomItem ( 3201 ) ;
ItemBase runeItem = ItemBase . getItemBase ( runeID ) ;
if ( runeItem ! = null ) {
MobLoot toAdd4 = new MobLoot ( mob , runeItem , true ) ;
if ( toAdd4 ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( toAdd4 ) ;
}
}
if ( epic ) {
int contractTableID = 250 ;
contractTableID + = ThreadLocalRandom . current ( ) . nextInt ( 0 , 11 ) ;
if ( contractTableID > 259 )
contractTableID = 659 ;
int id = rollRandomItem ( contractTableID ) ;
ItemBase ib = ItemBase . getItemBase ( id ) ;
if ( ib ! = null ) {
MobLoot contract = new MobLoot ( mob , ib , true ) ;
if ( contract ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( contract ) ;
}
}
}
}