Merge branch 'lakebane-zerg' into lakebane-master
# Conflicts: # src/engine/InterestManagement/InterestManager.java # src/engine/gameManager/SimulationManager.java # src/engine/mobileAI/MobAI.java # src/engine/objects/CharacterItemManager.java # src/engine/objects/Mine.java # src/engine/objects/PlayerCharacter.java
This commit is contained in:
@@ -2822,7 +2822,6 @@ public class Enum {
|
||||
|
||||
public enum MobBehaviourType {
|
||||
None(null, false, false, false, false, false),
|
||||
//Power
|
||||
Power(null, false, true, true, true, false),
|
||||
PowerHelpee(Power, false, true, true, false, true),
|
||||
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
||||
@@ -2847,6 +2846,7 @@ public class Enum {
|
||||
//Independent Types
|
||||
SimpleStandingGuard(null, false, false, false, false, false),
|
||||
Pet1(null, false, false, true, false, false),
|
||||
SiegeEngine(null, false, false, false, false, false),
|
||||
Simple(null, false, false, true, false, false),
|
||||
Helpee(null, false, true, true, false, true),
|
||||
HelpeeWimpy(null, true, false, true, false, false),
|
||||
@@ -2857,13 +2857,12 @@ public class Enum {
|
||||
HamletGuard(null, false, true, false, false, false),
|
||||
AggroWanderer(null, false, false, true, false, false);
|
||||
|
||||
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
||||
public MobBehaviourType BehaviourHelperType;
|
||||
public boolean isWimpy;
|
||||
public boolean isAgressive;
|
||||
public boolean canRoam;
|
||||
public boolean callsForHelp;
|
||||
public boolean respondsToCallForHelp;
|
||||
public final MobBehaviourType BehaviourHelperType;
|
||||
public final boolean isWimpy;
|
||||
public final boolean isAgressive;
|
||||
public final boolean canRoam;
|
||||
public final boolean callsForHelp;
|
||||
public final boolean respondsToCallForHelp;
|
||||
|
||||
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
||||
this.BehaviourHelperType = helpeebehaviourType;
|
||||
@@ -2880,6 +2879,8 @@ public class Enum {
|
||||
MOBILE,
|
||||
PET,
|
||||
CHARMED,
|
||||
|
||||
SIEGEENGINE,
|
||||
GUARD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,16 +8,17 @@
|
||||
|
||||
package engine.InterestManagement;
|
||||
|
||||
import com.sun.corba.se.spi.orbutil.fsm.ActionBase;
|
||||
import com.sun.corba.se.spi.orbutil.fsm.FSM;
|
||||
import com.sun.corba.se.spi.orbutil.fsm.Input;
|
||||
import engine.Enum;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.RefreshGroupJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
@@ -27,12 +28,13 @@ import engine.net.client.msg.LoadStructureMsg;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import static engine.math.FastMath.sqr;
|
||||
|
||||
@@ -471,7 +473,7 @@ public enum InterestManager implements Runnable {
|
||||
if (awonpc.despawned == true)
|
||||
continue;
|
||||
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||
((Mob) awonpc).setCombatTarget(null);
|
||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||
|
||||
@@ -484,7 +486,7 @@ public enum InterestManager implements Runnable {
|
||||
if (!awonpc.isAlive())
|
||||
continue;
|
||||
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||
|
||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||
((Mob) awonpc).setCombatTarget(null);
|
||||
@@ -529,15 +531,19 @@ public enum InterestManager implements Runnable {
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
|
||||
// apply the 1 box restriction
|
||||
if(player.level < 10) {
|
||||
player.setLevel((short) 10);
|
||||
MobLoot conc = new MobLoot(player,ItemBase.getItemBase(980066),false);
|
||||
//player.getCharItemManager().addItemToInventory(conc);
|
||||
player.getCharItemManager().addItemToInventory(conc.promoteToItem(player),1);
|
||||
player.getCharItemManager().updateInventory();
|
||||
}
|
||||
player.isBoxed = false;
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayers()){
|
||||
if(pc.isActive() == false)
|
||||
continue;
|
||||
|
||||
if(pc.isEnteredWorld() == false)
|
||||
continue;
|
||||
|
||||
if(origin.machineID.equals(pc.getClientConnection().machineID)){
|
||||
//add deatshroud effect
|
||||
if(pc.isBoxed == true)
|
||||
@@ -546,12 +552,7 @@ public enum InterestManager implements Runnable {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(player.getPromotionClass() == null && player.getLevel() < 10){
|
||||
player.setLevel((short)10);
|
||||
MobLoot ml = new MobLoot(player,ItemBase.getItemBase(980066),false);
|
||||
ml.promoteToItem(player);
|
||||
player.getCharItemManager().addGoldToInventory(50000, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||
|
||||
@@ -135,7 +135,11 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
worked = rs.getBoolean("result");
|
||||
try {
|
||||
worked = rs.getBoolean("result");
|
||||
}catch(Exception e){
|
||||
return true;
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
@@ -350,7 +354,11 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
worked = rs.getBoolean("result");
|
||||
try {
|
||||
worked = rs.getBoolean("result");
|
||||
} catch(Exception e){
|
||||
worked = true;
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
|
||||
@@ -28,31 +28,26 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||
}
|
||||
|
||||
public Mob ADD_MOB(Mob toAdd) {
|
||||
public Mob PERSIST(Mob toAdd) {
|
||||
|
||||
Mob mobile = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||
|
||||
preparedStatement.setLong(1, toAdd.getParentZoneID());
|
||||
preparedStatement.setInt(2, toAdd.getMobBaseID());
|
||||
preparedStatement.setInt(3, toAdd.getGuildUUID());
|
||||
preparedStatement.setFloat(4, toAdd.getSpawnX());
|
||||
preparedStatement.setFloat(5, toAdd.getSpawnY());
|
||||
preparedStatement.setFloat(6, toAdd.getSpawnZ());
|
||||
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
||||
preparedStatement.setInt(2, toAdd.loadID);
|
||||
preparedStatement.setInt(3, toAdd.guildUUID);
|
||||
preparedStatement.setFloat(4, toAdd.bindLoc.x);
|
||||
preparedStatement.setFloat(5, toAdd.bindLoc.y);
|
||||
preparedStatement.setFloat(6, toAdd.bindLoc.z);
|
||||
preparedStatement.setInt(7, 0);
|
||||
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
|
||||
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
|
||||
|
||||
if (toAdd.getContract() != null)
|
||||
preparedStatement.setInt(10, toAdd.getContract().getContractID());
|
||||
else
|
||||
preparedStatement.setInt(10, 0);
|
||||
|
||||
preparedStatement.setInt(11, toAdd.getBuildingID());
|
||||
preparedStatement.setInt(12, toAdd.getLevel());
|
||||
preparedStatement.setString(13, toAdd.getFirstName());
|
||||
preparedStatement.setFloat(8, toAdd.spawnRadius);
|
||||
preparedStatement.setInt(9, toAdd.spawnTime);
|
||||
preparedStatement.setInt(10, toAdd.contractUUID);
|
||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
||||
preparedStatement.setInt(12, toAdd.level);
|
||||
preparedStatement.setString(13, toAdd.firstName);
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
@@ -106,17 +101,17 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
return row_count;
|
||||
}
|
||||
|
||||
public void LOAD_PATROL_POINTS(Mob captain) {
|
||||
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, captain.getObjectUUID());
|
||||
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String name = rs.getString("name");
|
||||
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
|
||||
String minionName = rs.getString("name");
|
||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
||||
|
||||
if (toCreate == null)
|
||||
return;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
MobBase mb = (MobBase) mobbaseAGO;
|
||||
int loadID = mb.getObjectUUID();
|
||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||
null, true, zone, null, 0, "", 1);
|
||||
null, zone, null, null, "", 1);
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
this.setResult(String.valueOf(mob.getDBID()));
|
||||
@@ -84,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||
null, true, zone, null, 0, "", 1);
|
||||
null, zone, null, null, "", 1);
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
ChatManager.chatSayInfo(pc,
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
public class EnchantCmd extends AbstractDevCmd {
|
||||
|
||||
@@ -55,21 +56,9 @@ public class EnchantCmd extends AbstractDevCmd {
|
||||
this.setResult(String.valueOf(item.getObjectUUID()));
|
||||
} else {
|
||||
int cnt = words.length;
|
||||
for (int i = 1; i < cnt; i++) {
|
||||
String enchant = words[i];
|
||||
boolean valid = true;
|
||||
for (Effect eff : item.getEffects().values()) {
|
||||
if (eff.getEffectsBase().getIDString().equals(enchant)) {
|
||||
throwbackError(pc, "This item already has that enchantment");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (valid) {
|
||||
item.addPermanentEnchantmentForDev(enchant, rank);
|
||||
this.setResult(String.valueOf(item.getObjectUUID()));
|
||||
} else
|
||||
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
|
||||
}
|
||||
String enchant = words[1];
|
||||
enchant = EffectsBase.getItemEffectsByName(enchant.toLowerCase());
|
||||
item.addPermanentEnchantmentForDev(enchant, 0);
|
||||
cim.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,9 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "isSummonedPet: true";
|
||||
else
|
||||
output += "isSummonedPet: false";
|
||||
PlayerCharacter owner = targetMob.getOwner();
|
||||
|
||||
|
||||
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
|
||||
if (owner != null)
|
||||
output += " owner: " + owner.getObjectUUID();
|
||||
output += newline;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
@@ -151,7 +151,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
|
||||
@@ -154,7 +154,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
mobA = (Mob) ac;
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
@@ -209,7 +209,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
if (npc.building != null)
|
||||
npc.building.getHirelings().remove(npc);
|
||||
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
if (mob.getParentZone() != null)
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
int failures = 0;
|
||||
int goldAmount = 0;
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
for (int i = 0; i < 10000; ++i) {
|
||||
|
||||
try {
|
||||
mob.loadInventory();
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SlotTestCmd extends AbstractDevCmd {
|
||||
outString += "Hirelings List:";
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet())
|
||||
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
|
||||
outString += "\r\n" + hireling.getName() + "(" + hireling.getObjectUUID() + ") slot : " + building.getHirelings().get(hireling);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
||||
|
||||
mobile = Mob.createMob(_mobileUUID,
|
||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||
null, true, serverZone, null, 0, "", 1);
|
||||
null, serverZone, null, null, "", 1);
|
||||
|
||||
if (mobile != null) {
|
||||
mobile.updateDatabase();
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -56,36 +57,41 @@ public class aiInfoCmd extends AbstractDevCmd {
|
||||
Mob mob = (Mob) target;
|
||||
output = "Mob AI Information:" + newline;
|
||||
output += mob.getName() + newline;
|
||||
if (mob.BehaviourType != null) {
|
||||
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
|
||||
if (mob.BehaviourType.BehaviourHelperType != null) {
|
||||
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
|
||||
if (mob.behaviourType != null) {
|
||||
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
||||
if (mob.behaviourType.BehaviourHelperType != null) {
|
||||
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline;
|
||||
} else {
|
||||
output += "Behaviour Helper Type: NULL" + newline;
|
||||
}
|
||||
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
|
||||
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
|
||||
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
|
||||
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
|
||||
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
|
||||
} else {
|
||||
output += "BehaviourType: NULL" + newline;
|
||||
}
|
||||
output += "Wimpy: " + mob.behaviourType.isWimpy + newline;
|
||||
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
|
||||
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
|
||||
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
|
||||
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
|
||||
} else {
|
||||
output += "BehaviourType: NULL" + newline;
|
||||
}
|
||||
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
||||
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
||||
if (mob.playerAgroMap.size() > 0) {
|
||||
output += "Players Loaded:" + newline;
|
||||
}
|
||||
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
|
||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
|
||||
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
|
||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
|
||||
}
|
||||
if (mob.getCombatTarget() != null)
|
||||
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
||||
else
|
||||
output += "Current Target: NULL" + newline;
|
||||
|
||||
if (mob.guardedCity != null)
|
||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
||||
|
||||
output += "Powers:" + newline;
|
||||
|
||||
for (int token : mob.mobPowers.keySet())
|
||||
output += token + newline;
|
||||
output += PowersManager.getPowerByToken(token).getName() + newline;
|
||||
|
||||
throwbackInfo(playerCharacter, output);
|
||||
}
|
||||
|
||||
@@ -520,9 +520,10 @@ public enum BuildingManager {
|
||||
if (building.getBlueprintUUID() == 0)
|
||||
return false;
|
||||
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size()) {
|
||||
Logger.error("failed at addHireling with contract: " + contract.getContractID());
|
||||
return false;
|
||||
|
||||
}
|
||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
|
||||
if (item.getChargesRemaining() > 0)
|
||||
@@ -535,7 +536,7 @@ public enum BuildingManager {
|
||||
|
||||
if (NPC.ISWallArcher(contract)) {
|
||||
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
|
||||
if (mob == null)
|
||||
return false;
|
||||
@@ -547,7 +548,7 @@ public enum BuildingManager {
|
||||
|
||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
|
||||
if (mob == null)
|
||||
return false;
|
||||
@@ -559,7 +560,7 @@ public enum BuildingManager {
|
||||
if (contract.getContractID() == 910) {
|
||||
|
||||
//guard dog
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
|
||||
if (mob == null)
|
||||
return false;
|
||||
|
||||
@@ -814,6 +814,9 @@ public enum CombatManager {
|
||||
else
|
||||
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
damage *= ((PlayerCharacter)ac).ZergMultiplier;
|
||||
}
|
||||
float d = 0f;
|
||||
|
||||
errorTrack = 12;
|
||||
@@ -826,7 +829,8 @@ public enum CombatManager {
|
||||
damage *= 2.5f; //increase damage if sitting
|
||||
|
||||
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
((Mob)tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
|
||||
((Mob) tarAc).handleDirectAggro(ac);
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,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) {
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false) {
|
||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -34,6 +35,11 @@ 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}));
|
||||
|
||||
// Drop Rates
|
||||
|
||||
public static float NORMAL_DROP_RATE;
|
||||
@@ -75,16 +81,13 @@ public enum LootManager {
|
||||
|
||||
public static void GenerateMobLoot(Mob mob) {
|
||||
|
||||
//determine if mob is in hotzone
|
||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
||||
|
||||
//iterate the booty sets
|
||||
|
||||
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)
|
||||
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
|
||||
for (Item it : mob.getInventory()) {
|
||||
@@ -102,38 +105,40 @@ public enum LootManager {
|
||||
|
||||
}
|
||||
|
||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob) {
|
||||
|
||||
boolean hotzoneWasRan = false;
|
||||
float dropRate = 1.0f;
|
||||
float dropRate = NORMAL_DROP_RATE;
|
||||
|
||||
// Iterate all entries in this bootySet and process accordingly
|
||||
|
||||
for (BootySetEntry bse : entries) {
|
||||
switch (bse.bootyType) {
|
||||
case "GOLD":
|
||||
GenerateGoldDrop(mob, bse, inHotzone);
|
||||
GenerateGoldDrop(mob, bse);
|
||||
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
|
||||
|
||||
// Generate hotzone loot if in hotzone
|
||||
// Only one bite at the hotzone apple per bootyset.
|
||||
|
||||
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
|
||||
hotzoneWasRan = true;
|
||||
GenerateLootDrop(mob, bse.genTable); //generate normal loot drop
|
||||
if(ThreadLocalRandom.current().nextInt(1,101) < mob.level && mob.parentZone.getSafeZone() == 0) {
|
||||
if (ThreadLocalRandom.current().nextInt(1, 10000) < mob.level) {
|
||||
if (_genTables.containsKey(bse.genTable + 1)) {
|
||||
int roll = ThreadLocalRandom.current().nextInt(1, 101);
|
||||
MobLoot extraLoot = null;
|
||||
if (roll >= 1 && roll <= 50) {
|
||||
extraLoot = rollForContract(bse.genTable, mob);
|
||||
}
|
||||
if (roll >= 51 && roll <= 94) {
|
||||
extraLoot = rollForRune(bse.genTable, mob);
|
||||
}
|
||||
if (roll >= 95) {
|
||||
extraLoot = rollForGlass(mob);
|
||||
}
|
||||
if (extraLoot != null) {
|
||||
mob.getCharItemManager().addItemToInventory(extraLoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "ITEM":
|
||||
GenerateInventoryDrop(mob, bse);
|
||||
@@ -142,14 +147,14 @@ public enum LootManager {
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
return null;
|
||||
|
||||
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);
|
||||
|
||||
@@ -167,7 +172,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
||||
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
itemTableRoll = TableRoll(mob.level, inHotzone);
|
||||
itemTableRoll = TableRoll(mob.level);
|
||||
}
|
||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
||||
if (tableRow == null)
|
||||
@@ -179,6 +184,9 @@ public enum LootManager {
|
||||
return null;
|
||||
|
||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||
int chance = ThreadLocalRandom.current().nextInt(1,101);
|
||||
if(chance > 5)
|
||||
return null;
|
||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||
}
|
||||
@@ -189,7 +197,7 @@ public enum LootManager {
|
||||
|
||||
if(selectedRow.pModTable != 0){
|
||||
try {
|
||||
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
|
||||
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll);
|
||||
outItem.setIsID(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
|
||||
@@ -197,7 +205,7 @@ public enum LootManager {
|
||||
}
|
||||
if(selectedRow.sModTable != 0){
|
||||
try {
|
||||
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
|
||||
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll);
|
||||
outItem.setIsID(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||
@@ -206,7 +214,7 @@ public enum LootManager {
|
||||
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);
|
||||
|
||||
@@ -223,7 +231,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) {
|
||||
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
prefixTableRoll = TableRoll(mob.level, inHotzone);
|
||||
prefixTableRoll = TableRoll(mob.level);
|
||||
}
|
||||
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
||||
|
||||
@@ -238,7 +246,7 @@ public enum LootManager {
|
||||
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);
|
||||
|
||||
@@ -255,7 +263,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) {
|
||||
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
suffixTableRoll = TableRoll(mob.level, inHotzone);
|
||||
suffixTableRoll = TableRoll(mob.level);
|
||||
}
|
||||
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
||||
|
||||
@@ -270,7 +278,7 @@ public enum LootManager {
|
||||
return inItem;
|
||||
}
|
||||
|
||||
public static int TableRoll(int mobLevel, Boolean inHotzone) {
|
||||
public static int TableRoll(int mobLevel) {
|
||||
|
||||
if (mobLevel > 65)
|
||||
mobLevel = 65;
|
||||
@@ -285,15 +293,12 @@ public enum LootManager {
|
||||
if (min < 70)
|
||||
min = 70;
|
||||
|
||||
if (inHotzone)
|
||||
min += mobLevel;
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||
|
||||
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);
|
||||
|
||||
@@ -304,14 +309,9 @@ public enum LootManager {
|
||||
|
||||
//determine and add gold to mob inventory
|
||||
|
||||
int high = bse.highGold;
|
||||
int low = bse.lowGold;
|
||||
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
|
||||
|
||||
if (inHotzone == true)
|
||||
gold = (int) (gold * HOTZONE_GOLD_RATE);
|
||||
else
|
||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
||||
int high = (int)(bse.highGold * NORMAL_GOLD_RATE);
|
||||
int low = (int)(bse.lowGold * NORMAL_GOLD_RATE);
|
||||
int gold = ThreadLocalRandom.current().nextInt(low, high);
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
@@ -320,15 +320,16 @@ public enum LootManager {
|
||||
|
||||
}
|
||||
|
||||
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
||||
public static void GenerateLootDrop(Mob mob, int tableID) {
|
||||
|
||||
try {
|
||||
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob);
|
||||
|
||||
if (toAdd != null)
|
||||
if (toAdd != null) {
|
||||
toAdd.setIsID(true);
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||
int i = 0;
|
||||
@@ -350,8 +351,24 @@ public enum LootManager {
|
||||
|
||||
if (equipmentRoll > dropChance)
|
||||
continue;
|
||||
|
||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||
ItemBase genericIB = me.getItemBase();
|
||||
if(genericIB.isVorg()){
|
||||
if(genericIB.isClothArmor()){
|
||||
//get random cloth piece
|
||||
genericIB = 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 = 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 = 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 = 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) {
|
||||
ml.setIsID(true);
|
||||
@@ -461,4 +478,66 @@ public enum LootManager {
|
||||
itemMan.addItemToInventory(playerWinnings);
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
|
||||
public static MobLoot rollForContract(int table, Mob mob){
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(table, 99, 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(1,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 MobLoot rollForRune(int table, Mob mob){
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(table, 97, 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(1,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 MobLoot rollForGlass( Mob mob){
|
||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(1,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public enum MaintenanceManager {
|
||||
|
||||
// Build list of buildings to apply maintenance on.
|
||||
|
||||
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.Building));
|
||||
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.City));
|
||||
maintList = buildMaintList(buildingList);
|
||||
|
||||
// Deduct upkeep and build list of buildings
|
||||
@@ -53,7 +53,10 @@ public enum MaintenanceManager {
|
||||
// Reset maintenance dates for these buildings
|
||||
|
||||
for (Building building : maintList) {
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||
if(derankList.contains(building) == false)
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||
else
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(1));
|
||||
|
||||
}
|
||||
// Derak or destroy buildings that did not
|
||||
@@ -74,7 +77,10 @@ public enum MaintenanceManager {
|
||||
|
||||
for (AbstractGameObject gameObject : buildingList) {
|
||||
|
||||
Building building = (Building) gameObject;
|
||||
Building building = ((City)gameObject).getTOL();//(Building) gameObject;
|
||||
|
||||
if(building == null)
|
||||
continue;
|
||||
|
||||
// No maintenance on NPC owned buildings (Cache loaded)
|
||||
|
||||
@@ -154,7 +160,8 @@ public enum MaintenanceManager {
|
||||
|
||||
// Cache maintenance cost value
|
||||
|
||||
maintCost = building.getMaintCost();
|
||||
//maintCost = building.getMaintCost();
|
||||
maintCost = 3000000;
|
||||
|
||||
// Something went wrong. Missing buildinggroup from switch?
|
||||
|
||||
@@ -225,9 +232,9 @@ public enum MaintenanceManager {
|
||||
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
||||
// and it's not an R8 deranking
|
||||
|
||||
if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
||||
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
||||
}
|
||||
//if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
||||
// building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
||||
//}
|
||||
|
||||
return false; // Early exit for having failed to meet maintenance
|
||||
}
|
||||
|
||||
@@ -23,14 +23,6 @@ public enum NPCManager {
|
||||
NPC_MANAGER;
|
||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
||||
|
||||
public static void LoadAllRuneSets() {
|
||||
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||
}
|
||||
|
||||
public static void LoadAllBootySets() {
|
||||
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
||||
}
|
||||
|
||||
public static void applyRuneSetEffects(Mob mob) {
|
||||
|
||||
// Early exit
|
||||
@@ -127,10 +119,12 @@ public enum NPCManager {
|
||||
|
||||
DbManager.removeFromCache(necroPet);
|
||||
|
||||
PlayerCharacter petOwner = necroPet.getOwner();
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
necroPet.setOwner(null);
|
||||
|
||||
necroPet.guardCaptain = null;
|
||||
petOwner.setPet(null);
|
||||
|
||||
if (updateOwner == false)
|
||||
@@ -228,12 +222,14 @@ public enum NPCManager {
|
||||
WorldGrid.removeObject(toRemove);
|
||||
DbManager.removeFromCache(toRemove);
|
||||
|
||||
PlayerCharacter petOwner = toRemove.getOwner();
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
|
||||
petOwner.setPet(null);
|
||||
toRemove.setOwner(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
@@ -340,10 +336,19 @@ public enum NPCManager {
|
||||
else
|
||||
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
||||
|
||||
// Override slot for siege engines
|
||||
|
||||
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
||||
Mob siegeMobile = (Mob) abstractCharacter;
|
||||
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
|
||||
}
|
||||
|
||||
if (buildingSlot == -1)
|
||||
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||
|
||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||
// Pets are regular mobiles not hirelings (Siege engines)
|
||||
if (abstractCharacter.contract != null)
|
||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||
|
||||
// Override bind and location for this npc derived
|
||||
// from BuildingManager slot location data.
|
||||
@@ -370,4 +375,53 @@ public enum NPCManager {
|
||||
|
||||
return buildingSlot;
|
||||
}
|
||||
|
||||
public static int getMaxMinions(Mob guardCaptain) {
|
||||
|
||||
int maxSlots;
|
||||
|
||||
switch (guardCaptain.getRank()) {
|
||||
case 3:
|
||||
maxSlots = 2;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
maxSlots = 3;
|
||||
break;
|
||||
case 6:
|
||||
maxSlots = 4;
|
||||
break;
|
||||
case 7:
|
||||
maxSlots = 5;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
default:
|
||||
maxSlots = 1;
|
||||
|
||||
}
|
||||
return maxSlots;
|
||||
}
|
||||
|
||||
public static void AssignPatrolPoints(Mob mob) {
|
||||
mob.patrolPoints = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
float patrolRadius = mob.getSpawnRadius();
|
||||
|
||||
if (patrolRadius > 256)
|
||||
patrolRadius = 256;
|
||||
|
||||
if (patrolRadius < 60)
|
||||
patrolRadius = 60;
|
||||
|
||||
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
|
||||
mob.patrolPoints.add(newPatrolPoint);
|
||||
|
||||
if (i == 1) {
|
||||
mob.loc = newPatrolPoint;
|
||||
mob.endLoc = newPatrolPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,15 +300,15 @@ public enum PowersManager {
|
||||
int time = pb.getRecycleTime(trains);
|
||||
|
||||
// verify player is in correct mode (combat/nonCombat)
|
||||
if (playerCharacter.isCombat()) {
|
||||
if (!pb.allowedInCombat())
|
||||
//if (playerCharacter.isCombat()) {
|
||||
// if (!pb.allowedInCombat())
|
||||
// ChatManager.chatPowerError(pc,
|
||||
// "This power is not allowed in combat mode.");
|
||||
return true;
|
||||
} else if (!pb.allowedOutOfCombat())
|
||||
// return true;
|
||||
//} else if (!pb.allowedOutOfCombat())
|
||||
// ChatManager.chatPowerError(pc,
|
||||
// "You must be in combat mode to use this power.");
|
||||
return true;
|
||||
// return true;
|
||||
|
||||
// verify player is not stunned or prohibited from casting
|
||||
PlayerBonuses bonus = playerCharacter.getBonuses();
|
||||
@@ -842,8 +842,6 @@ public enum PowersManager {
|
||||
return;
|
||||
}
|
||||
|
||||
playerCharacter.setHateValue(pb.getHateValue(trains));
|
||||
|
||||
//Send Cast Message.
|
||||
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||
// castMsg.setNumTrains(9999);
|
||||
@@ -894,8 +892,6 @@ public enum PowersManager {
|
||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||
if (!pb.isHarmful())
|
||||
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
|
||||
}
|
||||
|
||||
// update target of used power timer
|
||||
@@ -1468,6 +1464,27 @@ public enum PowersManager {
|
||||
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
|
||||
allTargets, playerCharacter, maxTargets);
|
||||
|
||||
trackChars = new HashSet<>();
|
||||
HashSet<AbstractWorldObject> allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER);
|
||||
ArrayList<Guild> nationsInRange = new ArrayList<>();
|
||||
//first round to add players in range
|
||||
for(AbstractWorldObject trackChar : allInRange){
|
||||
if(allInRange.contains(trackChar)) {
|
||||
trackChars.add((AbstractCharacter)trackChar);
|
||||
Guild nation = ((AbstractCharacter)trackChar).guild.getNation();
|
||||
if(nationsInRange.contains(nation) == false)
|
||||
nationsInRange.add(nation);
|
||||
}
|
||||
}
|
||||
//second round add all others in window if they share a nation with a current
|
||||
for(AbstractWorldObject trackChar : allInRange) {
|
||||
Guild nation = ((AbstractCharacter) trackChar).guild.getNation();
|
||||
if (allInRange.contains(trackChar) == true && nationsInRange.add(nation) == true && trackChars.contains(trackChar) == false)
|
||||
trackChars.add((AbstractCharacter) trackChar);
|
||||
else if(((AbstractCharacter) trackChar).guild.getNation().equals(playerCharacter.guild.getNation()))
|
||||
trackChars.add((AbstractCharacter) trackChar);
|
||||
}
|
||||
|
||||
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
||||
|
||||
// send track window
|
||||
|
||||
@@ -10,7 +10,6 @@ package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -31,7 +30,6 @@ public enum SimulationManager {
|
||||
SERVERHEARTBEAT;
|
||||
|
||||
private static final long CITY_PULSE = 2000;
|
||||
private static final long MINE_PULSE = 2000;
|
||||
private static final long RUNEGATE_PULSE = 3000;
|
||||
private static final long UPDATE_PULSE = 1000;
|
||||
private static final long FlIGHT_PULSE = 100;
|
||||
@@ -39,7 +37,7 @@ public enum SimulationManager {
|
||||
public static Duration executionMax = Duration.ofNanos(1);
|
||||
private static SimulationManager instance = null;
|
||||
private long _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
private long _minePulseTime = System.currentTimeMillis() + MINE_PULSE;
|
||||
private long _minePulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
private long _runegatePulseTime = System.currentTimeMillis()
|
||||
+ RUNEGATE_PULSE;
|
||||
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
|
||||
@@ -132,18 +130,7 @@ public enum SimulationManager {
|
||||
pulseMines();
|
||||
} catch (Exception e) {
|
||||
Logger.error(
|
||||
"Fatal error in City Pulse: DISABLED. Error Message : "
|
||||
+ e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
try {
|
||||
if ((_minePulseTime != 0)
|
||||
&& (System.currentTimeMillis() > _minePulseTime))
|
||||
pulseMines();
|
||||
} catch (Exception e) {
|
||||
Logger.error(
|
||||
"Fatal error in City Pulse: DISABLED. Error Message : "
|
||||
"Fatal error in Mine Pulse: DISABLED. Error Message : "
|
||||
+ e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -175,8 +162,6 @@ public enum SimulationManager {
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
|
||||
player.update();
|
||||
}
|
||||
|
||||
@@ -226,31 +211,9 @@ public enum SimulationManager {
|
||||
city = (City) cityObject;
|
||||
city.onEnter();
|
||||
}
|
||||
|
||||
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
}
|
||||
private void pulseMines() {
|
||||
|
||||
Mine mine;
|
||||
|
||||
// *** Refactor: Need a list cached somewhere as it doesn't change very
|
||||
// often at all. Have a cityListIsDirty boolean that gets set if it
|
||||
// needs an update. Will speed up this method a great deal.
|
||||
|
||||
Collection<AbstractGameObject> mineList = DbManager.getList(Enum.GameObjectType.Mine);
|
||||
|
||||
if (mineList == null) {
|
||||
Logger.info("City List null");
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbstractGameObject mineObject : mineList) {
|
||||
mine = (Mine) mineObject;
|
||||
mine.onEnter();
|
||||
}
|
||||
|
||||
_minePulseTime = System.currentTimeMillis() + MINE_PULSE;
|
||||
}
|
||||
/*
|
||||
* Method runs proximity collision detection for all active portals on the
|
||||
* game's Runegates
|
||||
@@ -264,4 +227,21 @@ public enum SimulationManager {
|
||||
_runegatePulseTime = System.currentTimeMillis() + RUNEGATE_PULSE;
|
||||
|
||||
}
|
||||
private void pulseMines(){
|
||||
Mine mine;
|
||||
Collection<AbstractGameObject> mineList = DbManager.getList(Enum.GameObjectType.Mine);
|
||||
|
||||
if (mineList == null) {
|
||||
Logger.info("Mine List null");
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbstractGameObject mineObject : mineList) {
|
||||
mine = (Mine) mineObject;
|
||||
if(mine.isActive)
|
||||
mine.onEnter();
|
||||
}
|
||||
|
||||
_minePulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
package engine.gameManager;
|
||||
|
||||
public class ZergManager {
|
||||
public static float getMultiplier5Man(int count){
|
||||
float multiplier = 1.0f;
|
||||
switch(count){
|
||||
case 1:
|
||||
case 2:
|
||||
multiplier += 0.0f;
|
||||
break;
|
||||
case 3:
|
||||
multiplier += 0.55f;
|
||||
break;
|
||||
case 4:
|
||||
multiplier += 0.2f;
|
||||
break;
|
||||
case 5:
|
||||
multiplier += 0.0f;
|
||||
break;
|
||||
case 6:
|
||||
multiplier -= 0.2f;
|
||||
break;
|
||||
case 7:
|
||||
multiplier -= 0.35f;
|
||||
break;
|
||||
case 8:
|
||||
multiplier -= 0.50f;
|
||||
break;
|
||||
case 9:
|
||||
multiplier -= 0.750f;
|
||||
break;
|
||||
default:
|
||||
multiplier -= 1.0f;
|
||||
break;
|
||||
}
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
public static float getMultiplier10Man(int count){
|
||||
float multiplier = 1.0f;
|
||||
if(count <=4)
|
||||
return 0.0f;
|
||||
switch(count){
|
||||
case 5:
|
||||
multiplier += 0.5f;
|
||||
break;
|
||||
case 6:
|
||||
multiplier += 0.4f;
|
||||
break;
|
||||
case 7:
|
||||
multiplier += 0.3f;
|
||||
break;
|
||||
case 8:
|
||||
multiplier += 0.2f;
|
||||
break;
|
||||
case 9:
|
||||
multiplier += 0.1f;
|
||||
break;
|
||||
case 10:
|
||||
multiplier += 0.0f;
|
||||
break;
|
||||
case 11:
|
||||
multiplier -= 0.1f;
|
||||
break;
|
||||
case 12:
|
||||
multiplier -= 0.2f;
|
||||
break;
|
||||
case 13:
|
||||
multiplier -= 0.3f;
|
||||
break;
|
||||
case 14:
|
||||
multiplier -= 0.4f;
|
||||
break;
|
||||
case 15:
|
||||
multiplier -= 0.5f;
|
||||
break;
|
||||
case 16:
|
||||
multiplier -= 0.65f;
|
||||
break;
|
||||
case 17:
|
||||
multiplier -= 0.75f;
|
||||
break;
|
||||
case 18:
|
||||
multiplier -= 0.85f;
|
||||
break;
|
||||
default:
|
||||
multiplier -= 1.0f;
|
||||
break;
|
||||
}
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
public static float getMultiplier20Man(int count){
|
||||
float multiplier = 1.0f;
|
||||
if(count < 10){
|
||||
multiplier += 1.25f;
|
||||
}else {
|
||||
switch (count) {
|
||||
case 10:
|
||||
multiplier += 0.8f;
|
||||
break;
|
||||
case 11:
|
||||
multiplier += 0.65f;
|
||||
break;
|
||||
case 12:
|
||||
multiplier += 0.54f;
|
||||
break;
|
||||
case 13:
|
||||
multiplier += 0.46f;
|
||||
break;
|
||||
case 14:
|
||||
multiplier += 0.36f;
|
||||
break;
|
||||
case 15:
|
||||
multiplier += 0.28f;
|
||||
break;
|
||||
case 16:
|
||||
multiplier += 0.21f;
|
||||
break;
|
||||
case 17:
|
||||
multiplier += 0.15f;
|
||||
break;
|
||||
case 18:
|
||||
multiplier += 0.09f;
|
||||
break;
|
||||
case 19:
|
||||
multiplier += 0.04f;
|
||||
break;
|
||||
case 20:
|
||||
multiplier += 0.00f;
|
||||
break;
|
||||
case 21:
|
||||
multiplier -= 0.04f;
|
||||
break;
|
||||
case 22:
|
||||
multiplier -= 0.09f;
|
||||
break;
|
||||
case 23:
|
||||
multiplier -= 0.15f;
|
||||
break;
|
||||
case 24:
|
||||
multiplier -= 0.21f;
|
||||
break;
|
||||
case 25:
|
||||
multiplier -= 0.28f;
|
||||
break;
|
||||
case 26:
|
||||
multiplier -= 0.36f;
|
||||
break;
|
||||
case 27:
|
||||
multiplier -= 0.46f;
|
||||
break;
|
||||
case 28:
|
||||
multiplier -= 0.54f;
|
||||
break;
|
||||
case 29:
|
||||
multiplier -= 0.65f;
|
||||
break;
|
||||
default:
|
||||
multiplier -= 0.75f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
|
||||
if (this.target == null || (!(this.target instanceof Mob)))
|
||||
return;
|
||||
|
||||
((Mob) this.target).setFearedObject(null);
|
||||
((Mob) this.target).fearedObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
|
||||
if (this.target == null || (!(this.target instanceof Mob)))
|
||||
return;
|
||||
|
||||
((Mob) this.target).setFearedObject(null);
|
||||
((Mob) this.target).fearedObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,15 @@ public class ModTableEntry {
|
||||
|
||||
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||
|
||||
for (ModTableEntry iteration : itemTableEntryList)
|
||||
if(itemTableEntryList == null)
|
||||
return null;
|
||||
|
||||
for (ModTableEntry iteration : itemTableEntryList) {
|
||||
if (iteration == null)
|
||||
continue;
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
modTableEntry = iteration;
|
||||
|
||||
}
|
||||
return modTableEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public class Bounds {
|
||||
//player is inside building region, skip collision check. we only do collision from the outside.
|
||||
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
||||
continue;
|
||||
if (building.getBounds().colliders == null)
|
||||
if (building.getBounds() == null || building.getBounds().colliders == null)
|
||||
continue;
|
||||
|
||||
for (Colliders collider : building.getBounds().colliders) {
|
||||
|
||||
@@ -96,7 +96,7 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.BehaviourType.callsForHelp)
|
||||
if (mob.behaviourType.callsForHelp)
|
||||
MobCallForHelp(mob);
|
||||
|
||||
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
||||
@@ -155,7 +155,9 @@ public class MobAI {
|
||||
public static void AttackBuilding(Mob mob, Building target) {
|
||||
|
||||
try {
|
||||
|
||||
if(target == null){
|
||||
return;
|
||||
}
|
||||
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
@@ -165,7 +167,7 @@ public class MobAI {
|
||||
|
||||
if (playercity != null)
|
||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
||||
if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||
if (guard.behaviourType != null && guard.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
|
||||
guard.setCombatTarget(mob);
|
||||
|
||||
@@ -202,6 +204,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
mob.setCombatTarget(null);
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -260,7 +263,7 @@ public class MobAI {
|
||||
|
||||
//guard captains inherit barracks patrol points dynamically
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
|
||||
Building barracks = mob.building;
|
||||
|
||||
@@ -280,7 +283,7 @@ public class MobAI {
|
||||
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
|
||||
if (mob.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet())
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
@@ -312,9 +315,9 @@ public class MobAI {
|
||||
|
||||
int contractID;
|
||||
|
||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
||||
contractID = mob.npcOwner.contract.getContractID();
|
||||
else
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
||||
contractID = mob.guardCaptain.contract.getContractID();
|
||||
else
|
||||
contractID = mob.contract.getContractID();
|
||||
|
||||
if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
|
||||
@@ -350,7 +353,7 @@ public class MobAI {
|
||||
ArrayList<Integer> purgeTokens;
|
||||
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.BehaviourType.callsForHelp)
|
||||
if (mob.behaviourType.callsForHelp)
|
||||
MobCallForHelp(mob);
|
||||
|
||||
// Generate a list of tokens from the mob powers for this mobile.
|
||||
@@ -433,7 +436,7 @@ public class MobAI {
|
||||
ArrayList<Integer> purgeTokens;
|
||||
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.BehaviourType.callsForHelp)
|
||||
if (mob.behaviourType.callsForHelp)
|
||||
MobCallForHelp(mob);
|
||||
|
||||
// Generate a list of tokens from the mob powers for this mobile.
|
||||
@@ -564,7 +567,7 @@ public class MobAI {
|
||||
Zone mobCamp = mob.getParentZone();
|
||||
|
||||
for (Mob helper : mobCamp.zoneMobSet) {
|
||||
if (helper.BehaviourType.respondsToCallForHelp && helper.BehaviourType.BehaviourHelperType.equals(mob.BehaviourType)) {
|
||||
if (helper.behaviourType.respondsToCallForHelp && helper.behaviourType.BehaviourHelperType.equals(mob.behaviourType)) {
|
||||
helper.setCombatTarget(mob.getCombatTarget());
|
||||
callGotResponse = true;
|
||||
}
|
||||
@@ -608,8 +611,8 @@ public class MobAI {
|
||||
|
||||
if (mob.despawned && mob.isPlayerGuard) {
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
|
||||
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) {
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
|
||||
|
||||
//minions don't respawn while guard captain is dead
|
||||
|
||||
@@ -625,7 +628,7 @@ public class MobAI {
|
||||
|
||||
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
|
||||
|
||||
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false)
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
return;
|
||||
@@ -646,7 +649,7 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false)
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
if (mob.getCombatTarget() != null) {
|
||||
@@ -673,7 +676,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
|
||||
switch (mob.BehaviourType) {
|
||||
switch (mob.behaviourType) {
|
||||
case GuardCaptain:
|
||||
GuardCaptainLogic(mob);
|
||||
break;
|
||||
@@ -684,6 +687,7 @@ public class MobAI {
|
||||
GuardWallArcherLogic(mob);
|
||||
break;
|
||||
case Pet1:
|
||||
case SiegeEngine:
|
||||
PetLogic(mob);
|
||||
break;
|
||||
case HamletGuard:
|
||||
@@ -693,8 +697,6 @@ public class MobAI {
|
||||
DefaultLogic(mob);
|
||||
break;
|
||||
}
|
||||
if(mob.isAlive())
|
||||
RecoverHealth(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||
}
|
||||
@@ -709,7 +711,7 @@ public class MobAI {
|
||||
if (!aiAgent.isAlive())
|
||||
return;
|
||||
|
||||
ConcurrentHashMap<Integer, Boolean> loadedPlayers = aiAgent.playerAgroMap;
|
||||
ConcurrentHashMap<Integer, Float> loadedPlayers = aiAgent.playerAgroMap;
|
||||
|
||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||
|
||||
@@ -784,33 +786,39 @@ public class MobAI {
|
||||
|
||||
mob.updateLocation();
|
||||
|
||||
switch (mob.BehaviourType) {
|
||||
switch (mob.behaviourType) {
|
||||
|
||||
case Pet1:
|
||||
if (mob.getOwner() == null)
|
||||
|
||||
|
||||
if ((PlayerCharacter) mob.guardCaptain == null)
|
||||
return;
|
||||
|
||||
if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) {
|
||||
|
||||
if (!mob.playerAgroMap.containsKey(((PlayerCharacter) mob.guardCaptain).getObjectUUID())) {
|
||||
|
||||
//mob no longer has its owner loaded, translocate pet to owner
|
||||
|
||||
MovementManager.translocate(mob, mob.getOwner().getLoc(), null);
|
||||
|
||||
MovementManager.translocate(mob, ((PlayerCharacter) mob.guardCaptain).getLoc(), null);
|
||||
return;
|
||||
}
|
||||
if (mob.getCombatTarget() == null) {
|
||||
|
||||
//move back to owner
|
||||
|
||||
if (CombatUtilities.inRange2D(mob, mob.getOwner(), 6))
|
||||
|
||||
if (CombatUtilities.inRange2D(mob, (PlayerCharacter) mob.guardCaptain, 6))
|
||||
return;
|
||||
|
||||
mob.destination = mob.getOwner().getLoc();
|
||||
|
||||
mob.destination = ((PlayerCharacter) mob.guardCaptain).getLoc();
|
||||
MovementUtilities.moveToLocation(mob, mob.destination, 5);
|
||||
} else
|
||||
chaseTarget(mob);
|
||||
break;
|
||||
case GuardMinion:
|
||||
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null)
|
||||
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned)
|
||||
randomGuardPatrolPoint(mob);
|
||||
else {
|
||||
if (mob.getCombatTarget() != null) {
|
||||
@@ -829,7 +837,6 @@ public class MobAI {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||
@@ -896,7 +903,8 @@ public class MobAI {
|
||||
if (mob.getCombatTarget() == null)
|
||||
return;
|
||||
|
||||
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
|
||||
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
|
||||
mob.behaviourType.equals(Enum.MobBehaviourType.Pet1) == false) {
|
||||
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
@@ -912,10 +920,10 @@ public class MobAI {
|
||||
private static void CheckToSendMobHome(Mob mob) {
|
||||
|
||||
try {
|
||||
if (mob.BehaviourType.isAgressive) {
|
||||
if (mob.behaviourType.isAgressive) {
|
||||
|
||||
if (mob.isPlayerGuard()) {
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
CheckForAggro(mob);
|
||||
@@ -935,7 +943,7 @@ public class MobAI {
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain) && mob.isAlive()) {
|
||||
|
||||
//guard captain pulls his minions home with him
|
||||
|
||||
@@ -951,8 +959,8 @@ public class MobAI {
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
for (Entry playerEntry : mob.playerAgroMap.entrySet())
|
||||
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
||||
for (Integer playerEntry : mob.playerAgroMap.keySet())
|
||||
mob.playerAgroMap.put(playerEntry,0f);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||
@@ -1016,7 +1024,7 @@ public class MobAI {
|
||||
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD)))
|
||||
continue;
|
||||
|
||||
if(aggroMob.BehaviourType.equals(Enum.MobBehaviourType.Pet1))
|
||||
if (aggroMob.behaviourType.equals(Enum.MobBehaviourType.Pet1))
|
||||
continue;
|
||||
|
||||
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
|
||||
@@ -1046,6 +1054,7 @@ public class MobAI {
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
@@ -1056,15 +1065,29 @@ public class MobAI {
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
GuardCaptainLogic(mob);
|
||||
if (!mob.guardCaptain.isAlive()) {
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
|
||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||
|
||||
if (newTarget != null) {
|
||||
|
||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||
mob.setCombatTarget(newTarget);
|
||||
} else
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (mob.npcOwner.getCombatTarget() != null)
|
||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||
else
|
||||
if (mob.getCombatTarget() != null)
|
||||
mob.setCombatTarget(null);
|
||||
if (mob.guardCaptain.getCombatTarget() != null)
|
||||
mob.setCombatTarget(mob.guardCaptain.getCombatTarget());
|
||||
else if (mob.getCombatTarget() != null)
|
||||
mob.setCombatTarget(null);
|
||||
}
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
@@ -1089,14 +1112,31 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if (mob.getOwner() == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
||||
|
||||
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
|
||||
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
|
||||
mob.killCharacter("no owner");
|
||||
|
||||
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
|
||||
if (MovementUtilities.canMove(mob) && mob.behaviourType.canRoam)
|
||||
CheckMobMovement(mob);
|
||||
|
||||
CheckForAttack(mob);
|
||||
|
||||
//recover health
|
||||
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
if (mob.getHealth() < mob.getHealthMax()) {
|
||||
|
||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||
}
|
||||
@@ -1127,7 +1167,7 @@ public class MobAI {
|
||||
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false)
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
if (mob.BehaviourType.isAgressive) {
|
||||
if (mob.behaviourType.isAgressive) {
|
||||
|
||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||
|
||||
@@ -1135,7 +1175,7 @@ public class MobAI {
|
||||
mob.setCombatTarget(newTarget);
|
||||
else {
|
||||
if (mob.getCombatTarget() == null) {
|
||||
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
|
||||
if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard)
|
||||
SafeGuardAggro(mob); //safehold guard
|
||||
else
|
||||
CheckForAggro(mob); //normal aggro
|
||||
@@ -1145,12 +1185,12 @@ public class MobAI {
|
||||
|
||||
//check if mob can move for patrol or moving to target
|
||||
|
||||
if (mob.BehaviourType.canRoam)
|
||||
if (mob.behaviourType.canRoam)
|
||||
CheckMobMovement(mob);
|
||||
|
||||
//check if mob can attack if it isn't wimpy
|
||||
|
||||
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
|
||||
if (!mob.behaviourType.isWimpy && mob.getCombatTarget() != null)
|
||||
CheckForAttack(mob);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -1167,7 +1207,7 @@ public class MobAI {
|
||||
if (!mob.isAlive())
|
||||
return;
|
||||
|
||||
ConcurrentHashMap<Integer, Boolean> loadedPlayers = mob.playerAgroMap;
|
||||
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap;
|
||||
|
||||
for (Entry playerEntry : loadedPlayers.entrySet()) {
|
||||
|
||||
@@ -1215,8 +1255,8 @@ public class MobAI {
|
||||
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
|
||||
return false;
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
|
||||
if (((Mob) mob.npcOwner).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardMinion)) {
|
||||
if (((Mob) mob.guardCaptain).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
return true;
|
||||
}
|
||||
} else if (mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
|
||||
@@ -1300,7 +1340,7 @@ public class MobAI {
|
||||
|
||||
MovementUtilities.aiMove(mob, mob.destination, true);
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
|
||||
if (mob.behaviourType.equals(Enum.MobBehaviourType.GuardCaptain)) {
|
||||
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
|
||||
|
||||
//make sure mob is out of combat stance
|
||||
@@ -1327,7 +1367,7 @@ public class MobAI {
|
||||
float CurrentHateValue = 0;
|
||||
|
||||
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
|
||||
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue();
|
||||
|
||||
AbstractWorldObject mostHatedTarget = null;
|
||||
|
||||
@@ -1338,8 +1378,8 @@ public class MobAI {
|
||||
if (potentialTarget.equals(mob.getCombatTarget()))
|
||||
continue;
|
||||
|
||||
if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
CurrentHateValue = potentialTarget.getHateValue();
|
||||
if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue();
|
||||
mostHatedTarget = potentialTarget;
|
||||
}
|
||||
|
||||
@@ -1350,22 +1390,4 @@ public class MobAI {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void RecoverHealth(Mob mob){
|
||||
//recover health
|
||||
|
||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||
if (mob.getHealth() < mob.getHealthMax()) {
|
||||
|
||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class CombatUtilities {
|
||||
}
|
||||
|
||||
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
||||
return entity1.getLoc().distance2D(entity2.getLoc()) < range;
|
||||
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
|
||||
}
|
||||
|
||||
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
||||
|
||||
@@ -13,10 +13,10 @@ import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -38,7 +38,7 @@ public class MovementUtilities {
|
||||
if (agent.getContract() != null)
|
||||
guardCaptain = agent;
|
||||
else
|
||||
guardCaptain = (Mob) agent.npcOwner;
|
||||
guardCaptain = (Mob) agent.guardCaptain;
|
||||
|
||||
if (guardCaptain != null) {
|
||||
Building barracks = guardCaptain.building;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.net.client;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.MsgSendException;
|
||||
@@ -560,12 +561,17 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (!itemManager.inventoryContains(i))
|
||||
return;
|
||||
|
||||
if (i.isCanDestroy())
|
||||
if (i.isCanDestroy()) {
|
||||
if (itemManager.delete(i) == true) {
|
||||
int value = i.getItemBase().getBaseValue();
|
||||
if(i.getItemBase().isStatRune())
|
||||
value = 500000;
|
||||
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
|
||||
sourcePlayer.getCharItemManager().updateInventory();
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
||||
@@ -1888,6 +1894,17 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
break;
|
||||
case LEAVEREQUEST:
|
||||
origin.disconnect();
|
||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
|
||||
if(origin.machineID.equals(pc.getClientConnection().machineID))
|
||||
sameMachine.add(pc);
|
||||
}
|
||||
if(sameMachine.isEmpty() == false){
|
||||
if(sameMachine.get(0) != null) {
|
||||
sameMachine.get(0).isBoxed = false;
|
||||
ChatManager.chatSystemInfo(sameMachine.get(0), "You Are No Longer Flagged 'Boxed'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case POWER:
|
||||
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
||||
|
||||
@@ -57,6 +57,21 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,13 +93,20 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
if (building.getBlueprint().getSlotsForRank(building.getRank()) == 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!");
|
||||
@@ -104,10 +126,33 @@ 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.canSlotinBuilding(building) == false)
|
||||
return false;
|
||||
if (contract.getContractID() == 866)//banker
|
||||
override = true;
|
||||
|
||||
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(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;
|
||||
|
||||
|
||||
@@ -66,6 +66,9 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
// Send Guild, Nation and IC MOTD
|
||||
GuildManager.enterWorldMOTD(player);
|
||||
ChatManager.sendSystemMessage(player, ConfigManager.MB_WORLD_GREETING.getValue());
|
||||
ChatManager.sendSystemMessage(player, "Gold Drop Rate: " + ConfigManager.MB_NORMAL_GOLD_RATE.getValue());
|
||||
ChatManager.sendSystemMessage(player, "Loot Drop Rate: " + ConfigManager.MB_NORMAL_DROP_RATE.getValue());
|
||||
ChatManager.sendSystemMessage(player, "Experience Rate: " + ConfigManager.MB_NORMAL_EXP_RATE.getValue());
|
||||
|
||||
// Send branch string if available from ConfigManager.
|
||||
|
||||
|
||||
@@ -61,15 +61,6 @@ public class CityDataHandler extends AbstractClientMsgHandler {
|
||||
dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
// If the hotZone has changed then update the client's map accordingly.
|
||||
|
||||
if (playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
||||
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
playerCharacter.setTimeStamp("hotzoneupdate", System.currentTimeMillis() - 100);
|
||||
}
|
||||
|
||||
// Serialize the realms for this map
|
||||
|
||||
WorldRealmMsg worldRealmMsg = new WorldRealmMsg();
|
||||
|
||||
@@ -294,7 +294,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Owner is obviously allowed to upgrade his own buildings
|
||||
|
||||
if (building.getOwner().equals(player)) {
|
||||
if (building.getOwner() != null && building.getOwner().equals(player)) {
|
||||
|
||||
// Players cannot destroy or transfer a TOL.
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
Building shrineBuilding;
|
||||
Shrine shrine;
|
||||
|
||||
if (npc.getGuild() != player.getGuild())
|
||||
if (npc.getGuild().getNation() != player.getGuild().getNation())
|
||||
return;
|
||||
|
||||
shrineBuilding = npc.getBuilding();
|
||||
|
||||
@@ -8,7 +8,6 @@ import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -42,7 +41,6 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (player == null)
|
||||
return true;
|
||||
|
||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||
|
||||
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
||||
@@ -63,10 +61,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||
|
||||
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||
if (!npc.siegeMinionMap.containsKey(toRemove))
|
||||
return true;
|
||||
|
||||
npc.getSiegeMinionMap().remove(toRemove);
|
||||
npc.siegeMinionMap.remove(toRemove);
|
||||
|
||||
WorldGrid.RemoveWorldObject(toRemove);
|
||||
|
||||
@@ -74,14 +72,18 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||
|
||||
DbManager.removeFromCache(toRemove);
|
||||
PlayerCharacter petOwner = toRemove.getOwner();
|
||||
|
||||
if (petOwner != null) {
|
||||
petOwner.setPet(null);
|
||||
toRemove.setOwner(null);
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
petOwner.setPet(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
// we Found the move to remove, lets break the for loop so it doesnt look for more.
|
||||
@@ -115,7 +117,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (npc.getContractID() == 842)
|
||||
maxSlots = 1;
|
||||
|
||||
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||
if (npc.siegeMinionMap.size() == maxSlots)
|
||||
return true;
|
||||
|
||||
int mobBase;
|
||||
@@ -146,42 +148,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (mobBase == 0)
|
||||
return true;
|
||||
|
||||
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
|
||||
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
|
||||
|
||||
if (siegeMob == null)
|
||||
return true;
|
||||
|
||||
if (siegeMob != null) {
|
||||
|
||||
siegeMob.setSpawnTime(60 * 15);
|
||||
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
|
||||
|
||||
siegeMob.building = building;
|
||||
siegeMob.parentZone = zone;
|
||||
|
||||
// Slot siege minion
|
||||
// Can be either corner tower or bulwark.
|
||||
|
||||
int slot;
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
|
||||
slot = 2;
|
||||
else
|
||||
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
|
||||
|
||||
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
|
||||
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
|
||||
|
||||
// Rotate slot position by the building rotation
|
||||
|
||||
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
|
||||
|
||||
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||
|
||||
zone.zoneMobSet.add(siegeMob);
|
||||
siegeMob.setLoc(siegeMob.bindLoc);
|
||||
}
|
||||
}
|
||||
|
||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||
@@ -228,11 +198,14 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||
|
||||
DbManager.removeFromCache(toRemove);
|
||||
PlayerCharacter petOwner = toRemove.getOwner();
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
petOwner.setPet(null);
|
||||
toRemove.setOwner(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
@@ -298,14 +271,14 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
String pirateName = NPCManager.getPirateName(mobBase);
|
||||
|
||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||
return true;
|
||||
|
||||
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
|
||||
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
|
||||
|
||||
if (toCreate == null)
|
||||
return true;
|
||||
|
||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||
return true;
|
||||
|
||||
if (toCreate != null) {
|
||||
toCreate.setDeathTime(System.currentTimeMillis());
|
||||
toCreate.parentZone.zoneMobSet.add(toCreate);
|
||||
|
||||
@@ -439,8 +439,10 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
// }
|
||||
// break;
|
||||
//}
|
||||
|
||||
LootManager.peddleFate(player,item);
|
||||
int i = 0;
|
||||
if(i != 0) {
|
||||
LootManager.peddleFate(player, item);
|
||||
}
|
||||
break;
|
||||
|
||||
case 30: //water bucket
|
||||
|
||||
@@ -212,10 +212,6 @@ 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());
|
||||
|
||||
@@ -223,10 +219,6 @@ 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) {
|
||||
@@ -541,7 +533,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||
|
||||
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
||||
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
||||
|
||||
if (mob == null)
|
||||
return true;
|
||||
|
||||
@@ -800,7 +800,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||
treeObject.setParentZone(zoneObject);
|
||||
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(7));
|
||||
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(14));
|
||||
|
||||
// Update guild binds and tags
|
||||
//load the new city on the clients
|
||||
|
||||
@@ -343,7 +343,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.putInt(0); //runemaster list
|
||||
|
||||
//artillery captain list
|
||||
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.getSiegeMinionMap();
|
||||
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.siegeMinionMap;
|
||||
writer.putInt(1 + siegeMinions.size());
|
||||
serializeBulwarkList(writer, 1); //Trebuchet
|
||||
//serializeBulwarkList(writer, 2); //Ballista
|
||||
@@ -366,7 +366,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
long timeLife = upgradeTime - curTime;
|
||||
|
||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||
if (mob.npcOwner.isAlive()) {
|
||||
if (mob.guardCaptain.isAlive()) {
|
||||
writer.put((byte) 0);//shows respawning timer
|
||||
writer.putInt(mob.spawnTime);
|
||||
writer.putInt(mob.spawnTime);
|
||||
@@ -557,7 +557,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
|
||||
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
||||
|
||||
mobA = Mob.getFromCacheDBID(this.targetID);
|
||||
mobA = Mob.getMob(this.targetID);
|
||||
|
||||
if (mobA == null) {
|
||||
Logger.error("Missing Mob of ID " + this.targetID);
|
||||
@@ -689,7 +689,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
long timeLife = upgradeTime - curTime;
|
||||
|
||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||
if (mob.npcOwner.isAlive()) {
|
||||
if (mob.guardCaptain.isAlive()) {
|
||||
writer.put((byte) 0);//shows respawning timer
|
||||
writer.putInt(mob.spawnTime);
|
||||
writer.putInt(mob.spawnTime);
|
||||
|
||||
@@ -52,8 +52,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
public int contractUUID;
|
||||
public Contract contract;
|
||||
|
||||
protected String firstName;
|
||||
protected String lastName;
|
||||
public String firstName;
|
||||
public String lastName;
|
||||
protected short statStrCurrent;
|
||||
protected short statDexCurrent;
|
||||
protected short statConCurrent;
|
||||
@@ -117,16 +117,33 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
protected boolean movingUp = false;
|
||||
private float desiredAltitude = 0;
|
||||
private long takeOffTime = 0;
|
||||
private float hateValue = 0;
|
||||
private long lastHateUpdate = 0;
|
||||
private boolean collided = false;
|
||||
private byte aoecntr = 0;
|
||||
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
|
||||
public AbstractCharacter() {
|
||||
super();
|
||||
this.firstName = "";
|
||||
this.lastName = "";
|
||||
|
||||
this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
this.statStrCurrent = (short) 0;
|
||||
this.statDexCurrent = (short) 0;
|
||||
this.statConCurrent = (short) 0;
|
||||
this.statIntCurrent = (short) 0;
|
||||
this.statSpiCurrent = (short) 0;
|
||||
|
||||
this.unusedStatPoints = (short) 0;
|
||||
|
||||
this.level = (short) 0; // TODO get this from MobsBase later
|
||||
this.exp = 1;
|
||||
this.walkMode = true;
|
||||
this.bindLoc = Vector3fImmutable.ZERO;
|
||||
this.faceDir = Vector3fImmutable.ZERO;
|
||||
|
||||
this.runningTrains = (byte) 0;
|
||||
|
||||
this.skills = new ConcurrentHashMap<>();
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
this.initializeCharacter();
|
||||
|
||||
}
|
||||
@@ -214,8 +231,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
this.initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,8 +273,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
this.initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,8 +304,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,9 +353,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
|
||||
this.initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
public static int getBankCapacity() {
|
||||
@@ -1758,29 +1766,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.inBuildingID = inBuildingID;
|
||||
}
|
||||
|
||||
public float getHateValue() {
|
||||
if (this.hateValue <= 0) {
|
||||
this.hateValue = 0;
|
||||
return hateValue;
|
||||
}
|
||||
|
||||
if (this.lastHateUpdate == 0) {
|
||||
this.lastHateUpdate = System.currentTimeMillis();
|
||||
return this.hateValue;
|
||||
}
|
||||
long duration = System.currentTimeMillis() - this.lastHateUpdate;
|
||||
//convert duration to seconds and multiply Hate Delimiter.
|
||||
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
|
||||
this.hateValue -= modAmount;
|
||||
this.lastHateUpdate = System.currentTimeMillis();
|
||||
return this.hateValue;
|
||||
}
|
||||
|
||||
public void setHateValue(float hateValue) {
|
||||
this.lastHateUpdate = System.currentTimeMillis();
|
||||
this.hateValue = hateValue;
|
||||
}
|
||||
|
||||
public int getInFloorID() {
|
||||
return inFloorID;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.objects;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSet;
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
@@ -31,7 +32,20 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
protected Vector3fImmutable lastBindLoc;
|
||||
public boolean assist = false;
|
||||
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
||||
public boolean isPlayerGuard = false;
|
||||
public AbstractCharacter guardCaptain;
|
||||
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||
;
|
||||
public Enum.MobBehaviourType behaviourType;
|
||||
public ArrayList<Vector3fImmutable> patrolPoints;
|
||||
public int lastPatrolPointIndex = 0;
|
||||
public long stopPatrolTime = 0;
|
||||
public City guardedCity;
|
||||
|
||||
public AbstractIntelligenceAgent() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
@@ -87,7 +101,8 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
this.agentType = Enum.AIAgentType.CHARMED;
|
||||
|
||||
if (this.getObjectType().equals(GameObjectType.Mob)) {
|
||||
((Mob) this).setOwner(owner);
|
||||
|
||||
((Mob) this).guardCaptain = owner;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,14 +125,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public PlayerCharacter getOwner() {
|
||||
|
||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
||||
return this.getOwner();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getSafeZone() {
|
||||
|
||||
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
|
||||
@@ -158,7 +165,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
|
||||
//clear owner
|
||||
|
||||
PlayerCharacter owner = this.getOwner();
|
||||
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
||||
|
||||
//close pet window
|
||||
|
||||
@@ -174,7 +181,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
owner.setPet(null);
|
||||
|
||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
||||
((Mob) this).setOwner(null);
|
||||
((Mob) this).guardCaptain = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -357,7 +357,9 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
Mob mob = (Mob) this;
|
||||
if (mob.isSiege()) {
|
||||
if (mob.isPet()) {
|
||||
PlayerCharacter petOwner = mob.getOwner();
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) mob.guardCaptain;
|
||||
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
|
||||
petOwner.dismissPet();
|
||||
return;
|
||||
|
||||
@@ -167,10 +167,7 @@ public class Blueprint {
|
||||
// based upon the building's current rank
|
||||
|
||||
public static int getNpcMaintCost(int rank) {
|
||||
int maintCost = Integer.MAX_VALUE;
|
||||
|
||||
maintCost = (9730 * rank) + 1890;
|
||||
|
||||
int maintCost = 0;
|
||||
return maintCost;
|
||||
}
|
||||
|
||||
@@ -313,10 +310,10 @@ public class Blueprint {
|
||||
|
||||
// Early exit for buildings with single or no slots
|
||||
|
||||
if (this.maxSlots <= 1)
|
||||
if (this.maxSlots <= 1 && this.buildingGroup.equals(BuildingGroup.TOL) == false)
|
||||
return maxSlots;
|
||||
|
||||
if (this.maxRank == 1 && currentRank == 1)
|
||||
if (this.maxRank == 1 && currentRank == 1&& this.buildingGroup.equals(BuildingGroup.TOL) == false)
|
||||
return getMaxSlots();
|
||||
|
||||
switch (currentRank) {
|
||||
@@ -328,20 +325,22 @@ public class Blueprint {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
availableSlots = 2;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
availableSlots = 3;
|
||||
break;
|
||||
case 8:
|
||||
availableSlots = 1;
|
||||
availableSlots = 3;
|
||||
break;
|
||||
default:
|
||||
availableSlots = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||
availableSlots += 1;
|
||||
}
|
||||
return availableSlots;
|
||||
}
|
||||
|
||||
@@ -609,17 +608,10 @@ public class Blueprint {
|
||||
|
||||
switch (this.buildingGroup) {
|
||||
case TOL:
|
||||
case BARRACK:
|
||||
maintCost = (61500 * rank) + 19500;
|
||||
break;
|
||||
case SPIRE:
|
||||
maintCost = (4800 * rank) + 1200;
|
||||
maintCost = 3000000;
|
||||
break;
|
||||
default:
|
||||
if (maxRank == 1)
|
||||
maintCost = 22500;
|
||||
else
|
||||
maintCost = (15900 * rank) + 3300;
|
||||
maintCost = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1244,13 +1244,33 @@ public class CharacterItemManager {
|
||||
|
||||
return false;
|
||||
}
|
||||
if (i.getItemBase().getType().equals(ItemType.RESOURCE) && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
boolean added = false;
|
||||
for(Item item : this.getInventory()){
|
||||
if(item.getItemBaseID() == i.getItemBaseID()){
|
||||
if(item.getNumOfItems() + i.getNumOfItems() <= Warehouse.getMaxResources().get(item.getItemBaseID())) {
|
||||
item.setNumOfItems(item.getNumOfItems() + i.getNumOfItems());
|
||||
updateInventory();
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!added){
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
ItemBase ib = i.getItemBase();
|
||||
if (ib != null)
|
||||
this.inventoryWeight += ib.getWeight();
|
||||
}
|
||||
}else {
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
|
||||
ItemBase ib = i.getItemBase();
|
||||
if (ib != null)
|
||||
this.inventoryWeight += ib.getWeight();
|
||||
ItemBase ib = i.getItemBase();
|
||||
if (ib != null)
|
||||
this.inventoryWeight += ib.getWeight();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2095,7 +2115,7 @@ public class CharacterItemManager {
|
||||
if (this.absCharacter.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
||||
int newWeight = this.getCarriedWeight() + weight;
|
||||
return newWeight <= pc.getInventoryCapacity();
|
||||
return newWeight <= (int) pc.statStrBase * 3;
|
||||
} else if (this.absCharacter.getObjectType() == GameObjectType.NPC) {
|
||||
int newWeight = this.getCarriedWeight() + weight;
|
||||
return newWeight <= 1900 + (this.absCharacter.getLevel() * 3);
|
||||
@@ -2128,7 +2148,7 @@ public class CharacterItemManager {
|
||||
tradeWeight = tradeWeight + tradeCharacter.getCharItemManager().getTradingWeight();
|
||||
tradeWeight = tradeWeight - this.getTradingWeight();
|
||||
|
||||
return tradeWeight <= playerCharacter.getInventoryCapacity();
|
||||
return tradeWeight <= (int) playerCharacter.statStrBase * 3;
|
||||
}
|
||||
|
||||
public boolean hasRoomBank(short weight) {
|
||||
@@ -2432,9 +2452,9 @@ public class CharacterItemManager {
|
||||
if (item == null || amount < 1 || amount > 5)
|
||||
return;
|
||||
|
||||
//dont damage items when dieing in safezone
|
||||
if(ZoneManager.findSmallestZone(this.absCharacter.getLoc()).getSafeZone() == 0)
|
||||
if(ZoneManager.findSmallestZone(this.getOwner().loc).getSafeZone() == 1){
|
||||
return;
|
||||
}
|
||||
|
||||
//verify the item is equipped by this player
|
||||
int slot = item.getEquipSlot();
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Contract extends AbstractGameObject {
|
||||
public int inventorySet = 0;
|
||||
private int vendorID;
|
||||
private boolean isTrainer;
|
||||
private VendorDialog vendorDialog;
|
||||
public VendorDialog vendorDialog;
|
||||
private ArrayList<Integer> npcMenuOptions = new ArrayList<>();
|
||||
private ArrayList<Integer> npcModTypeTable = new ArrayList<>();
|
||||
private ArrayList<Integer> npcModSuffixTable = new ArrayList<>();
|
||||
|
||||
@@ -730,32 +730,29 @@ public class Guild extends AbstractWorldObject {
|
||||
|
||||
public boolean canSubAGuild(Guild toSub) {
|
||||
|
||||
boolean canSub;
|
||||
|
||||
boolean canSubToNation;
|
||||
boolean canAcceptSub;
|
||||
if (this.equals(toSub))
|
||||
return false;
|
||||
switch (this.guildState) {
|
||||
case Nation:
|
||||
case Sovereign:
|
||||
canSub = true;
|
||||
canAcceptSub = true;
|
||||
break;
|
||||
default:
|
||||
canSub = false;
|
||||
canAcceptSub = false;
|
||||
}
|
||||
|
||||
switch (toSub.guildState) {
|
||||
case Errant:
|
||||
case Sovereign:
|
||||
canSub = true;
|
||||
canSubToNation = true;
|
||||
break;
|
||||
default:
|
||||
canSub = false;
|
||||
canSubToNation = false;
|
||||
}
|
||||
City nationCap = City.getCity(nation.cityUUID);
|
||||
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
|
||||
canSub = false;
|
||||
}
|
||||
return canSub;
|
||||
|
||||
return canAcceptSub && canSubToNation;
|
||||
}
|
||||
|
||||
public int getRealmsOwnedFlag() {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Item extends AbstractWorldObject {
|
||||
private ArrayList<EnchantmentBase> enchants = new ArrayList<>();
|
||||
private long dateToUpgrade;
|
||||
private String customName = "";
|
||||
private int magicValue;
|
||||
public int magicValue;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
@@ -889,6 +889,8 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public boolean isCanDestroy() {
|
||||
if(this.getItemBaseID() == 7)//gold
|
||||
return false;
|
||||
return canDestroy;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ 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;
|
||||
|
||||
@@ -914,4 +915,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ public class ItemFactory {
|
||||
|
||||
if (rollPrefix < 80) {
|
||||
|
||||
int randomPrefix = LootManager.TableRoll(vendor.getLevel(), false);
|
||||
int randomPrefix = LootManager.TableRoll(vendor.getLevel());
|
||||
prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix);
|
||||
|
||||
if (prefixEntry != null)
|
||||
@@ -722,7 +722,7 @@ public class ItemFactory {
|
||||
|
||||
if (rollSuffix < 80 || prefixEntry == null) {
|
||||
|
||||
int randomSuffix = LootManager.TableRoll(vendor.getLevel(), false);
|
||||
int randomSuffix = LootManager.TableRoll(vendor.getLevel());
|
||||
suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix);
|
||||
|
||||
if (suffixEntry != null)
|
||||
|
||||
@@ -21,9 +21,7 @@ import java.net.UnknownHostException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static engine.gameManager.DbManager.MineQueries;
|
||||
@@ -32,7 +30,6 @@ import static engine.math.FastMath.sqr;
|
||||
|
||||
public class Mine extends AbstractGameObject {
|
||||
|
||||
public final HashSet<Integer> _playerMemory = new HashSet<>();
|
||||
public static ConcurrentHashMap<Mine, Integer> mineMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
public static ConcurrentHashMap<Integer, Mine> towerMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private final String zoneName;
|
||||
@@ -51,6 +48,13 @@ public class Mine extends AbstractGameObject {
|
||||
private int buildingID;
|
||||
private MineProduction mineType;
|
||||
|
||||
public int capSize;
|
||||
|
||||
public final HashSet<Integer> _playerMemory = new HashSet<>();
|
||||
public final HashMap<Integer,Long> _recentMemory = new HashMap<>();
|
||||
HashMap<Guild,ArrayList<Integer>> dividedPlayers;
|
||||
public Integer totalPlayers;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -91,6 +95,19 @@ public class Mine extends AbstractGameObject {
|
||||
this.production = Resource.valueOf(rs.getString("mine_resource"));
|
||||
this.lastClaimer = null;
|
||||
|
||||
//int capRoll = ThreadLocalRandom.current().nextInt(0,100);
|
||||
//if(capRoll >= 0 && capRoll <= 33){
|
||||
this.capSize = 5;
|
||||
//}
|
||||
//if(capRoll >= 34 && capRoll <= 66){
|
||||
// this.capSize = 10;
|
||||
//}
|
||||
//if(capRoll >= 67 && capRoll <= 100){
|
||||
// this.capSize = 20;
|
||||
//}
|
||||
Building mineTower = BuildingManager.getBuilding(this.buildingID);
|
||||
mineTower.setMaxHitPoints(5000 * this.capSize);
|
||||
mineTower.setCurrentHitPoints((float)5000 * this.capSize);
|
||||
}
|
||||
|
||||
public static void releaseMineClaims(PlayerCharacter playerCharacter) {
|
||||
@@ -165,7 +182,7 @@ public class Mine extends AbstractGameObject {
|
||||
writer.putInt(mine.getObjectUUID());
|
||||
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
||||
writer.putString(mine.mineType.name);
|
||||
writer.putString(mine.zoneName);
|
||||
writer.putString(mine.zoneName + " {" + mine.capSize + " Man}");
|
||||
writer.putInt(mine.production.hash);
|
||||
writer.putInt(mine.production.baseProduction);
|
||||
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
@@ -577,13 +594,12 @@ public class Mine extends AbstractGameObject {
|
||||
public void onEnter() {
|
||||
|
||||
HashSet<AbstractWorldObject> currentPlayers;
|
||||
HashSet<Integer> currentMemory;
|
||||
PlayerCharacter player;
|
||||
|
||||
// Gather current list of players within the zone bounds
|
||||
|
||||
currentPlayers = WorldGrid.getObjectsInRangePartial(BuildingManager.getBuildingFromCache(this.buildingID).loc, Enum.CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER);
|
||||
currentMemory = new HashSet<>();
|
||||
Building tower = BuildingManager.getBuildingFromCache(this.buildingID);
|
||||
currentPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, Enum.CityBoundsType.GRID.extents, MBServerStatics.MASK_PLAYER);
|
||||
boolean updated = false;
|
||||
|
||||
for (AbstractWorldObject playerObject : currentPlayers) {
|
||||
|
||||
@@ -591,9 +607,10 @@ public class Mine extends AbstractGameObject {
|
||||
continue;
|
||||
|
||||
player = (PlayerCharacter) playerObject;
|
||||
currentMemory.add(player.getObjectUUID());
|
||||
|
||||
// Player is already in our memory
|
||||
if (_recentMemory.containsKey(player.getObjectUUID()))
|
||||
_recentMemory.remove(player.getObjectUUID());
|
||||
|
||||
if (_playerMemory.contains(player.getObjectUUID()))
|
||||
continue;
|
||||
@@ -601,24 +618,60 @@ public class Mine extends AbstractGameObject {
|
||||
// Add player to our city's memory
|
||||
|
||||
_playerMemory.add(player.getObjectUUID());
|
||||
updated = true;
|
||||
|
||||
// ***For debugging
|
||||
// Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size());
|
||||
}
|
||||
this.totalPlayers = this._playerMemory.size();
|
||||
try {
|
||||
onExit(currentMemory);
|
||||
if(onExit(currentPlayers)){
|
||||
updated = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
PowersManager.applyZergBuff(this);
|
||||
this.dividedPlayers = new HashMap<>();
|
||||
for(Integer playerID : this._playerMemory){
|
||||
player = PlayerCharacter.getFromCache(playerID);
|
||||
Guild nation = player.getGuild().getNation(); Guild entry;
|
||||
if(this.dividedPlayers.containsKey(nation)){
|
||||
this.dividedPlayers.get(nation).add(playerID);
|
||||
}else{
|
||||
ArrayList<Integer> newEntry = new ArrayList<>();
|
||||
newEntry.add(playerID);
|
||||
this.dividedPlayers.put(nation,newEntry);
|
||||
}
|
||||
}
|
||||
if(updated == true){
|
||||
for(Integer playerID : this._playerMemory){
|
||||
player = PlayerCharacter.getFromCache(playerID);
|
||||
if(this.dividedPlayers.containsKey(player.getGuild().getNation())){
|
||||
int count = this.dividedPlayers.get(player.getGuild().getNation()).size();
|
||||
switch(this.capSize){
|
||||
case 5:
|
||||
player.ZergMultiplier = ZergManager.getMultiplier5Man(count);
|
||||
break;
|
||||
case 10:
|
||||
player.ZergMultiplier = ZergManager.getMultiplier10Man(count);
|
||||
break;
|
||||
case 20:
|
||||
player.ZergMultiplier = ZergManager.getMultiplier20Man(count);
|
||||
break;
|
||||
}
|
||||
} else{
|
||||
player.ZergMultiplier = 1.0f; //something went wrong reset to default until next cycle
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void onExit(HashSet<Integer> currentMemory) {
|
||||
|
||||
private Boolean onExit(HashSet<AbstractWorldObject> currentPlayers) {
|
||||
|
||||
PlayerCharacter player;
|
||||
int playerUUID = 0;
|
||||
HashSet<Integer> toRemove = new HashSet<>();
|
||||
Iterator<Integer> iter = _playerMemory.iterator();
|
||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(BuildingManager.getBuildingFromCache(this.buildingID).loc,Enum.CityBoundsType.ZONE.extents * 0.5f,MBServerStatics.MASK_PLAYER);
|
||||
while (iter.hasNext()) {
|
||||
|
||||
playerUUID = iter.next();
|
||||
@@ -626,15 +679,33 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
player = PlayerCharacter.getFromCache(playerUUID);
|
||||
|
||||
if (inRange.contains(player))
|
||||
if (currentPlayers.contains(player))
|
||||
continue;
|
||||
|
||||
toRemove.add(playerUUID);
|
||||
if(_recentMemory.containsKey(playerUUID) == false) {
|
||||
_recentMemory.put(playerUUID, System.currentTimeMillis());
|
||||
}
|
||||
player.ZergMultiplier = 1.0f; // reset damage modifier to 1.0
|
||||
}
|
||||
|
||||
// Remove players from mine memory
|
||||
|
||||
_playerMemory.removeAll(toRemove);
|
||||
PowersManager.removeZergBuff(toRemove);
|
||||
//_playerMemory.removeAll(toRemove);
|
||||
HashSet<Integer> purge = new HashSet<>();
|
||||
for(Integer id : _recentMemory.keySet()){
|
||||
if(System.currentTimeMillis() > _recentMemory.get(playerUUID) + 60000){
|
||||
purge.add(id);
|
||||
}
|
||||
}
|
||||
for(Integer id : purge){
|
||||
_recentMemory.remove(id);
|
||||
}
|
||||
if(toRemove.isEmpty()){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+355
-716
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@ public class MobEquipment extends AbstractGameObject {
|
||||
private AbstractPowerAction suffix;
|
||||
private int pValue;
|
||||
private int sValue;
|
||||
private int magicValue;
|
||||
public int magicValue;
|
||||
|
||||
private float dropChance = 0;
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ public class NPC extends AbstractCharacter {
|
||||
// Used for thread safety
|
||||
public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
private final ArrayList<MobLoot> rolling = new ArrayList<>();
|
||||
private final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
|
||||
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
|
||||
public HashMap<Integer, MobEquipment> equip = null;
|
||||
@@ -86,6 +85,7 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
public NPC() {
|
||||
|
||||
super();
|
||||
this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
||||
this.currentID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
|
||||
}
|
||||
@@ -654,12 +654,14 @@ public class NPC extends AbstractCharacter {
|
||||
WorldGrid.RemoveWorldObject(toRemove);
|
||||
DbManager.removeFromCache(toRemove);
|
||||
|
||||
PlayerCharacter petOwner = toRemove.getOwner();
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
|
||||
petOwner.setPet(null);
|
||||
toRemove.setOwner(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
@@ -805,6 +807,8 @@ public class NPC extends AbstractCharacter {
|
||||
@Override
|
||||
public void runAfterLoad() {
|
||||
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
|
||||
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
|
||||
return;
|
||||
|
||||
@@ -846,10 +850,6 @@ public class NPC extends AbstractCharacter {
|
||||
if (wordCount(this.name) < 2 && this.contract != null)
|
||||
this.name += " the " + this.contract.getName();
|
||||
|
||||
// Initialize inventory
|
||||
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
|
||||
// Configure parent zone adding this NPC to the
|
||||
// zone collection
|
||||
|
||||
@@ -1103,10 +1103,6 @@ public class NPC extends AbstractCharacter {
|
||||
return (int) time;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Mob, Integer> getSiegeMinionMap() {
|
||||
return siegeMinionMap;
|
||||
}
|
||||
|
||||
public boolean remove() {
|
||||
|
||||
Building building;
|
||||
@@ -1330,7 +1326,6 @@ public class NPC extends AbstractCharacter {
|
||||
return;
|
||||
|
||||
dateToUpgrade = DateTime.now().plusHours(this.getUpgradeTime());
|
||||
|
||||
this.setUpgradeDateTime(dateToUpgrade);
|
||||
|
||||
// Schedule upgrade job
|
||||
|
||||
@@ -144,7 +144,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
private long lastUpdateTime = System.currentTimeMillis();
|
||||
private long lastStamUpdateTime = System.currentTimeMillis();
|
||||
private boolean safeZone = false;
|
||||
private int bindBuildingID;
|
||||
|
||||
/*
|
||||
DataWarehouse based kill/death tracking.
|
||||
@@ -177,8 +176,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
public boolean isBoxed = false;
|
||||
|
||||
public boolean receivedConc = false;
|
||||
|
||||
public float ZergMultiplier = 1.0f;
|
||||
/**
|
||||
* No Id Constructor
|
||||
*/
|
||||
@@ -209,15 +207,18 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.spiMod.set(spiMod);
|
||||
|
||||
this.guildStatus = new AtomicInteger(0);
|
||||
this.bindBuildingID = -1;
|
||||
this.buildingUUID = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
public PlayerCharacter(ResultSet rs) throws SQLException {
|
||||
|
||||
super(rs, true);
|
||||
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
|
||||
this.runes = DbManager.CharacterRuneQueries.GET_RUNES_FOR_CHARACTER(this.getObjectUUID());
|
||||
int accountID = rs.getInt("parent");
|
||||
this.account = DbManager.AccountQueries.GET_ACCOUNT(accountID);
|
||||
@@ -269,7 +270,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.intMod.set(rs.getShort("char_intMod"));
|
||||
this.spiMod.set(rs.getShort("char_spiMod"));
|
||||
|
||||
this.bindBuildingID = rs.getInt("char_bindBuilding");
|
||||
this.buildingUUID = rs.getInt("char_bindBuilding");
|
||||
|
||||
this.hash = rs.getString("hash");
|
||||
|
||||
@@ -2191,11 +2192,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
}
|
||||
|
||||
//public int getInventoryCapacity() {
|
||||
// return statStrBase * 3;
|
||||
//}
|
||||
public int getInventoryCapacity() {
|
||||
return 1000;
|
||||
return statStrBase * 3;
|
||||
}
|
||||
|
||||
public int getInventoryCapacityRemaining() {
|
||||
@@ -2230,7 +2228,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
// Warehouse this event
|
||||
CharacterRecord.updatePromotionClass(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2729,12 +2726,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
*/
|
||||
|
||||
public synchronized int getBindBuildingID() {
|
||||
return this.bindBuildingID;
|
||||
return this.buildingUUID;
|
||||
}
|
||||
|
||||
public synchronized void setBindBuildingID(int value) {
|
||||
DbManager.PlayerCharacterQueries.SET_BIND_BUILDING(this, value);
|
||||
this.bindBuildingID = value;
|
||||
this.buildingUUID = value;
|
||||
}
|
||||
|
||||
public AbstractGameObject getLastTarget() {
|
||||
@@ -4569,10 +4566,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
@Override
|
||||
public void runAfterLoad() {
|
||||
|
||||
// Init inventory
|
||||
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
|
||||
Bounds playerBounds = Bounds.borrow();
|
||||
playerBounds.setBounds(this.getLoc());
|
||||
this.setBounds(playerBounds);
|
||||
@@ -4700,7 +4693,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
} else if (currentPet.isSiege()) {
|
||||
currentPet.agentType = AIAgentType.MOBILE;
|
||||
currentPet.setOwner(null);
|
||||
|
||||
currentPet.guardCaptain = null;
|
||||
currentPet.setCombatTarget(null);
|
||||
if (currentPet.isAlive())
|
||||
WorldGrid.updateObject(currentPet);
|
||||
@@ -4819,9 +4813,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
updateBlessingMessage();
|
||||
|
||||
this.safeZone = this.isInSafeZone();
|
||||
if(this.isBoxed == true && this.containsEffect(1672601862) == false)
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
|
||||
if(this.isBoxed && 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);
|
||||
} finally {
|
||||
|
||||
@@ -1334,4 +1334,75 @@ public class Warehouse extends AbstractWorldObject {
|
||||
|
||||
return resourceType.elementOf(this.lockedResourceTypes);
|
||||
}
|
||||
|
||||
public static int getCostForResource(int id){
|
||||
int newCost = 0;
|
||||
switch(id){
|
||||
case 1580000://stone
|
||||
newCost = 3000;
|
||||
break;
|
||||
case 1580001://truesteel
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580002://iron
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580003://adamant
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580004://lumber
|
||||
newCost = 3000;
|
||||
break;
|
||||
case 1580005://oak
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580006://bronzewood
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580007://mandrake
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580008://coal
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580009://agate
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580010://diamond
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580011://onyx
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580012://azoth
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580013://orichalk
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580014://antimony
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580015://sulfur
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580016://quicksilver
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580017://galvor
|
||||
newCost = 300000;
|
||||
break;
|
||||
case 1580018://wormwood
|
||||
newCost = 300000;
|
||||
break;
|
||||
case 1580019://obsidian
|
||||
newCost = 200000;
|
||||
break;
|
||||
case 1580020://bloodstone
|
||||
newCost = 200000;
|
||||
break;
|
||||
}
|
||||
|
||||
return newCost;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +176,10 @@ public class HealthEffectModifier extends AbstractEffectModifier {
|
||||
if (!ac.isAlive())
|
||||
return;
|
||||
|
||||
if(source.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
modAmount *= ((PlayerCharacter)source).ZergMultiplier;
|
||||
}
|
||||
|
||||
int powerID = 0, effectID = 0;
|
||||
String powerName = "";
|
||||
if (effect.getPower() != null) {
|
||||
|
||||
@@ -157,6 +157,9 @@ public class ManaEffectModifier extends AbstractEffectModifier {
|
||||
skipImmune = true;
|
||||
}
|
||||
}
|
||||
if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
||||
modAmount *= ((PlayerCharacter)source).ZergMultiplier;
|
||||
}
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
|
||||
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
|
||||
|
||||
@@ -153,6 +153,9 @@ public class StaminaEffectModifier extends AbstractEffectModifier {
|
||||
skipImmune = true;
|
||||
}
|
||||
}
|
||||
if(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
||||
modAmount *= ((PlayerCharacter)source).ZergMultiplier;
|
||||
}
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
|
||||
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.powers.poweractions;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.jobs.ChantJob;
|
||||
import engine.jobs.DeferredPowerJob;
|
||||
@@ -22,6 +23,7 @@ import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
@@ -117,20 +119,12 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
|
||||
awo.addEffect(stackType, duration, eff, effect, trains);
|
||||
} else
|
||||
awo.applyAllBonuses();
|
||||
// //TODO if chant, start cycle
|
||||
// if (pb.isChant() && source.equals(awo)) {
|
||||
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
|
||||
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
|
||||
// eff.setChant(true);
|
||||
// }
|
||||
|
||||
if (this.effectID.equals("TAUNT")) {
|
||||
|
||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
||||
((Mob) awo).setCombatTarget(source);
|
||||
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
|
||||
DispatchMessage.sendToAllInRange(source, msg);
|
||||
((Mob)awo).refresh();
|
||||
}
|
||||
}
|
||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
||||
@@ -140,7 +134,21 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
|
||||
}
|
||||
this.effect.startEffect(source, awo, trains, eff);
|
||||
}
|
||||
//apply effects to mobs within range for chants
|
||||
if(pb.isChant){
|
||||
for(AbstractGameObject ago : WorldGrid.getObjectsInRangePartial(awo.loc,pb.range, MBServerStatics.MASK_MOB)){
|
||||
Mob mob = (Mob)ago;
|
||||
if(mob.playerAgroMap.containsKey(source.getObjectUUID()))
|
||||
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
|
||||
|
||||
}
|
||||
}else {
|
||||
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
|
||||
Mob mob = (Mob) awo;
|
||||
if (mob.playerAgroMap.containsKey(source.getObjectUUID()))
|
||||
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void _applyEffectForItem(Item item, int trains) {
|
||||
|
||||
@@ -12,7 +12,6 @@ package engine.powers.poweractions;
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
@@ -75,7 +74,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
return;
|
||||
|
||||
//create Pet
|
||||
Mob pet = Mob.createPet(mobID, guild, seaFloor, owner, (short) mobLevel);
|
||||
Mob pet = Mob.createPetMinion(mobID, seaFloor, owner, (short) mobLevel);
|
||||
|
||||
|
||||
if (pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
|
||||
@@ -84,8 +83,6 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
WorldGrid.RemoveWorldObject(currentPet);
|
||||
currentPet.setCombatTarget(null);
|
||||
|
||||
//if (currentPet.getParentZone() != null)
|
||||
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
|
||||
seaFloor.zoneMobSet.remove(currentPet);
|
||||
currentPet.playerAgroMap.clear();
|
||||
|
||||
@@ -95,10 +92,10 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
//currentPet.disableIntelligence();
|
||||
} else if (currentPet != null && currentPet.isSiege()) {
|
||||
currentPet.agentType = Enum.AIAgentType.MOBILE;
|
||||
currentPet.setOwner(null);
|
||||
|
||||
currentPet.guardCaptain = null;
|
||||
currentPet.setCombatTarget(null);
|
||||
|
||||
if (currentPet.isAlive())
|
||||
@@ -106,7 +103,6 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
}
|
||||
//remove 10th pet
|
||||
|
||||
|
||||
NPCManager.spawnNecroPet(owner, pet);
|
||||
|
||||
} else { //is not a necro pet
|
||||
@@ -115,7 +111,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
DbManager.removeFromCache(currentPet);
|
||||
currentPet.setCombatTarget(null);
|
||||
|
||||
currentPet.setOwner(null);
|
||||
currentPet.guardCaptain = null;
|
||||
WorldGrid.RemoveWorldObject(currentPet);
|
||||
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
|
||||
seaFloor.zoneMobSet.remove(currentPet);
|
||||
@@ -125,7 +121,8 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
} else {
|
||||
if (currentPet.isSiege()) {
|
||||
currentPet.agentType = Enum.AIAgentType.MOBILE;
|
||||
currentPet.setOwner(null);
|
||||
|
||||
currentPet.guardCaptain = null;
|
||||
currentPet.setCombatTarget(null);
|
||||
|
||||
if (currentPet.isAlive())
|
||||
@@ -137,26 +134,9 @@ public class CreateMobPowerAction extends AbstractPowerAction {
|
||||
NPCManager.resetNecroPets(owner);
|
||||
}
|
||||
}
|
||||
/* if(owner.getPet() != null) {
|
||||
if(owner.getPet().getMobBaseID() != 12021 && owner.getPet().getMobBaseID() != 12022) {
|
||||
//if not a necro pet, remove pet
|
||||
WorldGrid.removeWorldObject(owner.getPet());
|
||||
owner.getPet().disableIntelligence();
|
||||
Mob.removePet(owner.getPet().getUUID());
|
||||
owner.setPet(null);
|
||||
}
|
||||
else {
|
||||
//if it is a necro pet, add it to the line and set as mob
|
||||
owner.getPet().setMob();
|
||||
}
|
||||
}*/
|
||||
|
||||
// if (mobID == 12021 || mobID == 12022) //Necro Pets
|
||||
// pet.setPet(owner, true);
|
||||
owner.setPet(pet);
|
||||
if(pet.isSiege() == false) {
|
||||
MovementManager.translocate(pet, owner.getLoc(), owner.region);
|
||||
}
|
||||
|
||||
pet.recalculateStats();
|
||||
pet.healthMax = pet.level * 0.5f * 120;
|
||||
pet.setHealth(pet.healthMax);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class FearPowerAction extends AbstractPowerAction {
|
||||
int duration = 10 + ((int) (trains * 0.5));
|
||||
String stackType = ab.getStackType();
|
||||
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
|
||||
((Mob) awo).setFearedObject(source);
|
||||
((Mob) awo).fearedObject = source;
|
||||
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,7 @@ public class TransferStatPowerAction extends AbstractPowerAction {
|
||||
|
||||
// put it back between min and max
|
||||
damage += min;
|
||||
damage *= ((PlayerCharacter) source).ZergMultiplier;
|
||||
}
|
||||
|
||||
// Apply any power effect modifiers (such as stances)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
package engine.server.world;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.BuildingGroup;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.MinionType;
|
||||
import engine.Enum.SupportMsgType;
|
||||
@@ -18,11 +17,13 @@ import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.db.handlers.dbPowerHandler;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.LogoutCharacterJob;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.mobileAI.Threads.MobRespawnThread;
|
||||
import engine.net.Dispatch;
|
||||
@@ -334,7 +335,7 @@ public class WorldServer {
|
||||
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
|
||||
|
||||
Logger.info("Loading NPC and Mob Rune Sets");
|
||||
NPCManager.LoadAllRuneSets();
|
||||
NPCManager._runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||
|
||||
Logger.info("Loading Booty Sets");
|
||||
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
||||
@@ -352,7 +353,7 @@ public class WorldServer {
|
||||
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
||||
|
||||
Logger.info("Loading Mob Powers");
|
||||
PowersManager.AllMobPowers = DbManager.PowerQueries.LOAD_MOB_POWERS();
|
||||
PowersManager.AllMobPowers = dbPowerHandler.LOAD_MOB_POWERS();
|
||||
|
||||
Logger.info("Loading item enchants");
|
||||
DbManager.LootQueries.LOAD_ENCHANT_VALUES();
|
||||
@@ -436,7 +437,7 @@ public class WorldServer {
|
||||
DbManager.SkillsBaseQueries.LOAD_ALL_MAX_SKILLS_FOR_CONTRACT();
|
||||
|
||||
//pick a startup Hotzone
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
//ZoneManager.generateAndSetRandomHotzone();
|
||||
|
||||
Logger.info("Loading All Players from database to Server Cache");
|
||||
long start = System.currentTimeMillis();
|
||||
@@ -482,7 +483,7 @@ public class WorldServer {
|
||||
|
||||
Logger.info("Initializing Client Connection Manager");
|
||||
initClientConnectionManager();
|
||||
|
||||
|
||||
//intiate mob respawn thread
|
||||
Logger.info("Starting Mob Respawn Thread");
|
||||
MobRespawnThread.startRespawnThread();
|
||||
@@ -551,44 +552,40 @@ public class WorldServer {
|
||||
}
|
||||
|
||||
//Set sea floor object for server
|
||||
|
||||
Zone seaFloor = rootParent.get(0);
|
||||
seaFloor.setParent(null);
|
||||
ZoneManager.setSeaFloor(seaFloor);
|
||||
|
||||
// zoneManager.addZone(seaFloor.getLoadNum(), seaFloor); <- DIE IN A FUCKING CAR FIRE BONUS CODE LIKE THIS SUCKS FUCKING DICK
|
||||
|
||||
rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor));
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
for (Zone zone : rootParent) {
|
||||
|
||||
ZoneManager.addZone(zone.getLoadNum(), zone);
|
||||
zone.generateWorldAltitude();
|
||||
|
||||
|
||||
//Handle Buildings
|
||||
|
||||
try {
|
||||
ZoneManager.addZone(zone.getLoadNum(), zone);
|
||||
|
||||
try {
|
||||
zone.generateWorldAltitude();
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Handle Buildings
|
||||
|
||||
ArrayList<Building> bList;
|
||||
bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone);
|
||||
|
||||
for (Building b : bList) {
|
||||
|
||||
try {
|
||||
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||
b.setLoc(b.getLoc());
|
||||
} catch (Exception e) {
|
||||
Logger.error(b.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
||||
}
|
||||
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||
b.setLoc(b.getLoc());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Handle Mobs
|
||||
//Handle Mobs
|
||||
|
||||
try {
|
||||
ArrayList<Mob> mobs;
|
||||
mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone);
|
||||
|
||||
@@ -596,15 +593,22 @@ public class WorldServer {
|
||||
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
|
||||
m.setLoc(m.getLoc());
|
||||
|
||||
//ADD GUARDS HERE.
|
||||
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
||||
DbManager.MobQueries.LOAD_PATROL_POINTS(m);
|
||||
}
|
||||
// Load Minions for Guard Captains here.
|
||||
|
||||
//Handle npc's
|
||||
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.BARRACK)
|
||||
DbManager.MobQueries.LOAD_GUARD_MINIONS(m);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Handle NPCs
|
||||
|
||||
try {
|
||||
ArrayList<NPC> npcs;
|
||||
|
||||
// Ignore npc's on the seafloor (npc guild leaders, etc)
|
||||
// Ignore NPCs on the seafloor (npc guild leaders, etc)
|
||||
|
||||
if (zone.equals(seaFloor))
|
||||
continue;
|
||||
@@ -612,26 +616,48 @@ public class WorldServer {
|
||||
npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone);
|
||||
|
||||
for (NPC n : npcs) {
|
||||
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
||||
|
||||
try {
|
||||
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
|
||||
n.setLoc(n.getLoc());
|
||||
} catch (Exception e) {
|
||||
Logger.error(n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
|
||||
if(n.contract.getContractID() == 1200) {
|
||||
DbManager.NPCQueries.DELETE_NPC(n);
|
||||
continue;
|
||||
}
|
||||
n.setLoc(n.getLoc());
|
||||
}
|
||||
|
||||
//Handle cities
|
||||
|
||||
ZoneManager.loadCities(zone);
|
||||
ZoneManager.populateWorldZones(zone);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(e.getMessage() + zone.getName() + ' ' + zone.getObjectUUID());
|
||||
Logger.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
//Handle cities
|
||||
|
||||
ZoneManager.loadCities(zone);
|
||||
ZoneManager.populateWorldZones(zone);
|
||||
|
||||
}
|
||||
//add extra vendors for lakebane
|
||||
//
|
||||
try {
|
||||
Building sdrHut = BuildingManager.getBuilding(27979);
|
||||
Zone sdr = sdrHut.parentZone;
|
||||
boolean exists = false;
|
||||
for(NPC merchant : sdr.zoneNPCSet)
|
||||
if(merchant.contract.getContractID() == 1200)
|
||||
exists = true;
|
||||
if (!exists) {
|
||||
NPC runeMerchant = NPC.createNPC("Runey", 1200, Vector3fImmutable.ZERO, Guild.getGuild(6), ZoneManager.getZoneByUUID(656), (short) 70, null);
|
||||
runeMerchant.sellPercent = 9999.00f;
|
||||
runeMerchant.buildingUUID = sdrHut.getObjectUUID();
|
||||
runeMerchant.building = sdrHut;
|
||||
NPCManager.slotCharacterInBuilding(runeMerchant);
|
||||
runeMerchant.setLoc(runeMerchant.bindLoc);
|
||||
runeMerchant.updateDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
Logger.info("time to load: " + (System.currentTimeMillis() - start) + " ms");
|
||||
catch(Exception e){
|
||||
Logger.error("FAILED TO ADD RUNE MERCHANT");
|
||||
}
|
||||
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -704,7 +730,7 @@ public class WorldServer {
|
||||
return;
|
||||
}
|
||||
//remove player from loaded mobs agro maps
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(),MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_MOB)) {
|
||||
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_MOB)) {
|
||||
Mob loadedMob = (Mob) awo;
|
||||
loadedMob.playerAgroMap.remove(player.getObjectUUID());
|
||||
}
|
||||
|
||||
@@ -189,28 +189,28 @@ public class HourlyJobThread implements Runnable {
|
||||
|
||||
Logger.info("Hourly job is now running.");
|
||||
|
||||
try {
|
||||
//try {
|
||||
|
||||
// Use the same hotZone this hour up and until
|
||||
// the HotZone_Duration from the ConfigManager
|
||||
|
||||
if (ZoneManager.hotZone == null)
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
else
|
||||
ZoneManager.hotZoneCycle = ZoneManager.hotZoneCycle + 1;
|
||||
//if (ZoneManager.hotZone == null)
|
||||
// ZoneManager.generateAndSetRandomHotzone();
|
||||
//else
|
||||
// ZoneManager.hotZoneCycle = ZoneManager.hotZoneCycle + 1;
|
||||
|
||||
if (ZoneManager.hotZoneCycle > Integer.parseInt(ConfigManager.MB_HOTZONE_DURATION.getValue()))
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
//if (ZoneManager.hotZoneCycle > Integer.parseInt(ConfigManager.MB_HOTZONE_DURATION.getValue()))
|
||||
// ZoneManager.generateAndSetRandomHotzone();
|
||||
|
||||
if (ZoneManager.hotZone == null) {
|
||||
Logger.error("Null HotZone returned from ZoneManager");
|
||||
} else {
|
||||
Logger.info("HotZone switched to: " + ZoneManager.hotZone.getName());
|
||||
}
|
||||
//if (ZoneManager.hotZone == null) {
|
||||
// Logger.error("Null HotZone returned from ZoneManager");
|
||||
//} else {
|
||||
// Logger.info("HotZone switched to: " + ZoneManager.hotZone.getName());
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
//} catch (Exception e) {
|
||||
// Logger.error(e.toString());
|
||||
//}
|
||||
|
||||
// Open or Close mines for the current mine window.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user