@ -17,6 +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.concurrent.ThreadLocalRandom ;
import java.util.concurrent.ThreadLocalRandom ;
@ -34,6 +35,13 @@ 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 } ) ) ;
public static ArrayList < Integer > racial_stewards = new ArrayList < > ( Arrays . asList ( new Integer [ ] { 974 , 1064 , 1172 , 1267 , 1368 , 1468 , 1520 , 1528 , 1553 , 1578 , 1617 , 1667 , 1712 } ) ) ;
public static ArrayList < Integer > undead_guards = new ArrayList < > ( Arrays . asList ( new Integer [ ] { 980100 , 980101 , 980102 , 980110 , 980111 } ) ) ;
// Drop Rates
// Drop Rates
public static float NORMAL_DROP_RATE ;
public static float NORMAL_DROP_RATE ;
@ -68,6 +76,30 @@ public enum LootManager {
public static void GenerateMobLoot ( Mob mob ) {
public static void GenerateMobLoot ( Mob mob ) {
if ( mob = = null )
return ;
if ( mob . level = = 85 ) {
MobLoot mithril = new MobLoot ( mob , ItemBase . getItemBase ( 1580021 ) , 1 , true ) ;
mob . getCharItemManager ( ) . addItemToInventory ( mithril ) ;
try {
int stewardRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , racial_stewards . size ( ) + 1 ) ;
MobLoot steward = new MobLoot ( mob , ItemBase . getItemBase ( ( Integer ) racial_stewards . toArray ( ) [ stewardRoll ] ) , true ) ;
mob . getCharItemManager ( ) . addItemToInventory ( steward ) ;
} catch ( Exception ex ) {
}
try {
int guardRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , undead_guards . size ( ) + 1 ) ;
MobLoot guard = new MobLoot ( mob , ItemBase . getItemBase ( ( Integer ) undead_guards . toArray ( ) [ guardRoll ] ) , true ) ;
mob . getCharItemManager ( ) . addItemToInventory ( guard ) ;
} catch ( Exception ex ) {
}
return ;
}
//determine if mob is in hotzone
//determine if mob is in hotzone
boolean inHotzone = ZoneManager . inHotZone ( mob . getLoc ( ) ) ;
boolean inHotzone = ZoneManager . inHotZone ( mob . getLoc ( ) ) ;
@ -85,12 +117,18 @@ 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 ( ) ) ;
DispatchMessage . dispatchMsgToAll ( chatMsg ) ;
DispatchMessage . dispatchMsgToAll ( chatMsg ) ;
}
}
if ( ib . isDiscRune ( ) ) {
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 . setChannel ( Enum . ChatChannelType . SYSTEM . getChannelID ( ) ) ;
DispatchMessage . dispatchMsgToAll ( chatMsg ) ;
}
}
}
}
}
@ -129,7 +167,7 @@ public enum LootManager {
break ;
break ;
case "ITEM" :
case "ITEM" :
GenerateInventoryDrop ( mob , bse ) ;
GenerateInventoryDrop ( mob , bse , inHotzone ) ;
break ;
break ;
}
}
}
}
@ -171,7 +209,7 @@ public enum LootManager {
if ( itemUUID = = 0 )
if ( itemUUID = = 0 )
return null ;
return null ;
if ( ItemBase . getItemBase ( itemUUID ) . getType ( ) . ordinal ( ) = = Enum . ItemType . RESOURCE . ordinal ( ) ) {
if ( ItemBase . getItemBase ( itemUUID ) . getType ( ) . ordinal ( ) = = Enum . ItemType . RESOURCE . ordinal ( ) & & itemUUID ! = 1580021 ) {
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 ) ;
}
}
@ -196,6 +234,9 @@ public enum LootManager {
Logger . error ( "Failed to GenerateSuffix for item: " + outItem . getName ( ) ) ;
Logger . error ( "Failed to GenerateSuffix for item: " + outItem . getName ( ) ) ;
}
}
}
}
if ( outItem . getName ( ) . toLowerCase ( ) . contains ( "of the gods" ) & & inHotzone = = false )
return null ;
return outItem ;
return outItem ;
}
}
@ -343,8 +384,24 @@ public enum LootManager {
if ( equipmentRoll > dropChance )
if ( equipmentRoll > dropChance )
continue ;
continue ;
ItemBase genericIB = me . getItemBase ( ) ;
MobLoot ml = new MobLoot ( mob , me . getItemBase ( ) , false ) ;
//if(genericIB.isVorg()){
if ( vorg_cloth_uuids . contains ( genericIB . getUUID ( ) ) ) {
//get random cloth piece
genericIB = ItemBase . getItemBase ( vorg_cloth_uuids . get ( ThreadLocalRandom . current ( ) . nextInt ( 0 , vorg_cloth_uuids . size ( ) - 1 ) ) ) ;
} else if ( vorg_ha_uuids . contains ( genericIB . getUUID ( ) ) ) {
//get random heavy armor piece
genericIB = ItemBase . getItemBase ( vorg_ha_uuids . get ( ThreadLocalRandom . current ( ) . nextInt ( 0 , vorg_ha_uuids . size ( ) - 1 ) ) ) ;
} else if ( vorg_ma_uuids . contains ( genericIB . getUUID ( ) ) ) {
//get random medium armor piece
genericIB = ItemBase . getItemBase ( vorg_ma_uuids . get ( ThreadLocalRandom . current ( ) . nextInt ( 0 , vorg_ma_uuids . size ( ) - 1 ) ) ) ;
} else if ( vorg_la_uuids . contains ( genericIB . getUUID ( ) ) ) {
//get random light armor piece
genericIB = 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 ) {
if ( ml ! = null & & dropCount < 1 ) {
ml . setIsID ( true ) ;
ml . setIsID ( true ) ;
@ -356,7 +413,7 @@ public enum LootManager {
}
}
}
}
public static void GenerateInventoryDrop ( Mob mob , BootySetEntry bse ) {
public static void GenerateInventoryDrop ( Mob mob , BootySetEntry bse , boolean inHotzone ) {
int chanceRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
int chanceRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 100 + 1 ) ;
@ -365,12 +422,23 @@ public enum LootManager {
if ( chanceRoll > bse . dropChance )
if ( chanceRoll > bse . dropChance )
return ;
return ;
ItemBase ib = ItemBase . getItemBase ( bse . itemBase ) ;
if ( ib = = null )
return ;
if ( ib . isDiscRune ( ) ) {
ItemBase newDisc = ItemBase . getItemBase ( ThreadLocalRandom . current ( ) . nextInt ( 3001 , 3049 + 1 ) ) ;
if ( newDisc ! = null ) {
//mob.getInventory().add(new MobLoot(mob, newDisc, true));
mob . getCharItemManager ( ) . addItemToInventory ( new MobLoot ( mob , newDisc , true ) ) ;
return ;
}
}
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 ) ;
}
}
public static void peddleFate ( PlayerCharacter playerCharacter , Item gift ) {
public static void peddleFate ( PlayerCharacter playerCharacter , Item gift ) {
//get table ID for the itembase ID
//get table ID for the itembase ID