WyvernMods Configurable Phase 3

This commit is contained in:
Sindusk
2019-05-08 02:15:14 -04:00
parent acf5d74a9c
commit 17ddab3783
11 changed files with 538 additions and 322 deletions

View File

@@ -5,10 +5,6 @@ import com.wurmonline.server.TimeConstants;
import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.creatures.Creatures;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
import javassist.bytecode.Descriptor;
import mod.sin.lib.Util;
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;

View File

@@ -91,34 +91,13 @@ public class Bounty {
try {
ClassPool classPool = HookManager.getInstance().getClassPool();
final Class<Bounty> thisClass = Bounty.class;
String replace;
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
/*CtMethod ctCheckBounty = CtMethod.make((String)
"public void checkBounty(com.wurmonline.server.players.Player player, com.wurmonline.server.creatures.Creature mob){"
+ " if(!mod.sin.wyvernmods.bounty.MethodsBounty.isCombatant(this.attackers, player.getWurmId()) || mob.isPlayer() || mob.isReborn()){"
+ " return;"
+ " }"
+ (mod.bDebug ? "logger.info(player.getName()+\" killed \"+mob.getName());" : "")
+ " mod.sin.wyvernmods.bounty.MethodsBounty.checkPlayerReward(player, mob);"
+ "}", ctCreature);
ctCreature.addMethod(ctCheckBounty);*/
String replace;
replace = ""
//+ "mod.sin.wyvern.bounty.MethodsBounty.checkBounty(player, this);"
+ PlayerBounty.class.getName()+".checkPlayerBounty(player, this);"
replace = PlayerBounty.class.getName()+".checkPlayerBounty(player, this);"
+ "$_ = $proceed($$);";
Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "checkCoinAward", replace);
/*ctCreature.getDeclaredMethod("modifyFightSkill").instrument(new ExprEditor(){
public void edit(MethodCall m) throws CannotCompileException {
if (m.getMethodName().equals("checkCoinAward")) {
m.replace("mod.sin.wyvern.bounty.MethodsBounty.checkBounty(player, this);"
+ "$_ = $proceed($$);");
logger.info("Instrumented checkCoinAward to call checkBounty as well.");
return;
}
}
});*/
// Die method description
CtClass ctString = classPool.get("java.lang.String");
@@ -130,19 +109,8 @@ public class Bounty {
String desc1 = Descriptor.ofMethod(CtClass.voidType, params1);
replace = "$_ = $proceed($$);"
//+ "mod.sin.wyvern.bounty.MethodsBounty.checkLootTable(this, corpse);";
+ LootBounty.class.getName()+".checkLootTable(this, corpse);";
Util.instrumentDescribed(thisClass, ctCreature, "die", desc1, "setRotation", replace);
/*ctCreature.getDeclaredMethod("die").instrument(new ExprEditor(){
public void edit(MethodCall m) throws CannotCompileException {
if (m.getMethodName().equals("setRotation")) {
m.replace("$_ = $proceed($$);"
+ "mod.sin.wyvern.bounty.MethodsBounty.checkLootTable(this, corpse);");
logger.info("Instrumented setRotation to call insertCorpseItems as well.");
return;
}
}
});*/
// doNew(int templateid, boolean createPossessions, float aPosX, float aPosY, float aRot, int layer, String name, byte gender, byte kingdom, byte ctype, boolean reborn, byte age)
CtClass[] params2 = {
@@ -161,56 +129,48 @@ public class Bounty {
CtClass.intType
};
String desc2 = Descriptor.ofMethod(ctCreature, params2);
Util.insertBeforeDescribed(thisClass, ctCreature, "doNew", desc2, "logger.info(\"Creating new creature: \"+templateid+\" - \"+(aPosX/4)+\", \"+(aPosY/4)+\" [\"+com.wurmonline.server.creatures.CreatureTemplateFactory.getInstance().getTemplate(templateid).getName()+\"]\");");
// Debugging to show all new creatures created.
//CtMethod ctDoNew = ctCreature.getMethod("doNew", "(IZFFFILjava/lang/String;BBBZB)Lcom/wurmonline/server/creatures/Creature;");
//ctDoNew.insertBefore("logger.info(\"Creating new creature: \"+templateid+\" - \"+(aPosX/4)+\", \"+(aPosY/4)+\" [\"+com.wurmonline.server.creatures.CreatureTemplateFactory.getInstance().getTemplate(templateid).getName()+\"]\");");
// Modify new creatures
Util.setReason("Log new creature spawns.");
replace = "logger.info(\"Creating new creature: \"+templateid+\" - \"+(aPosX/4)+\", \"+(aPosY/4)+\" [\"+com.wurmonline.server.creatures.CreatureTemplateFactory.getInstance().getTemplate(templateid).getName()+\"]\");";
Util.insertBeforeDescribed(thisClass, ctCreature, "doNew", desc2, replace);
Util.setReason("Modify newly created creatures.");
replace = "$_ = $proceed($$);"
//+ "mod.sin.wyvern.bestiary.MethodsBestiary.modifyNewCreature($1);";
+ MethodsBestiary.class.getName()+".modifyNewCreature($1);";
Util.instrumentDescribed(thisClass, ctCreature, "doNew", desc2, "sendToWorld", replace);
/*ctDoNew.instrument(new ExprEditor(){
public void edit(MethodCall m) throws CannotCompileException {
if (m.getMethodName().equals("sendToWorld")) {
m.replace("$_ = $proceed($$);"
+ "mod.sin.wyvern.bestiary.MethodsBestiary.modifyNewCreature($1);");
return;
}
}
});*/
// -- Enable adjusting size for creatures -- //
CtClass ctCreatureStatus = classPool.get("com.wurmonline.server.creatures.CreatureStatus");
Util.setBodyDeclared(thisClass, ctCreatureStatus, "getSizeMod", "{return "+MethodsBestiary.class.getName()+".getAdjustedSizeMod(this);}");
//ctCreatureStatus.getDeclaredMethod("getSizeMod").setBody("{return mod.sin.wyvern.bestiary.MethodsBestiary.getAdjustedSizeMod(this);}");
// -- Enable adjusting size for creatures -- //
CtClass ctCreatureStatus = classPool.get("com.wurmonline.server.creatures.CreatureStatus");
Util.setBodyDeclared(thisClass, ctCreatureStatus, "getSizeMod", "{return "+MethodsBestiary.class.getName()+".getAdjustedSizeMod(this);}");
//ctCreatureStatus.getDeclaredMethod("getSizeMod").setBody("{return mod.sin.wyvern.bestiary.MethodsBestiary.getAdjustedSizeMod(this);}");
// -- Enable adjusting color for creatures -- //
/*CtClass ctCreatureTemplate = classPool.get("com.wurmonline.server.creatures.CreatureTemplate");
replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){"
// -- Enable adjusting color for creatures -- //
/*CtClass ctCreatureTemplate = classPool.get("com.wurmonline.server.creatures.CreatureTemplate");
replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){"
+ " return "+MethodsBestiary.class.getName()+".getCreatureColorRed(this);"
+ "}";
Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorRed", replace);
replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){"
Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorRed", replace);
replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){"
+ " return "+MethodsBestiary.class.getName()+".getCreatureColorGreen(this);"
+ "}";
Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorGreen", replace);
replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){"
Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorGreen", replace);
replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){"
+ " return "+MethodsBestiary.class.getName()+".getCreatureColorBlue(this);"
+ "}";
Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorBlue", replace);*/
/*ctCreatureTemplate.getDeclaredMethod("getColorRed").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){"
Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorBlue", replace);*/
/*ctCreatureTemplate.getDeclaredMethod("getColorRed").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){"
+ " return mod.sin.wyvern.bestiary.MethodsBestiary.getCreatureColorRed(this);"
+ "}");
ctCreatureTemplate.getDeclaredMethod("getColorGreen").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){"
ctCreatureTemplate.getDeclaredMethod("getColorGreen").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){"
+ " return mod.sin.wyvern.bestiary.MethodsBestiary.getCreatureColorGreen(this);"
+ "}");
ctCreatureTemplate.getDeclaredMethod("getColorBlue").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){"
ctCreatureTemplate.getDeclaredMethod("getColorBlue").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){"
+ " return mod.sin.wyvern.bestiary.MethodsBestiary.getCreatureColorBlue(this);"
+ "}");*/
// -- When a creature takes damage, track the damage taken -- //
/*CtClass[] params2 = {
// -- When a creature takes damage, track the damage taken -- //
/*CtClass[] params2 = {
ctCreature,
ctCreature,
CtClass.byteType,
@@ -223,18 +183,18 @@ public class Bounty {
CtClass.floatType,
CtClass.booleanType,
CtClass.booleanType
};
String desc2 = Descriptor.ofMethod(CtClass.booleanType, params2);
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
replace = "if($1 != null && $2 != null){"
};
String desc2 = Descriptor.ofMethod(CtClass.booleanType, params2);
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
replace = "if($1 != null && $2 != null){"
+ " "+Bounty.class.getName()+".addDealtDamage($2.getWurmId(), $1.getWurmId(), $5);"
+ "}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc2, replace);*/
//ctCombatEngine.getMethod("addWound", desc2).insertBefore("if($1 != null && $2 != null){mod.sin.wyvern.bounty.MethodsBounty.addDealtDamage($2.getWurmId(), $1.getWurmId(), $5);}");
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc2, replace);*/
//ctCombatEngine.getMethod("addWound", desc2).insertBefore("if($1 != null && $2 != null){mod.sin.wyvern.bounty.MethodsBounty.addDealtDamage($2.getWurmId(), $1.getWurmId(), $5);}");
}
catch (NotFoundException e) {
throw new HookException(e);
}
}
catch (NotFoundException e) {
throw new HookException(e);
}
}
}

