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

@@ -763,6 +763,172 @@ knowledgeInfoTileCooldown=14400000
## >> END MEDITATION MODULE << ## ## >> END MEDITATION MODULE << ##
## >> TITAN MODULE << ##
## The Titan Module handles the implementation of Titans, "raid boss" style creatures with unique mechanics.
## These titans are designed to be completely impossible by small groups of players and must be tackled in a sizable group.
enableTitanModule=true
#disableTitanNaturalRegeneration: Disables the natural health regeneration of titans.
disableTitanNaturalRegeneration=true
#pollTitanSpawnTime: Amount of time, in milliseconds, to poll the new spawn of a titan.
# This is not the time for a new titan to spawn, just how frequently the server will check to see if a new one should spawn.
# Default is 120000, or 2 minutes.
pollTitanSpawnTime=120000
#pollTitanTime: Amount of time, in milliseconds, to poll mechanics on the titan.
# This is how frequently it will check to do mechanics during a titan fight. The less frequent the polling, the less often mechanics will occur.
# Default is 1000, or 1 second.
pollTitanTime=1000
#titanRespawnTime: Amount of time, in milliseconds, between spawns of new titans.
# There can only be one titan active on a server at a time. This timer will determine how long after the previous spawn a new one should be spawned.
# Default is 288000000, or 80 hours (3 days 8 hours)
titanRespawnTime=288000000
#TODO: Add additional configurations for which titans should be allowed to spawn, their loot, mechanics, and more.
## >> END TITAN MODULE << ##
## >> RARE SPAWN MODULE << ##
## The Rare Spawn Module handles the spawning of new creatures which are designed to be stronger than trolls but weaker than legendary creatures.
## This helps fill the gap for small hunting parties, allowing groups of 2-5 slay challenging creatures.
enableRareSpawnModule=true
#pollRareSpawnTime: Amount of time, in milliseconds, to check spawning of a new rare spawn.
# Rare spawns occur if no other rare spawn is found on the server. As soon as one dies, another replaces it.
pollRareSpawnTime=300000
#TODO: Add additional configurations for which rare spawns should be allowed to spawn, their loot, additional creature spawns, and more.
## >> END RARE SPAWN MODULE << ##
## >> MISSION MODULE << ##
## The Mission Module adds additional features to the existing epic mission features.
## It also helps integrate them more easily into PvE environments by making them more frequent and rewarding.
## Finally, it also helps clear up some bugs which prevent them from occurring properly under some scenarios.
enableMissionModule=true
# > NEW MISSION CREATOR < #
# New Mission Creator is a system that's independent of the natural mission creation system.
# This handles the creation of new missions in a more precise way than the vanilla handling, which sometimes doesn't function as intended.
# Instead of creation of a mission at random, it will always create a new mission on a timer (set below).
# The only case where it will not create a new missions is if there is already the maximum amount of missions available (1 per entity).
# When missions expire in the default system, there are generally issues with removal of those missions to make room for more.
# This system also double-checks all active missions when the poll occurs, removing any missions which have been expired or completed.
# The process helps open up new slots for missions to be created in a more timely and clean manner.
enableNewMissionCreator=true
#pollMissionCreatorTime: Amount of time, in milliseconds, to poll the creation of new missions using the New Mission Creator.
# This handles how frequently new missions are added to the system. If you want a new mission every day, set to 1 day worth of milliseconds.
# Default is 14400000, or 4 hours.
pollMissionCreatorTime=14400000
#useValreiEntities: Whether to use Valrei Entities as the creators for some missions.
# This option extends the default system to include entities such as Walnut, Jackal, and Scavenger to add new missions.
# Using the New Mission Creator, this will allow up to 11 missions to be active at a time instead of the default 4.
useValreiEntities=true
#TODO: Add additional options for control over what missions are created.
# > END NEW MISSION CREATOR < #
#addMissionCurrencyReward: Adds a 20-40 copper reward at random for players who participated in the completion of a mission.
addMissionCurrencyReward=true
#TODO: Allow configuration of the currency reward.
#preventMissionOceanSpawns: Prevents mission creatures from spawning in water.
preventMissionOceanSpawns=true
#additionalHerbivoreChecks: Adds additional checks when the system attempts to spawn a herbivore epic creature.
# This prevents legendary creatures, titans, and rare spawns from being used in epic missions which shouldn't allow them.
additionalHerbivoreChecks=true
#additionalMissionSlayableChecks: Adds additional checks when the system attempts to spawn an epic mission slayable creature.
# This prevents legendary creatures, titans, and rare spawns from being used in epic missions which shouldn't allow them.
additionalMissionSlayableChecks=true
#disableEpicMissionTypes: Disables the Ritual, Destroy Guard Tower, and Slay Tower Guards mission types from the system.
# This helps prevent missions from occurring which can be annoying or impossible to complete in some enviornments.
disableEpicMissionTypes=true
#TODO: Allow configuration of which types of missions to disable.
## >> END MISSION MODULE << ##
## >> MOUNTED MODULE << ##
## The Mounted Module handles various changes to mounts such as horses.
## It does not affect vehicle speeds, and strictly relates to creature mounts.
enableMountedModule=true
#newMountSpeedScaling: Changes the way hunger and health affects the mounted speed of a creature. Explanation:
# Mount speed has been completely redone from the ground up, using new formulas and different weights.
# Mount speed now scales from all the variables used to calculate speed.
# The thresholds for damage and hunger have been removed and replaced by a formula with a smoothed function to calculate the new speeds.
# Equipment on mounts now scale the speed multiplicatively instead of additively.
# - This means that well-equipped mounts will no longer be able to run decently fast when extremely hurt.
# - If they're low on health, they move slow, period.
# Barding now has a multiplicative speed reduction. Cloth offers the lowest penalty, while chain incurs the largest penalty.
# Traits remain additive to the hunger and health modifiers, but are now scaled multiplicatively by gear and other effects.
# Oakshell now has an slowing effect on the speed of a mount depending on power.
# - This effect is more severe than the epic iteration of the spell, applying a multiplicative slow to the creature.
# Old chart: https://i.imgur.com/bgVY8ne.png
# New chart: https://i.imgur.com/2IYEsA1.png
newMountSpeedScaling=true
#TODO: Add additional options for scaling of WoA/BoTD effects, QL scaling, etc.
#updateMountSpeedOnDamage: Forces a mount's speed to update instantaneously when it takes damage.
# In the vanilla system, there is a random factor where dealing damage to a mount can take a random amount of time to update.
# Through testing, this could take up to 20 seconds or even longer, since the update was random.
# This setting prevents that from happening, and hard-forces the server to update the mount speed immediately when the mount takes damage.
updateMountSpeedOnDamage=true
#allowBisonMounts: Allows Bison to be mounted, just like a horse. If it can pull a wagon, why not hold a person?
allowBisonMounts=true
#TODO: Enable configuration of bison mount speeds. In the meantime, might be able to be adjusted through bdew's movement mod.
## >> END MOUNTED MODULE << ##
## >> TELEPORT MODULE << ##
## The Teleport Module handles custom teleportation between two servers with additional features.
## Instead of requiring one server to always give the exact location where the player should arrive on the other side,
## the Teleport Module uses a new method which allows the player to land at either their village token or random location.
enableTeleportModule=true
#useArenaTeleportMethod: Uses a special method when specific coordinates are given on a server to either randomize location
# place them at their village token on the new server.
# ! Most of this system is hardcoded and will not function well on a server that is not Revenant !
useArenaTeleportMethod=true
#TODO: Expand this system and make it more configurable. Document more clearly.
## >> END TELEPORT MODULE << ##
## >> ECONOMY MODULE << ##
## The Economy Module handles pricing of items and various mechanics involving currency and traders.
enableEconomyModule=true
#adjustSealedMapValue: The Sealed Map is a custom item which creates a Treasure Map (from TreasureHunting mod) when unsealed.
# This option adjusts their value so it is not static, and instead scaled based on the QL of the sealed map.
adjustSealedMapValue=true
#TODO: Add additional options to adjust the price of sealed maps.
#disableTraderRefill: Disables Traders from refilling their currency from the king's coffers at random.
# Other methods of refilling their currency will be required if you disable this.
disableTraderRefill=true
#voidTraderMoney: When players buy items from traders, by default all the money goes into the trader to be extracted again.
# This option voids 80% of the currency that gets traded to traders, preventing players from simply draining their spent currency out immediately.
voidTraderMoney=true
## >> END ECONOMY MODULE << ##
## >> SUPPLY DEPOT MODULE << ##
## The Supply Depot Module implements a new system where supply depots are spawned randomly on the map to be claimed by players.
## These depots will reward the player if they manage to stand near the depot without interruption for a certain amount of time.
## On PvP servers, these can create interesting combat scenarios in locations that are unexpected.
enableSupplyDepotModule=true
#useSupplyDepotLights: Whether or not to use the "rift beam" light to mark the locations of depots for all players on the map.
useSupplyDepotLights=true
#pollDepotTime: Amount of time, in milliseconds, to poll supply depots.
# This is not the amount of time before new ones spawn, but just how often it checks if they should be spawned, cleared, and similar.
# Default is 60000, or 1 minute.
pollDepotTime=60000
#captureMessageInterval: Amount of time, in milliseconds, to wait before allowing another global capture message to occur.
# This prevents players from spamming the capture action to create global messages for players.
# Default is 180000, or 3 minutes.
captureMessageInterval=180000
#depotRespawnTime: Amount of time, in milliseconds, between spawns of depots.
# This is calculated from the last spawn of a depot, not the last capture.
# Default is 39600000, or 11 hours.
depotRespawnTime=39600000
#TODO: Allow configuration of rewards from depots and other options.
## >> END SUPPLY DEPOT MODULE << ##
## >> TREASURE CHEST LOOT MODULE << ## ## >> TREASURE CHEST LOOT MODULE << ##
## The Treasure Chest Loot Module affects the vanilla treasure chests. ## The Treasure Chest Loot Module affects the vanilla treasure chests.
## By default, treasure chests can spawn randomly in the wild. This module reconfigures the loot that spawns in them. ## By default, treasure chests can spawn randomly in the wild. This module reconfigures the loot that spawns in them.

