|
|
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
|
|
// Magicbane Emulator Project © 2013 - 2022
|
|
|
|
// www.magicbane.com
|
|
|
|
|
|
|
|
|
|
|
|
package engine.workthreads;
|
|
|
|
|
|
|
|
import engine.Enum;
|
|
|
|
import engine.gameManager.*;
|
|
|
|
import engine.net.MessageDispatcher;
|
|
|
|
import engine.objects.*;
|
|
|
|
import engine.server.world.WorldServer;
|
|
|
|
import org.pmw.tinylog.Logger;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
|
|
public class HourlyJobThread implements Runnable {
|
|
|
|
|
|
|
|
public HourlyJobThread() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
// *** REFACTOR: TRY TRY TRY TRY {{{{{{{{{{{ OMG
|
|
|
|
|
|
|
|
Logger.info("Hourly job is now running.");
|
|
|
|
|
|
|
|
// Update city population values
|
|
|
|
|
|
|
|
ConcurrentHashMap<Integer, AbstractGameObject> map = DbManager.getMap(Enum.GameObjectType.City);
|
|
|
|
|
|
|
|
if (map != null) {
|
|
|
|
|
|
|
|
for (AbstractGameObject ago : map.values()) {
|
|
|
|
|
|
|
|
City city = (City) ago;
|
|
|
|
|
|
|
|
if (city != null)
|
|
|
|
if (city.getGuild() != null) {
|
|
|
|
ArrayList<PlayerCharacter> guildList = Guild.GuildRoster(city.getGuild());
|
|
|
|
city.setPopulation(guildList.size());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
City.lastCityUpdate = System.currentTimeMillis();
|
|
|
|
} else {
|
|
|
|
Logger.error("missing city map");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Log metrics to console
|
|
|
|
Logger.info(WorldServer.getUptimeString());
|
|
|
|
Logger.info(SimulationManager.getPopulationString());
|
|
|
|
Logger.info(MessageDispatcher.getNetstatString());
|
|
|
|
Logger.info(PurgeOprhans.recordsDeleted.toString() + "orphaned items deleted");
|
|
|
|
}
|
|
|
|
}
|