Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc11d573f3 | ||
|
|
a6377cfe6e | ||
|
|
feadb52cb9 | ||
|
|
a577ecd3e4 | ||
|
|
57b5cef021 | ||
|
|
a320333ddc | ||
|
|
797b863fe1 | ||
|
|
557f89d2e0 | ||
|
|
00eceaaa7c | ||
|
|
278641767a | ||
|
|
66ca0276a3 | ||
|
|
c2f6f89b12 | ||
|
|
d14b21fc9e | ||
|
|
826a7d1198 | ||
|
|
8cbcb15b50 | ||
|
|
dc9b0e4ece | ||
|
|
cd900d6e2e | ||
|
|
35e18e4186 | ||
|
|
2e5892ff32 | ||
|
|
af269d6b33 | ||
|
|
9bbcbda9ee | ||
|
|
50d014df2b | ||
|
|
8c5e402bb6 | ||
|
|
fec0a05c46 | ||
|
|
8349c26906 | ||
|
|
b6f66a8d9f | ||
|
|
54414ecc3f | ||
|
|
4c0eb38889 | ||
|
|
9bf859b473 | ||
|
|
54e372b278 | ||
|
|
fb2465ccfd | ||
|
|
2ff0c9b938 | ||
|
|
13e85b6a3e | ||
|
|
f992caba3c | ||
|
|
a1f1c5f4a4 | ||
|
|
0ccf9f61cb | ||
|
|
ff5b41f494 | ||
|
|
8958f4132f | ||
|
|
288ad02952 | ||
|
|
c99b1ab491 | ||
|
|
6b284c7f80 | ||
|
|
83c8698798 | ||
|
|
c3c897b035 | ||
|
|
44692031d9 | ||
|
|
a4d20af0f8 | ||
|
|
2bfdc0f203 | ||
|
|
ad51d90e1e | ||
|
|
603c4d1d5a | ||
|
|
8fcbd8c1e0 | ||
|
|
8e4aa20404 | ||
|
|
8537463e5c | ||
|
|
042a292b31 | ||
|
|
67a5b1749c | ||
|
|
930434f35b |
No files matched your search
@@ -2307,8 +2307,8 @@ public class Enum {
|
|||||||
public enum CityBoundsType {
|
public enum CityBoundsType {
|
||||||
|
|
||||||
GRID(640),
|
GRID(640),
|
||||||
ZONE(875),
|
ZONE(675),
|
||||||
PLACEMENT(876);
|
PLACEMENT(677);
|
||||||
|
|
||||||
public final float extents;
|
public final float extents;
|
||||||
|
|
||||||
|
|||||||
@@ -19,15 +19,19 @@ import engine.net.AbstractNetMsg;
|
|||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
|
import engine.net.client.ClientConnectionManager;
|
||||||
import engine.net.client.msg.LoadCharacterMsg;
|
import engine.net.client.msg.LoadCharacterMsg;
|
||||||
import engine.net.client.msg.LoadStructureMsg;
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
import engine.net.client.msg.MoveToPointMsg;
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
import engine.net.client.msg.UnloadObjectsMsg;
|
import engine.net.client.msg.UnloadObjectsMsg;
|
||||||
|
import engine.net.client.msg.login.CharSelectScreenMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
import engine.session.Session;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import static engine.math.FastMath.sqr;
|
import static engine.math.FastMath.sqr;
|
||||||
@@ -213,6 +217,9 @@ public enum InterestManager implements Runnable {
|
|||||||
if (!playerCharacter.isEnteredWorld())
|
if (!playerCharacter.isEnteredWorld())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(playerCharacter.level < 10)
|
||||||
|
playerCharacter.setLevel((short)10);
|
||||||
|
|
||||||
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -519,12 +526,29 @@ public enum InterestManager implements Runnable {
|
|||||||
if (origin == null)
|
if (origin == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int currentConnections = 0;
|
||||||
|
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||||
|
if(pc.isActive() && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(player.getClientConnection().machineID)){
|
||||||
|
currentConnections++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (currentConnections >= 3) {
|
||||||
|
Session s = SessionManager.getSession(player);
|
||||||
|
if (s.getAccount() != null) {
|
||||||
|
CharSelectScreenMsg cssm = new CharSelectScreenMsg(s, false);
|
||||||
|
s.getConn().sendMsg(cssm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception ex){
|
||||||
|
|
||||||
|
}
|
||||||
// Update loaded upbjects lists
|
// Update loaded upbjects lists
|
||||||
|
|
||||||
player.setDirtyLoad(true);
|
player.setDirtyLoad(true);
|
||||||
updateStaticList(player, origin);
|
updateStaticList(player, origin);
|
||||||
updateMobileList(player, origin);
|
updateMobileList(player, origin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
String type = rs.getString("type");
|
String type = rs.getString("type");
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "zone":
|
case "zone":
|
||||||
|
if(rs.getInt("isPlayerCity") == 0 && Zone.skipZone(rs.getString("Name")))
|
||||||
|
break;
|
||||||
Zone zone = new Zone(rs);
|
Zone zone = new Zone(rs);
|
||||||
DbManager.addToCache(zone);
|
DbManager.addToCache(zone);
|
||||||
list.add(zone);
|
list.add(zone);
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.GracefulShutdown;
|
|
||||||
import engine.objects.AbstractGameObject;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Devcmd: graceful shutdown.
|
|
||||||
*
|
|
||||||
* Announces a countdown to every player, writes all online characters to the
|
|
||||||
* database (skills/powers, stat modifiers, experience) and then stops the
|
|
||||||
* login and world servers. Unlike './reboot' - which simply runs mbrestart.sh
|
|
||||||
* and therefore kills the JVMs with SIGKILL - nothing still parked in a
|
|
||||||
* deferred database job is lost.
|
|
||||||
*
|
|
||||||
* Usage: ./shutdown [seconds] (default 60, maximum 3600)
|
|
||||||
*/
|
|
||||||
public class ShutdownCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
private static final int DEFAULT_DELAY_SECONDS = 60;
|
|
||||||
private static final int MAX_DELAY_SECONDS = 3600;
|
|
||||||
|
|
||||||
public ShutdownCmd() {
|
|
||||||
super("shutdown");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args, AbstractGameObject target) {
|
|
||||||
|
|
||||||
int delay = DEFAULT_DELAY_SECONDS;
|
|
||||||
|
|
||||||
if (args.length > 0 && args[0].isEmpty() == false) {
|
|
||||||
try {
|
|
||||||
delay = Integer.parseInt(args[0].trim());
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
this.sendUsage(pcSender);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delay < 0)
|
|
||||||
delay = 0;
|
|
||||||
|
|
||||||
if (delay > MAX_DELAY_SECONDS)
|
|
||||||
delay = MAX_DELAY_SECONDS;
|
|
||||||
|
|
||||||
throwbackInfo(pcSender, "Graceful shutdown started: player data will be saved in " + delay + " second(s).");
|
|
||||||
|
|
||||||
final int delaySeconds = delay;
|
|
||||||
|
|
||||||
// The countdown sleeps, so run it off the message handling thread.
|
|
||||||
|
|
||||||
Thread shutdownThread = new Thread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
GracefulShutdown.gracefulStop(delaySeconds);
|
|
||||||
}
|
|
||||||
}, "gracefulShutdown");
|
|
||||||
|
|
||||||
shutdownThread.setDaemon(false);
|
|
||||||
shutdownThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Gracefully shuts the server down: warns the players, saves every online character, then stops the servers";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /shutdown [seconds]'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -520,9 +520,10 @@ public enum BuildingManager {
|
|||||||
if (building.getBlueprintUUID() == 0)
|
if (building.getBlueprintUUID() == 0)
|
||||||
return false;
|
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;
|
return false;
|
||||||
|
}
|
||||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||||
|
|
||||||
if (item.getChargesRemaining() > 0)
|
if (item.getChargesRemaining() > 0)
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
|
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
|
||||||
DevCmdManager.registerDevCmd(new RealmInfoCmd());
|
DevCmdManager.registerDevCmd(new RealmInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new RebootCmd());
|
DevCmdManager.registerDevCmd(new RebootCmd());
|
||||||
DevCmdManager.registerDevCmd(new ShutdownCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new SetMineTypeCmd());
|
DevCmdManager.registerDevCmd(new SetMineTypeCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetMineExpansion());
|
DevCmdManager.registerDevCmd(new SetMineExpansion());
|
||||||
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
DevCmdManager.registerDevCmd(new SetForceRenameCityCmd());
|
||||||
@@ -181,7 +180,7 @@ public enum DevCmdManager {
|
|||||||
//kill any commands not available to everyone on production server
|
//kill any commands not available to everyone on production server
|
||||||
//only admin level can run dev commands on production
|
//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 && a.getUname().toLowerCase().equals("sinmara#1") == false) {
|
||||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,202 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.util.ThreadUtils;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Graceful shutdown support.
|
|
||||||
*
|
|
||||||
* The stock devops scripts stop the game with SIGKILL (mbkill.sh runs
|
|
||||||
* 'kill -9'), which throws away everything still parked in a character's
|
|
||||||
* deferred database job: experience is written five minutes after it is
|
|
||||||
* earned and stats/skills thirty seconds after they change
|
|
||||||
* (see {@link engine.jobs.DatabaseUpdateJob}). This class adds the missing
|
|
||||||
* write-out:
|
|
||||||
*
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #flushAllPlayers()} writes every online character's pending state
|
|
||||||
* (skills/powers, stat modifiers, experience) immediately.</li>
|
|
||||||
* <li>{@link #registerShutdownHook(String)} makes an orderly SIGTERM flush
|
|
||||||
* before the JVM exits. SIGKILL cannot be intercepted by design, so it is
|
|
||||||
* still the operator's job to log the players out first, or to use
|
|
||||||
* {@link #gracefulStop(int)}.</li>
|
|
||||||
* <li>{@link #gracefulStop(int)} announces a countdown to the players, flushes
|
|
||||||
* them and then stops the login and world servers.</li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public class GracefulShutdown {
|
|
||||||
|
|
||||||
private static final AtomicBoolean flushing = new AtomicBoolean(false);
|
|
||||||
private static final AtomicBoolean stopping = new AtomicBoolean(false);
|
|
||||||
|
|
||||||
// Countdown marks, in seconds remaining, that are announced to the players.
|
|
||||||
|
|
||||||
private static final int[] ANNOUNCE_MARKS = {300, 180, 120, 60, 30, 10, 5, 3, 1};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write every online character's deferred state to the database now.
|
|
||||||
* Idempotent and safe to call from a shutdown hook or repeatedly.
|
|
||||||
*
|
|
||||||
* @return the number of characters that were written successfully
|
|
||||||
*/
|
|
||||||
public static int flushAllPlayers() {
|
|
||||||
|
|
||||||
if (flushing.compareAndSet(false, true) == false) {
|
|
||||||
Logger.warn("GracefulShutdown: a flush is already in progress, skipping");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int saved = 0;
|
|
||||||
int failed = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
ArrayList<PlayerCharacter> online = new ArrayList<>(SessionManager.getAllActivePlayerCharacters());
|
|
||||||
|
|
||||||
Logger.info("GracefulShutdown: flushing " + online.size() + " online character(s)");
|
|
||||||
|
|
||||||
for (PlayerCharacter pc : online) {
|
|
||||||
|
|
||||||
if (pc == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
try {
|
|
||||||
pc.updateSkillsAndPowersToDatabase();
|
|
||||||
DbManager.PlayerCharacterQueries.UPDATE_CHARACTER_STATS(pc);
|
|
||||||
DbManager.PlayerCharacterQueries.UPDATE_CHARACTER_EXPERIENCE(pc);
|
|
||||||
saved++;
|
|
||||||
Logger.info("GracefulShutdown: saved " + pc.getCombinedName() + " (" + pc.getObjectUUID() + ')');
|
|
||||||
} catch (Exception e) {
|
|
||||||
failed++;
|
|
||||||
Logger.error("GracefulShutdown: could not save character " + pc.getObjectUUID() + ": " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("GracefulShutdown: flush finished, saved=" + saved + " failed=" + failed);
|
|
||||||
System.out.println("GracefulShutdown: flush finished, saved=" + saved + " failed=" + failed);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("GracefulShutdown: flush aborted: " + e);
|
|
||||||
} finally {
|
|
||||||
flushing.set(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return saved;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Broadcast a system-wide flash message to every player.
|
|
||||||
*
|
|
||||||
* @param text - message to display
|
|
||||||
*/
|
|
||||||
public static void announce(String text) {
|
|
||||||
|
|
||||||
if (text == null || text.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
ChatManager.chatSystemFlash(text);
|
|
||||||
Logger.info("GracefulShutdown: announced '" + text + '\'');
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("GracefulShutdown: unable to announce: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the JVM shutdown hook used by an orderly SIGTERM
|
|
||||||
* (kill -TERM on the process, i.e. the signal the servers currently never
|
|
||||||
* receive). The hook flushes every online character before the JVM exits.
|
|
||||||
*
|
|
||||||
* @param serverName - name used in the log lines
|
|
||||||
*/
|
|
||||||
public static void registerShutdownHook(final String serverName) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Logger.info("GracefulShutdown: " + serverName + " is terminating, flushing player data");
|
|
||||||
System.out.println("GracefulShutdown: " + serverName + " is terminating, flushing player data");
|
|
||||||
flushAllPlayers();
|
|
||||||
Logger.info("GracefulShutdown: " + serverName + " shutdown hook finished");
|
|
||||||
System.out.println("GracefulShutdown: " + serverName + " shutdown hook finished");
|
|
||||||
}
|
|
||||||
}, "gracefulShutdownHook"));
|
|
||||||
|
|
||||||
Logger.info("GracefulShutdown: shutdown hook registered for " + serverName);
|
|
||||||
System.out.println("GracefulShutdown: shutdown hook registered for " + serverName);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("GracefulShutdown: unable to register shutdown hook: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Announce a countdown, flush every online character and then stop the
|
|
||||||
* login and world servers. Only the first call has any effect.
|
|
||||||
*
|
|
||||||
* @param delaySeconds - seconds to wait before saving and stopping
|
|
||||||
* (0 stops immediately)
|
|
||||||
*/
|
|
||||||
public static void gracefulStop(final int delaySeconds) {
|
|
||||||
|
|
||||||
if (stopping.compareAndSet(false, true) == false) {
|
|
||||||
Logger.warn("GracefulShutdown: a shutdown is already in progress");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int remaining = Math.max(0, delaySeconds);
|
|
||||||
|
|
||||||
announce("Server is shutting down in " + remaining + " seconds. Please log out to save your character.");
|
|
||||||
|
|
||||||
while (remaining > 0) {
|
|
||||||
|
|
||||||
ThreadUtils.sleep(1000);
|
|
||||||
remaining--;
|
|
||||||
|
|
||||||
for (int mark : ANNOUNCE_MARKS)
|
|
||||||
if (mark == remaining)
|
|
||||||
announce("Server is shutting down in " + remaining + " second(s).");
|
|
||||||
}
|
|
||||||
|
|
||||||
announce("Server is shutting down now. Saving all characters...");
|
|
||||||
|
|
||||||
flushAllPlayers();
|
|
||||||
|
|
||||||
stopServers();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop the login and world server processes the same way the devops
|
|
||||||
* scripts do. Called only after every character has been written out.
|
|
||||||
*/
|
|
||||||
private static void stopServers() {
|
|
||||||
|
|
||||||
try {
|
|
||||||
Logger.info("GracefulShutdown: stopping the login and world servers");
|
|
||||||
System.out.println("GracefulShutdown: player data saved, stopping the login and world servers");
|
|
||||||
Runtime.getRuntime().exec("./mbkill.sh");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("GracefulShutdown: unable to run mbkill.sh: " + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Give the script a moment to stop the login server before this JVM disappears.
|
|
||||||
|
|
||||||
ThreadUtils.sleep(2000);
|
|
||||||
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,6 +17,7 @@ import engine.objects.*;
|
|||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
@@ -34,6 +35,13 @@ public enum LootManager {
|
|||||||
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
||||||
|
|
||||||
|
public static ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510}));
|
||||||
|
public static ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27570,188900,188910,188920,188930,188940,188950,189500}));
|
||||||
|
public static ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27550,27560,189100,189110,189120,189130,189140,189150}));
|
||||||
|
public static ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27600,188700,188720,189550,189560}));
|
||||||
|
public static ArrayList<Integer> racial_stewards = new ArrayList<>(Arrays.asList(new Integer[]{974,1064,1172,1267,1368,1468,1520,1528,1553,1578,1617,1667,1712}));
|
||||||
|
public static ArrayList<Integer> undead_guards = new ArrayList<>(Arrays.asList(new Integer[]{980100,980101,980102,980110,980111}));
|
||||||
|
|
||||||
// Drop Rates
|
// Drop Rates
|
||||||
|
|
||||||
public static float NORMAL_DROP_RATE;
|
public static float NORMAL_DROP_RATE;
|
||||||
@@ -68,6 +76,30 @@ public enum LootManager {
|
|||||||
|
|
||||||
public static void GenerateMobLoot(Mob mob) {
|
public static void GenerateMobLoot(Mob mob) {
|
||||||
|
|
||||||
|
if(mob == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(mob.level == 85){
|
||||||
|
MobLoot mithril = new MobLoot(mob, ItemBase.getItemBase(1580021), 1, true);
|
||||||
|
mob.getCharItemManager().addItemToInventory(mithril);
|
||||||
|
|
||||||
|
try{
|
||||||
|
int stewardRoll = ThreadLocalRandom.current().nextInt(1,racial_stewards.size() + 1);
|
||||||
|
MobLoot steward = new MobLoot(mob, ItemBase.getItemBase((Integer) racial_stewards.toArray()[stewardRoll]), true);
|
||||||
|
mob.getCharItemManager().addItemToInventory(steward);
|
||||||
|
}catch(Exception ex){
|
||||||
|
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
int guardRoll = ThreadLocalRandom.current().nextInt(1,undead_guards.size() + 1);
|
||||||
|
MobLoot guard = new MobLoot(mob, ItemBase.getItemBase((Integer) undead_guards.toArray()[guardRoll]), true);
|
||||||
|
mob.getCharItemManager().addItemToInventory(guard);
|
||||||
|
}catch(Exception ex){
|
||||||
|
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//determine if mob is in hotzone
|
//determine if mob is in hotzone
|
||||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
||||||
|
|
||||||
@@ -85,12 +117,18 @@ public enum LootManager {
|
|||||||
ItemBase ib = it.getItemBase();
|
ItemBase ib = it.getItemBase();
|
||||||
if(ib == null)
|
if(ib == null)
|
||||||
break;
|
break;
|
||||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
if (ib.getName().toLowerCase().contains("of the gods")) {
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||||
chatMsg.setMessageType(10);
|
chatMsg.setMessageType(10);
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
}
|
}
|
||||||
|
if(ib.isDiscRune()){
|
||||||
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||||
|
chatMsg.setMessageType(10);
|
||||||
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -129,7 +167,7 @@ public enum LootManager {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "ITEM":
|
case "ITEM":
|
||||||
GenerateInventoryDrop(mob, bse);
|
GenerateInventoryDrop(mob, bse, inHotzone);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +209,7 @@ public enum LootManager {
|
|||||||
if (itemUUID == 0)
|
if (itemUUID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal() && itemUUID != 1580021) {
|
||||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||||
}
|
}
|
||||||
@@ -196,6 +234,9 @@ public enum LootManager {
|
|||||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(outItem.getName().toLowerCase().contains("of the gods") && inHotzone == false)
|
||||||
|
return null;
|
||||||
|
|
||||||
return outItem;
|
return outItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,8 +384,24 @@ public enum LootManager {
|
|||||||
|
|
||||||
if (equipmentRoll > dropChance)
|
if (equipmentRoll > dropChance)
|
||||||
continue;
|
continue;
|
||||||
|
ItemBase genericIB = me.getItemBase();
|
||||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
//if(genericIB.isVorg()){
|
||||||
|
if(vorg_cloth_uuids.contains(genericIB.getUUID())){
|
||||||
|
//get random cloth piece
|
||||||
|
genericIB = ItemBase.getItemBase(vorg_cloth_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_cloth_uuids.size() - 1)));
|
||||||
|
} else if(vorg_ha_uuids.contains(genericIB.getUUID())){
|
||||||
|
//get random heavy armor piece
|
||||||
|
genericIB = ItemBase.getItemBase(vorg_ha_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ha_uuids.size() - 1)));
|
||||||
|
} else if(vorg_ma_uuids.contains(genericIB.getUUID())){
|
||||||
|
//get random medium armor piece
|
||||||
|
genericIB = ItemBase.getItemBase(vorg_ma_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ma_uuids.size() - 1)));
|
||||||
|
} else if(vorg_la_uuids.contains(genericIB.getUUID())){
|
||||||
|
//get random light armor piece
|
||||||
|
genericIB = ItemBase.getItemBase(vorg_la_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_la_uuids.size() - 1)));
|
||||||
|
}
|
||||||
|
mob.spawnTime = ThreadLocalRandom.current().nextInt(300,2700);
|
||||||
|
//}
|
||||||
|
MobLoot ml = new MobLoot(mob, genericIB, false);
|
||||||
|
|
||||||
if (ml != null && dropCount < 1) {
|
if (ml != null && dropCount < 1) {
|
||||||
ml.setIsID(true);
|
ml.setIsID(true);
|
||||||
@@ -356,7 +413,7 @@ public enum LootManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse, boolean inHotzone) {
|
||||||
|
|
||||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||||
|
|
||||||
@@ -365,12 +422,23 @@ public enum LootManager {
|
|||||||
if (chanceRoll > bse.dropChance)
|
if (chanceRoll > bse.dropChance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ItemBase ib = ItemBase.getItemBase(bse.itemBase);
|
||||||
|
if (ib == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ib.isDiscRune()) {
|
||||||
|
ItemBase newDisc = ItemBase.getItemBase(ThreadLocalRandom.current().nextInt(3001, 3049 + 1));
|
||||||
|
if (newDisc != null) {
|
||||||
|
//mob.getInventory().add(new MobLoot(mob, newDisc, true));
|
||||||
|
mob.getCharItemManager().addItemToInventory(new MobLoot(mob, newDisc, true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
||||||
|
|
||||||
if (lootItem != null)
|
if (lootItem != null)
|
||||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||||
|
|
||||||
//get table ID for the itembase ID
|
//get table ID for the itembase ID
|
||||||
|
|||||||
@@ -874,7 +874,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) {
|
} else if (System.currentTimeMillis() > aiAgent.deathTime + (aiAgent.spawnTime * 1000)) {
|
||||||
|
|
||||||
if (Zone.respawnQue.contains(aiAgent) == false) {
|
if (Zone.respawnQue.contains(aiAgent) == false) {
|
||||||
Zone.respawnQue.add(aiAgent);
|
Zone.respawnQue.add(aiAgent);
|
||||||
@@ -1030,7 +1030,10 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardCaptainLogic(Mob mob) {
|
public static void GuardCaptainLogic(Mob mob) {
|
||||||
|
if(mob.guardedCity.getBane() == null){
|
||||||
|
CheckMobMovement(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
@@ -1054,7 +1057,10 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardMinionLogic(Mob mob) {
|
public static void GuardMinionLogic(Mob mob) {
|
||||||
|
if(mob.guardedCity.getBane() == null){
|
||||||
|
CheckMobMovement(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
boolean isComanded = mob.npcOwner.isAlive();
|
boolean isComanded = mob.npcOwner.isAlive();
|
||||||
if (!isComanded) {
|
if (!isComanded) {
|
||||||
@@ -1074,7 +1080,10 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardWallArcherLogic(Mob mob) {
|
public static void GuardWallArcherLogic(Mob mob) {
|
||||||
|
if(mob.guardedCity.getBane() == null){
|
||||||
|
CheckMobMovement(mob);
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
|
|||||||
@@ -14,21 +14,6 @@ public class MobAIThread implements Runnable{
|
|||||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||||
public static int AI_PATROL_DIVISOR = 15;
|
public static int AI_PATROL_DIVISOR = 15;
|
||||||
public static float AI_CAST_FREQUENCY;
|
public static float AI_CAST_FREQUENCY;
|
||||||
|
|
||||||
/**
|
|
||||||
* Fixed-rate pacing for one full AI pass, in milliseconds (default 10 passes
|
|
||||||
* per second).
|
|
||||||
*
|
|
||||||
* The pass used to run with no delay whatsoever - `while (true)` straight into
|
|
||||||
* a sweep of every zone and every mob - which pinned one core for the entire
|
|
||||||
* lifetime of the world server (~100% of a core even in an empty world, two
|
|
||||||
* cores together with MobRespawnThread). Individual actions inside
|
|
||||||
* MobAI.DetermineAction are already gated by timestamps (lastAttackTime,
|
|
||||||
* nextCastTime, patrol delays), so running the sweep at a fixed rate removes
|
|
||||||
* the busy spin without changing behaviour. Raise this value to trade AI
|
|
||||||
* reaction time for CPU.
|
|
||||||
*/
|
|
||||||
public static int AI_TICK_INTERVAL_MS = 100;
|
|
||||||
// Thread constructor
|
// Thread constructor
|
||||||
|
|
||||||
public MobAIThread() {
|
public MobAIThread() {
|
||||||
@@ -42,9 +27,6 @@ public class MobAIThread implements Runnable{
|
|||||||
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
AI_CAST_FREQUENCY = Float.parseFloat(ConfigManager.MB_AI_CAST_FREQUENCY.getValue());
|
||||||
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
long tickStart = System.currentTimeMillis();
|
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.getAllZones()) {
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
|
|
||||||
for (Mob mob : zone.zoneMobSet) {
|
for (Mob mob : zone.zoneMobSet) {
|
||||||
@@ -58,16 +40,6 @@ public class MobAIThread implements Runnable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long sleep = AI_TICK_INTERVAL_MS - (System.currentTimeMillis() - tickStart);
|
|
||||||
|
|
||||||
if (sleep > 0) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(sleep);
|
|
||||||
} catch (InterruptedException ie) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void startAIThread() {
|
public static void startAIThread() {
|
||||||
|
|||||||
@@ -25,13 +25,6 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
public class MobRespawnThread implements Runnable {
|
public class MobRespawnThread implements Runnable {
|
||||||
|
|
||||||
/**
|
|
||||||
* Fixed-rate pacing for one respawn sweep, in milliseconds. The sweep used to
|
|
||||||
* run with no delay at all, pinning a core for the lifetime of the world server
|
|
||||||
* (the 100 ms check below only throttles how often a mob may actually respawn,
|
|
||||||
* it never paused the loop). Keep this at or below the 100 ms respawn throttle.
|
|
||||||
*/
|
|
||||||
public static int RESPAWN_TICK_INTERVAL_MS = 100;
|
|
||||||
|
|
||||||
public MobRespawnThread() {
|
public MobRespawnThread() {
|
||||||
Logger.info(" MobRespawnThread thread has started!");
|
Logger.info(" MobRespawnThread thread has started!");
|
||||||
@@ -43,8 +36,6 @@ public class MobRespawnThread implements Runnable {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
long tickStart = System.currentTimeMillis();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (Zone zone : ZoneManager.getAllZones()) {
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
|
|
||||||
@@ -64,15 +55,6 @@ public class MobRespawnThread implements Runnable {
|
|||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
long sleep = RESPAWN_TICK_INTERVAL_MS - (System.currentTimeMillis() - tickStart);
|
|
||||||
|
|
||||||
if (sleep > 0) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(sleep);
|
|
||||||
} catch (InterruptedException ie) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void startRespawnThread() {
|
public static void startRespawnThread() {
|
||||||
|
|||||||
@@ -562,6 +562,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
if (i.isCanDestroy())
|
if (i.isCanDestroy())
|
||||||
if (itemManager.delete(i) == true) {
|
if (itemManager.delete(i) == true) {
|
||||||
|
int value = i.getItemBase().getBaseValue();
|
||||||
|
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
|
||||||
|
sourcePlayer.getCharItemManager().updateInventory();
|
||||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,21 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
if (contract.canSlotinBuilding(building))
|
if (contract.canSlotinBuilding(building))
|
||||||
ItemLists.add(hirelings);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Item contractItem = Item.getFromCache(msg.getContractItem());
|
Item contractItem = Item.getFromCache(msg.getContractItem());
|
||||||
|
|
||||||
if (contractItem == null)
|
if (contractItem == null)
|
||||||
return false;
|
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())) {
|
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
|
||||||
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
|
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
|
||||||
@@ -104,10 +126,29 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check if contract can be slotted in this building
|
// 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)
|
if (contract.getContractID() == 866)//banker
|
||||||
return false;
|
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(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))
|
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Owner is obviously allowed to upgrade his own buildings
|
// 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.
|
// Players cannot destroy or transfer a TOL.
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import engine.net.client.msg.*;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -98,6 +99,10 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
private static void requestHermitBlessing(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
|
private static void requestHermitBlessing(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
|
||||||
|
|
||||||
|
|
||||||
|
if(DateTime.now().getHourOfDay() < 18 || DateTime.now().getHourOfDay() > 21){
|
||||||
|
ChatManager.chatSystemInfo(player, "Blessing can only be received between 6:00 pm and 10:00 pm");
|
||||||
|
}
|
||||||
Guild guild;
|
Guild guild;
|
||||||
Realm realm;
|
Realm realm;
|
||||||
City city;
|
City city;
|
||||||
|
|||||||
@@ -123,6 +123,11 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (resourceValue < 15)
|
if (resourceValue < 15)
|
||||||
hasResources = false;
|
hasResources = false;
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
|
||||||
|
|
||||||
|
if (resourceValue < 1)
|
||||||
|
hasResources = false;
|
||||||
|
|
||||||
if (hasResources == false) {
|
if (hasResources == false) {
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 184); // Insufficient gold or resources to upgrade to capital
|
ErrorPopupMsg.sendErrorPopup(player, 184); // Insufficient gold or resources to upgrade to capital
|
||||||
return false;
|
return false;
|
||||||
@@ -180,6 +185,16 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
|
||||||
|
|
||||||
|
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 1) == true) {
|
||||||
|
warehouse.getResources().put(Warehouse.mithrilIB, resourceValue - 1);
|
||||||
|
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.MITHRIL, 1);
|
||||||
|
} else {
|
||||||
|
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
realm.claimRealmForCity(city, charterUUID);
|
realm.claimRealmForCity(city, charterUUID);
|
||||||
|
|
||||||
tol.setRank(8);
|
tol.setRank(8);
|
||||||
|
|||||||
@@ -212,10 +212,6 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractCharacter guard : building.getHirelings().keySet()) {
|
|
||||||
if (guard.getObjectType() == GameObjectType.Mob)
|
|
||||||
((Mob) guard).setPatrolPointIndex(0);
|
|
||||||
}
|
|
||||||
} else if (building.getPatrolPoints() != null)
|
} else if (building.getPatrolPoints() != null)
|
||||||
ClearPatrolPoints(building.getObjectUUID());
|
ClearPatrolPoints(building.getObjectUUID());
|
||||||
|
|
||||||
@@ -223,10 +219,6 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
||||||
} else if (building.getSentryPoints() != null)
|
} else if (building.getSentryPoints() != null)
|
||||||
ClearSentryPoints(building.getObjectUUID());
|
ClearSentryPoints(building.getObjectUUID());
|
||||||
|
|
||||||
// Dispatch dispatch = Dispatch.borrow(pc, msg);
|
|
||||||
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
||||||
@@ -541,7 +533,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||||
|
|
||||||
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
|||||||
cities = City.getCitiesToTeleportTo(player);
|
cities = City.getCitiesToTeleportTo(player);
|
||||||
else
|
else
|
||||||
cities = City.getCitiesToRepledgeTo(player);
|
cities = City.getCitiesToRepledgeTo(player);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ public class Blueprint {
|
|||||||
|
|
||||||
maintCost = (9730 * rank) + 1890;
|
maintCost = (9730 * rank) + 1890;
|
||||||
|
|
||||||
return maintCost;
|
return maintCost * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxRank() {
|
public int getMaxRank() {
|
||||||
@@ -313,10 +313,10 @@ public class Blueprint {
|
|||||||
|
|
||||||
// Early exit for buildings with single or no slots
|
// 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;
|
return maxSlots;
|
||||||
|
|
||||||
if (this.maxRank == 1 && currentRank == 1)
|
if (this.maxRank == 1 && currentRank == 1&& this.buildingGroup.equals(BuildingGroup.TOL) == false)
|
||||||
return getMaxSlots();
|
return getMaxSlots();
|
||||||
|
|
||||||
switch (currentRank) {
|
switch (currentRank) {
|
||||||
@@ -328,20 +328,22 @@ public class Blueprint {
|
|||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
|
||||||
availableSlots = 2;
|
availableSlots = 2;
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
availableSlots = 3;
|
availableSlots = 3;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
availableSlots = 1;
|
availableSlots = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
availableSlots = 0;
|
availableSlots = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||||
|
availableSlots += 1;
|
||||||
|
}
|
||||||
return availableSlots;
|
return availableSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,54 +494,19 @@ public class Blueprint {
|
|||||||
// Select equation for rank time based upon the
|
// Select equation for rank time based upon the
|
||||||
// buildings current Maintenance BuildingGroup. These values
|
// buildings current Maintenance BuildingGroup. These values
|
||||||
// are expressed in hours
|
// are expressed in hours
|
||||||
|
if(this.getBuildingGroup().equals(BuildingGroup.TOL))
|
||||||
|
switch(targetRank){
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
return 6;
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
return 36;
|
||||||
|
}
|
||||||
|
|
||||||
switch (this.buildingGroup) {
|
return 5;
|
||||||
|
|
||||||
case GENERICNOUPGRADE:
|
|
||||||
break; // Cannot be upgraded
|
|
||||||
case VILLA:
|
|
||||||
case ESTATE:
|
|
||||||
case FORTRESS:
|
|
||||||
case CITADEL:
|
|
||||||
rankTime = (7 * targetRank) - 7;
|
|
||||||
break;
|
|
||||||
case TOL:
|
|
||||||
rankTime = (7 * targetRank) - 7;
|
|
||||||
break;
|
|
||||||
case BARRACK:
|
|
||||||
rankTime = (7 * targetRank) - 7;
|
|
||||||
break;
|
|
||||||
case CHURCH:
|
|
||||||
rankTime = (7 * targetRank) - 7;
|
|
||||||
break;
|
|
||||||
case FORGE:
|
|
||||||
case INN:
|
|
||||||
case TAILOR:
|
|
||||||
case MAGICSHOP:
|
|
||||||
rankTime = (7 * targetRank) - 7;
|
|
||||||
break;
|
|
||||||
case SPIRE:
|
|
||||||
rankTime = (4 * targetRank) + 4;
|
|
||||||
break;
|
|
||||||
case AMAZONHALL:
|
|
||||||
case CATHEDRAL:
|
|
||||||
case GREATHALL:
|
|
||||||
case KEEP:
|
|
||||||
case THIEFHALL:
|
|
||||||
case TEMPLEHALL:
|
|
||||||
case WIZARDHALL:
|
|
||||||
case ELVENHALL:
|
|
||||||
case ELVENSANCTUM:
|
|
||||||
case IREKEIHALL:
|
|
||||||
case FORESTHALL:
|
|
||||||
rankTime = (7 * targetRank) - 7;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Logger.error("Attempt to retrieve ranktime without MaintGroup");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rankTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2f getExtents() {
|
public Vector2f getExtents() {
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ public class Building extends AbstractWorldObject {
|
|||||||
|
|
||||||
// Add cost for building structure
|
// Add cost for building structure
|
||||||
|
|
||||||
maintCost += this.getBlueprint().getMaintCost(rank);
|
maintCost += this.getBlueprint().getMaintCost(rank) * 2;
|
||||||
|
|
||||||
// Add costs associated with hirelings
|
// Add costs associated with hirelings
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,6 @@ public class City extends AbstractWorldObject {
|
|||||||
private byte isCapital = 0;
|
private byte isCapital = 0;
|
||||||
private byte isSafeHold;
|
private byte isSafeHold;
|
||||||
private boolean forceRename = false;
|
private boolean forceRename = false;
|
||||||
private boolean noTeleport = false; //used by npc cities
|
|
||||||
private boolean noRepledge = false; //used by npc cities
|
|
||||||
private boolean isOpen = false;
|
|
||||||
private int treeOfLifeID;
|
private int treeOfLifeID;
|
||||||
private Vector3fImmutable location = Vector3fImmutable.ZERO;
|
private Vector3fImmutable location = Vector3fImmutable.ZERO;
|
||||||
|
|
||||||
@@ -142,14 +139,6 @@ public class City extends AbstractWorldObject {
|
|||||||
this.forceRename = rs.getInt("forceRename") == 1;
|
this.forceRename = rs.getInt("forceRename") == 1;
|
||||||
this.open = rs.getInt("open") == 1;
|
this.open = rs.getInt("open") == 1;
|
||||||
|
|
||||||
if (this.cityName.equals("Perdition") || this.cityName.equals("Bastion")) {
|
|
||||||
this.noTeleport = true;
|
|
||||||
this.noRepledge = true;
|
|
||||||
} else {
|
|
||||||
this.noTeleport = false;
|
|
||||||
this.noRepledge = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hash = rs.getString("hash");
|
this.hash = rs.getString("hash");
|
||||||
|
|
||||||
if (this.motto.isEmpty()) {
|
if (this.motto.isEmpty()) {
|
||||||
@@ -356,9 +345,6 @@ public class City extends AbstractWorldObject {
|
|||||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
if (ago.getObjectType().equals(GameObjectType.City)) {
|
||||||
City city = (City) ago;
|
City city = (City) ago;
|
||||||
|
|
||||||
if (city.noTeleport)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
||||||
|
|
||||||
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
|
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
|
||||||
@@ -412,8 +398,6 @@ public class City extends AbstractWorldObject {
|
|||||||
for (AbstractGameObject ago : worldCities.values()) {
|
for (AbstractGameObject ago : worldCities.values()) {
|
||||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
if (ago.getObjectType().equals(GameObjectType.City)) {
|
||||||
City city = (City) ago;
|
City city = (City) ago;
|
||||||
if (city.noRepledge)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import engine.Enum.DamageType;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ItemType;
|
import engine.Enum.ItemType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.LootManager;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -914,4 +915,23 @@ public class ItemBase {
|
|||||||
public void setAutoID(boolean autoID) {
|
public void setAutoID(boolean autoID) {
|
||||||
this.autoID = autoID;
|
this.autoID = autoID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVorg(){
|
||||||
|
return LootManager.vorg_ha_uuids.contains(this.uuid) || LootManager.vorg_ma_uuids.contains(this.uuid) || LootManager.vorg_la_uuids.contains(this.uuid) || LootManager.vorg_cloth_uuids.contains(this.uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getVorgStats() {
|
||||||
|
if(this.isLightArmor() || this.isMediumArmor() || this.isHeavyArmor() || this.isClothArmor()){
|
||||||
|
if(this.getValidSlot() == MBServerStatics.SLOT_FEET) {
|
||||||
|
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007","SUF-150"};
|
||||||
|
}else {
|
||||||
|
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"};
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(this.isShield()){//shield
|
||||||
|
return new String[]{"SUF-265","PRE-123","PRE-232", "PRE-212", "PRE-222"};
|
||||||
|
} else{//weapon
|
||||||
|
return new String[]{"PRE-020","PRE-033",};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1970,6 +1970,13 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
try {
|
try {
|
||||||
NPCManager.applyRuneSetEffects(this);
|
NPCManager.applyRuneSetEffects(this);
|
||||||
recalculateStats();
|
recalculateStats();
|
||||||
|
if(this.mobBase.getLevel() > 80){
|
||||||
|
if(this.getMobBaseID() == 14319){//ithriana
|
||||||
|
this.healthMax = 5400000;
|
||||||
|
} else{
|
||||||
|
this.healthMax = 1500000;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.setHealth(this.healthMax);
|
this.setHealth(this.healthMax);
|
||||||
|
|
||||||
// Set bounds for this mobile
|
// Set bounds for this mobile
|
||||||
@@ -2020,6 +2027,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.deathTime = 0;
|
this.deathTime = 0;
|
||||||
|
|
||||||
|
if(this.getName().equals("Chaos Chimera") || this.getName().equals("Taint Horror"))
|
||||||
|
this.level -= 10;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e.getMessage());
|
Logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1074,8 +1074,8 @@ public class NPC extends AbstractCharacter {
|
|||||||
filteredItemList.add(910010 + subID);
|
filteredItemList.add(910010 + subID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getRank() == 7)
|
//if (this.getRank() == 7)
|
||||||
filteredItemList.add(910018);
|
// filteredItemList.add(910018);
|
||||||
}
|
}
|
||||||
|
|
||||||
return filteredItemList;
|
return filteredItemList;
|
||||||
@@ -1152,9 +1152,13 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
upgradeTime = Integer.MAX_VALUE;
|
upgradeTime = Integer.MAX_VALUE;
|
||||||
|
|
||||||
if (this.getRank() < 7)
|
if (this.getRank() < 7) {
|
||||||
return (this.getRank() * 8);
|
if(this.contract.getName().contains("Trainer") == false){
|
||||||
|
return 5;
|
||||||
|
}else{
|
||||||
|
return this.getRank() * 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
import java.util.concurrent.locks.ReadWriteLock;
|
import java.util.concurrent.locks.ReadWriteLock;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
|
import static engine.InterestManagement.RealmMap.getRealmAtLocation;
|
||||||
|
|
||||||
|
|
||||||
public class PlayerCharacter extends AbstractCharacter {
|
public class PlayerCharacter extends AbstractCharacter {
|
||||||
|
|
||||||
@@ -4811,6 +4813,18 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
updateBlessingMessage();
|
updateBlessingMessage();
|
||||||
|
|
||||||
this.safeZone = this.isInSafeZone();
|
this.safeZone = this.isInSafeZone();
|
||||||
|
Realm currentRealm = getRealmAtLocation(this.getLoc());
|
||||||
|
if(currentRealm != null) {
|
||||||
|
boolean forbiddenRealm = false;
|
||||||
|
if (Realm.overridePlacement(currentRealm.getRealmName()))
|
||||||
|
forbiddenRealm = true;
|
||||||
|
if (forbiddenRealm && this.containsEffect(1672601862) == false) {//Deathshroud
|
||||||
|
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding
|
||||||
|
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false);
|
||||||
|
//}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
|
|||||||
@@ -76,18 +76,40 @@ public class Realm {
|
|||||||
this.mapG = (float) (mapColor.getGreen() * 0.00392156863);
|
this.mapG = (float) (mapColor.getGreen() * 0.00392156863);
|
||||||
this.mapB = (float) (mapColor.getBlue() * 0.00392156863);
|
this.mapB = (float) (mapColor.getBlue() * 0.00392156863);
|
||||||
this.mapA = 1;
|
this.mapA = 1;
|
||||||
this.canBeClaimed = rs.getBoolean("canBeClaimed");
|
if (overridePlacement(rs.getString("realmName"))) {
|
||||||
this.canPlaceCities = rs.getBoolean("canPlaceCities");
|
this.canBeClaimed = false;
|
||||||
this.numCities = rs.getInt("numCities");
|
this.canPlaceCities = false;
|
||||||
this.realmName = rs.getString("realmName");
|
this.numCities = 0;
|
||||||
this.rulingCityUUID = rs.getInt("rulingCityUID");
|
this.rulingCityUUID = 0;
|
||||||
this.charterType = rs.getInt("charterType");
|
this.charterType = 0;
|
||||||
|
this.realmName = "Plagued Land";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.canPlaceCities = rs.getBoolean("canPlaceCities");
|
||||||
|
this.numCities = rs.getInt("numCities");
|
||||||
|
if(this.numCities > 0){
|
||||||
|
this.canBeClaimed = true;
|
||||||
|
}else{
|
||||||
|
this.canBeClaimed = false;
|
||||||
|
}
|
||||||
|
this.rulingCityUUID = rs.getInt("rulingCityUID");
|
||||||
|
if (this.rulingCityUUID != 0) {
|
||||||
|
this.charterType = rs.getInt("charterType");
|
||||||
|
} else {
|
||||||
|
this.charterType = 0;
|
||||||
|
}
|
||||||
|
this.realmName = rs.getString("realmName");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
java.sql.Timestamp ruledTimeStamp = rs.getTimestamp("ruledSince");
|
java.sql.Timestamp ruledTimeStamp = rs.getTimestamp("ruledSince");
|
||||||
|
|
||||||
if (ruledTimeStamp != null)
|
if (ruledTimeStamp != null){
|
||||||
this.ruledSince = LocalDateTime.ofInstant(ruledTimeStamp.toInstant(), ZoneId.systemDefault());
|
this.ruledSince = LocalDateTime.ofInstant(ruledTimeStamp.toInstant(), ZoneId.systemDefault());
|
||||||
|
}else {
|
||||||
|
this.rulingCityUUID = 0;
|
||||||
|
this.charterType = 0;
|
||||||
|
}
|
||||||
this.mapY1 = rs.getFloat("mapY1");
|
this.mapY1 = rs.getFloat("mapY1");
|
||||||
this.mapX1 = rs.getFloat("mapX1");
|
this.mapX1 = rs.getFloat("mapX1");
|
||||||
this.mapY2 = rs.getFloat("mapY2");
|
this.mapY2 = rs.getFloat("mapY2");
|
||||||
@@ -100,6 +122,21 @@ public class Realm {
|
|||||||
this.hash = rs.getString("hash");
|
this.hash = rs.getString("hash");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean overridePlacement(String realm){
|
||||||
|
switch(realm.toLowerCase()) {
|
||||||
|
case "neshraa":
|
||||||
|
case "adduram":
|
||||||
|
case "letharuun":
|
||||||
|
case "kralgaard":
|
||||||
|
//case "ecklund":
|
||||||
|
case "nordenthol":
|
||||||
|
case "thollmar":
|
||||||
|
case "haldorn isles":
|
||||||
|
case "hregenlund":
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public static void configureAllRealms() {
|
public static void configureAllRealms() {
|
||||||
|
|
||||||
for (Realm realm : Realm._realms.values()) {
|
for (Realm realm : Realm._realms.values()) {
|
||||||
|
|||||||
@@ -74,7 +74,11 @@ public class Zone extends AbstractGameObject {
|
|||||||
this.zCoord = rs.getFloat("ZCoord");
|
this.zCoord = rs.getFloat("ZCoord");
|
||||||
this.yCoord = rs.getFloat("YOffset");
|
this.yCoord = rs.getFloat("YOffset");
|
||||||
this.loadNum = rs.getInt("LoadNum");
|
this.loadNum = rs.getInt("LoadNum");
|
||||||
this.safeZone = rs.getByte("SafeZone");
|
if(overrideSafety(rs.getString("Name"))){
|
||||||
|
this.safeZone = (byte) 0;
|
||||||
|
}else {
|
||||||
|
this.safeZone = rs.getByte("SafeZone");
|
||||||
|
}
|
||||||
this.Icon1 = rs.getString("Icon1");
|
this.Icon1 = rs.getString("Icon1");
|
||||||
this.Icon2 = rs.getString("Icon2");
|
this.Icon2 = rs.getString("Icon2");
|
||||||
this.Icon3 = rs.getString("Icon3");
|
this.Icon3 = rs.getString("Icon3");
|
||||||
@@ -103,7 +107,44 @@ public class Zone extends AbstractGameObject {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static boolean skipZone(String name){
|
||||||
|
switch(name){
|
||||||
|
case "Kralgar Holm":
|
||||||
|
case "Doomhorn Skrae":
|
||||||
|
case "Ymur's Crown":
|
||||||
|
case "Ecklund Wilds":
|
||||||
|
case "Ragnir Holm":
|
||||||
|
case "Aurrochs Skrae":
|
||||||
|
case "Hregerend Wildlands":
|
||||||
|
case "The Blood Sands":
|
||||||
|
case "Vale of Nar Addad":
|
||||||
|
case "Kharsoom":
|
||||||
|
case "Leth'khalivar Desert":
|
||||||
|
case "Thollok Marsh":
|
||||||
|
case "The Black Bog":
|
||||||
|
case "sevaath Mere":
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean overrideSafety(String name){
|
||||||
|
switch(name){
|
||||||
|
case"Sanctuary":
|
||||||
|
case "All-Father's Rest":
|
||||||
|
case "Hamlet of Hothor's Doom":
|
||||||
|
case"Hamlet of Hrimdal":
|
||||||
|
case "Hamlet of Valkirch":
|
||||||
|
case "Hamlet of Scraefahl":
|
||||||
|
case "Hamlet of Hengest":
|
||||||
|
case "Starkholm":
|
||||||
|
case "Aeldreth Havens":
|
||||||
|
case "Erkeng Hold":
|
||||||
|
case "Sea Dog's Rest":
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
||||||
|
|
||||||
if (zone.loadNum == 0 && zone.playerCityID == 0)
|
if (zone.loadNum == 0 && zone.playerCityID == 0)
|
||||||
|
|||||||
@@ -96,11 +96,6 @@ public class LoginServer {
|
|||||||
// Start the Login Server
|
// Start the Login Server
|
||||||
|
|
||||||
loginServer.init();
|
loginServer.init();
|
||||||
|
|
||||||
// flush any cached character state on an orderly termination
|
|
||||||
// (the login server holds no players, so this normally logs 0).
|
|
||||||
|
|
||||||
GracefulShutdown.registerShutdownHook("LoginServer");
|
|
||||||
loginServer.exec();
|
loginServer.exec();
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -150,42 +145,29 @@ public class LoginServer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true when something is already listening on the given TCP port.
|
|
||||||
*
|
|
||||||
* This used to shell out to `lsof -i tcp:<port>` through /bin/bash and read the
|
|
||||||
* child's output until EOF. With no timeout and no waitFor() a child that blocks
|
|
||||||
* is fatal: lsof has been observed stuck in uninterruptible I/O (D state) while
|
|
||||||
* scanning the busy world server inside the container, which left the login
|
|
||||||
* server permanently inside its startup path. LoginServer.exec() never returned
|
|
||||||
* from checkServerHealth(), the accept loop never started, and clients could open
|
|
||||||
* a TCP connection to the port and then wait forever for the 100 byte DH
|
|
||||||
* handshake - surfacing as "Failed to open a server connection" after the
|
|
||||||
* client's own timeout.
|
|
||||||
*
|
|
||||||
* A bind probe is equivalent for this purpose, needs no external tool and cannot
|
|
||||||
* hang. SO_REUSEADDR does not allow stealing a port that is actively listening,
|
|
||||||
* so a successful bind still means the port is free.
|
|
||||||
*/
|
|
||||||
public static boolean isPortInUse(int port) {
|
public static boolean isPortInUse(int port) {
|
||||||
|
|
||||||
java.net.ServerSocket probe = null;
|
ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c", "lsof -i tcp:" + port + " | tail -n +2 | awk '{print $2}'");
|
||||||
|
builder.redirectErrorStream(true);
|
||||||
|
Process process = null;
|
||||||
|
String line = null;
|
||||||
|
boolean portInUse = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
probe = new java.net.ServerSocket();
|
process = builder.start();
|
||||||
probe.setReuseAddress(true);
|
|
||||||
probe.bind(new java.net.InetSocketAddress(port));
|
InputStream is = process.getInputStream();
|
||||||
return false;
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
|
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
portInUse = true;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return true;
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (probe != null)
|
|
||||||
try {
|
|
||||||
probe.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// the bind result is what matters; closing cannot change it
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return portInUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exec() {
|
private void exec() {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import engine.Enum.DispatchChannel;
|
|||||||
import engine.Enum.MinionType;
|
import engine.Enum.MinionType;
|
||||||
import engine.Enum.SupportMsgType;
|
import engine.Enum.SupportMsgType;
|
||||||
import engine.InterestManagement.HeightMap;
|
import engine.InterestManagement.HeightMap;
|
||||||
|
import engine.InterestManagement.InterestManager;
|
||||||
import engine.InterestManagement.RealmMap;
|
import engine.InterestManagement.RealmMap;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.db.archive.DataWarehouse;
|
import engine.db.archive.DataWarehouse;
|
||||||
@@ -109,11 +110,6 @@ public class WorldServer {
|
|||||||
|
|
||||||
worldServer.init();
|
worldServer.init();
|
||||||
|
|
||||||
// flush every online character if the JVM is asked to terminate
|
|
||||||
// in an orderly way (kill -TERM); SIGKILL cannot be intercepted.
|
|
||||||
|
|
||||||
GracefulShutdown.registerShutdownHook("WorldServer");
|
|
||||||
|
|
||||||
int retVal = worldServer.exec();
|
int retVal = worldServer.exec();
|
||||||
|
|
||||||
if (retVal != 0)
|
if (retVal != 0)
|
||||||
@@ -715,7 +711,6 @@ public class WorldServer {
|
|||||||
}
|
}
|
||||||
player.getTimestamps().put("logout", System.currentTimeMillis());
|
player.getTimestamps().put("logout", System.currentTimeMillis());
|
||||||
player.setEnteredWorld(false);
|
player.setEnteredWorld(false);
|
||||||
|
|
||||||
// remove from simulation and zero current loc
|
// remove from simulation and zero current loc
|
||||||
|
|
||||||
WorldGrid.RemoveWorldObject(player);
|
WorldGrid.RemoveWorldObject(player);
|
||||||
|
|||||||
Reference in new issue
Block a user