View File

@@ -5,10 +5,6 @@ import com.wurmonline.server.TimeConstants;
import com.wurmonline.server.creatures.Creature; import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.creatures.Creatures; import com.wurmonline.server.creatures.Creatures;
import javassist.ClassPool; 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.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager; import org.gotti.wurmunlimited.modloader.classhooks.HookManager;

View File

@@ -91,34 +91,13 @@ public class Bounty {
try { try {
ClassPool classPool = HookManager.getInstance().getClassPool(); ClassPool classPool = HookManager.getInstance().getClassPool();
final Class<Bounty> thisClass = Bounty.class; final Class<Bounty> thisClass = Bounty.class;
String replace;
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
/*CtMethod ctCheckBounty = CtMethod.make((String) replace = PlayerBounty.class.getName()+".checkPlayerBounty(player, this);"
"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);"
+ "$_ = $proceed($$);"; + "$_ = $proceed($$);";
Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "checkCoinAward", replace); 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 // Die method description
CtClass ctString = classPool.get("java.lang.String"); CtClass ctString = classPool.get("java.lang.String");
@@ -130,19 +109,8 @@ public class Bounty {
String desc1 = Descriptor.ofMethod(CtClass.voidType, params1); String desc1 = Descriptor.ofMethod(CtClass.voidType, params1);
replace = "$_ = $proceed($$);" replace = "$_ = $proceed($$);"
//+ "mod.sin.wyvern.bounty.MethodsBounty.checkLootTable(this, corpse);";
+ LootBounty.class.getName()+".checkLootTable(this, corpse);"; + LootBounty.class.getName()+".checkLootTable(this, corpse);";
Util.instrumentDescribed(thisClass, ctCreature, "die", desc1, "setRotation", replace); 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) // 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 = { CtClass[] params2 = {
@@ -161,24 +129,16 @@ public class Bounty {
CtClass.intType CtClass.intType
}; };
String desc2 = Descriptor.ofMethod(ctCreature, params2); 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. Util.setReason("Log new creature spawns.");
//CtMethod ctDoNew = ctCreature.getMethod("doNew", "(IZFFFILjava/lang/String;BBBZB)Lcom/wurmonline/server/creatures/Creature;"); replace = "logger.info(\"Creating new creature: \"+templateid+\" - \"+(aPosX/4)+\", \"+(aPosY/4)+\" [\"+com.wurmonline.server.creatures.CreatureTemplateFactory.getInstance().getTemplate(templateid).getName()+\"]\");";
//ctDoNew.insertBefore("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);
// Modify new creatures
Util.setReason("Modify newly created creatures.");
replace = "$_ = $proceed($$);" replace = "$_ = $proceed($$);"
//+ "mod.sin.wyvern.bestiary.MethodsBestiary.modifyNewCreature($1);"; //+ "mod.sin.wyvern.bestiary.MethodsBestiary.modifyNewCreature($1);";
+ MethodsBestiary.class.getName()+".modifyNewCreature($1);"; + MethodsBestiary.class.getName()+".modifyNewCreature($1);";
Util.instrumentDescribed(thisClass, ctCreature, "doNew", desc2, "sendToWorld", replace); 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 -- // // -- Enable adjusting size for creatures -- //
CtClass ctCreatureStatus = classPool.get("com.wurmonline.server.creatures.CreatureStatus"); CtClass ctCreatureStatus = classPool.get("com.wurmonline.server.creatures.CreatureStatus");

View File

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

View File

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

View File

@@ -114,14 +114,19 @@ public class MountedChanges {
final Class<MountedChanges> thisClass = MountedChanges.class; final Class<MountedChanges> thisClass = MountedChanges.class;
String replace; String replace;
Util.setReason("Scaling horse speed.");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
replace = "{ return "+MountedChanges.class.getName()+".newMountSpeedMultiplier(this, $1); }";
Util.setBodyDeclared(thisClass, ctCreature, "getMountSpeedPercent", 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."); Util.setReason("Force mount speed change check on damage.");
replace = "forceMountSpeedChange();"; replace = "forceMountSpeedChange();";
Util.insertBeforeDeclared(thisClass, ctCreature, "setWounded", replace); Util.insertBeforeDeclared(thisClass, ctCreature, "setWounded", replace);
}
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) { } catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(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; 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.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -7,41 +28,10 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Logger; 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 { public class SupplyDepots {
private static Logger logger = Logger.getLogger(SupplyDepots.class.getName()); private static Logger logger = Logger.getLogger(SupplyDepots.class.getName());
public static ArrayList<Item> depots = new ArrayList<>(); public static ArrayList<Item> depots = new ArrayList<>();
public static Creature host = null; public static Creature host = null;
public static final long depotRespawnTime = TimeConstants.HOUR_MILLIS*11L;
public static long lastSpawnedDepot = 0; public static long lastSpawnedDepot = 0;
protected static boolean initalizedSupplyDepot = false; protected static boolean initalizedSupplyDepot = false;
@@ -90,6 +80,9 @@ public class SupplyDepots {
} }
} }
public static void sendDepotEffect(Player player, Item depot){ 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); player.getCommunicator().sendAddEffect(depot.getWurmId(), (byte) 25, depot.getPosX(), depot.getPosY(), depot.getPosZ(), (byte) 0);
} }
public static void sendDepotEffectsToPlayer(Player player){ 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); 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."); logger.info("No Depots were found, and the timer has expired. Spawning a new one.");
boolean spawned = false; boolean spawned = false;
int i = 0; 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."); logger.warning("Could not find a valid location within 20 tries for a supply depot.");
} }
}else if(host != null){ }else if(host != null){
long timeleft = (lastSpawnedDepot + depotRespawnTime) - System.currentTimeMillis(); long timeleft = (lastSpawnedDepot + WyvernMods.depotRespawnTime) - System.currentTimeMillis();
long minutesLeft = timeleft/TimeConstants.MINUTE_MILLIS; long minutesLeft = timeleft/TimeConstants.MINUTE_MILLIS;
if(minutesLeft > 0){ if(minutesLeft > 0){
if(minutesLeft == 4){ if(minutesLeft == 4){
@@ -209,13 +202,12 @@ public class SupplyDepots {
} }
public static long lastAttemptedDepotCapture = 0; public static long lastAttemptedDepotCapture = 0;
public static final long captureMessageInterval = TimeConstants.MINUTE_MILLIS*3L;
public static void broadcastCapture(Creature performer){ public static void broadcastCapture(Creature performer){
MiscChanges.sendServerTabMessage("arena", performer.getName()+" has claimed an Arena depot!", 255, 128, 0); 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); MiscChanges.sendGlobalFreedomChat(performer, performer.getName()+" has claimed an Arena depot!", 255, 128, 0);
} }
public static void maybeBroadcastOpen(Creature performer){ 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.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); MiscChanges.sendGlobalFreedomChat(performer, performer.getName()+" is beginning to capture an Arena depot!", 255, 128, 0);
lastAttemptedDepotCapture = System.currentTimeMillis(); lastAttemptedDepotCapture = System.currentTimeMillis();
@@ -285,13 +277,20 @@ public class SupplyDepots {
public static void preInit(){ public static void preInit(){
try{ try{
ClassPool classPool = HookManager.getInstance().getClassPool(); ClassPool classPool = HookManager.getInstance().getClassPool();
Class<SupplyDepots> thisClass = SupplyDepots.class;
String replace;
// - Add light effects for the supply depots, since they are unique - //
CtClass ctPlayers = classPool.get("com.wurmonline.server.Players"); CtClass ctPlayers = classPool.get("com.wurmonline.server.Players");
ctPlayers.getDeclaredMethod("sendAltarsToPlayer").insertBefore("mod.sin.wyvern.SupplyDepots.sendDepotEffectsToPlayer($1);");
}catch (CannotCompileException | NotFoundException e) { if (WyvernMods.useSupplyDepotLights) {
throw new HookException(e); 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 (NotFoundException e) {
e.printStackTrace();
} }
} }
} }

View File

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

View File

@@ -716,9 +716,7 @@ public class Titans {
} }
public static ArrayList<Creature> titans = new ArrayList<>(); public static ArrayList<Creature> titans = new ArrayList<>();
public static long lastPolledTitanSpawn = 0;
public static long lastSpawnedTitan = 0; public static long lastSpawnedTitan = 0;
public static final long titanRespawnTime = TimeConstants.HOUR_MILLIS*80L;
public static void addTitan(Creature mob){ public static void addTitan(Creature mob){
if(isTitan(mob) && !titans.contains(mob)){ if(isTitan(mob) && !titans.contains(mob)){
titans.add(mob); titans.add(mob);
@@ -755,7 +753,7 @@ public class Titans {
} }
} }
if(titans.isEmpty()){ 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."); logger.info("No Titan was found, and the timer has expired. Spawning a new one.");
boolean found = false; boolean found = false;
int spawnX = 2048; int spawnX = 2048;
@@ -803,7 +801,6 @@ public class Titans {
for(Creature c : titans){ for(Creature c : titans){
c.healRandomWound(1000); c.healRandomWound(1000);
} }
lastPolledTitanSpawn = System.currentTimeMillis();
} }
} }
@@ -813,68 +810,20 @@ public class Titans {
Class<Titans> thisClass = Titans.class; Class<Titans> thisClass = Titans.class;
String replace; String replace;
Util.setReason("Disable natural regeneration on titans.");
CtClass ctWound = classPool.get("com.wurmonline.server.bodys.Wound"); CtClass ctWound = classPool.get("com.wurmonline.server.bodys.Wound");
replace = "if(!"+Titans.class.getName()+".isTitan(this.creature)){" CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
if (WyvernMods.disableTitanNaturalRegeneration) {
Util.setReason("Disable natural regeneration on titans.");
replace = "if(!" + Titans.class.getName() + ".isTitan(this.creature)){"
+ " $_ = $proceed($$);" + " $_ = $proceed($$);"
+ "}"; + "}";
Util.instrumentDeclared(thisClass, ctWound, "poll", "modifySeverity", replace); Util.instrumentDeclared(thisClass, ctWound, "poll", "modifySeverity", replace);
Util.setReason("Disable natural regeneration on titans.");
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkInfection", replace); Util.instrumentDeclared(thisClass, ctWound, "poll", "checkInfection", replace);
Util.setReason("Disable natural regeneration on titans.");
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkPoison", 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);*/
}catch (NotFoundException e) { }catch (NotFoundException e) {
throw new HookException(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 knowledgeInfoCreatureCooldown = 64800000L; // 18 hours default
public static long knowledgeInfoTileCooldown = 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 // Treasure Chest Loot Module Configuration
public static boolean enableTreasureChestLootModule = true; public static boolean enableTreasureChestLootModule = true;
@@ -460,6 +505,51 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
knowledgeInfoCreatureCooldown = Prop.getLongProperty("knowledgeInfoCreatureCooldown", knowledgeInfoCreatureCooldown); knowledgeInfoCreatureCooldown = Prop.getLongProperty("knowledgeInfoCreatureCooldown", knowledgeInfoCreatureCooldown);
knowledgeInfoTileCooldown = Prop.getLongProperty("knowledgeInfoTileCooldown", knowledgeInfoTileCooldown); 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 // Treasure Chest Loot Module
enableTreasureChestLootModule = Prop.getBooleanProperty("enableTreasureChestLootModule", enableTreasureChestLootModule); 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) { public static void handleExamine(Creature performer, Item target) {
@@ -842,27 +984,54 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
Mastercraft.preInit(); Mastercraft.preInit();
} }
// Skill Module Pre-Init
if (enableSkillModule) { if (enableSkillModule) {
SkillChanges.preInit(); SkillChanges.preInit();
} }
// Meditation Module Pre-Init
if (enableMeditationModule) { if (enableMeditationModule) {
MeditationPerks.preInit(); 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 // Treasure Chest Loot Module Pre-Init
if (enableTreasureChestLootModule) { if (enableTreasureChestLootModule) {
TreasureChests.preInit(); TreasureChests.preInit();
} }
Titans.preInit();
RareSpawns.preInit();
TeleportHandler.preInit();
MethodsBestiary.preInit(); MethodsBestiary.preInit();
MissionCreator.preInit();
MountedChanges.preInit(); // Only clears responses, doesn't have any effect. Harmless to run even if key fragments are not used.
EconomicChanges.preInit();
SupplyDepots.preInit();
KeyEvent.preInit(); KeyEvent.preInit();
// Bloodlust might no longer be necessary. Code remains for reference. // Bloodlust might no longer be necessary. Code remains for reference.
@@ -907,7 +1076,10 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
// Vanilla: // Vanilla:
logger.info("Registering Vanilla creature changes."); logger.info("Registering Vanilla creature changes.");
if (enableMountedModule && allowBisonMounts) {
logger.info("Allowing Bison to be mounted.");
ModCreatures.addCreature(new Bison()); ModCreatures.addCreature(new Bison());
}
// Epic: // Epic:
logger.info("Registering Epic creatures."); logger.info("Registering Epic creatures.");
@@ -1054,19 +1226,15 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
public static long lastSecondPolled = 0; public static long lastSecondPolled = 0;
public static long lastPolledTitanSpawn = 0; public static long lastPolledTitanSpawn = 0;
public static final long pollTitanSpawnTime = TimeConstants.MINUTE_MILLIS*2;
public static long lastPolledTitans = 0; public static long lastPolledTitans = 0;
public static final long pollTitanTime = TimeConstants.SECOND_MILLIS;
public static long lastPolledDepots = 0; public static long lastPolledDepots = 0;
public static final long pollDepotTime = TimeConstants.MINUTE_MILLIS;
public static long lastPolledRareSpawns = 0; public static long lastPolledRareSpawns = 0;
public static final long pollRareSpawnTime = TimeConstants.MINUTE_MILLIS*5;
public static long lastPolledEternalReservoirs = 0; public static long lastPolledEternalReservoirs = 0;
public static final long pollEternalReservoirTime = TimeConstants.MINUTE_MILLIS*10; public static final long pollEternalReservoirTime = TimeConstants.MINUTE_MILLIS*10;
public static long lastPolledMissionCreator = 0; 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 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 long lastPolledUniqueRegeneration = 0;
public static final long pollUniqueRegenerationTime = TimeConstants.SECOND_MILLIS; public static final long pollUniqueRegenerationTime = TimeConstants.SECOND_MILLIS;
public static long lastPolledUniqueCollection = 0; public static long lastPolledUniqueCollection = 0;
@@ -1076,19 +1244,19 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
@Override @Override
public void onServerPoll() { public void onServerPoll() {
if((lastSecondPolled + TimeConstants.SECOND_MILLIS) < System.currentTimeMillis()){ if((lastSecondPolled + TimeConstants.SECOND_MILLIS) < System.currentTimeMillis()){
if(lastPolledDepots + pollDepotTime < System.currentTimeMillis()){ if(enableSupplyDepotModule && lastPolledDepots + pollDepotTime < System.currentTimeMillis()){
SupplyDepots.pollDepotSpawn(); SupplyDepots.pollDepotSpawn();
lastPolledDepots += pollDepotTime; lastPolledDepots += pollDepotTime;
} }
if(lastPolledTitanSpawn + pollTitanSpawnTime < System.currentTimeMillis()){ if(enableTitanModule && lastPolledTitanSpawn + pollTitanSpawnTime < System.currentTimeMillis()){
Titans.pollTitanSpawn(); Titans.pollTitanSpawn();
lastPolledTitanSpawn += pollTitanSpawnTime; lastPolledTitanSpawn += pollTitanSpawnTime;
} }
if(lastPolledTitans + pollTitanTime < System.currentTimeMillis()){ if(enableTitanModule && lastPolledTitans + pollTitanTime < System.currentTimeMillis()){
Titans.pollTitans(); Titans.pollTitans();
lastPolledTitans += pollTitanTime; lastPolledTitans += pollTitanTime;
} }
if(lastPolledRareSpawns + pollRareSpawnTime < System.currentTimeMillis()){ if(enableRareSpawnModule && lastPolledRareSpawns + pollRareSpawnTime < System.currentTimeMillis()){
RareSpawns.pollRareSpawns(); RareSpawns.pollRareSpawns();
lastPolledRareSpawns += pollRareSpawnTime; lastPolledRareSpawns += pollRareSpawnTime;
} }
@@ -1096,14 +1264,15 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
Soulstealing.pollSoulForges(); Soulstealing.pollSoulForges();
lastPolledEternalReservoirs += pollEternalReservoirTime; lastPolledEternalReservoirs += pollEternalReservoirTime;
} }
if(lastPolledMissionCreator + pollMissionCreatorTime < System.currentTimeMillis()){ if(enableMissionModule && enableNewMissionCreator && lastPolledMissionCreator + pollMissionCreatorTime < System.currentTimeMillis()){
MissionCreator.pollMissions(); MissionCreator.pollMissions();
lastPolledMissionCreator += pollMissionCreatorTime; lastPolledMissionCreator += pollMissionCreatorTime;
} }
/* Disabled for now, might need to be revisited.
if(lastPolledBloodlust + pollBloodlustTime < System.currentTimeMillis()){ if(lastPolledBloodlust + pollBloodlustTime < System.currentTimeMillis()){
Bloodlust.pollLusts(); Bloodlust.pollLusts();
lastPolledBloodlust += pollBloodlustTime; lastPolledBloodlust += pollBloodlustTime;
} }*/
if(WyvernMods.useStaticLegendaryRegeneration && lastPolledUniqueRegeneration + pollUniqueRegenerationTime < System.currentTimeMillis()){ if(WyvernMods.useStaticLegendaryRegeneration && lastPolledUniqueRegeneration + pollUniqueRegenerationTime < System.currentTimeMillis()){
CombatChanges.pollUniqueRegeneration(); CombatChanges.pollUniqueRegeneration();
lastPolledUniqueRegeneration += pollUniqueRegenerationTime; lastPolledUniqueRegeneration += pollUniqueRegenerationTime;
@@ -1129,7 +1298,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
lastPolledRareSpawns = System.currentTimeMillis(); lastPolledRareSpawns = System.currentTimeMillis();
lastPolledEternalReservoirs = System.currentTimeMillis(); lastPolledEternalReservoirs = System.currentTimeMillis();
lastPolledMissionCreator = System.currentTimeMillis(); lastPolledMissionCreator = System.currentTimeMillis();
lastPolledBloodlust = System.currentTimeMillis(); //lastPolledBloodlust = System.currentTimeMillis();
lastPolledUniqueRegeneration = System.currentTimeMillis(); lastPolledUniqueRegeneration = System.currentTimeMillis();
lastPolledUniqueCollection = System.currentTimeMillis(); lastPolledUniqueCollection = System.currentTimeMillis();
lastPolledTerrainSmooth = System.currentTimeMillis(); lastPolledTerrainSmooth = System.currentTimeMillis();