View File

@@ -87,6 +87,10 @@ public class EconomicChanges {
final Class<EconomicChanges> thisClass = EconomicChanges.class;
String replace;
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
CtClass ctTrade = classPool.get("com.wurmonline.server.items.Trade");
/* [2/4/19] Disabled - Likely causing issues with upkeep fluctuation.
Util.setReason("Increase deed upkeep by modifying the amount of tiles it thinks it has.");
CtClass ctGuardPlan = classPool.get("com.wurmonline.server.villages.GuardPlan");
@@ -107,23 +111,26 @@ public class EconomicChanges {
replace = "{ return "+EconomicChanges.class.getName()+".getNewDisbandMoney(this, this.getVillage()); }";
Util.setBodyDeclared(thisClass, ctGuardPlan, "getDisbandMoneyLeft", replace);*/
Util.setReason("Adjust value for certain items.");
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
replace = "int newVal = "+EconomicChanges.class.getName()+".getNewValue(this);"
+ "if(newVal > 0){"
+ " return newVal;"
+ "}";
Util.insertBeforeDeclared(thisClass, ctItem, "getValue", replace);
if (WyvernMods.adjustSealedMapValue) {
Util.setReason("Adjust value for certain items.");
replace = "int newVal = " + EconomicChanges.class.getName() + ".getNewValue(this);"
+ "if(newVal > 0){"
+ " return newVal;"
+ "}";
Util.insertBeforeDeclared(thisClass, ctItem, "getValue", replace);
}
Util.setReason("Remove trader refilling off kings coffers.");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
replace = "$_ = 1;";
Util.instrumentDeclared(thisClass, ctCreature, "removeRandomItems", "nextInt", replace);
if (WyvernMods.disableTraderRefill) {
Util.setReason("Remove trader refilling off kings coffers.");
replace = "$_ = 1;";
Util.instrumentDeclared(thisClass, ctCreature, "removeRandomItems", "nextInt", replace);
}
Util.setReason("Void 80% of all currency put into traders.");
CtClass ctTrade = classPool.get("com.wurmonline.server.items.Trade");
replace = "$1 = "+EconomicChanges.class.getName()+".getNewShopDiff($0, $1, $0.shopDiff);";
Util.insertBeforeDeclared(thisClass, ctTrade, "addShopDiff", replace);
if (WyvernMods.voidTraderMoney) {
Util.setReason("Void 80% of all currency put into traders.");
replace = "$1 = " + EconomicChanges.class.getName() + ".getNewShopDiff($0, $1, $0.shopDiff);";
Util.insertBeforeDeclared(thisClass, ctTrade, "addShopDiff", replace);
}
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);

