Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5bbc9eee0 | |||
| 4092f7f38f | |||
| a4eea2173d | |||
| d193a12554 | |||
| 96387aa4f4 | |||
| 785a5eb736 | |||
| dd4f4bffe9 | |||
| 2cdeaa4d66 | |||
| 0430fb3e42 | |||
| 5c34853293 | |||
| d991a4f2d8 | |||
| d87d3e2f41 | |||
| edf11f166f | |||
| e5c1dc7bcb | |||
| 9542034e32 | |||
| 3649c629b7 | |||
| 1c31070fc8 |
@@ -2307,8 +2307,8 @@ public class Enum {
|
||||
public enum CityBoundsType {
|
||||
|
||||
GRID(640),
|
||||
ZONE(675),
|
||||
PLACEMENT(677);
|
||||
ZONE(875),
|
||||
PLACEMENT(876);
|
||||
|
||||
public final float extents;
|
||||
|
||||
|
||||
@@ -19,19 +19,15 @@ import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.ClientConnectionManager;
|
||||
import engine.net.client.msg.LoadCharacterMsg;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
import engine.net.client.msg.login.CharSelectScreenMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.session.Session;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static engine.math.FastMath.sqr;
|
||||
@@ -217,9 +213,6 @@ public enum InterestManager implements Runnable {
|
||||
if (!playerCharacter.isEnteredWorld())
|
||||
continue;
|
||||
|
||||
if(playerCharacter.level < 10)
|
||||
playerCharacter.setLevel((short)10);
|
||||
|
||||
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
||||
|
||||
try {
|
||||
@@ -526,29 +519,12 @@ public enum InterestManager implements Runnable {
|
||||
if (origin == null)
|
||||
return;
|
||||
|
||||
int currentConnections = 0;
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(pc.isActive() && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(player.getClientConnection().machineID)){
|
||||
currentConnections++;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (currentConnections >= 3) {
|
||||
Session s = SessionManager.getSession(player);
|
||||
if (s.getAccount() != null) {
|
||||
CharSelectScreenMsg cssm = new CharSelectScreenMsg(s, false);
|
||||
s.getConn().sendMsg(cssm);
|
||||
}
|
||||
}
|
||||
}catch(Exception ex){
|
||||
|
||||
}
|
||||
// Update loaded upbjects lists
|
||||
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
|
||||
}
|
||||
|
||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||
|
||||
@@ -32,8 +32,6 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
String type = rs.getString("type");
|
||||
switch (type) {
|
||||
case "zone":
|
||||
if(rs.getInt("isPlayerCity") == 0 && Zone.skipZone(rs.getString("Name")))
|
||||
break;
|
||||
Zone zone = new Zone(rs);
|
||||
DbManager.addToCache(zone);
|
||||
list.add(zone);
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.*;
|
||||
|
||||
public class SetCampLevelCmd extends AbstractDevCmd {
|
||||
public SetCampLevelCmd() { super("setcamplevel"); }
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pcSender, String[] args, AbstractGameObject target) {
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
this.sendUsage(pcSender);
|
||||
}
|
||||
|
||||
int targetLevel = 0;
|
||||
if (args.length == 1) {
|
||||
try {
|
||||
targetLevel = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throwbackError(pcSender, "Argument MUST be integer. Received: " + args[0]);
|
||||
} catch (Exception e) {
|
||||
throwbackError(pcSender, "Unknown command parsing provided camp level: " + args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if ((target instanceof Mob))
|
||||
{
|
||||
// Get the camp that owns the targeted Mob
|
||||
Zone campZone = ((Mob) target).parentZone;
|
||||
|
||||
// Make sure that the zone we're targeting is valid for action
|
||||
if (campZone == null ||
|
||||
campZone.zoneMobSet.isEmpty() ||
|
||||
campZone.isPlayerCity()) {
|
||||
throwbackError(pcSender, "Current zone must own mobs, and NOT be a city.");
|
||||
return;
|
||||
}
|
||||
|
||||
campZone.setCampLvl(targetLevel);
|
||||
}
|
||||
else if (target instanceof PlayerCharacter)
|
||||
{
|
||||
PlayerCharacter pc = (PlayerCharacter)target;
|
||||
PowersManager.applyPower(pc, pc, pc.getLoc(), "CMP-001", targetLevel, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "Sets the level of the currently occupied camp to the desired level";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "'./setcamplevel levelNum'";
|
||||
}
|
||||
}
|
||||
@@ -520,10 +520,9 @@ public enum BuildingManager {
|
||||
if (building.getBlueprintUUID() == 0)
|
||||
return false;
|
||||
|
||||
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size()) {
|
||||
Logger.error("failed at addHireling with contract: " + contract.getContractID());
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
return false;
|
||||
}
|
||||
|
||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
|
||||
if (item.getChargesRemaining() > 0)
|
||||
|
||||
@@ -143,6 +143,7 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||
DevCmdManager.registerDevCmd(new SetCampLevelCmd());
|
||||
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ public enum DevCmdManager {
|
||||
//kill any commands not available to everyone on production server
|
||||
//only admin level can run dev commands on production
|
||||
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false && a.getUname().toLowerCase().equals("sinmara#1") == false) {
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -35,13 +35,6 @@ public enum LootManager {
|
||||
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = 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
|
||||
|
||||
public static float NORMAL_DROP_RATE;
|
||||
@@ -76,30 +69,6 @@ public enum LootManager {
|
||||
|
||||
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
|
||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
||||
|
||||
@@ -117,18 +86,12 @@ public enum LootManager {
|
||||
ItemBase ib = it.getItemBase();
|
||||
if(ib == null)
|
||||
break;
|
||||
if (ib.getName().toLowerCase().contains("of the gods")) {
|
||||
if (ib.isDiscRune() || 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?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -138,6 +101,16 @@ public enum LootManager {
|
||||
boolean hotzoneWasRan = false;
|
||||
float dropRate = 1.0f;
|
||||
|
||||
if (mob.getSafeZone() == false)
|
||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||
|
||||
if (inHotzone == true)
|
||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
||||
|
||||
// Adjust for camp scaling
|
||||
Zone camp = mob.getParentZone();
|
||||
dropRate = dropRate * ZoneLevel.getLootDropModifier(camp);
|
||||
|
||||
// Iterate all entries in this bootySet and process accordingly
|
||||
|
||||
for (BootySetEntry bse : entries) {
|
||||
@@ -147,12 +120,6 @@ public enum LootManager {
|
||||
break;
|
||||
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))
|
||||
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
|
||||
|
||||
@@ -167,7 +134,7 @@ public enum LootManager {
|
||||
|
||||
break;
|
||||
case "ITEM":
|
||||
GenerateInventoryDrop(mob, bse, inHotzone);
|
||||
GenerateInventoryDrop(mob, bse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -209,7 +176,7 @@ public enum LootManager {
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal() && itemUUID != 1580021) {
|
||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||
}
|
||||
@@ -234,9 +201,9 @@ public enum LootManager {
|
||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||
}
|
||||
}
|
||||
if(outItem.getName().toLowerCase().contains("of the gods") && inHotzone == false)
|
||||
return null;
|
||||
|
||||
// We don't want to bother with identifying gear
|
||||
outItem.setIsID(true);
|
||||
return outItem;
|
||||
}
|
||||
|
||||
@@ -347,6 +314,9 @@ public enum LootManager {
|
||||
else
|
||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
||||
|
||||
Zone camp = mob.getParentZone();
|
||||
gold = (int) (gold * ZoneLevel.getGoldDropModifier(camp));
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||
@@ -384,24 +354,8 @@ public enum LootManager {
|
||||
|
||||
if (equipmentRoll > dropChance)
|
||||
continue;
|
||||
ItemBase genericIB = me.getItemBase();
|
||||
//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);
|
||||
|
||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||
|
||||
if (ml != null && dropCount < 1) {
|
||||
ml.setIsID(true);
|
||||
@@ -413,7 +367,7 @@ public enum LootManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse, boolean inHotzone) {
|
||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
||||
|
||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
|
||||
@@ -422,23 +376,12 @@ public enum LootManager {
|
||||
if (chanceRoll > bse.dropChance)
|
||||
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);
|
||||
|
||||
if (lootItem != null)
|
||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||
}
|
||||
|
||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||
|
||||
//get table ID for the itembase ID
|
||||
|
||||
@@ -874,7 +874,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (System.currentTimeMillis() > aiAgent.deathTime + (aiAgent.spawnTime * 1000)) {
|
||||
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) {
|
||||
|
||||
if (Zone.respawnQue.contains(aiAgent) == false) {
|
||||
Zone.respawnQue.add(aiAgent);
|
||||
@@ -1030,10 +1030,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
public static void GuardCaptainLogic(Mob mob) {
|
||||
if(mob.guardedCity.getBane() == null){
|
||||
CheckMobMovement(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (mob.getCombatTarget() == null)
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
@@ -1057,10 +1054,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
if(mob.guardedCity.getBane() == null){
|
||||
CheckMobMovement(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
@@ -1080,10 +1074,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
public static void GuardWallArcherLogic(Mob mob) {
|
||||
if(mob.guardedCity.getBane() == null){
|
||||
CheckMobMovement(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (mob.getCombatTarget() == null)
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.mobileAI.Threads;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.Zone;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,6 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
public class MobRespawnThread implements Runnable {
|
||||
|
||||
|
||||
public MobRespawnThread() {
|
||||
Logger.info(" MobRespawnThread thread has started!");
|
||||
|
||||
@@ -34,23 +34,85 @@ public class MobRespawnThread implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
long rollingKeepFraction = (Zone.rollingAvgMobsAliveDepth - 1) / Zone.rollingAvgMobsAliveDepth;
|
||||
long rollingAddFraction = 1 / Zone.rollingAvgMobsAliveDepth;
|
||||
|
||||
while (true) {
|
||||
|
||||
try {
|
||||
|
||||
for (Zone zone : ZoneManager.getAllZones()) {
|
||||
|
||||
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||
|
||||
Mob respawner = zone.respawnQue.iterator().next();
|
||||
|
||||
if (respawner == null)
|
||||
continue;
|
||||
|
||||
respawner.respawn();
|
||||
zone.respawnQue.remove(respawner);
|
||||
zone.lastRespawn = System.currentTimeMillis();
|
||||
/*
|
||||
if (zone.respawnQue.size() > ZoneLevel.queueLengthToLevelUp) {
|
||||
zone.setCampLvl(zone.getCamplvl() + 1);
|
||||
}
|
||||
else if (zone.respawnQue.isEmpty() &&
|
||||
(zone.lastRespawn + ZoneLevel.msToLevelDown < System.currentTimeMillis()) &&
|
||||
zone.getCamplvl() > 0) {
|
||||
zone.setCampLvl(zone.getCamplvl() - 1);
|
||||
}
|
||||
*/
|
||||
|
||||
int aliveCount = 0;
|
||||
int deadCount = 0;
|
||||
for (Mob mob : zone.zoneMobSet) {
|
||||
if (mob.isAlive()) {
|
||||
aliveCount = aliveCount + 1;
|
||||
}
|
||||
else {
|
||||
deadCount = deadCount + 1;
|
||||
}
|
||||
}
|
||||
|
||||
zone.rollingAvgMobsAlive =
|
||||
((zone.rollingAvgMobsAlive * (Zone.rollingAvgMobsAliveDepth - 1) + aliveCount) / Zone.rollingAvgMobsAliveDepth);
|
||||
|
||||
/*
|
||||
if (startTime + ZoneLevel.msDelayToCampLevel < System.currentTimeMillis()) {
|
||||
if (aliveCount > Math.floor(zone.zoneMobSet.size() / 2.0)) {
|
||||
if (zone.levelUpTimer == 0) {
|
||||
zone.levelUpTimer = System.currentTimeMillis();
|
||||
} else if (zone.levelUpTimer + ZoneLevel.msTolevelUp < System.currentTimeMillis()) {
|
||||
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||
|
||||
zone.levelUpTimer = 0;
|
||||
}
|
||||
} else if (aliveCount == 0) {
|
||||
|
||||
if (zone.levelDownTimer == 0) {
|
||||
zone.levelDownTimer = System.currentTimeMillis();
|
||||
} else if (zone.levelDownTimer + ZoneLevel.msToLevelDown < System.currentTimeMillis()) {
|
||||
if (zone.getCampLvl() > 0) {
|
||||
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||
|
||||
zone.levelDownTimer = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zone.levelUpTimer = 0;
|
||||
zone.levelDownTimer = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Manage mob respawn
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
if (!Zone.respawnQue.isEmpty() && Zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||
|
||||
Mob respawner = Zone.respawnQue.iterator().next();
|
||||
|
||||
if (respawner == null)
|
||||
continue;
|
||||
|
||||
respawner.respawn();
|
||||
Zone.respawnQue.remove(respawner);
|
||||
Zone.lastRespawn = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
@@ -562,9 +562,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
if (i.isCanDestroy())
|
||||
if (itemManager.delete(i) == true) {
|
||||
int value = i.getItemBase().getBaseValue();
|
||||
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
|
||||
sourcePlayer.getCharItemManager().updateInventory();
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
@@ -57,21 +57,6 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (contract.canSlotinBuilding(building))
|
||||
ItemLists.add(hirelings);
|
||||
|
||||
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
|
||||
if(contract.getContractID() == 899)//alchemist
|
||||
ItemLists.add(hirelings);
|
||||
|
||||
if(contract.getContractID() == 866)//banker
|
||||
ItemLists.add(hirelings);
|
||||
|
||||
if(contract.getContractID() == 865)//siege engineer
|
||||
ItemLists.add(hirelings);
|
||||
}
|
||||
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
|
||||
if(contract.getContractID() == 865)//siege engineer
|
||||
ItemLists.add(hirelings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,20 +78,13 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size())
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
return false;
|
||||
|
||||
Item contractItem = Item.getFromCache(msg.getContractItem());
|
||||
|
||||
if (contractItem == null)
|
||||
return false;
|
||||
if (msg.getContractItem() == 850) {//runemaster
|
||||
for (AbstractCharacter abs : building.getHirelings().keySet()) {
|
||||
NPC npc = (NPC) abs;
|
||||
if (npc.contract.getContractID() == 850)
|
||||
return false; //can only have 1 runemaster
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
|
||||
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
|
||||
@@ -126,29 +104,10 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
|
||||
// Check if contract can be slotted in this building
|
||||
//Logger.error("inserting contract: " + contract.getContractID());
|
||||
if (contract.canSlotinBuilding(building) == false) {
|
||||
boolean override = false;
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)) {
|
||||
if (contract.getContractID() == 899)//alchemist
|
||||
override = true;
|
||||
|
||||
if (contract.getContractID() == 866)//banker
|
||||
override = true;
|
||||
if (contract.canSlotinBuilding(building) == false)
|
||||
return false;
|
||||
|
||||
if (contract.getContractID() == 865)//siege engineer
|
||||
override = true;
|
||||
}
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)) {
|
||||
if (contract.getContractID() == 865)//siege engineer
|
||||
override = true;
|
||||
}
|
||||
if(override == false) {
|
||||
Logger.error("failed at override with contract: " + contract.getContractID());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//Logger.error("override successful: " + contract.getContractID());
|
||||
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Owner is obviously allowed to upgrade his own buildings
|
||||
|
||||
if (building.getOwner() != null && building.getOwner().equals(player)) {
|
||||
if (building.getOwner().equals(player)) {
|
||||
|
||||
// Players cannot destroy or transfer a TOL.
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -99,10 +98,6 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
private static void requestHermitBlessing(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
|
||||
|
||||
|
||||
if(DateTime.now().getHourOfDay() < 18 || DateTime.now().getHourOfDay() > 21){
|
||||
ChatManager.chatSystemInfo(player, "Blessing can only be received between 6:00 pm and 10:00 pm");
|
||||
}
|
||||
Guild guild;
|
||||
Realm realm;
|
||||
City city;
|
||||
|
||||
@@ -123,11 +123,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
if (resourceValue < 15)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
|
||||
|
||||
if (resourceValue < 1)
|
||||
hasResources = false;
|
||||
|
||||
if (hasResources == false) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 184); // Insufficient gold or resources to upgrade to capital
|
||||
return false;
|
||||
@@ -185,16 +180,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 1) == true) {
|
||||
warehouse.getResources().put(Warehouse.mithrilIB, resourceValue - 1);
|
||||
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.MITHRIL, 1);
|
||||
} else {
|
||||
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return false;
|
||||
}
|
||||
|
||||
realm.claimRealmForCity(city, charterUUID);
|
||||
|
||||
tol.setRank(8);
|
||||
|
||||
@@ -212,6 +212,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbstractCharacter guard : building.getHirelings().keySet()) {
|
||||
if (guard.getObjectType() == GameObjectType.Mob)
|
||||
((Mob) guard).setPatrolPointIndex(0);
|
||||
}
|
||||
} else if (building.getPatrolPoints() != null)
|
||||
ClearPatrolPoints(building.getObjectUUID());
|
||||
|
||||
@@ -219,6 +223,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
||||
} else if (building.getSentryPoints() != null)
|
||||
ClearSentryPoints(building.getObjectUUID());
|
||||
|
||||
// Dispatch dispatch = Dispatch.borrow(pc, msg);
|
||||
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
||||
@@ -533,7 +541,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||
|
||||
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
||||
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
||||
|
||||
if (mob == null)
|
||||
return true;
|
||||
|
||||
@@ -81,7 +81,6 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
cities = City.getCitiesToTeleportTo(player);
|
||||
else
|
||||
cities = City.getCitiesToRepledgeTo(player);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -171,7 +171,7 @@ public class Blueprint {
|
||||
|
||||
maintCost = (9730 * rank) + 1890;
|
||||
|
||||
return maintCost * 2;
|
||||
return maintCost;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
@@ -313,10 +313,10 @@ public class Blueprint {
|
||||
|
||||
// Early exit for buildings with single or no slots
|
||||
|
||||
if (this.maxSlots <= 1 && this.buildingGroup.equals(BuildingGroup.TOL) == false)
|
||||
if (this.maxSlots <= 1)
|
||||
return maxSlots;
|
||||
|
||||
if (this.maxRank == 1 && currentRank == 1&& this.buildingGroup.equals(BuildingGroup.TOL) == false)
|
||||
if (this.maxRank == 1 && currentRank == 1)
|
||||
return getMaxSlots();
|
||||
|
||||
switch (currentRank) {
|
||||
@@ -328,22 +328,20 @@ public class Blueprint {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
availableSlots = 2;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
availableSlots = 3;
|
||||
break;
|
||||
case 8:
|
||||
availableSlots = 3;
|
||||
availableSlots = 1;
|
||||
break;
|
||||
default:
|
||||
availableSlots = 0;
|
||||
break;
|
||||
}
|
||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||
availableSlots += 1;
|
||||
}
|
||||
|
||||
return availableSlots;
|
||||
}
|
||||
|
||||
@@ -494,19 +492,54 @@ public class Blueprint {
|
||||
// Select equation for rank time based upon the
|
||||
// buildings current Maintenance BuildingGroup. These values
|
||||
// are expressed in hours
|
||||
if(this.getBuildingGroup().equals(BuildingGroup.TOL))
|
||||
switch(targetRank){
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return 6;
|
||||
case 6:
|
||||
case 7:
|
||||
return 36;
|
||||
}
|
||||
|
||||
return 5;
|
||||
switch (this.buildingGroup) {
|
||||
|
||||
case GENERICNOUPGRADE:
|
||||
break; // Cannot be upgraded
|
||||
case VILLA:
|
||||
case ESTATE:
|
||||
case FORTRESS:
|
||||
case CITADEL:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case TOL:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case BARRACK:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case CHURCH:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case FORGE:
|
||||
case INN:
|
||||
case TAILOR:
|
||||
case MAGICSHOP:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case SPIRE:
|
||||
rankTime = (4 * targetRank) + 4;
|
||||
break;
|
||||
case AMAZONHALL:
|
||||
case CATHEDRAL:
|
||||
case GREATHALL:
|
||||
case KEEP:
|
||||
case THIEFHALL:
|
||||
case TEMPLEHALL:
|
||||
case WIZARDHALL:
|
||||
case ELVENHALL:
|
||||
case ELVENSANCTUM:
|
||||
case IREKEIHALL:
|
||||
case FORESTHALL:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
default:
|
||||
Logger.error("Attempt to retrieve ranktime without MaintGroup");
|
||||
break;
|
||||
}
|
||||
|
||||
return rankTime;
|
||||
}
|
||||
|
||||
public Vector2f getExtents() {
|
||||
|
||||
@@ -784,7 +784,7 @@ public class Building extends AbstractWorldObject {
|
||||
|
||||
// Add cost for building structure
|
||||
|
||||
maintCost += this.getBlueprint().getMaintCost(rank) * 2;
|
||||
maintCost += this.getBlueprint().getMaintCost(rank);
|
||||
|
||||
// Add costs associated with hirelings
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ public class City extends AbstractWorldObject {
|
||||
private byte isCapital = 0;
|
||||
private byte isSafeHold;
|
||||
private boolean forceRename = false;
|
||||
private boolean noTeleport = false; //used by npc cities
|
||||
private boolean noRepledge = false; //used by npc cities
|
||||
private boolean isOpen = false;
|
||||
private int treeOfLifeID;
|
||||
private Vector3fImmutable location = Vector3fImmutable.ZERO;
|
||||
|
||||
@@ -139,6 +142,14 @@ public class City extends AbstractWorldObject {
|
||||
this.forceRename = rs.getInt("forceRename") == 1;
|
||||
this.open = rs.getInt("open") == 1;
|
||||
|
||||
if (this.cityName.equals("Perdition") || this.cityName.equals("Bastion")) {
|
||||
this.noTeleport = true;
|
||||
this.noRepledge = true;
|
||||
} else {
|
||||
this.noTeleport = false;
|
||||
this.noRepledge = false;
|
||||
}
|
||||
|
||||
this.hash = rs.getString("hash");
|
||||
|
||||
if (this.motto.isEmpty()) {
|
||||
@@ -345,6 +356,9 @@ public class City extends AbstractWorldObject {
|
||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
||||
City city = (City) ago;
|
||||
|
||||
if (city.noTeleport)
|
||||
continue;
|
||||
|
||||
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
||||
|
||||
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
|
||||
@@ -398,6 +412,8 @@ public class City extends AbstractWorldObject {
|
||||
for (AbstractGameObject ago : worldCities.values()) {
|
||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
||||
City city = (City) ago;
|
||||
if (city.noRepledge)
|
||||
continue;
|
||||
|
||||
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import engine.Enum.DamageType;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.LootManager;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -915,23 +914,4 @@ public class ItemBase {
|
||||
public void setAutoID(boolean autoID) {
|
||||
this.autoID = autoID;
|
||||
}
|
||||
|
||||
public boolean isVorg(){
|
||||
return LootManager.vorg_ha_uuids.contains(this.uuid) || LootManager.vorg_ma_uuids.contains(this.uuid) || LootManager.vorg_la_uuids.contains(this.uuid) || LootManager.vorg_cloth_uuids.contains(this.uuid);
|
||||
}
|
||||
|
||||
public String[] getVorgStats() {
|
||||
if(this.isLightArmor() || this.isMediumArmor() || this.isHeavyArmor() || this.isClothArmor()){
|
||||
if(this.getValidSlot() == MBServerStatics.SLOT_FEET) {
|
||||
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007","SUF-150"};
|
||||
}else {
|
||||
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"};
|
||||
}
|
||||
|
||||
} else if(this.isShield()){//shield
|
||||
return new String[]{"SUF-265","PRE-123","PRE-232", "PRE-212", "PRE-222"};
|
||||
} else{//weapon
|
||||
return new String[]{"PRE-020","PRE-033",};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +290,9 @@ public class Mine extends AbstractGameObject {
|
||||
if (treeRank < 1)
|
||||
return false;
|
||||
|
||||
if (guildUnderMineLimit(playerGuild.getNation(), treeRank) == false) {
|
||||
// We check the limit against only the player guild right now
|
||||
// each guild (even within a nation) is limited by the nation tree
|
||||
if (guildUnderMineLimit(playerGuild, treeRank) == false) {
|
||||
ErrorPopupMsg.sendErrorMsg(playerCharacter, "Your nation cannot support another mine.");
|
||||
return false;
|
||||
}
|
||||
@@ -304,10 +306,11 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
mineCnt += Mine.getMinesForGuild(playerGuild.getObjectUUID()).size();
|
||||
|
||||
for (Guild guild : playerGuild.getSubGuildList())
|
||||
mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
|
||||
// Only count mines for a specific guild
|
||||
//for (Guild guild : playerGuild.getSubGuildList())
|
||||
// mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
|
||||
|
||||
return mineCnt <= tolRank;
|
||||
return mineCnt <= (tolRank * 2);
|
||||
}
|
||||
|
||||
public boolean changeProductionType(Resource resource) {
|
||||
|
||||
+36
-11
@@ -31,6 +31,7 @@ import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.MobPowerEntry;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -101,6 +102,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
private DateTime upgradeDateTime = null;
|
||||
private boolean lootSync = false;
|
||||
|
||||
private String originalFirstName;
|
||||
private String originalLastName;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
@@ -129,6 +132,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.lastName = "the " + contract.getName();
|
||||
}
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,6 +156,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.building = building;
|
||||
initializeMob(false, false, false);
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,6 +175,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.BehaviourType = Enum.MobBehaviourType.Pet1;
|
||||
initializeMob(true, false, false);
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
//SIEGE CONSTRUCTOR
|
||||
@@ -180,6 +192,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.equip = new HashMap<>();
|
||||
initializeMob(false, true, isPlayerGuard);
|
||||
clearStatic();
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,6 +303,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error("Mobile:" + this.dbID + ": " + e);
|
||||
}
|
||||
|
||||
originalFirstName = this.firstName;
|
||||
originalLastName = this.lastName;
|
||||
}
|
||||
|
||||
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
|
||||
@@ -1382,6 +1399,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
NPCManager.applyRuneSetEffects(this);
|
||||
|
||||
// Set Name based on parent zone level
|
||||
Zone camp = this.getParentZone();
|
||||
this.lastName = this.originalLastName + ZoneLevel.getNameSuffix(camp);
|
||||
|
||||
//PowersManager.applyPower(this, this, this.getLoc(), "CMP-001", camp.getCamplvl(), false);
|
||||
|
||||
this.recalculateStats();
|
||||
this.setHealth(this.healthMax);
|
||||
|
||||
@@ -1495,6 +1518,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
|
||||
}
|
||||
|
||||
// Modify max health based on camp level - bad, we need to use effects for this
|
||||
Zone camp = this.getParentZone();
|
||||
h = h * ZoneLevel.getMaxHealthPctModifier(camp);
|
||||
|
||||
// Set max health, mana and stamina
|
||||
|
||||
if (h > 0)
|
||||
@@ -1595,6 +1622,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error("Error: missing bonuses");
|
||||
|
||||
defense = (defense < 1) ? 1 : defense;
|
||||
|
||||
// Modify defense for camp level - bad, we need to use effects for this
|
||||
Zone camp = this.getParentZone();
|
||||
defense = defense * ZoneLevel.getDefPctModifier(camp);
|
||||
|
||||
this.defenseRating = (short) (defense + 0.5f);
|
||||
} catch (Exception e) {
|
||||
Logger.info("Mobbase ID " + this.getMobBaseID() + " returned an error. Setting to Default Defense." + e.getMessage());
|
||||
@@ -1796,6 +1828,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
atr *= (1 + neg_Bonus);
|
||||
}
|
||||
|
||||
// Modify atr for camp level - bad, we need to use effects for this
|
||||
Zone camp = this.getParentZone();
|
||||
atr = atr * ZoneLevel.getAtrPctModifier(camp);
|
||||
|
||||
atr = (atr < 1) ? 1 : atr;
|
||||
|
||||
// set atr
|
||||
@@ -1970,13 +2006,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
try {
|
||||
NPCManager.applyRuneSetEffects(this);
|
||||
recalculateStats();
|
||||
if(this.mobBase.getLevel() > 80){
|
||||
if(this.getMobBaseID() == 14319){//ithriana
|
||||
this.healthMax = 5400000;
|
||||
} else{
|
||||
this.healthMax = 1500000;
|
||||
}
|
||||
}
|
||||
this.setHealth(this.healthMax);
|
||||
|
||||
// Set bounds for this mobile
|
||||
@@ -2027,10 +2056,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
|
||||
this.deathTime = 0;
|
||||
|
||||
if(this.getName().equals("Chaos Chimera") || this.getName().equals("Taint Horror"))
|
||||
this.level -= 10;
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1074,8 +1074,8 @@ public class NPC extends AbstractCharacter {
|
||||
filteredItemList.add(910010 + subID);
|
||||
}
|
||||
|
||||
//if (this.getRank() == 7)
|
||||
// filteredItemList.add(910018);
|
||||
if (this.getRank() == 7)
|
||||
filteredItemList.add(910018);
|
||||
}
|
||||
|
||||
return filteredItemList;
|
||||
@@ -1152,13 +1152,9 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
upgradeTime = Integer.MAX_VALUE;
|
||||
|
||||
if (this.getRank() < 7) {
|
||||
if(this.contract.getName().contains("Trainer") == false){
|
||||
return 5;
|
||||
}else{
|
||||
return this.getRank() * 8;
|
||||
}
|
||||
}
|
||||
if (this.getRank() < 7)
|
||||
return (this.getRank() * 8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import static engine.InterestManagement.RealmMap.getRealmAtLocation;
|
||||
|
||||
|
||||
public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
@@ -4813,18 +4811,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
updateBlessingMessage();
|
||||
|
||||
this.safeZone = this.isInSafeZone();
|
||||
Realm currentRealm = getRealmAtLocation(this.getLoc());
|
||||
if(currentRealm != null) {
|
||||
boolean forbiddenRealm = false;
|
||||
if (Realm.overridePlacement(currentRealm.getRealmName()))
|
||||
forbiddenRealm = true;
|
||||
if (forbiddenRealm && this.containsEffect(1672601862) == false) {//Deathshroud
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
}
|
||||
}
|
||||
//if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding
|
||||
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false);
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
|
||||
@@ -76,40 +76,18 @@ public class Realm {
|
||||
this.mapG = (float) (mapColor.getGreen() * 0.00392156863);
|
||||
this.mapB = (float) (mapColor.getBlue() * 0.00392156863);
|
||||
this.mapA = 1;
|
||||
if (overridePlacement(rs.getString("realmName"))) {
|
||||
this.canBeClaimed = false;
|
||||
this.canPlaceCities = false;
|
||||
this.numCities = 0;
|
||||
this.rulingCityUUID = 0;
|
||||
this.charterType = 0;
|
||||
this.realmName = "Plagued Land";
|
||||
} else {
|
||||
|
||||
this.canPlaceCities = rs.getBoolean("canPlaceCities");
|
||||
this.numCities = rs.getInt("numCities");
|
||||
if(this.numCities > 0){
|
||||
this.canBeClaimed = true;
|
||||
}else{
|
||||
this.canBeClaimed = false;
|
||||
}
|
||||
this.rulingCityUUID = rs.getInt("rulingCityUID");
|
||||
if (this.rulingCityUUID != 0) {
|
||||
this.charterType = rs.getInt("charterType");
|
||||
} else {
|
||||
this.charterType = 0;
|
||||
}
|
||||
this.realmName = rs.getString("realmName");
|
||||
}
|
||||
|
||||
this.canBeClaimed = rs.getBoolean("canBeClaimed");
|
||||
this.canPlaceCities = rs.getBoolean("canPlaceCities");
|
||||
this.numCities = rs.getInt("numCities");
|
||||
this.realmName = rs.getString("realmName");
|
||||
this.rulingCityUUID = rs.getInt("rulingCityUID");
|
||||
this.charterType = rs.getInt("charterType");
|
||||
|
||||
java.sql.Timestamp ruledTimeStamp = rs.getTimestamp("ruledSince");
|
||||
|
||||
if (ruledTimeStamp != null){
|
||||
if (ruledTimeStamp != null)
|
||||
this.ruledSince = LocalDateTime.ofInstant(ruledTimeStamp.toInstant(), ZoneId.systemDefault());
|
||||
}else {
|
||||
this.rulingCityUUID = 0;
|
||||
this.charterType = 0;
|
||||
}
|
||||
|
||||
this.mapY1 = rs.getFloat("mapY1");
|
||||
this.mapX1 = rs.getFloat("mapX1");
|
||||
this.mapY2 = rs.getFloat("mapY2");
|
||||
@@ -122,21 +100,6 @@ public class Realm {
|
||||
this.hash = rs.getString("hash");
|
||||
}
|
||||
|
||||
public static boolean overridePlacement(String realm){
|
||||
switch(realm.toLowerCase()) {
|
||||
case "neshraa":
|
||||
case "adduram":
|
||||
case "letharuun":
|
||||
case "kralgaard":
|
||||
//case "ecklund":
|
||||
case "nordenthol":
|
||||
case "thollmar":
|
||||
case "haldorn isles":
|
||||
case "hregenlund":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static void configureAllRealms() {
|
||||
|
||||
for (Realm realm : Realm._realms.values()) {
|
||||
|
||||
@@ -18,7 +18,10 @@ import engine.math.Bounds;
|
||||
import engine.math.Vector2f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.ZoneLevel;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
@@ -61,6 +64,13 @@ public class Zone extends AbstractGameObject {
|
||||
//public static ArrayList<Mob> respawnQue = new ArrayList<>();
|
||||
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
public static long lastRespawn = 0;
|
||||
|
||||
private int campLvl = 0;
|
||||
public long levelUpTimer = 0;
|
||||
public long levelDownTimer = 0;
|
||||
public int rollingAvgMobsAlive = 0;
|
||||
public static final int rollingAvgMobsAliveDepth = 100;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -74,11 +84,7 @@ public class Zone extends AbstractGameObject {
|
||||
this.zCoord = rs.getFloat("ZCoord");
|
||||
this.yCoord = rs.getFloat("YOffset");
|
||||
this.loadNum = rs.getInt("LoadNum");
|
||||
if(overrideSafety(rs.getString("Name"))){
|
||||
this.safeZone = (byte) 0;
|
||||
}else {
|
||||
this.safeZone = rs.getByte("SafeZone");
|
||||
}
|
||||
this.safeZone = rs.getByte("SafeZone");
|
||||
this.Icon1 = rs.getString("Icon1");
|
||||
this.Icon2 = rs.getString("Icon2");
|
||||
this.Icon3 = rs.getString("Icon3");
|
||||
@@ -104,47 +110,35 @@ public class Zone extends AbstractGameObject {
|
||||
|
||||
if (hash == null)
|
||||
setHash();
|
||||
|
||||
|
||||
}
|
||||
public static boolean skipZone(String name){
|
||||
switch(name){
|
||||
case "Kralgar Holm":
|
||||
case "Doomhorn Skrae":
|
||||
case "Ymur's Crown":
|
||||
case "Ecklund Wilds":
|
||||
case "Ragnir Holm":
|
||||
case "Aurrochs Skrae":
|
||||
case "Hregerend Wildlands":
|
||||
case "The Blood Sands":
|
||||
case "Vale of Nar Addad":
|
||||
case "Kharsoom":
|
||||
case "Leth'khalivar Desert":
|
||||
case "Thollok Marsh":
|
||||
case "The Black Bog":
|
||||
case "sevaath Mere":
|
||||
return true;
|
||||
|
||||
public void setCampLvl(int level)
|
||||
{
|
||||
this.campLvl = level;
|
||||
|
||||
if (this.campLvl > ZoneLevel.campMaxLvl)
|
||||
{
|
||||
this.campLvl = ZoneLevel.campMaxLvl;
|
||||
}
|
||||
else if (this.campLvl < 0)
|
||||
{
|
||||
this.campLvl = 0;
|
||||
}
|
||||
|
||||
//if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
|
||||
{
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, this.getName() + " has reached camp level " + this.campLvl + "! Will anyone contest?!");
|
||||
chatMsg.setMessageType(2);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean overrideSafety(String name){
|
||||
switch(name){
|
||||
case"Sanctuary":
|
||||
case "All-Father's Rest":
|
||||
case "Hamlet of Hothor's Doom":
|
||||
case"Hamlet of Hrimdal":
|
||||
case "Hamlet of Valkirch":
|
||||
case "Hamlet of Scraefahl":
|
||||
case "Hamlet of Hengest":
|
||||
case "Starkholm":
|
||||
case "Aeldreth Havens":
|
||||
case "Erkeng Hold":
|
||||
case "Sea Dog's Rest":
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
public int getCampLvl()
|
||||
{
|
||||
return this.campLvl;
|
||||
}
|
||||
|
||||
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
||||
|
||||
if (zone.loadNum == 0 && zone.playerCityID == 0)
|
||||
|
||||
@@ -15,7 +15,6 @@ import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.MinionType;
|
||||
import engine.Enum.SupportMsgType;
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
@@ -289,6 +288,7 @@ public class WorldServer {
|
||||
|
||||
private boolean init() {
|
||||
|
||||
Logger.info("Server Code: [NovaTest] Branch");
|
||||
Logger.info("MAGICBANE SERVER GREETING:");
|
||||
Logger.info(ConfigManager.MB_WORLD_GREETING.getValue());
|
||||
|
||||
@@ -711,6 +711,7 @@ public class WorldServer {
|
||||
}
|
||||
player.getTimestamps().put("logout", System.currentTimeMillis());
|
||||
player.setEnteredWorld(false);
|
||||
|
||||
// remove from simulation and zero current loc
|
||||
|
||||
WorldGrid.RemoveWorldObject(player);
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package engine.util;
|
||||
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class ZoneLevel {
|
||||
|
||||
private static final float healthPctPerLevel = (float)0.2;
|
||||
private static final float atrPctPerLevel = (float)0.2;
|
||||
private static final float defPctPerLevel = (float)0.2;
|
||||
private static final float lootPctPerLevel = (float)0.1;
|
||||
private static final float goldPctPerLevel = (float)0.2;
|
||||
|
||||
public static final int campLvlAnnounceThreshold = 5;
|
||||
public static final int campMaxLvl = 10;
|
||||
|
||||
public static final int queueLengthToLevelUp = 5;
|
||||
public static final int msToLevelDown = 60 * 1000;
|
||||
public static final int msTolevelUp = 60 * 1000;
|
||||
public static final long msDelayToCampLevel = 60 * 1000;
|
||||
|
||||
private static final String[] nameMap =
|
||||
{
|
||||
"",
|
||||
" I",
|
||||
" II",
|
||||
" III",
|
||||
" IV",
|
||||
" V",
|
||||
" VI",
|
||||
" VII",
|
||||
" VIII",
|
||||
" IX",
|
||||
" X"
|
||||
};
|
||||
|
||||
public static String getNameSuffix(Zone zone)
|
||||
{
|
||||
try {
|
||||
return nameMap[zone.getCampLvl()];
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static float getMaxHealthPctModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, healthPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getAtrPctModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, atrPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getDefPctModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, defPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getLootDropModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, lootPctPerLevel);
|
||||
}
|
||||
|
||||
public static float getGoldDropModifier(Zone zone)
|
||||
{
|
||||
return getGenericModifier(zone, goldPctPerLevel);
|
||||
}
|
||||
|
||||
private static float getGenericModifier(Zone zone, float modifierPerLevel)
|
||||
{
|
||||
float modifier = (float)1.0;
|
||||
|
||||
if (zone != null)
|
||||
{
|
||||
modifier += zone.getCampLvl() * modifierPerLevel;
|
||||
}
|
||||
|
||||
return modifier;
|
||||
}
|
||||
}
|
||||
@@ -128,10 +128,12 @@ public class HourlyJobThread implements Runnable {
|
||||
if (mine.isActive == false)
|
||||
return false;
|
||||
|
||||
Logger.info(mine.getZoneName() + "'s Mine is now Closing");
|
||||
|
||||
Building mineBuilding = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
||||
|
||||
if (mineBuilding == null) {
|
||||
Logger.debug("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
|
||||
Logger.info("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -139,6 +141,8 @@ public class HourlyJobThread implements Runnable {
|
||||
// We can early exit here.
|
||||
|
||||
if (mineBuilding.getRank() > 0) {
|
||||
Logger.info("Mine still standing when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID());
|
||||
|
||||
mine.setActive(false);
|
||||
mine.lastClaimer = null;
|
||||
return true;
|
||||
@@ -149,6 +153,8 @@ public class HourlyJobThread implements Runnable {
|
||||
// and keep the window open.
|
||||
|
||||
if (!Mine.validateClaimer(mine.lastClaimer)) {
|
||||
Logger.info("Mine has no valid claimer when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID());
|
||||
|
||||
mine.lastClaimer = null;
|
||||
mine.updateGuildOwner(null);
|
||||
mine.setActive(true);
|
||||
@@ -157,6 +163,8 @@ public class HourlyJobThread implements Runnable {
|
||||
|
||||
//Update ownership to map
|
||||
|
||||
Logger.info("Mine ownership changing when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID() + " new owning guild: " + mine.getOwningGuild().getObjectUUID());
|
||||
|
||||
mine.guildName = mine.getOwningGuild().getName();
|
||||
mine.guildTag = mine.getOwningGuild().getGuildTag();
|
||||
Guild nation = mine.getOwningGuild().getNation();
|
||||
|
||||
Reference in New Issue
Block a user