@ -14,9 +14,11 @@ import engine.net.DispatchMessage;
import engine.net.client.msg.ErrorPopupMsg ;
import engine.net.client.msg.ErrorPopupMsg ;
import engine.net.client.msg.chat.ChatSystemMsg ;
import engine.net.client.msg.chat.ChatSystemMsg ;
import engine.objects.* ;
import engine.objects.* ;
import engine.server.MBServerStatics ;
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.concurrent.ThreadLocalRandom ;
import java.util.concurrent.ThreadLocalRandom ;
@ -34,6 +36,11 @@ 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 ArrayList < Integer > vorg_ha_uuids = new ArrayList < > ( Arrays . asList ( new Integer [ ] { 27580 , 27590 , 188500 , 188510 , 188520 , 188530 , 188540 , 188550 , 189510 } ) ) ;
public static ArrayList < Integer > vorg_ma_uuids = new ArrayList < > ( Arrays . asList ( new Integer [ ] { 27570 , 188900 , 188910 , 188920 , 188930 , 188940 , 188950 , 189500 } ) ) ;
public static ArrayList < Integer > vorg_la_uuids = new ArrayList < > ( Arrays . asList ( new Integer [ ] { 27550 , 27560 , 189100 , 189110 , 189120 , 189130 , 189140 , 189150 } ) ) ;
public static ArrayList < Integer > vorg_cloth_uuids = new ArrayList < > ( Arrays . asList ( new Integer [ ] { 27600 , 188700 , 188720 , 189550 , 189560 } ) ) ;
// Drop Rates
// Drop Rates
public static float NORMAL_DROP_RATE ;
public static float NORMAL_DROP_RATE ;
@ -68,16 +75,13 @@ public enum LootManager {
public static void GenerateMobLoot ( Mob mob ) {
public static void GenerateMobLoot ( Mob mob ) {
//determine if mob is in hotzone
boolean inHotzone = ZoneManager . inHotZone ( mob . getLoc ( ) ) ;
//iterate the booty sets
//iterate the booty sets
if ( mob . getMobBase ( ) . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . getMobBase ( ) . bootySet ) = = true )
if ( mob . getMobBase ( ) . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . getMobBase ( ) . bootySet ) = = true )
RunBootySet ( _bootySetMap . get ( mob . getMobBase ( ) . bootySet ) , mob , inHotzone ) ;
RunBootySet ( _bootySetMap . get ( mob . getMobBase ( ) . bootySet ) , mob ) ;
if ( mob . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . bootySet ) = = true )
if ( mob . bootySet ! = 0 & & _bootySetMap . containsKey ( mob . bootySet ) = = true )
RunBootySet ( _bootySetMap . get ( mob . bootySet ) , mob , inHotzone ) ;
RunBootySet ( _bootySetMap . get ( mob . bootySet ) , 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 ( ) ) {
@ -85,7 +89,7 @@ public enum LootManager {
ItemBase ib = it . getItemBase ( ) ;
ItemBase ib = it . getItemBase ( ) ;
if ( ib = = null )
if ( ib = = null )
break ;
break ;
if ( ib . isDiscRune ( ) | | ib . getName ( ) . toLowerCase ( ) . contains ( "of the gods" ) ) {
if ( ib . getName ( ) . toLowerCase ( ) . contains ( "of the gods" ) ) {
ChatSystemMsg chatMsg = new ChatSystemMsg ( null , mob . getName ( ) + " in " + mob . getParentZone ( ) . getName ( ) + " has found the " + ib . getName ( ) + ". Are you tough enough to take it?" ) ;
ChatSystemMsg chatMsg = new ChatSystemMsg ( null , mob . getName ( ) + " in " + mob . getParentZone ( ) . getName ( ) + " has found the " + ib . getName ( ) + ". Are you tough enough to take it?" ) ;
chatMsg . setMessageType ( 10 ) ;
chatMsg . setMessageType ( 10 ) ;
chatMsg . setChannel ( Enum . ChatChannelType . SYSTEM . getChannelID ( ) ) ;
chatMsg . setChannel ( Enum . ChatChannelType . SYSTEM . getChannelID ( ) ) ;
@ -95,54 +99,105 @@ public enum LootManager {
}
}
private static void RunBootySet ( ArrayList < BootySetEntry > entries , Mob mob , boolean inHotzone ) {
private static void RunBootySet ( ArrayList < BootySetEntry > entries , Mob mob ) {
mob . runeCounter + + ;
boolean hotzoneWasRan = false ;
mob . contractCounter + + ;
float dropRate = 1 . 0f ;
float dropRate = NORMAL_DROP_RATE ;
//roll the geenric world drop table
if ( mob . parentZone . getSafeZone ( ) = = 0 ) {
GenerateLootDrop ( mob , 1300 ) ;
if ( ThreadLocalRandom . current ( ) . nextInt ( 1 , 10000 ) = = 5000 ) {
MobLoot extraLoot = rollForGlass ( mob ) ;
if ( extraLoot ! = null ) {
mob . getCharItemManager ( ) . addItemToInventory ( extraLoot ) ;
}
}
}
// 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" :
GenerateGoldDrop ( mob , bse , inHotzone ) ;
GenerateGoldDrop ( mob , bse ) ;
break ;
break ;
case "LOOT" :
case "LOOT" :
if ( mob . getSafeZone ( ) = = false )
dropRate = LootManager . NORMAL_DROP_RATE ;
if ( inHotzone = = true )
dropRate = LootManager . HOTZONE_DROP_RATE ;
if ( ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) < ( bse . dropChance * dropRate ) )
if ( ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) < ( bse . dropChance * dropRate ) )
GenerateLootDrop ( mob , bse . genTable , false ) ; //generate normal loot drop
GenerateLootDrop ( mob , bse . genTable ) ; //generate normal loot drop
if ( ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 ) = = 50 ) {
// Generate hotzone loot if in hotzone
MobLoot extraLoot = rollForContract ( bse . genTable , mob ) ;
// Only one bite at the hotzone apple per bootyset.
if ( extraLoot ! = null ) {
mob . getCharItemManager ( ) . addItemToInventory ( extraLoot ) ;
if ( inHotzone = = true & & hotzoneWasRan = = false )
}
if ( _genTables . containsKey ( bse . genTable + 1 ) & & ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) < ( bse . dropChance * dropRate ) ) {
}
GenerateLootDrop ( mob , bse . genTable + 1 , true ) ; //generate loot drop from hotzone table
if ( ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 ) = = 50 ) {
hotzoneWasRan = true ;
MobLoot extraLoot = rollForRune ( bse . genTable , mob ) ;
if ( extraLoot ! = null ) {
mob . getCharItemManager ( ) . addItemToInventory ( extraLoot ) ;
}
}
}
break ;
break ;
case "ITEM" :
case "ITEM" :
GenerateInventoryDrop ( mob , bse ) ;
GenerateInventoryDrop ( mob , bse ) ;
break ;
break ;
}
}
}
}
MobLoot specialDrop = null ;
switch ( mob . getObjectUUID ( ) ) {
case 22595 : //elf 1
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252134 ) , true ) ;
mob . setFirstName ( "Melandrach The Blood-Mage" ) ;
break ;
case 22432 : //elf 2
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252135 ) , true ) ;
mob . setFirstName ( "Kyrtaar The Blood-Mage" ) ;
break ;
case 22537 : //elf 3
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252136 ) , true ) ;
mob . setFirstName ( "Vamir The Blood-Mage" ) ;
break ;
case 16387 : //human 4 DONE
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252129 ) , true ) ;
mob . setFirstName ( "Alatar The Blood-Mage" ) ;
break ;
case 32724 : // human 5 GOOD
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252130 ) , true ) ;
mob . setFirstName ( "Elphaba The Blood-Mage" ) ;
break ;
case 23379 : //human 1 GOOD
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252131 ) , true ) ;
mob . setFirstName ( "Bavmorda The Blood-Mage" ) ;
break ;
case 10826 : //human 2 REDO
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252132 ) , true ) ;
mob . setFirstName ( "Draco The Blood-Mage" ) ;
break ;
case 15929 : //human 3 GOOD
specialDrop = new MobLoot ( mob , ItemBase . getItemBase ( 252133 ) , true ) ;
mob . setFirstName ( "Atlantes The Blood-Mage" ) ;
break ;
}
if ( specialDrop ! = null ) {
mob . setLevel ( ( short ) 65 ) ;
mob . setSpawnTime ( 10800 ) ;
mob . healthMax = ( 7500 ) ;
mob . setHealth ( 7500 ) ;
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" ) ) ;
}
}
}
public static MobLoot getGenTableItem ( int genTableID , AbstractCharacter mob , Boolean inHotzone ) {
public static MobLoot getGenTableItem ( int genTableID , AbstractCharacter mob ) {
if ( mob = = null | | _genTables . containsKey ( genTableID ) = = false )
if ( mob = = null | | _genTables . containsKey ( genTableID ) = = false )
return null ;
return null ;
MobLoot outItem ;
MobLoot outItem ;
int genRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
int genRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 94 + 1 ) ;
GenTableEntry selectedRow = GenTableEntry . rollTable ( genTableID , genRoll , 1 . 0f ) ;
GenTableEntry selectedRow = GenTableEntry . rollTable ( genTableID , genRoll , 1 . 0f ) ;
@ -160,7 +215,7 @@ public enum LootManager {
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 , inHotzone ) ;
itemTableRoll = TableRoll ( mob . level ) ;
}
}
ItemTableEntry tableRow = ItemTableEntry . rollTable ( itemTableId , itemTableRoll ) ;
ItemTableEntry tableRow = ItemTableEntry . rollTable ( itemTableId , itemTableRoll ) ;
if ( tableRow = = null )
if ( tableRow = = null )
@ -172,7 +227,10 @@ 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 ( ) ) {
int amount = ThreadLocalRandom . current ( ) . nextInt ( tableRow . minSpawn , tableRow . maxSpawn + 1 ) ;
int chance = ThreadLocalRandom . current ( ) . nextInt ( 1 , 101 ) ;
if ( chance > 10 )
return null ;
int amount = ThreadLocalRandom . current ( ) . nextInt ( ( int ) ( tableRow . minSpawn * 0 . 5f ) , ( int ) ( ( tableRow . maxSpawn + 1 ) * 0 . 5f ) ) ;
return new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , amount , false ) ;
return new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , amount , false ) ;
}
}
@ -182,7 +240,7 @@ public enum LootManager {
if ( selectedRow . pModTable ! = 0 ) {
if ( selectedRow . pModTable ! = 0 ) {
try {
try {
outItem = GeneratePrefix ( mob , outItem , genTableID , genRoll , inHotzone ) ;
outItem = GeneratePrefix ( mob , outItem , genTableID , genRoll ) ;
outItem . setIsID ( false ) ;
outItem . setIsID ( false ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
Logger . error ( "Failed to GeneratePrefix for item: " + outItem . getName ( ) ) ;
Logger . error ( "Failed to GeneratePrefix for item: " + outItem . getName ( ) ) ;
@ -190,7 +248,7 @@ public enum LootManager {
}
}
if ( selectedRow . sModTable ! = 0 ) {
if ( selectedRow . sModTable ! = 0 ) {
try {
try {
outItem = GenerateSuffix ( mob , outItem , genTableID , genRoll , inHotzone ) ;
outItem = GenerateSuffix ( mob , outItem , genTableID , genRoll ) ;
outItem . setIsID ( false ) ;
outItem . setIsID ( false ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
Logger . error ( "Failed to GenerateSuffix for item: " + outItem . getName ( ) ) ;
Logger . error ( "Failed to GenerateSuffix for item: " + outItem . getName ( ) ) ;
@ -199,7 +257,7 @@ public enum LootManager {
return outItem ;
return outItem ;
}
}
private static MobLoot GeneratePrefix ( AbstractCharacter mob , MobLoot inItem , int genTableID , int genRoll , Boolean inHotzone ) {
private static MobLoot GeneratePrefix ( AbstractCharacter mob , MobLoot inItem , int genTableID , int genRoll ) {
GenTableEntry selectedRow = GenTableEntry . rollTable ( genTableID , genRoll , 1 . 0f ) ;
GenTableEntry selectedRow = GenTableEntry . rollTable ( genTableID , genRoll , 1 . 0f ) ;
@ -216,7 +274,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 , inHotzone ) ;
prefixTableRoll = TableRoll ( mob . level ) ;
}
}
ModTableEntry prefixMod = ModTableEntry . rollTable ( prefixTable . modTableID , prefixTableRoll ) ;
ModTableEntry prefixMod = ModTableEntry . rollTable ( prefixTable . modTableID , prefixTableRoll ) ;
@ -231,7 +289,7 @@ public enum LootManager {
return inItem ;
return inItem ;
}
}
private static MobLoot GenerateSuffix ( AbstractCharacter mob , MobLoot inItem , int genTableID , int genRoll , Boolean inHotzone ) {
private static MobLoot GenerateSuffix ( AbstractCharacter mob , MobLoot inItem , int genTableID , int genRoll ) {
GenTableEntry selectedRow = GenTableEntry . rollTable ( genTableID , genRoll , 1 . 0f ) ;
GenTableEntry selectedRow = GenTableEntry . rollTable ( genTableID , genRoll , 1 . 0f ) ;
@ -248,7 +306,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 , inHotzone ) ;
suffixTableRoll = TableRoll ( mob . level ) ;
}
}
ModTableEntry suffixMod = ModTableEntry . rollTable ( suffixTable . modTableID , suffixTableRoll ) ;
ModTableEntry suffixMod = ModTableEntry . rollTable ( suffixTable . modTableID , suffixTableRoll ) ;
@ -263,7 +321,7 @@ public enum LootManager {
return inItem ;
return inItem ;
}
}
public static int TableRoll ( int mobLevel , Boolean inHotzone ) {
public static int TableRoll ( int mobLevel ) {
if ( mobLevel > 65 )
if ( mobLevel > 65 )
mobLevel = 65 ;
mobLevel = 65 ;
@ -278,15 +336,12 @@ public enum LootManager {
if ( min < 70 )
if ( min < 70 )
min = 70 ;
min = 70 ;
if ( inHotzone )
min + = mobLevel ;
int roll = ThreadLocalRandom . current ( ) . nextInt ( min , max + 1 ) ;
int roll = ThreadLocalRandom . current ( ) . nextInt ( min , max + 1 ) ;
return roll ;
return roll ;
}
}
public static void GenerateGoldDrop ( Mob mob , BootySetEntry bse , Boolean inHotzone ) {
public static void GenerateGoldDrop ( Mob mob , BootySetEntry bse ) {
int chanceRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
int chanceRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
@ -297,14 +352,9 @@ public enum LootManager {
//determine and add gold to mob inventory
//determine and add gold to mob inventory
int high = bse . highGold ;
int high = ( int ) ( bse . highGold * NORMAL_GOLD_RATE ) ;
int low = bse . lowGold ;
int low = ( int ) ( bse . lowGold * NORMAL_GOLD_RATE ) ;
int gold = ThreadLocalRandom . current ( ) . nextInt ( low , high + 1 ) ;
int gold = ThreadLocalRandom . current ( ) . nextInt ( low , high ) ;
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 ) ;
@ -313,23 +363,31 @@ public enum LootManager {
}
}
public static void GenerateLootDrop ( Mob mob , int tableID , Boolean inHotzone ) {
public static void GenerateLootDrop ( Mob mob , int tableID ) {
try {
try {
if ( mob . parentZone . getSafeZone ( ) = = 1 ) {
return ;
}
MobLoot toAdd = getGenTableItem ( tableID , mob ) ;
if ( toAdd . getItemBase ( ) . getType ( ) . equals ( Enum . ItemType . CONTRACT ) | | toAdd . getItemBase ( ) . getType ( ) . equals ( Enum . ItemType . RUNE ) )
return ; //block all contracts and runes that drop outside the confines of the new system
MobLoot toAdd = getGenTableItem ( tableID , mob , inHotzone ) ;
if ( toAdd ! = null ) {
toAdd . setIsID ( true ) ;
if ( toAdd ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
mob . getCharItemManager ( ) . addItemToInventory ( toAdd ) ;
}
} catch ( Exception e ) {
} catch ( Exception e ) {
//TODO chase down loot generation error, affects roughly 2% of drops
//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 . parentZone . getSafeZone ( ) = = 1 ) {
return ;
}
//do equipment here
//do equipment here
int dropCount = 0 ;
int dropCount = 0 ;
if ( mob . getEquip ( ) ! = null )
if ( mob . getEquip ( ) ! = null )
@ -340,25 +398,64 @@ public enum LootManager {
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 ;
if ( equipmentRoll > dropChance )
if ( equipmentRoll > dropChance )
continue ;
continue ;
ItemBase genericIB = me . getItemBase ( ) ;
MobLoot ml = new MobLoot ( mob , me . getItemBase ( ) , false ) ;
if ( genericIB . isVorg ( ) ) {
if ( genericIB . isClothArmor ( ) ) {
if ( ml ! = null & & dropCount < 1 ) {
//get random cloth piece
genericIB = getRandomVorgCloth ( ) ; //ItemBase.getItemBase(vorg_cloth_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_cloth_uuids.size() - 1)));
} else if ( genericIB . isHeavyArmor ( ) ) {
//get random heavy armor piece
genericIB = getRandomVorgHA ( ) ; //ItemBase.getItemBase(vorg_ha_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ha_uuids.size() - 1)));
} else if ( genericIB . isMediumArmor ( ) ) {
//get random medium armor piece
genericIB = getRandomVorgMA ( ) ; //ItemBase.getItemBase(vorg_ma_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ma_uuids.size() - 1)));
} else if ( genericIB . isLightArmor ( ) ) {
//get random light armor piece
genericIB = getRandomVorgLA ( ) ; //ItemBase.getItemBase(vorg_la_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_la_uuids.size() - 1)));
}
mob . spawnTime = ThreadLocalRandom . current ( ) . nextInt ( 300 , 2700 ) ;
}
MobLoot ml = new MobLoot ( mob , genericIB , false ) ;
if ( ml ! = null & & dropCount < 1 & & genericIB . isVorg ( ) = = false ) {
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 ;
dropCount = 1 ;
//break; // Exit on first successful roll.
//break; // Exit on first successful roll.
}
}
if ( ml ! = null & & genericIB . isVorg ( ) & & mob . getMobBaseID ( ) ! = 14062 ) {
ml . setIsID ( true ) ;
ml . setDurabilityCurrent ( ml . getDurabilityMax ( ) ) ;
mob . getCharItemManager ( ) . addItemToInventory ( ml ) ;
}
}
}
}
}
public static void GenerateInventoryDrop ( Mob mob , BootySetEntry bse ) {
public static void GenerateInventoryDrop ( Mob mob , BootySetEntry bse ) {
int chanceRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
if ( ItemBase . getItemBase ( bse . itemBase ) . isDiscRune ( ) ) {
if ( ! Mob . disciplineDroppers . contains ( mob ) )
Mob . disciplineDroppers . add ( mob ) ;
mob . setResists ( new Resists ( "Dropper" ) ) ;
ChatSystemMsg chatMsg = new ChatSystemMsg ( null , mob . getName ( ) + " in " + mob . getParentZone ( ) . getName ( ) + " has found the " + ItemBase . getItemBase ( bse . itemBase ) . getName ( ) + ". Are you tough enough to take it?" ) ;
chatMsg . setMessageType ( 10 ) ;
chatMsg . setChannel ( Enum . ChatChannelType . SYSTEM . getChannelID ( ) ) ;
DispatchMessage . dispatchMsgToAll ( chatMsg ) ;
}
//if((bse.itemBase == 3040 || bse.itemBase == 3021) && mob.level < 80){
// chance = 100;
//}
if ( mob . parentZone . getSafeZone ( ) = = 1 ) {
return ;
}
int chanceRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 99 ) ;
//early exit, failed to hit minimum chance roll
//early exit, failed to hit minimum chance roll
@ -454,4 +551,164 @@ public enum LootManager {
itemMan . addItemToInventory ( playerWinnings ) ;
itemMan . addItemToInventory ( playerWinnings ) ;
itemMan . updateInventory ( ) ;
itemMan . updateInventory ( ) ;
}
}
public static MobLoot rollForContract ( int table , Mob mob ) {
int roll = 99 ;
if ( table = = 1900 | | table = = 1500 )
roll = 73 ;
GenTableEntry selectedRow = GenTableEntry . rollTable ( table , roll , 1 . 0f ) ;
if ( selectedRow = = null )
return null ;
int itemTableId = selectedRow . itemTableID ;
if ( _itemTables . containsKey ( itemTableId ) = = false )
return null ;
ItemTableEntry tableRow = ItemTableEntry . rollTable ( itemTableId , ThreadLocalRandom . current ( ) . nextInt ( 75 , 321 ) ) ;
if ( tableRow = = null )
return null ;
int itemUUID = tableRow . cacheID ;
if ( itemUUID = = 0 )
return null ;
MobLoot outItem = new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , false ) ;
if ( outItem ! = null ) {
mob . contractCounter = ThreadLocalRandom . current ( ) . nextInt ( 200 ) ;
ChatSystemMsg chatMsg = new ChatSystemMsg ( null , mob . getName ( ) + " looks like he found something special" ) ;
chatMsg . setMessageType ( 10 ) ;
chatMsg . setChannel ( Enum . ChatChannelType . SYSTEM . getChannelID ( ) ) ;
DispatchMessage . dispatchMsgToInterestArea ( mob , chatMsg , Enum . DispatchChannel . PRIMARY , MBServerStatics . CHARACTER_LOAD_RANGE , false , false ) ;
return outItem ;
}
return null ;
}
public static MobLoot rollForRune ( int table , Mob mob ) {
int roll = 97 ;
if ( table = = 1900 | | table = = 1500 ) {
roll = 77 ;
}
GenTableEntry selectedRow = GenTableEntry . rollTable ( table , roll , 1 . 0f ) ;
if ( selectedRow = = null )
return null ;
int itemTableId = selectedRow . itemTableID ;
if ( _itemTables . containsKey ( itemTableId ) = = false )
return null ;
ItemTableEntry tableRow = ItemTableEntry . rollTable ( itemTableId , ThreadLocalRandom . current ( ) . nextInt ( 75 , 321 ) ) ;
if ( tableRow = = null )
return null ;
int itemUUID = tableRow . cacheID ;
if ( itemUUID = = 0 )
return null ;
MobLoot outItem = new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , false ) ;
if ( outItem ! = null ) {
mob . runeCounter = ThreadLocalRandom . current ( ) . nextInt ( 200 ) ;
ChatSystemMsg chatMsg = new ChatSystemMsg ( null , mob . getName ( ) + " looks like he found something special" ) ;
chatMsg . setMessageType ( 10 ) ;
chatMsg . setChannel ( Enum . ChatChannelType . SYSTEM . getChannelID ( ) ) ;
DispatchMessage . dispatchMsgToInterestArea ( mob , chatMsg , Enum . DispatchChannel . PRIMARY , MBServerStatics . CHARACTER_LOAD_RANGE , false , false ) ;
return outItem ;
}
return null ;
}
public static MobLoot rollForGlass ( Mob mob ) {
ItemTableEntry tableRow = ItemTableEntry . rollTable ( 126 , ThreadLocalRandom . current ( ) . nextInt ( 220 , 321 ) ) ;
if ( tableRow = = null )
return null ;
int itemUUID = tableRow . cacheID ;
if ( itemUUID = = 0 )
return null ;
MobLoot outItem = new MobLoot ( mob , ItemBase . getItemBase ( itemUUID ) , false ) ;
if ( outItem ! = null )
return outItem ;
return null ;
}
public static ItemBase getRandomVorgCloth ( ) {
int random = ThreadLocalRandom . current ( ) . nextInt ( 100 ) ;
if ( random < 20 )
return ItemBase . getItemBase ( 27600 ) ;
if ( random > 20 & & random < 40 )
return ItemBase . getItemBase ( 188700 ) ;
if ( random > 40 & & random < 60 )
return ItemBase . getItemBase ( 188720 ) ;
if ( random > 60 & & random < 80 )
return ItemBase . getItemBase ( 189550 ) ;
if ( random > 80 )
return ItemBase . getItemBase ( 189560 ) ;
return null ;
}
public static ItemBase getRandomVorgLA ( ) {
int random = ThreadLocalRandom . current ( ) . nextInt ( 160 ) ;
if ( random < 20 )
return ItemBase . getItemBase ( 27550 ) ;
if ( random > 20 & & random < 40 )
return ItemBase . getItemBase ( 27560 ) ;
if ( random > 40 & & random < 60 )
return ItemBase . getItemBase ( 189100 ) ;
if ( random > 60 & & random < 80 )
return ItemBase . getItemBase ( 189110 ) ;
if ( random > 80 & & random < 100 )
return ItemBase . getItemBase ( 189120 ) ;
if ( random > 100 & & random < 120 )
return ItemBase . getItemBase ( 189130 ) ;
if ( random > 120 & & random < 140 )
return ItemBase . getItemBase ( 189140 ) ;
if ( random > 140 )
return ItemBase . getItemBase ( 189150 ) ;
return null ;
}
public static ItemBase getRandomVorgMA ( ) {
int random = ThreadLocalRandom . current ( ) . nextInt ( 160 ) ;
if ( random < 20 )
return ItemBase . getItemBase ( 27570 ) ;
if ( random > 20 & & random < 40 )
return ItemBase . getItemBase ( 188900 ) ;
if ( random > 40 & & random < 60 )
return ItemBase . getItemBase ( 188910 ) ;
if ( random > 60 & & random < 80 )
return ItemBase . getItemBase ( 188920 ) ;
if ( random > 80 & & random < 100 )
return ItemBase . getItemBase ( 188930 ) ;
if ( random > 100 & & random < 120 )
return ItemBase . getItemBase ( 188940 ) ;
if ( random > 120 & & random < 140 )
return ItemBase . getItemBase ( 188950 ) ;
if ( random > 140 )
return ItemBase . getItemBase ( 189500 ) ;
return null ;
}
public static ItemBase getRandomVorgHA ( ) {
int random = ThreadLocalRandom . current ( ) . nextInt ( 180 ) ;
if ( random < 20 )
return ItemBase . getItemBase ( 27580 ) ;
if ( random > 20 & & random < 40 )
return ItemBase . getItemBase ( 27590 ) ;
if ( random > 40 & & random < 60 )
return ItemBase . getItemBase ( 188500 ) ;
if ( random > 60 & & random < 80 )
return ItemBase . getItemBase ( 188510 ) ;
if ( random > 80 & & random < 100 )
return ItemBase . getItemBase ( 188520 ) ;
if ( random > 100 & & random < 120 )
return ItemBase . getItemBase ( 188530 ) ;
if ( random > 120 & & random < 140 )
return ItemBase . getItemBase ( 188540 ) ;
if ( random > 140 & & random < 160 )
return ItemBase . getItemBase ( 188550 ) ;
if ( random > 160 )
return ItemBase . getItemBase ( 189510 ) ;
return null ;
}
}
}