View File

@@ -23,8 +23,14 @@ public class MissionCreator {
public static void pollMissions(){
int[] deityNums = {
1, 2, 3, 4, // Original Gods
};
int[] epicEntityNums = {
1, 2, 3, 4, // Original Gods
6, 7, 8, 9, 10, 11, 12 // Valrei Entities
};
if (WyvernMods.useValreiEntities){
deityNums = epicEntityNums;
}
EpicServerStatus es = new EpicServerStatus();
EpicMission[] missions = EpicServerStatus.getCurrentEpicMissions();
int i = 0;
@@ -43,19 +49,18 @@ public class MissionCreator {
i++;
}
if(EpicServerStatus.getCurrentEpicMissions().length >= deityNums.length){
logger.info("All entities already have a mission. Aborting.");
logger.info("All entities already have a mission, so no new missions need to be created.");
return;
}
i = 10;
int number = 1;
while(i > 0) {
number = deityNums[Server.rand.nextInt(deityNums.length)];
logger.info("Testing number "+number);
if(EpicServerStatus.getEpicMissionForEntity(number) == null){
logger.info("Has no mission, breaking loop.");
logger.info("Entity "+number+" has no mission, beginning to .");
break;
}else{
logger.info("Has mission, finding new number.");
logger.info("Entity "+number+" has a mission, finding new entity.");
}
i++;
if(i == 0){
@@ -63,9 +68,8 @@ public class MissionCreator {
return;
}
}
logger.info("Entity number = "+number);
String entityName = Deities.getDeityName(number);
logger.info("Entity name = "+entityName);
logger.info("Creating new mission for entity "+entityName);
int time = 604800;
logger.info("Current epic missions: "+EpicServerStatus.getCurrentEpicMissions().length);
if (EpicServerStatus.getCurrentScenario() != null) {
@@ -118,35 +122,49 @@ public class MissionCreator {
final Class<MissionCreator> thisClass = MissionCreator.class;
String replace;
Util.setReason("Give players currency for completing a mission.");
CtClass ctTriggerEffect = classPool.get("com.wurmonline.server.tutorial.TriggerEffect");
replace = "$_ = $proceed($$);" +
MissionCreator.class.getName()+".awardMissionBonus($0);";
Util.instrumentDeclared(thisClass, ctTriggerEffect, "effect", "addToSleep", replace);
Util.setReason("Prevent mission creatures from spawning in water.");
CtClass ctEpicServerStatus = classPool.get("com.wurmonline.server.epic.EpicServerStatus");
replace = "$_ = false;";
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "spawnSingleCreature", "isSwimming", replace);
Util.setReason("Modify which templates are allowed to spawn on herbivore-only epic missions.");
replace = "$_ = "+MissionCreator.class.getName()+".isMissionOkayHerbivore($0);";
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayCreatureMission", "isHerbivore", replace);
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayTraitorMission", "isHerbivore", replace);
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSacrificeCreatureMission", "isHerbivore", replace);
Util.setReason("Modify which templates are allowed to spawn on slay missions.");
replace = "$_ = "+MissionCreator.class.getName()+".isMissionOkaySlayable($0);";
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayCreatureMission", "isEpicMissionSlayable", replace);
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSacrificeCreatureMission", "isEpicMissionSlayable", replace);
Util.setReason("Adjust which epic missions are available..");
CtClass ctEpicMissionEnum = classPool.get("com.wurmonline.server.epic.EpicMissionEnum");
replace = "{ if($0.getMissionType() == 108 || $0.getMissionType() == 120 || $0.getMissionType() == 124){" +
" return 0;" +
"}" +
"return $0.missionChance; }";
Util.setBodyDeclared(thisClass, ctEpicMissionEnum, "getMissionChance", replace);
if (WyvernMods.addMissionCurrencyReward) {
Util.setReason("Give players currency for completing a mission.");
replace = "$_ = $proceed($$);" +
MissionCreator.class.getName() + ".awardMissionBonus($0);";
Util.instrumentDeclared(thisClass, ctTriggerEffect, "effect", "addToSleep", replace);
}
if (WyvernMods.preventMissionOceanSpawns) {
Util.setReason("Prevent mission creatures from spawning in water.");
replace = "$_ = false;";
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "spawnSingleCreature", "isSwimming", replace);
}
if (WyvernMods.additionalHerbivoreChecks) {
Util.setReason("Modify which templates are allowed to spawn on herbivore-only epic missions.");
replace = "$_ = " + MissionCreator.class.getName() + ".isMissionOkayHerbivore($0);";
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayCreatureMission", "isHerbivore", replace);
Util.setReason("Modify which templates are allowed to spawn on herbivore-only epic missions.");
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayTraitorMission", "isHerbivore", replace);
Util.setReason("Modify which templates are allowed to spawn on herbivore-only epic missions.");
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSacrificeCreatureMission", "isHerbivore", replace);
}
if (WyvernMods.additionalMissionSlayableChecks) {
Util.setReason("Modify which templates are allowed to spawn on slay missions.");
replace = "$_ = " + MissionCreator.class.getName() + ".isMissionOkaySlayable($0);";
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayCreatureMission", "isEpicMissionSlayable", replace);
Util.setReason("Modify which templates are allowed to spawn on slay missions.");
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSacrificeCreatureMission", "isEpicMissionSlayable", replace);
}
if (WyvernMods.disableEpicMissionTypes) {
Util.setReason("Adjust which epic missions are available.");
replace = "{ if($0.getMissionType() == 108 || $0.getMissionType() == 120 || $0.getMissionType() == 124){" +
" return 0;" +
"}" +
"return $0.missionChance; }";
Util.setBodyDeclared(thisClass, ctEpicMissionEnum, "getMissionChance", replace);
}
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);

View File

@@ -114,14 +114,19 @@ public class MountedChanges {
final Class<MountedChanges> thisClass = MountedChanges.class;
String replace;
Util.setReason("Scaling horse speed.");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
replace = "{ return "+MountedChanges.class.getName()+".newMountSpeedMultiplier(this, $1); }";
Util.setBodyDeclared(thisClass, ctCreature, "getMountSpeedPercent", replace);
Util.setReason("Force mount speed change check on damage.");
replace = "forceMountSpeedChange();";
Util.insertBeforeDeclared(thisClass, ctCreature, "setWounded", replace);
if (WyvernMods.newMountSpeedScaling) {
Util.setReason("New mount speed scaling.");
replace = "{ return " + MountedChanges.class.getName() + ".newMountSpeedMultiplier(this, $1); }";
Util.setBodyDeclared(thisClass, ctCreature, "getMountSpeedPercent", replace);
}
if (WyvernMods.updateMountSpeedOnDamage) {
Util.setReason("Force mount speed change check on damage.");
replace = "forceMountSpeedChange();";
Util.insertBeforeDeclared(thisClass, ctCreature, "setWounded", replace);
}
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);

View File

@@ -99,60 +99,4 @@ public class RareSpawns {
}
}
}
public static void preInit(){
try {
ClassPool classPool = HookManager.getInstance().getClassPool();
Class<RareSpawns> thisClass = RareSpawns.class;
String replace;
/*Util.setReason("Disable casting Smite on titans.");
CtClass ctSmite = classPool.get("com.wurmonline.server.spells.Smite");
replace = "if("+RareSpawns.class.getName()+".isRareCreature($3)){"
+ " $2.getCommunicator().sendNormalServerMessage(\"This creature is immune to Smite.\");"
+ " return false;"
+ "}";
Util.insertBeforeDeclared(thisClass, ctSmite, "precondition", replace);*/
Util.setReason("Disable casting Worm Brains on titans.");
CtClass ctWormBrains = classPool.get("com.wurmonline.server.spells.WormBrains");
replace = "if("+RareSpawns.class.getName()+".isRareCreature($3)){"
+ " $2.getCommunicator().sendNormalServerMessage(\"This creature is immune to Worm Brains.\");"
+ " return false;"
+ "}";
Util.insertBeforeDeclared(thisClass, ctWormBrains, "precondition", replace);
/* Disabled in Wurm Unlimited 1.9 - No longer necessary while using DUSKombat.
Util.setReason("Increase titan extra damage to pets.");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
CtClass ctString = classPool.get("java.lang.String");
CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle");
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
// @Nullable Creature performer, Creature defender, byte type, int pos, double damage, float armourMod,
// String attString, @Nullable Battle battle, float infection, float poison, boolean archery, boolean alreadyCalculatedResist
CtClass[] params1 = {
ctCreature,
ctCreature,
CtClass.byteType,
CtClass.intType,
CtClass.doubleType,
CtClass.floatType,
ctString,
ctBattle,
CtClass.floatType,
CtClass.floatType,
CtClass.booleanType,
CtClass.booleanType
};
String desc1 = Descriptor.ofMethod(CtClass.booleanType, params1);
replace = "if($2.isDominated() && $1 != null && "+RareSpawns.class.getName()+".isRareCreature($1)){" +
//" logger.info(\"Detected rare spawn hit on a pet. Adding damage.\");" +
" $5 = $5 * 2d;" +
"}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);*/
}catch (NotFoundException e) {
throw new HookException(e);
}
}
}

