forked from MagicBane/Server
r8 hotzones loot manager
This commit is contained in:
@@ -2,14 +2,15 @@ package engine.gameManager;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
|
import engine.net.client.msg.HotzoneChangeMsg;
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
import engine.objects.Guild;
|
import engine.objects.*;
|
||||||
import engine.objects.Mob;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class HotzoneManager {
|
public class HotzoneManager {
|
||||||
|
|
||||||
@@ -55,7 +56,101 @@ public class HotzoneManager {
|
|||||||
created.runAfterLoad();
|
created.runAfterLoad();
|
||||||
WorldGrid.addObject(created,created.bindLoc.x,created.bindLoc.z);
|
WorldGrid.addObject(created,created.bindLoc.x,created.bindLoc.z);
|
||||||
created.teleport(created.bindLoc);
|
created.teleport(created.bindLoc);
|
||||||
|
created.BehaviourType = Enum.MobBehaviourType.Aggro;
|
||||||
hotzoneMob = created;
|
hotzoneMob = created;
|
||||||
HellgateManager.SpecialLootHandler(created,true,true);
|
HellgateManager.SpecialLootHandler(created,true,true);
|
||||||
|
|
||||||
|
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) {
|
||||||
|
HotzoneChangeMsg hcm = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||||
|
Dispatch dispatch = Dispatch.borrow(player, hcm);
|
||||||
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void GenerateHotzoneEpicLoot(Mob mob){
|
||||||
|
mob.getCharItemManager().clearInventory();
|
||||||
|
Random random = new Random();
|
||||||
|
int roll = random.nextInt(100);
|
||||||
|
int itemId;
|
||||||
|
ItemBase runeBase;
|
||||||
|
if(roll >= 90){
|
||||||
|
//35 or 40
|
||||||
|
roll = ThreadLocalRandom.current().nextInt(HellgateManager.static_rune_ids_high.size() + 1);
|
||||||
|
itemId = HellgateManager.static_rune_ids_high.get(0);
|
||||||
|
try {
|
||||||
|
itemId = HellgateManager.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);
|
||||||
|
}
|
||||||
|
}else if (roll >= 76 && roll <= 89){
|
||||||
|
//30,35 or 40
|
||||||
|
roll = ThreadLocalRandom.current().nextInt(HellgateManager.static_rune_ids_mid.size() + 1);
|
||||||
|
itemId = HellgateManager.static_rune_ids_mid.get(0);
|
||||||
|
try {
|
||||||
|
itemId = HellgateManager.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);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//5-30
|
||||||
|
roll = ThreadLocalRandom.current().nextInt(HellgateManager.static_rune_ids_low.size() + 1);
|
||||||
|
itemId = HellgateManager.static_rune_ids_low.get(0);
|
||||||
|
try {
|
||||||
|
itemId = HellgateManager.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(roll >= 95){
|
||||||
|
//glass
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//guard captain
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user