@ -3,12 +3,12 @@ package engine.gameManager;
@@ -3,12 +3,12 @@ package engine.gameManager;
import engine.mobileAI.MobAI ;
import engine.mobileAI.utilities.CombatUtilities ;
import engine.mobileAI.utilities.MovementUtilities ;
import engine.objects.Mob ;
import engine.objects.Resists ;
import engine.objects.Zone ;
import engine.objects.* ;
import engine.server.MBServerStatics ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.concurrent.ThreadLocalRandom ;
public class HellgateManager {
public static ArrayList < Mob > hellgate_mobs ;
@ -23,6 +23,29 @@ public class HellgateManager {
@@ -23,6 +23,29 @@ public class HellgateManager {
public static final int hell_portal_4_zone_id = 998 ;
public static boolean initialized = false ;
public static final ArrayList < Integer > static_rune_ids_low = new ArrayList < > ( Arrays . asList (
250001 , 250002 , 250003 , 250004 , 250005 , 250006 , 250010 , 250011 ,
250012 , 250013 , 250014 , 250015 , 250019 , 250020 , 250021 , 250022 ,
250023 , 250024 , 250028 , 250029 , 250030 , 250031 , 250032 , 250033 ,
250037 , 250038 , 250039 , 250040 , 250041 , 250042
) ) ;
public static final ArrayList < Integer > static_rune_ids_mid = new ArrayList < > ( Arrays . asList (
250006 , 250007 , 250008 ,
250015 , 250016 , 250017 ,
250024 , 250025 , 250026 ,
250033 , 250034 , 250035 ,
250042 , 250043 , 250044
) ) ;
public static final ArrayList < Integer > static_rune_ids_high = new ArrayList < > ( Arrays . asList (
250007 , 250008 ,
250016 , 250017 ,
250025 , 250026 ,
250034 , 250035 ,
250043 , 250044
) ) ;
public static void confiureHellgate ( ) {
compile_mob_list ( ) ;
}
@ -67,7 +90,7 @@ public class HellgateManager {
@@ -67,7 +90,7 @@ public class HellgateManager {
switch ( mob . getMobBaseID ( ) ) {
case 14163 : // basic saetor warrior
mob . getCharItemManager ( ) . clearInventory ( ) ;
LootManager . GenerateStrongholdLoot ( mob , false , false ) ;
SpecialLootHandler ( mob , false , false ) ;
mob . setResists ( new Resists ( "Elite" ) ) ;
mob . healthMax = 8500 ;
mob . setHealth ( mob . healthMax ) ;
@ -75,7 +98,7 @@ public class HellgateManager {
@@ -75,7 +98,7 @@ public class HellgateManager {
break ;
case 12770 : // minotaur mini boss
mob . getCharItemManager ( ) . clearInventory ( ) ;
LootManager . GenerateStrongholdLoot ( mob , true , false ) ;
SpecialLootHandler ( mob , true , false ) ;
mob . setResists ( new Resists ( "Elite" ) ) ;
mob . healthMax = 12500 ;
mob . setHealth ( mob . healthMax ) ;
@ -83,7 +106,7 @@ public class HellgateManager {
@@ -83,7 +106,7 @@ public class HellgateManager {
break ;
case 14180 : // mordoth, son of morlock
mob . getCharItemManager ( ) . clearInventory ( ) ;
LootManager . GenerateStrongholdLoot ( mob , false , true ) ;
SpecialLootHandler ( mob , false , true ) ;
mob . setResists ( new Resists ( "Elite" ) ) ;
mob . healthMax = mob . mobBase . getHealthMax ( ) ;
mob . setHealth ( mob . healthMax ) ;
@ -103,6 +126,7 @@ public class HellgateManager {
@@ -103,6 +126,7 @@ public class HellgateManager {
mob . respawn ( ) ;
}
mob . setHealth ( mob . healthMax ) ;
SpecialLootHandler ( mob , false , false ) ;
}
for ( Mob mob : hellgate_mini_bosses ) {
if ( ! mob . isAlive ( ) ) {
@ -112,6 +136,7 @@ public class HellgateManager {
@@ -112,6 +136,7 @@ public class HellgateManager {
mob . respawn ( ) ;
}
mob . setHealth ( mob . healthMax ) ;
SpecialLootHandler ( mob , true , false ) ;
}
if ( ! hellgate_boss . isAlive ( ) ) {
if ( ! hellgate_boss . despawned ) {
@ -120,6 +145,7 @@ public class HellgateManager {
@@ -120,6 +145,7 @@ public class HellgateManager {
hellgate_boss . respawn ( ) ;
}
hellgate_boss . setHealth ( hellgate_boss . healthMax ) ;
SpecialLootHandler ( hellgate_boss , false , true ) ;
}
public static void SpecialMobAIHandler ( Mob mob ) {
@ -139,9 +165,125 @@ public class HellgateManager {
@@ -139,9 +165,125 @@ public class HellgateManager {
if ( mob . combatTarget ! = null )
MobAI . CheckForAttack ( mob ) ;
if ( mob . combatTarget = = null & & mob . loc . distanceSquared ( mob . bindLoc ) > 100 )
if ( mob . combatTarget = = null & & mob . loc . distanceSquared ( mob . bindLoc ) > 1024 ) { //32 units
mob . teleport ( mob . bindLoc ) ;
mob . setCombatTarget ( null ) ;
MovementUtilities . aiMove ( mob , mob . bindLoc , true ) ;
}
}
public static void SpecialLootHandler ( Mob mob , Boolean commander , Boolean epic ) {
mob . getCharItemManager ( ) . clearInventory ( ) ;
int contractRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 101 ) ;
if ( contractRoll < = 25 ) {
//generate random contract
}
int runeRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 101 ) ;
ItemBase runeBase = null ;
int roll ;
int itemId ;
if ( runeRoll < = 60 & & ! commander & & ! epic ) {
//generate random rune (standard 5-30)
roll = ThreadLocalRandom . current ( ) . nextInt ( static_rune_ids_low . size ( ) + 1 ) ;
itemId = static_rune_ids_low . get ( 0 ) ;
try {
itemId = static_rune_ids_low . get ( roll ) ;
} catch ( Exception e ) {
}
runeBase = ItemBase . getItemBase ( itemId ) ;
if ( runeBase ! = null ) {
MobLoot rune = new MobLoot ( mob , runeBase , true ) ;
if ( rune ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( rune ) ;
}
}
if ( runeRoll < = 50 & & commander ) {
//generate random rune (30-40)
roll = ThreadLocalRandom . current ( ) . nextInt ( static_rune_ids_mid . size ( ) + 1 ) ;
itemId = static_rune_ids_mid . get ( 0 ) ;
try {
itemId = static_rune_ids_mid . get ( roll ) ;
} catch ( Exception e ) {
}
runeBase = ItemBase . getItemBase ( itemId ) ;
if ( runeBase ! = null ) {
MobLoot rune = new MobLoot ( mob , runeBase , true ) ;
if ( rune ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( rune ) ;
}
}
if ( runeRoll < = 80 & & epic ) {
//generate random rune (35-40)
roll = ThreadLocalRandom . current ( ) . nextInt ( static_rune_ids_high . size ( ) + 1 ) ;
itemId = static_rune_ids_high . get ( 0 ) ;
try {
itemId = static_rune_ids_high . get ( roll ) ;
} catch ( Exception e ) {
}
runeBase = ItemBase . getItemBase ( itemId ) ;
if ( runeBase ! = null ) {
MobLoot rune = new MobLoot ( mob , runeBase , true ) ;
if ( rune ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( rune ) ;
}
}
if ( commander | | epic ) {
//handle special case for racial guards
roll = ThreadLocalRandom . current ( ) . nextInt ( LootManager . racial_guard_uuids . size ( ) + 1 ) ;
itemId = LootManager . racial_guard_uuids . get ( 0 ) ;
try {
itemId = LootManager . racial_guard_uuids . get ( roll ) ;
} catch ( Exception e ) {
}
runeBase = ItemBase . getItemBase ( itemId ) ;
if ( runeBase ! = null ) {
MobLoot rune = new MobLoot ( mob , runeBase , true ) ;
if ( rune ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( rune ) ;
}
}
if ( epic ) {
//handle glass chance for epic
int glassRoll = ThreadLocalRandom . current ( ) . nextInt ( 1 , 101 ) ;
if ( glassRoll < 5 ) {
int glassID = LootManager . rollRandomItem ( 126 ) ;
ItemBase glassItem = ItemBase . getItemBase ( glassID ) ;
if ( glassItem ! = null ) {
MobLoot glass = new MobLoot ( mob , glassItem , true ) ;
if ( glass ! = null )
mob . getCharItemManager ( ) . addItemToInventory ( glass ) ;
}
}
}
//handle gold drops
int goldDrop ;
if ( ! commander & & ! epic ) {
goldDrop = ThreadLocalRandom . current ( ) . nextInt ( 25000 ) ;
mob . getCharItemManager ( ) . addGoldToInventory ( goldDrop , false ) ;
}
if ( commander ) {
goldDrop = ThreadLocalRandom . current ( ) . nextInt ( 100000 , 250000 ) ;
mob . getCharItemManager ( ) . addGoldToInventory ( goldDrop , false ) ;
}
if ( epic ) {
goldDrop = ThreadLocalRandom . current ( ) . nextInt ( 2500000 , 5000000 ) ;
mob . getCharItemManager ( ) . addGoldToInventory ( goldDrop , false ) ;
}
}
}