View File

@@ -1,5 +1,26 @@
package mod.sin.wyvern;
import com.wurmonline.mesh.Tiles;
import com.wurmonline.server.*;
import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.economy.Economy;
import com.wurmonline.server.items.Item;
import com.wurmonline.server.items.ItemFactory;
import com.wurmonline.server.items.ItemList;
import com.wurmonline.server.items.NoSuchTemplateException;
import com.wurmonline.server.players.Player;
import com.wurmonline.server.zones.Zones;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
import mod.sin.items.ArenaSupplyDepot;
import mod.sin.items.caches.*;
import mod.sin.lib.Util;
import mod.sin.wyvern.util.ItemUtil;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modsupport.ModSupportDb;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -7,41 +28,10 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Logger;
import com.wurmonline.server.economy.Economy;
import mod.sin.items.SorceryFragment;
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import com.wurmonline.mesh.Tiles;
import com.wurmonline.server.FailedException;
import com.wurmonline.server.Items;
import com.wurmonline.server.Players;
import com.wurmonline.server.Server;
import com.wurmonline.server.Servers;
import com.wurmonline.server.TimeConstants;
import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.items.Item;
import com.wurmonline.server.items.ItemFactory;
import com.wurmonline.server.items.ItemList;
import com.wurmonline.server.items.NoSuchTemplateException;
import com.wurmonline.server.players.Player;
import com.wurmonline.server.zones.Zones;
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
import mod.sin.items.ArenaSupplyDepot;
import mod.sin.items.caches.*;
import mod.sin.wyvern.util.ItemUtil;
import org.gotti.wurmunlimited.modsupport.ModSupportDb;
public class SupplyDepots {
private static Logger logger = Logger.getLogger(SupplyDepots.class.getName());
public static ArrayList<Item> depots = new ArrayList<>();
public static Creature host = null;
public static final long depotRespawnTime = TimeConstants.HOUR_MILLIS*11L;
public static long lastSpawnedDepot = 0;
protected static boolean initalizedSupplyDepot = false;
@@ -90,6 +80,9 @@ public class SupplyDepots {
}
}
public static void sendDepotEffect(Player player, Item depot){
if (!WyvernMods.useSupplyDepotLights){
return;
}
player.getCommunicator().sendAddEffect(depot.getWurmId(), (byte) 25, depot.getPosX(), depot.getPosY(), depot.getPosZ(), (byte) 0);
}
public static void sendDepotEffectsToPlayer(Player player){
@@ -150,7 +143,7 @@ public class SupplyDepots {
MiscChanges.sendGlobalFreedomChat(host, "Greetings! I'll be your host, informing you of the next depot to appear over here on the Arena!", 255, 128, 0);
}
}
if(System.currentTimeMillis() > lastSpawnedDepot + depotRespawnTime){
if(System.currentTimeMillis() > lastSpawnedDepot + WyvernMods.depotRespawnTime){
logger.info("No Depots were found, and the timer has expired. Spawning a new one.");
boolean spawned = false;
int i = 0;
@@ -191,7 +184,7 @@ public class SupplyDepots {
logger.warning("Could not find a valid location within 20 tries for a supply depot.");
}
}else if(host != null){
long timeleft = (lastSpawnedDepot + depotRespawnTime) - System.currentTimeMillis();
long timeleft = (lastSpawnedDepot + WyvernMods.depotRespawnTime) - System.currentTimeMillis();
long minutesLeft = timeleft/TimeConstants.MINUTE_MILLIS;
if(minutesLeft > 0){
if(minutesLeft == 4){
@@ -209,13 +202,12 @@ public class SupplyDepots {
}
public static long lastAttemptedDepotCapture = 0;
public static final long captureMessageInterval = TimeConstants.MINUTE_MILLIS*3L;
public static void broadcastCapture(Creature performer){
MiscChanges.sendServerTabMessage("arena", performer.getName()+" has claimed an Arena depot!", 255, 128, 0);
MiscChanges.sendGlobalFreedomChat(performer, performer.getName()+" has claimed an Arena depot!", 255, 128, 0);
}
public static void maybeBroadcastOpen(Creature performer){
if(System.currentTimeMillis() > lastAttemptedDepotCapture + captureMessageInterval){
if(System.currentTimeMillis() > lastAttemptedDepotCapture + WyvernMods.captureMessageInterval){
MiscChanges.sendServerTabMessage("arena", performer.getName()+" is beginning to capture an Arena depot!", 255, 128, 0);
MiscChanges.sendGlobalFreedomChat(performer, performer.getName()+" is beginning to capture an Arena depot!", 255, 128, 0);
lastAttemptedDepotCapture = System.currentTimeMillis();
@@ -285,13 +277,20 @@ public class SupplyDepots {
public static void preInit(){
try{
ClassPool classPool = HookManager.getInstance().getClassPool();
// - Add light effects for the supply depots, since they are unique - //
Class<SupplyDepots> thisClass = SupplyDepots.class;
String replace;
CtClass ctPlayers = classPool.get("com.wurmonline.server.Players");
ctPlayers.getDeclaredMethod("sendAltarsToPlayer").insertBefore("mod.sin.wyvern.SupplyDepots.sendDepotEffectsToPlayer($1);");
if (WyvernMods.useSupplyDepotLights) {
Util.setReason("Add depot lights for players.");
replace = "mod.sin.wyvern.SupplyDepots.sendDepotEffectsToPlayer($1);";
Util.insertBeforeDeclared(thisClass, ctPlayers, "sendAltarsToPlayer", replace);
//ctPlayers.getDeclaredMethod("sendAltarsToPlayer").insertBefore("mod.sin.wyvern.SupplyDepots.sendDepotEffectsToPlayer($1);");
}
}catch (CannotCompileException | NotFoundException e) {
throw new HookException(e);
}catch (NotFoundException e) {
e.printStackTrace();
}
}
}

View File

@@ -104,15 +104,18 @@ public class TeleportHandler {
final Class<TeleportHandler> thisClass = TeleportHandler.class;
String replace;
Util.setReason("Custom teleportation system for Arena teleport/escape.");
CtClass ctPlayerMetaData = classPool.get("com.wurmonline.server.players.PlayerMetaData");
replace = "logger.info(\"posx = \"+this.posx+\", posy = \"+this.posy);" +
"if(this.posx >= 4000f && this.posx <= 4050f && this.posy >= 4000f && this.posy <= 4050f){" +
" this.posx = "+TeleportHandler.class.getName()+".getTeleportPosX(this.wurmid);" +
" this.posy = "+TeleportHandler.class.getName()+".getTeleportPosY(this.wurmid);" +
"}" +
"$_ = $proceed($$);";
Util.instrumentDeclared(thisClass, ctPlayerMetaData, "save", "getPosition", replace);
if (WyvernMods.useArenaTeleportMethod) {
Util.setReason("Custom teleportation system for Arena teleport/escape.");
replace = "logger.info(\"posx = \"+this.posx+\", posy = \"+this.posy);" +
"if(this.posx >= 4000f && this.posx <= 4050f && this.posy >= 4000f && this.posy <= 4050f){" +
" this.posx = " + TeleportHandler.class.getName() + ".getTeleportPosX(this.wurmid);" +
" this.posy = " + TeleportHandler.class.getName() + ".getTeleportPosY(this.wurmid);" +
"}" +
"$_ = $proceed($$);";
Util.instrumentDeclared(thisClass, ctPlayerMetaData, "save", "getPosition", replace);
}
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);

View File

@@ -716,9 +716,7 @@ public class Titans {
}
public static ArrayList<Creature> titans = new ArrayList<>();
public static long lastPolledTitanSpawn = 0;
public static long lastSpawnedTitan = 0;
public static final long titanRespawnTime = TimeConstants.HOUR_MILLIS*80L;
public static void addTitan(Creature mob){
if(isTitan(mob) && !titans.contains(mob)){
titans.add(mob);
@@ -755,7 +753,7 @@ public class Titans {
}
}
if(titans.isEmpty()){
if(lastSpawnedTitan + titanRespawnTime < System.currentTimeMillis()){
if(lastSpawnedTitan + WyvernMods.titanRespawnTime < System.currentTimeMillis()){
logger.info("No Titan was found, and the timer has expired. Spawning a new one.");
boolean found = false;
int spawnX = 2048;
@@ -803,7 +801,6 @@ public class Titans {
for(Creature c : titans){
c.healRandomWound(1000);
}
lastPolledTitanSpawn = System.currentTimeMillis();
}
}
@@ -813,68 +810,20 @@ public class Titans {
Class<Titans> thisClass = Titans.class;
String replace;
Util.setReason("Disable natural regeneration on titans.");
CtClass ctWound = classPool.get("com.wurmonline.server.bodys.Wound");
replace = "if(!"+Titans.class.getName()+".isTitan(this.creature)){"
+ " $_ = $proceed($$);"
+ "}";
Util.instrumentDeclared(thisClass, ctWound, "poll", "modifySeverity", replace);
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkInfection", replace);
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkPoison", replace);
/*Util.setReason("Disable casting Smite on titans.");
CtClass ctSmite = classPool.get("com.wurmonline.server.spells.Smite");
replace = "if("+Titans.class.getName()+".isTitan($3)){"
+ " $2.getCommunicator().sendNormalServerMessage(\"You cannot smite a Titan!\");"
+ " return false;"
+ "}";
Util.insertBeforeDeclared(thisClass, ctSmite, "precondition", replace);*/
/* Disabled in Wurm Unlimited 1.9 - No longer necessary as spells are balanced.
Util.setReason("Disable casting Worm Brains on titans.");
CtClass ctWormBrains = classPool.get("com.wurmonline.server.spells.WormBrains");
replace = "if("+Titans.class.getName()+".isTitan($3)){"
+ " $2.getCommunicator().sendNormalServerMessage(\"Titans are immune to that spell.\");"
+ " return false;"
+ "}";
Util.insertBeforeDeclared(thisClass, ctWormBrains, "precondition", replace);*/
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
Util.setReason("Add spell resistance to titans.");
replace = "if("+Titans.class.getName()+".isTitan(this)){" +
" return 0.05f;" +
"}";
Util.insertBeforeDeclared(thisClass, ctCreature, "addSpellResistance", replace);
/* Disabled in Wurm Unlimited 1.9 - No longer needed while using DUSKombat.
Util.setReason("Increase titan extra damage to pets.");
CtClass ctString = classPool.get("java.lang.String");
CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle");
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
// @Nullable Creature performer, Creature defender, byte type, int pos, double damage, float armourMod,
// String attString, @Nullable Battle battle, float infection, float poison, boolean archery, boolean alreadyCalculatedResist
CtClass[] params1 = {
ctCreature,
ctCreature,
CtClass.byteType,
CtClass.intType,
CtClass.doubleType,
CtClass.floatType,
ctString,
ctBattle,
CtClass.floatType,
CtClass.floatType,
CtClass.booleanType,
CtClass.booleanType
};
String desc1 = Descriptor.ofMethod(CtClass.booleanType, params1);
replace = "if($2.isDominated() && $1 != null && "+Titans.class.getName()+".isTitan($1)){" +
" logger.info(\"Detected titan hit on a pet. Adding damage.\");" +
" $5 = $5 * 2d;" +
"}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);*/
if (WyvernMods.disableTitanNaturalRegeneration) {
Util.setReason("Disable natural regeneration on titans.");
replace = "if(!" + Titans.class.getName() + ".isTitan(this.creature)){"
+ " $_ = $proceed($$);"
+ "}";
Util.instrumentDeclared(thisClass, ctWound, "poll", "modifySeverity", replace);
Util.setReason("Disable natural regeneration on titans.");
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkInfection", replace);
Util.setReason("Disable natural regeneration on titans.");
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkPoison", replace);
}
}catch (NotFoundException e) {
throw new HookException(e);

View File

@@ -220,6 +220,51 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
public static long knowledgeInfoCreatureCooldown = 64800000L; // 18 hours default
public static long knowledgeInfoTileCooldown = 64800000L; // 18 hours default
// Titan Module Configuration
public static boolean enableTitanModule = true;
public static boolean disableTitanNaturalRegeneration = true;
public static long pollTitanSpawnTime = TimeConstants.MINUTE_MILLIS*2;
public static long pollTitanTime = TimeConstants.SECOND_MILLIS;
public static long titanRespawnTime = TimeConstants.HOUR_MILLIS*80L;
// Rare Spawn Module Configuration
public static boolean enableRareSpawnModule = true;
public static long pollRareSpawnTime = TimeConstants.MINUTE_MILLIS*5;
// Mission Module Configuration
public static boolean enableMissionModule = true;
public static boolean enableNewMissionCreator = true;
public static long pollMissionCreatorTime = TimeConstants.HOUR_MILLIS*4;
public static boolean useValreiEntities = true;
public static boolean addMissionCurrencyReward = true;
public static boolean preventMissionOceanSpawns = true;
public static boolean additionalHerbivoreChecks = true;
public static boolean additionalMissionSlayableChecks = true;
public static boolean disableEpicMissionTypes = true;
// Mounted Module Configuration
public static boolean enableMountedModule = true;
public static boolean newMountSpeedScaling = true;
public static boolean updateMountSpeedOnDamage = true;
public static boolean allowBisonMounts = true;
// Teleport Module Configuration
public static boolean enableTeleportModule = true;
public static boolean useArenaTeleportMethod = true;
// Economic Module Configuration
public static boolean enableEconomyModule = true;
public static boolean adjustSealedMapValue = true;
public static boolean disableTraderRefill = true;
public static boolean voidTraderMoney = true;
// Supply Depot Module Configuration
public static boolean enableSupplyDepotModule = true;
public static boolean useSupplyDepotLights = true;
public static long pollDepotTime = TimeConstants.MINUTE_MILLIS;
public static long captureMessageInterval = TimeConstants.MINUTE_MILLIS*3L;
public static long depotRespawnTime = TimeConstants.HOUR_MILLIS*11L;
// Treasure Chest Loot Module Configuration
public static boolean enableTreasureChestLootModule = true;
@@ -460,6 +505,51 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
knowledgeInfoCreatureCooldown = Prop.getLongProperty("knowledgeInfoCreatureCooldown", knowledgeInfoCreatureCooldown);
knowledgeInfoTileCooldown = Prop.getLongProperty("knowledgeInfoTileCooldown", knowledgeInfoTileCooldown);
// Titan Module
enableTitanModule = Prop.getBooleanProperty("enableTitanModule", enableTitanModule);
disableTitanNaturalRegeneration = Prop.getBooleanProperty("disableTitanNaturalRegeneration", disableTitanNaturalRegeneration);
pollTitanSpawnTime = Prop.getLongProperty("pollTitanSpawnTime", pollTitanSpawnTime);
pollTitanTime = Prop.getLongProperty("pollTitanTime", pollTitanTime);
titanRespawnTime = Prop.getLongProperty("titanRespawnTime", titanRespawnTime);
// Rare Spawn Module
enableRareSpawnModule = Prop.getBooleanProperty("enableRareSpawnModule", enableRareSpawnModule);
pollRareSpawnTime = Prop.getLongProperty("pollRareSpawnTime", pollRareSpawnTime);
// Mission Module
enableMissionModule = Prop.getBooleanProperty("enableMissionModule", enableMissionModule);
enableNewMissionCreator = Prop.getBooleanProperty("enableNewMissionCreator", enableNewMissionCreator);
pollMissionCreatorTime = Prop.getLongProperty("pollMissionCreatorTime", pollMissionCreatorTime);
useValreiEntities = Prop.getBooleanProperty("useValreiEntities", useValreiEntities);
addMissionCurrencyReward = Prop.getBooleanProperty("addMissionCurrencyReward", addMissionCurrencyReward);
preventMissionOceanSpawns = Prop.getBooleanProperty("preventMissionOceanSpawns", preventMissionOceanSpawns);
additionalHerbivoreChecks = Prop.getBooleanProperty("additionalHerbivoreChecks", additionalHerbivoreChecks);
additionalMissionSlayableChecks = Prop.getBooleanProperty("additionalMissionSlayableChecks", additionalMissionSlayableChecks);
disableEpicMissionTypes = Prop.getBooleanProperty("disableEpicMissionTypes", disableEpicMissionTypes);
// Mounted Module
enableMountedModule = Prop.getBooleanProperty("enableMountedModule", enableMountedModule);
newMountSpeedScaling = Prop.getBooleanProperty("newMountSpeedScaling", newMountSpeedScaling);
updateMountSpeedOnDamage = Prop.getBooleanProperty("updateMountSpeedOnDamage", updateMountSpeedOnDamage);
allowBisonMounts = Prop.getBooleanProperty("allowBisonMounts", allowBisonMounts);
// Teleport Module
enableTeleportModule = Prop.getBooleanProperty("enableTeleportModule", enableTeleportModule);
useArenaTeleportMethod = Prop.getBooleanProperty("useArenaTeleportMethod", useArenaTeleportMethod);
// Economy Module
enableEconomyModule = Prop.getBooleanProperty("enableEconomyModule", enableEconomyModule);
adjustSealedMapValue = Prop.getBooleanProperty("adjustSealedMapValue", adjustSealedMapValue);
disableTraderRefill = Prop.getBooleanProperty("disableTraderRefill", disableTraderRefill);
voidTraderMoney = Prop.getBooleanProperty("voidTraderMoney", voidTraderMoney);
// Supply Depot Module
enableSupplyDepotModule = Prop.getBooleanProperty("enableSupplyDepotModule", enableSupplyDepotModule);
useSupplyDepotLights = Prop.getBooleanProperty("useSupplyDepotLights", useSupplyDepotLights);
pollDepotTime = Prop.getLongProperty("pollDepotTime", pollDepotTime);
captureMessageInterval = Prop.getLongProperty("captureMessageInterval", captureMessageInterval);
depotRespawnTime = Prop.getLongProperty("depotRespawnTime", depotRespawnTime);
// Treasure Chest Loot Module
enableTreasureChestLootModule = Prop.getBooleanProperty("enableTreasureChestLootModule", enableTreasureChestLootModule);
@@ -785,9 +875,61 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
}
}
logger.info("Treasure Chest Loot Module: "+enableTreasureChestLootModule);
logger.info("Titan Module: "+enableTitanModule);
if (enableTitanModule){
logger.info("Disable Titan Natural Regeneration: "+disableTitanNaturalRegeneration);
logger.info("Poll Titan Spawn Timer: "+pollTitanSpawnTime);
logger.info("Poll Titan Timer: "+pollTitanTime);
logger.info("Titan Respawn Timer: "+titanRespawnTime);
}
//this.logger.log(Level.INFO, "Property: " + this.somevalue);
logger.info("Rare Spawn Module: "+enableRareSpawnModule);
if (enableRareSpawnModule){
logger.info("Poll Rare Spawn Timer: "+pollRareSpawnTime);
}
logger.info("Mission Module: "+enableMissionModule);
if (enableMissionModule){
logger.info("New Mission Creator: "+enableNewMissionCreator);
if (enableNewMissionCreator){
logger.info("New Mission Creator Timer: " + pollMissionCreatorTime);
logger.info("Use Valrei Entities: "+useValreiEntities);
}
logger.info("Add Mission Currency Reward: "+addMissionCurrencyReward);
logger.info("Prevent Ocean Mission Spawns: "+preventMissionOceanSpawns);
logger.info("Additional Herbivore Checks: "+additionalHerbivoreChecks);
logger.info("Additional Mission Slayable Checks: "+additionalMissionSlayableChecks);
logger.info("Disable Epic Mission Types: "+disableEpicMissionTypes);
}
logger.info("Mounted Module: "+enableMountedModule);
if (enableMountedModule){
logger.info("New Mount Speed Scaling: "+newMountSpeedScaling);
logger.info("Update Mount Speed On Damage: "+updateMountSpeedOnDamage);
logger.info("Allow Bison Mounts: "+allowBisonMounts);
}
logger.info("Teleport Module: "+enableTeleportModule);
if (enableTeleportModule){
logger.info("Use Arena Teleport Method: "+useArenaTeleportMethod);
}
logger.info("Economy Module: "+enableEconomyModule);
if (enableEconomyModule){
logger.info("Adjust Sealed Map Value: "+adjustSealedMapValue);
logger.info("Disable Trader Refill: "+disableTraderRefill);
logger.info("Void Trader Money: "+voidTraderMoney);
}
logger.info("Supply Depot Module: "+enableSupplyDepotModule);
if (enableSupplyDepotModule){
logger.info("Use Supply Depot Lights: "+useSupplyDepotLights);
logger.info("Poll Depot Timer: "+pollDepotTime);
logger.info("Capture Message Interval: "+captureMessageInterval);
logger.info("Depot Respawn Timer: "+depotRespawnTime);
}
logger.info("Treasure Chest Loot Module: "+enableTreasureChestLootModule);
}
public static void handleExamine(Creature performer, Item target) {
@@ -842,27 +984,54 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
Mastercraft.preInit();
}
// Skill Module Pre-Init
if (enableSkillModule) {
SkillChanges.preInit();
}
// Meditation Module Pre-Init
if (enableMeditationModule) {
MeditationPerks.preInit();
}
// Titan Module Pre-Init
if (enableTitanModule) {
Titans.preInit();
}
// Mission Module Pre-Init
if (enableMissionModule) {
MissionCreator.preInit();
}
// Mounted Module Pre-Init
if (enableMountedModule) {
MountedChanges.preInit();
}
// Teleport Module Pre-Init
if (enableTeleportModule) {
TeleportHandler.preInit();
}
// Economy Module Pre-Init
if (enableEconomyModule) {
EconomicChanges.preInit();
}
// Supply Depot Module Pre-Init
if (enableSupplyDepotModule) {
SupplyDepots.preInit();
}
// Treasure Chest Loot Module Pre-Init
if (enableTreasureChestLootModule) {
TreasureChests.preInit();
}
Titans.preInit();
RareSpawns.preInit();
TeleportHandler.preInit();
MethodsBestiary.preInit();
MissionCreator.preInit();
MountedChanges.preInit();
EconomicChanges.preInit();
SupplyDepots.preInit();
// Only clears responses, doesn't have any effect. Harmless to run even if key fragments are not used.
KeyEvent.preInit();
// Bloodlust might no longer be necessary. Code remains for reference.
@@ -907,7 +1076,10 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
// Vanilla:
logger.info("Registering Vanilla creature changes.");
ModCreatures.addCreature(new Bison());
if (enableMountedModule && allowBisonMounts) {
logger.info("Allowing Bison to be mounted.");
ModCreatures.addCreature(new Bison());
}
// Epic:
logger.info("Registering Epic creatures.");
@@ -1054,19 +1226,15 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
public static long lastSecondPolled = 0;
public static long lastPolledTitanSpawn = 0;
public static final long pollTitanSpawnTime = TimeConstants.MINUTE_MILLIS*2;
public static long lastPolledTitans = 0;
public static final long pollTitanTime = TimeConstants.SECOND_MILLIS;
public static long lastPolledDepots = 0;
public static final long pollDepotTime = TimeConstants.MINUTE_MILLIS;
public static long lastPolledRareSpawns = 0;
public static final long pollRareSpawnTime = TimeConstants.MINUTE_MILLIS*5;
public static long lastPolledEternalReservoirs = 0;
public static final long pollEternalReservoirTime = TimeConstants.MINUTE_MILLIS*10;
public static long lastPolledMissionCreator = 0;
public static final long pollMissionCreatorTime = TimeConstants.HOUR_MILLIS*4;
/* Disabled for now, might need to be revisited.
public static long lastPolledBloodlust = 0;
public static final long pollBloodlustTime = TimeConstants.MINUTE_MILLIS;
public static final long pollBloodlustTime = TimeConstants.MINUTE_MILLIS;*/
public static long lastPolledUniqueRegeneration = 0;
public static final long pollUniqueRegenerationTime = TimeConstants.SECOND_MILLIS;
public static long lastPolledUniqueCollection = 0;
@@ -1076,19 +1244,19 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
@Override
public void onServerPoll() {
if((lastSecondPolled + TimeConstants.SECOND_MILLIS) < System.currentTimeMillis()){
if(lastPolledDepots + pollDepotTime < System.currentTimeMillis()){
if(enableSupplyDepotModule && lastPolledDepots + pollDepotTime < System.currentTimeMillis()){
SupplyDepots.pollDepotSpawn();
lastPolledDepots += pollDepotTime;
}
if(lastPolledTitanSpawn + pollTitanSpawnTime < System.currentTimeMillis()){
if(enableTitanModule && lastPolledTitanSpawn + pollTitanSpawnTime < System.currentTimeMillis()){
Titans.pollTitanSpawn();
lastPolledTitanSpawn += pollTitanSpawnTime;
}
if(lastPolledTitans + pollTitanTime < System.currentTimeMillis()){
if(enableTitanModule && lastPolledTitans + pollTitanTime < System.currentTimeMillis()){
Titans.pollTitans();
lastPolledTitans += pollTitanTime;
}
if(lastPolledRareSpawns + pollRareSpawnTime < System.currentTimeMillis()){
if(enableRareSpawnModule && lastPolledRareSpawns + pollRareSpawnTime < System.currentTimeMillis()){
RareSpawns.pollRareSpawns();
lastPolledRareSpawns += pollRareSpawnTime;
}
@@ -1096,14 +1264,15 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
Soulstealing.pollSoulForges();
lastPolledEternalReservoirs += pollEternalReservoirTime;
}
if(lastPolledMissionCreator + pollMissionCreatorTime < System.currentTimeMillis()){
if(enableMissionModule && enableNewMissionCreator && lastPolledMissionCreator + pollMissionCreatorTime < System.currentTimeMillis()){
MissionCreator.pollMissions();
lastPolledMissionCreator += pollMissionCreatorTime;
}
/* Disabled for now, might need to be revisited.
if(lastPolledBloodlust + pollBloodlustTime < System.currentTimeMillis()){
Bloodlust.pollLusts();
lastPolledBloodlust += pollBloodlustTime;
}
}*/
if(WyvernMods.useStaticLegendaryRegeneration && lastPolledUniqueRegeneration + pollUniqueRegenerationTime < System.currentTimeMillis()){
CombatChanges.pollUniqueRegeneration();
lastPolledUniqueRegeneration += pollUniqueRegenerationTime;
@@ -1129,7 +1298,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
lastPolledRareSpawns = System.currentTimeMillis();
lastPolledEternalReservoirs = System.currentTimeMillis();
lastPolledMissionCreator = System.currentTimeMillis();
lastPolledBloodlust = System.currentTimeMillis();
//lastPolledBloodlust = System.currentTimeMillis();
lastPolledUniqueRegeneration = System.currentTimeMillis();
lastPolledUniqueCollection = System.currentTimeMillis();
lastPolledTerrainSmooth = System.currentTimeMillis();