MagicBot
2 years ago
7 changed files with 34 additions and 276 deletions
@ -1,94 +0,0 @@
@@ -1,94 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds; |
||||
|
||||
import engine.Enum.BuildingGroup; |
||||
import engine.Enum.GameObjectType; |
||||
import engine.devcmd.AbstractDevCmd; |
||||
import engine.gameManager.BuildingManager; |
||||
import engine.objects.*; |
||||
|
||||
public class setOpenDateCmd extends AbstractDevCmd { |
||||
|
||||
public setOpenDateCmd() { |
||||
super("minedate"); |
||||
} |
||||
|
||||
@Override |
||||
protected void _doCmd(PlayerCharacter pcSender, String[] words, |
||||
AbstractGameObject target) { |
||||
|
||||
|
||||
if (words[0].equalsIgnoreCase("list")){ |
||||
for (int buildingID : Mine.towerMap.keySet()){ |
||||
Building building = BuildingManager.getBuildingFromCache(buildingID); |
||||
if (building == null){ |
||||
this.throwbackError(pcSender, "null building for ID " + buildingID); |
||||
continue; |
||||
} |
||||
|
||||
Zone zone = building.getParentZone(); |
||||
|
||||
Zone parentZone = zone.getParent(); |
||||
|
||||
Mine mine = Mine.towerMap.get(buildingID); |
||||
this.throwbackInfo(pcSender, "Mine UUID : " + mine.getObjectUUID() + " Mine Type: " + zone.getName() + " Zone : " + parentZone.getName() |
||||
+ " Open Date : " + mine.openDate); |
||||
} |
||||
|
||||
} |
||||
if (target == null){ |
||||
this.throwbackError(pcSender, "null target"); |
||||
return; |
||||
} |
||||
if (target.getObjectType().equals(GameObjectType.Building) == false){ |
||||
this.throwbackError(pcSender, "target must be object type building"); |
||||
return; |
||||
} |
||||
|
||||
Building building = (Building)target; |
||||
if (building.getBlueprint() == null){ |
||||
this.throwbackError(pcSender, "null blueprint"); |
||||
return; |
||||
} |
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE) == false){ |
||||
|
||||
this.throwbackError(pcSender, "target not mine"); |
||||
return; |
||||
} |
||||
|
||||
Mine mine = Mine.getMineFromTower(building.getObjectUUID()); |
||||
|
||||
if (mine == null){ |
||||
this.throwbackError(pcSender, "null mine"); |
||||
return; |
||||
} |
||||
int days = Integer.parseInt(words[0]); |
||||
int hours = Integer.parseInt(words[1]); |
||||
|
||||
mine.openDate = mine.openDate.plusDays(days).plusHours(hours); |
||||
|
||||
this.throwbackInfo(pcSender, "Mine Open Date Changed to " + mine.openDate.toString()); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String _getUsageString() { |
||||
return "' /bounds'"; |
||||
} |
||||
|
||||
@Override |
||||
protected String _getHelpString() { |
||||
return "Audits all the mobs in a zone."; |
||||
|
||||
} |
||||
|
||||
} |
@ -1,71 +0,0 @@
@@ -1,71 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.jobs; |
||||
|
||||
import engine.job.AbstractJob; |
||||
import engine.objects.Mine; |
||||
import org.pmw.tinylog.Logger; |
||||
|
||||
import java.time.LocalDateTime; |
||||
import java.util.ArrayList; |
||||
|
||||
public class MineActiveJob extends AbstractJob { |
||||
|
||||
public MineActiveJob() { |
||||
super(); |
||||
} |
||||
|
||||
@Override |
||||
protected void doJob() { |
||||
ArrayList<Mine> mines = Mine.getMines(); |
||||
LocalDateTime now = LocalDateTime.now(); |
||||
|
||||
for (Mine mine : mines) { |
||||
try { |
||||
|
||||
if (mine.getOwningGuild() == null){ |
||||
mine.handleStartMineWindow(); |
||||
Mine.setLastChange(System.currentTimeMillis()); |
||||
continue; |
||||
} |
||||
|
||||
//handle claimed mines
|
||||
LocalDateTime mineWindow = mine.openDate.withMinute(0).withSecond(0).withNano(0); |
||||
if (mineWindow != null && now.plusMinutes(1).isAfter(mineWindow)) |
||||
if (!mine.getIsActive()) { |
||||
Logger.info("activating mine. " + mineWindow.getHour() + " , " + now.getHour()); |
||||
mine.handleStartMineWindow(); |
||||
Mine.setLastChange(System.currentTimeMillis()); |
||||
|
||||
}else{ |
||||
if (mine.handleEndMineWindow()){ |
||||
Logger.info("Deactivating mine. " + mineWindow.getHour() + " , " + now.getHour()); |
||||
Mine.setLastChange(System.currentTimeMillis()); |
||||
} |
||||
|
||||
} |
||||
}catch (Exception e) { |
||||
Logger.error( "mineID: " + mine.getObjectUUID() + e); |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue