diff --git a/mods/WyvernMods.properties b/mods/WyvernMods.properties index baa3cd3..9cbd13f 100644 --- a/mods/WyvernMods.properties +++ b/mods/WyvernMods.properties @@ -242,6 +242,12 @@ disableSmeltingPots=true hideSorceryBuffBar=true #sqlAchievementFix: Fixes the errors that occur with achievements in SQL in WU 1.9. sqlAchievementFix=true +#changePumpkinKingTitle: Changes the Pumpkin King title (100 farming) for females from "Pumpkin King" to "Pumpkin Queen" +changePumpkinKingTitle=true +#changeDeityPassives: Changes some of the deity passives for demigods with ID 101 and 102. +# This option is specifically for compatibility to Revenant for the time being. +changeDeityPassives=true +#TODO: Remove this option and add deity passive configuration to Spellcraft. ## >> END MISCELLANEOUS CHANGES MODULE << ## @@ -929,6 +935,317 @@ depotRespawnTime=39600000 ## >> END SUPPLY DEPOT MODULE << ## +## >> BESTIARY MODULE << ## +## The Bestiary Module controls a variety of features regarding creatures in Wurm. +## This module includes options that controls creature attributes, changing their behavior, and additions of new creatures. +enableBestiaryModule=true + +#fixSacrificingStrongCreatures: Removes the ability to sacrifice strong modded creatures such as titans and rare spawns. +fixSacrificingStrongCreatures=true +#disableAfkTraining: Disables afk training by doing combat with a creature while not targeting it. +# This is usually called "shield training" when you engage in combat with a creature then target another to prevent attacking it back. +# With this enabled, it will prevent players from gaining skill from a creature unless they are targeting it as well. +# If DUSKombat is active, this is built into it. Probably not necessary to enable if you have DUSKombat installed, but will do no harm if enabled. +disableAfkTraining=true +#fixChargersWalkingThroughWalls: By default, since Chargers are considered ghost units like templars, they are allowed to walk through walls. +# This option will add a hard override to their pathing and prevent them from walking through walls despite being ghosts. +fixChargersWalkingThroughWalls=true +#conditionWildCreatures: Adds conditions randomly to creatures spawned naturally in the wild. +# By default, only creatures spawned from a den will have a condition (greenish, angry, etc.) +# This option will allow *any* natural spawn to have a condition. +# Will not affect creatures which cannot have a condition by default (such as horses, pigs, etc) +# Chance is 1/5 for a random condition, and 1/250 to be a champion. +conditionWildCreatures=true +#allowGhostArchery: Allows archery against targets marked as "ghosts" - including chargers and spirit templars. +# This is done to prevent players from mounting chargers and being immune to archery to dismount them. +allowGhostArchery=true +#disableArcheryOnStrongCreatures: Disables archery against strong creatures such as titans and rare spawns. +disableArcheryOnStrongCreatures=true +#genesisEnchantedGrassNewborns: When a new creature is born on enchanted grass, it will automatically remove a negative trait. +genesisEnchantedGrassNewborns=true +#useCustomCorpseSizes: Custom creatures can sometimes have poor corpse sizes when slain. +# This option fixes that issue by utilizing custom corpse sizes when they die and adjusting the size to be closer to their normal size. +useCustomCorpseSizes=true +#allowCustomCreatureBreedNames: Allows some custom creatures (Chargers) to have breeding names similar to horses. +allowCustomCreatureBreedNames=true +#allowGhostBreeding: Allows breeding of ghost creatures (such as Chargers). +allowGhostBreeding=true +#allowGhostCorpses: Allows ghost creatures (Chargers and Spirit Trolls) to drop corpses. +allowGhostCorpses=true +#useCustomCreatureSizes: Adjusts the size of creatures when they're alive. +# This makes wyverns smaller than drakes, forest spiders smaller than large spiders, etc. +useCustomCreatureSizes=true +#TODO: Allow custom settings for unit sizes. +#useCustomCreatureSFX: Uses special effects to augment some of the custom creatures (such as fire crabs). +useCustomCreatureSFX=true +#preventLegendaryHitching: When a player dominates a legendary creature such as a dragon, it can sometimes be hitched. +# When hitched, it uses the body strength of the creature to determine speed of the vehicle. +# This usually results in vehicles that go ~30-40kmh. This option prevents this instance from occurring. +preventLegendaryHitching=true +#modifyNewCreatures: Modifies custom creatures in a variety of ways to make sure they function properly. +# Also handles announcement of some custom creatures such as titans. +modifyNewCreatures=true +#logCreatureSpawns: Logs all spawns of creatures to the server log. This is purely informative and has no gameplay effect. +logCreatureSpawns=true +#allowEpicCreatureNaturalSpawns: Allows Sol Demons, Lava Fiends, and Worgs to spawn naturally in the world. +# Sol Demons and Lava Fiends spawn on sand. Worgs spawn on grass and steppe. +allowEpicCreatureNaturalSpawns=true +#TODO: Enable customization of the spawn rates for creatures individually. + +# > CUSTOM CREATURES < # +# Custom Creatures are new creatures independent from vanilla ones that are designed to add additional content for players. +enableCustomCreatures=true +#TODO: This module needs to be restructured to allow configuration of each creature independently. + +#enableWyverns: Enables the Black, Blue, Green, Red, and White Wyvern creatures. +# These are difficult creatures that spawn naturally on unique tilesets. +# All are able to be mounted and hitched. +# They are unable to spawn on PvP servers. +enableWyverns=true +#enableFlavorMobs: Enables the Avenger, Fire Crab, Forest Spider, Giant, Charger, Horned Pony, Large Boar, and Spirit Troll creatures. +# These creatures all spawn naturally. +# Giants and Avengers are unable to spawn on PvP servers. +enableFlavorMobs=true +#enableEventMobs: Enables the Ice Cat, Fire Giant, Terror, and Guardian of Magranon event creatures. +# These creatures do not spawn naturally. +enableEventMobs=true +#enableRareSpawns: Enables the Reaper and Spectral Drake creatures. +# These creatures only spawn naturally if using the Rare Spawns module. +enableRareSpawns=true +#enableCustomLegendaries: Enables the Facebreyker legendary creature. +# Only spawns naturally if using the Misc Changes addition to add to the spawn list. +enableCustomLegendaries=true +#enableTitans: Enables the Ifrit and Lilith titan creatures. Also includes their additional creatures. +# Only spawns naturally if configured to do so through the Titan module. +enableTitans=true + +# > END CUSTOM CREATURES < # + +## >> END BESTIARY MODULE << ## + +## >> BOUNTY MODULE << ## +## The Bounty Module handles effects and rewards that occur when a player slays a creature. +enableBountyModule=true +#TODO: This module needs to be restructured to give more options for what type of drops and rewards occur. + +#usePlayerBounty: Allows players to be rewarded directly when they slay a creature. +usePlayerBounty=true +#TODO: Give further options for player bounty. +#useLootTable: Allows creatures to drop rewards on their corpses. +useLootTable=true +#TODO: Give further options for loot tables. + +## >> END BOUNTY MODULE << ## + +## >> ITEM MODULE << ## +## The Item Module handles the implementation of new items and their effects. +## It also grants options that change default items in a variety of ways. +enableItemModule=true +#TODO: This module needs to be restructured to give more options regarding each individual item instead of using true/false. + +#combineLeather: Allows leather to be combined. +# Will prevent improvement with leather lower than item QL unless the Misc Changes configuration is enabled. +combineLeather=true +#combineLogs: Allows logs to be combined. +combineLogs=true +#reduceLogVolume: Reduces the volume of logs by 50%, making twice as many fit in bulk containers. +# This also makes them easier to fit into containers that otherwise would not hold them. +reduceLogVolume=true +#reduceKindlingVolume: Reduces the volume of kindling by 75%, preventing them from being technically larger than logs. +# In vanilla gameplay, turning logs into kindling would actually yield a higher volume of material... which doesn't make sense. +reduceKindlingVolume=true +#droppableSleepPowder: Allows sleep powder to be dropped. +# This will cause players to drop sleep powder if they die, but also makes them able to be mailed. +droppableSleepPowder=true +#setSilverMirrorPrice: Sets silver mirrors to cost 20 silver instead of 1 iron. This should allow them to be sold on traders. +setSilverMirrorPrice=true +#setGoldMirrorPrice: Sets gold mirrors to cost 1 gold instead of 1 iron. This should allow them to be sold on traders. +setGoldMirrorPrice=true +#setCreatureCratePrice: Sets creature cages to cost 10 silver. This allows them to be sold on traders. +setCreatureCratePrice=true +#setResurrectionStonePrice: Sets resurrection stones to cost 2 silver instead of 5 silver. +setResurrectionStonePrice=true +#loadableMailbox: Allows mailboxes (spirit cottage, spirit castle, etc) to be loaded into vehicles. +# Does not work on PvP servers even if enabled. +loadableMailbox=true +#loadableBellTower: Allows bell towers to be loaded into vehicles. +loadableBellTower=true +#loadableTrashBin: Allows trash bins to be loaded into vehicles. +loadableTrashBin=true +#loadableAltars: Allows altars (wood, stone, silver, gold) to be loaded into vehicles. +# Does not affect the huge altars (White Light and Black Light). +loadableAltars=true +#oneHandedLongSpear: Makes long spears one-handed, allowing them to be equipped in dual wield or with a shield. +oneHandedLongSpear=true +#reduceDirtDifficulty: Reduces the difficulty of crafting dirt from 99 to 50. +# Dirt by default has no crafting recipe so this does nothing on it's own. +reduceDirtDifficulty=true +#reduceSandDifficulty: Reduces the difficulty of crafting sand from 99 to 50. +# Sand by default has no crafting recipe so this does nothing on it's own. +reduceSandDifficulty=true +#reduceSandstoneDifficulty: Reduces the difficulty of crafting sandstone from 99 to 50. +# Sandstone by default has no crafting recipe so this does nothing on it's own. +reduceSandstoneDifficulty=true +#decorationStoneKeystone: Makes stone keystones into a decoration item. +# This prevents them from going into piles of items when dropped, allowing them to be used for decorative purposes. +decorationStoneKeystone=true +#decorationMarbleKeystone: Makes marble keystons into a decoration item. +# This prevents them from going into piles of items when dropped, allowing them to be used for decorative purposes. +decorationMarbleKeystone=true +#useCustomCacheFragments: Modifies the fragment count for archaeology with the custom caches from WyvernMods. +useCustomCacheFragments=true +#adjustStatueFragmentCount: Adjusts the fragment count for some statues in Archaeology. +# Worg and Eagle: 40 fragments. +# Hell Horse and Drake: 45 fragments. +# Fo, Magranon, Libila, and Vynora: 50 fragments. +adjustStatueFragmentCount=true +#removeLockpickSkillRequirement: Removes the 20 locksmithing requirement to begin crafting lockpicks. +# If the quality of materials is too low, players might still not be able to craft them with less than 20 skill. +removeLockpickSkillRequirement=true +#createCustomItemTemplates: Creates the item templates for the custom items from WyvernMods. +# This only initializes the item so it can be used on the server. Enabling this option does not make any items craftable. +# The ability to craft items is set in other configurations below this one. +# It is highly recommended to enable this and keep it enabled if you plan on using any of the custom items. +# If you want to remove an item, disabling this is not advised. Instead, remove the ability to craft that item in other configurations. +createCustomItemTemplates=true + +# > CUSTOM ITEM CREATION < # +# Custom Item Creation identifies which of the custom items you want to have be player-made. +# Each option will list the creation recipe and requirements. +enableCustomItemCreation=true +#TODO: Recode to allow custom recipes for both modded items and non-modded items. + +#craftHuntingArrowPacks: Creation Entry for Hunting Arrow Packs. +# Start with quiver + hunting arrow. Finish with 39 additional hunting arrows. +# Uses Fletching and requires 50 skill to begin. +craftHuntingArrowPacks=true +#craftWarArrowPacks: Creation Entry for War Arrow Packs. +# Start with quiver + war arrow. Finish with 39 additional war arrows. +# Uses Fletching and requires 50 skill to begin. +craftWarArrowPacks=true +#craftBattleYoyo: Creation Entry for Battle Yoyo. +# Crafted with a string of cloth and shaft. +# Uses Toymaking. +craftBattleYoyo=true +#craftClub: Creation Entry for Club. +# Crafted using a carving knife on a log. +# Uses Carpentry. +craftClub=true +#craftDepthDrill: Creation Entry for Depth Drill. +# Start with ribbon and shaft. Finish with a two wooden handles and a small nails. +# Uses Fine Carpentry. +craftDepthDrill=true +#craftEternalReservoir: Creation Entry for Eternal Reservoir. Used in Soulstealing. +# Start with a star diamond + dirt. Finish with 99 additional dirt, 200 pottery bricks, 30 chaos crystals, and 20 hearts. +# Uses Pottery. +craftEternalReservoir=true +#craftEviscerator: Creation Entry for Eviscerator. NOTE: This is meant to be a GM-only weapon. +# Crafted using a Wilhelm's Wrath on another Wilhelm's Wrath. This is not intended to be done. +# Uses Weapon Smithing. +# This creation entry is only made to enable the material functionality on the weapon. It is not meant to be used. +# The Eviscerator is a weapon designed to help with testing against tough targets (like titans) because it does insane damage. +craftEviscerator=true +#craftKnuckles: Creation Entry for Knuckles. +# Crafted using a lump of metal on a small anvil. +# Uses Weapon Heads Smithing. +craftKnuckles=true +#craftMassStorageUnit: Creation Entry for Mass Storage Unit. +# Start with wood beam + wood beam. Finish with 500 planks, 200 shafts, 50 ribbons, and 100 large nails. +# Uses Fine Carpentry and requires 70 skill to begin. +craftMassStorageUnit=true +#craftStatuetteDeities: Creation Entries for statuette of (Demigod). +# Created the same way normal statuettes are. +# The current statuettes are Thelastdab and Reevi. These are hardcoded. +craftStatuetteDeities=true +#TODO: Allow creation of new deity statuettes through configuration. +#craftWarhammer: Creation Entry for Warhammer and Warhammer Head. +# Warhammer Head is crafted using a lump of metal on a large anvil. +# Warhammer is crafted using a Warhammer Head on a shaft. +# Both use Weapon Heads Smithing. +craftWarhammer=true + +# > END CUSTOM ITEM CREATION < # + +## >> END ITEM MODULE << ## + +## >> SOULSTEALING MODULE << ## +## The Soulstealing Module is the implementation of a new skill, Soulstealing. This replaces the standard Stealing skill. +## When a creature dies, players can use a Sacrificial Knife to collect the creature's soul instead of butchering it. +## Stealing the soul will generate a small item, a soul, which can then be used for various purposes. +## When the soul is stolen, the corpse of the creature will be removed. This makes Soulstealing a handy skill for light hunting. +## Souls can be used in the Eternal Reservoir to charge it, which will automatically feed carnivore creatures nearby and keep forges and ovens lit. +enableSoulstealingModule=true +#TODO: This section needs more configurations for the eternal reservoir effects and how soulstealing functions. + +#pollEternalReservoirTime: Amount of time, in milliseconds, to poll Eternal Reservoirs for their effects. +# This will reduce their fuel and provide the effects of feeding nearby carnivores and lighting nearby forges and ovens. +# Default is 600000, or 10 minutes. +pollEternalReservoirTime=600000 + +## >> END SOULSTEALING MODULE << ## + +## >> ACTION MODULE << ## +## The Action Module handles new actions which are unrelated to other functions. Some serve as QoL and others as new features. +enableActionModule=true + +#actionUnequipAll: Provides an "Unequip All" action when players right-click an item they are wearing. +# This is slightly different than the body action for Unequip All that was added to the base game. It does not conflict with it. +actionUnequipAll=true +#actionReceiveAllMail: Provides a "Receive All Mail" action when players right-click a mailbox. +# This will not accept CoD items, and only accepts mail with no cost. +# It will accept up to 100 items at a time and place them in the mailbox upon action completion. +actionReceiveAllMail=true +#actionSplitSorcery: Provides a "Split Sorcery" action when players right-click any sorcery/tome. +# This allows them to split it into several tomes each with one charge. +# Amount of items granted is equivalent to the amount of charges in the original sorcery/tome. +actionSplitSorcery=true +#actionLeaderboard: Provides a "Leaderboard" action when players right-click their body. Also works when right-clicking skills. +# This opens up a full leaderboard dialogue where players can see the skill levels, achievements, and similar of other players. +# The system is opt-in, with each player opted out by default. +actionLeaderboard=true +#TODO: Allow customization of the leaderboard dialogue colors and similar. +#actionSorceryFragmentCombine: Allows sorcery fragments to be combined at a huge altar (White Light or Black Light). +actionSorceryFragmentCombine=true +#actionArenaTeleports: Provides the "Arena Teleport" and "Arena Escape" actions. +# These are hardcoded heavily for Revenant and likely will not work well on any other server. +actionArenaTeleports=true +#TODO: Expand on these actions to enable better teleportation options. +#actionAddMissionDev: Adds action "Add Mission" to the body of GM power 5 accounts. +# This adds a random mission using the custom Mission Creator. +actionAddMissionDev=true +#TODO: Allow configuration of power requirement. +#actionRemoveMissionDev: Adds action "Remove Mission" to the body of GM power 5 accounts. +# This removes a random active mission. +actionRemoveMissionDev=true +#TODO: Allow configuration of power requirement. +#actionCreatureReportDev: Adds action "Creature Report" to the body of GM power 5 accounts. +# This provides a list of current creatures on the server. +# Thanks to Bdew for providing the code to make this action work. +actionCreatureReportDev=true +#TODO: Allow configuration of power requirement. +#actionSmoothTerrainDev: Adds action "Smooth Terrain" when targeting a tile corner for GM power 5 accounts. +# This will enact "erosion" on the area and smooth the terrain by 1 step. +# Binding the action to a key and pressing it multiple times will demonstrate the effects of the Erosion system. +actionSmoothTerrainDev=true +#TODO: Allow configuration of the power requirement. + +## >> END ACTION MODULE << ## + +## >> EROSION MODULE << ## +## The Erosion Module handles a new system that helps smooth the terrain on otherwise bumpy maps. +## In some cases, the heightmap generation when making a new map is flawed and will create a very bumpy terrain. +## The erosion system is a slow but effective method by which to smooth the bumps in the terrain and make it more natural. +## This operation occurs on an interval, but is fairly expensive when it executes. +## If you notice laggspikes while this system is enabled, it is recommended that you either disable it or increase the interval. +enableErosionModule=true + +#pollTerrainSmoothTime: Amount of time, in milliseconds, between each terrain smoothing attempt. +# This operation selects a random spot on the map and smooths a 10x10 area. +# Default is 5000, or 5 seconds. +pollTerrainSmoothTime=5000 + +## >> END EROSION MODULE << ## + ## >> TREASURE CHEST LOOT MODULE << ## ## 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. diff --git a/src/main/java/mod/sin/creatures/WyvernBlack.java b/src/main/java/mod/sin/creatures/WyvernBlack.java index 9e0eb2c..315a0f8 100644 --- a/src/main/java/mod/sin/creatures/WyvernBlack.java +++ b/src/main/java/mod/sin/creatures/WyvernBlack.java @@ -124,14 +124,14 @@ public class WyvernBlack implements ModCreature, CreatureTypes { new EncounterBuilder(Tiles.Tile.TILE_SAND.id) .addCreatures(templateId, 1) .build(1); - //}else if(Servers.localServer.PVPSERVER){ - /*new EncounterBuilder(Tiles.Tile.TILE_GRASS.id) + }/*else if(Servers.localServer.PVPSERVER){ + new EncounterBuilder(Tiles.Tile.TILE_GRASS.id) .addCreatures(templateId, 1) .build(1); new EncounterBuilder(Tiles.Tile.TILE_TREE.id) .addCreatures(templateId, 1) - .build(1);*/ - } + .build(1); + }*/ } } diff --git a/src/main/java/mod/sin/wyvern/bestiary/MethodsBestiary.java b/src/main/java/mod/sin/wyvern/Bestiary.java similarity index 74% rename from src/main/java/mod/sin/wyvern/bestiary/MethodsBestiary.java rename to src/main/java/mod/sin/wyvern/Bestiary.java index b055928..23e719b 100644 --- a/src/main/java/mod/sin/wyvern/bestiary/MethodsBestiary.java +++ b/src/main/java/mod/sin/wyvern/Bestiary.java @@ -1,11 +1,10 @@ -package mod.sin.wyvern.bestiary; +package mod.sin.wyvern; import java.lang.reflect.InvocationTargetException; import java.util.logging.Logger; import com.wurmonline.mesh.Tiles; import com.wurmonline.server.Servers; -import com.wurmonline.server.behaviours.AutoEquipMethods; import com.wurmonline.server.combat.Weapon; import com.wurmonline.server.creatures.*; import com.wurmonline.server.items.*; @@ -21,8 +20,6 @@ import javassist.expr.ExprEditor; import javassist.expr.MethodCall; import mod.sin.items.SealedMap; import mod.sin.lib.Util; -import mod.sin.wyvern.RareSpawns; -import mod.sin.wyvern.Titans; import org.gotti.wurmunlimited.modloader.ReflectionUtil; import com.wurmonline.server.FailedException; @@ -38,12 +35,11 @@ import mod.sin.creatures.*; import mod.sin.creatures.titans.*; import mod.sin.weapons.Club; import mod.sin.weapons.titan.*; -import mod.sin.wyvern.MiscChanges; import org.gotti.wurmunlimited.modloader.classhooks.HookException; import org.gotti.wurmunlimited.modloader.classhooks.HookManager; -public class MethodsBestiary { - protected static Logger logger = Logger.getLogger(MethodsBestiary.class.getName()); +public class Bestiary { + protected static Logger logger = Logger.getLogger(Bestiary.class.getName()); protected static boolean isUsuallyHitched(int templateId){ if(templateId == Charger.templateId){ @@ -701,55 +697,68 @@ public class MethodsBestiary { public static void preInit(){ try{ ClassPool classPool = HookManager.getInstance().getClassPool(); - final Class thisClass = MethodsBestiary.class; + final Class thisClass = Bestiary.class; String replace; - Util.setReason("Disable sacrificing strong creatures."); - CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); - CtClass ctItem = classPool.get("com.wurmonline.server.items.Item"); - CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action"); - CtClass ctMethodsReligion = classPool.get("com.wurmonline.server.behaviours.MethodsReligion"); - CtClass[] params1 = { - ctCreature, - ctCreature, - ctItem, - ctAction, - CtClass.floatType - }; - String desc1 = Descriptor.ofMethod(CtClass.booleanType, params1); - replace = "if("+MethodsBestiary.class.getName()+".isSacrificeImmune($2)){" + - " performer.getCommunicator().sendNormalServerMessage(\"This creature cannot be sacrificed.\");" + - " return true;" + - "}"; - Util.insertBeforeDescribed(thisClass, ctMethodsReligion, "sacrifice", desc1, replace); + CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); + CtClass ctItem = classPool.get("com.wurmonline.server.items.Item"); + CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action"); + CtClass ctMethodsReligion = classPool.get("com.wurmonline.server.behaviours.MethodsReligion"); + CtClass ctPathFinder = classPool.get("com.wurmonline.server.creatures.ai.PathFinder"); + CtClass ctArchery = classPool.get("com.wurmonline.server.combat.Archery"); + CtClass ctVirtualZone = classPool.get("com.wurmonline.server.zones.VirtualZone"); + CtClass ctVehicle = classPool.get("com.wurmonline.server.behaviours.Vehicle"); + CtClass ctCreatureStatus = classPool.get("com.wurmonline.server.creatures.CreatureStatus"); - Util.setReason("Disable afk training."); - CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler"); - replace = "if("+MethodsBestiary.class.getName()+".blockSkillFrom($1, $0)){"+//"if($1.isPlayer() && $1.getTarget() != $0){" + - //" logger.info(\"Non-targeted mob detected - \" + $1.getName());" + - " $_ = true;" + - "}else{" + - " $_ = $proceed($$);" + - "}"; - Util.instrumentDeclared(thisClass, ctCombatHandler, "setDamage", "isNoSkillFor", replace); - Util.instrumentDeclared(thisClass, ctCombatHandler, "checkDefenderParry", "isNoSkillFor", replace); - Util.instrumentDeclared(thisClass, ctCombatHandler, "checkShield", "isNoSkillFor", replace); - Util.instrumentDeclared(thisClass, ctCombatHandler, "setBonuses", "isNoSkillFor", replace); - CtMethod[] ctGetDamages = ctCombatHandler.getDeclaredMethods("getDamage"); - for(CtMethod method : ctGetDamages){ - method.instrument(new ExprEditor(){ - public void edit(MethodCall m) throws CannotCompileException { - if (m.getMethodName().equals("isNoSkillFor")) { - m.replace("if("+MethodsBestiary.class.getName()+".blockSkillFrom($1, $0)){" + //"if($1.isPlayer() && $1.getTarget() != $0){" + - //" logger.info(\"Non-targeted mob detected - \" + $1.getName());" + - " $_ = true;" + - "}else{" + - " $_ = $proceed($$);" + - "}"); - } - } - }); - } + if (WyvernMods.fixSacrificingStrongCreatures) { + Util.setReason("Disable sacrificing strong creatures."); + CtClass[] params1 = { + ctCreature, + ctCreature, + ctItem, + ctAction, + CtClass.floatType + }; + String desc1 = Descriptor.ofMethod(CtClass.booleanType, params1); + replace = "if(" + Bestiary.class.getName() + ".isSacrificeImmune($2)){" + + " performer.getCommunicator().sendNormalServerMessage(\"This creature cannot be sacrificed.\");" + + " return true;" + + "}"; + Util.insertBeforeDescribed(thisClass, ctMethodsReligion, "sacrifice", desc1, replace); + } + + if (WyvernMods.disableAfkTraining) { + Util.setReason("Disable afk training."); + CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler"); + replace = "if(" + Bestiary.class.getName() + ".blockSkillFrom($1, $0)){" +//"if($1.isPlayer() && $1.getTarget() != $0){" + + //" logger.info(\"Non-targeted mob detected - \" + $1.getName());" + + " $_ = true;" + + "}else{" + + " $_ = $proceed($$);" + + "}"; + Util.instrumentDeclared(thisClass, ctCombatHandler, "setDamage", "isNoSkillFor", replace); + Util.setReason("Disable afk training."); + Util.instrumentDeclared(thisClass, ctCombatHandler, "checkDefenderParry", "isNoSkillFor", replace); + Util.setReason("Disable afk training."); + Util.instrumentDeclared(thisClass, ctCombatHandler, "checkShield", "isNoSkillFor", replace); + Util.setReason("Disable afk training."); + Util.instrumentDeclared(thisClass, ctCombatHandler, "setBonuses", "isNoSkillFor", replace); + CtMethod[] ctGetDamages = ctCombatHandler.getDeclaredMethods("getDamage"); + for (CtMethod method : ctGetDamages) { + method.instrument(new ExprEditor() { + public void edit(MethodCall m) throws CannotCompileException { + if (m.getMethodName().equals("isNoSkillFor")) { + m.replace("if(" + Bestiary.class.getName() + ".blockSkillFrom($1, $0)){" + //"if($1.isPlayer() && $1.getTarget() != $0){" + + //" logger.info(\"Non-targeted mob detected - \" + $1.getName());" + + " $_ = true;" + + "}else{" + + " $_ = $proceed($$);" + + "}"); + } + } + }); + } + } // Die method description CtClass ctString = classPool.get("java.lang.String"); @@ -760,125 +769,203 @@ public class MethodsBestiary { }; String desc5 = Descriptor.ofMethod(CtClass.voidType, params5); - Util.setReason("Deny chargers walking through walls."); - CtClass ctPathFinder = classPool.get("com.wurmonline.server.creatures.ai.PathFinder"); - replace = "if("+MethodsBestiary.class.getName()+".denyPathingOverride($0)){" + - " $_ = false;" + - "}else{" + - " $_ = $proceed($$);" + - "}"; - Util.instrumentDeclared(thisClass, ctPathFinder, "canPass", "isGhost", replace); - Util.instrumentDeclared(thisClass, ctCreature, "setPathing", "isGhost", replace); - Util.instrumentDeclared(thisClass, ctCreature, "startPathingToTile", "isGhost", replace); - Util.instrumentDeclared(thisClass, ctCreature, "moveAlongPath", "isGhost", replace); - Util.instrumentDeclared(thisClass, ctCreature, "takeSimpleStep", "isGhost", replace); - Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "isGhost", replace); + if (WyvernMods.fixChargersWalkingThroughWalls) { + Util.setReason("Deny chargers walking through walls."); + replace = "if(" + Bestiary.class.getName() + ".denyPathingOverride($0)){" + + " $_ = false;" + + "}else{" + + " $_ = $proceed($$);" + + "}"; + Util.instrumentDeclared(thisClass, ctPathFinder, "canPass", "isGhost", replace); + Util.setReason("Deny chargers walking through walls."); + Util.instrumentDeclared(thisClass, ctCreature, "setPathing", "isGhost", replace); + Util.setReason("Deny chargers walking through walls."); + Util.instrumentDeclared(thisClass, ctCreature, "startPathingToTile", "isGhost", replace); + Util.setReason("Deny chargers walking through walls."); + Util.instrumentDeclared(thisClass, ctCreature, "moveAlongPath", "isGhost", replace); + Util.setReason("Deny chargers walking through walls."); + Util.instrumentDeclared(thisClass, ctCreature, "takeSimpleStep", "isGhost", replace); + Util.setReason("Deny chargers walking through walls."); + Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "isGhost", replace); + } - Util.setReason("Apply random types to creatures in the wilderness."); - CtClass[] params2 = { - CtClass.intType, - CtClass.booleanType, - CtClass.floatType, - CtClass.floatType, - CtClass.floatType, - CtClass.intType, - classPool.get("java.lang.String"), - CtClass.byteType, - CtClass.byteType, - CtClass.byteType, - CtClass.booleanType, - CtClass.byteType, - CtClass.intType - }; - String desc2 = Descriptor.ofMethod(ctCreature, params2); - replace = "$10 = "+MethodsBestiary.class.getName()+".newCreatureType($1, $10);"; - Util.insertBeforeDescribed(thisClass, ctCreature, "doNew", desc2, replace); + if (WyvernMods.conditionWildCreatures) { + Util.setReason("Apply random types to creatures in the wilderness."); + CtClass[] params2 = { + CtClass.intType, + CtClass.booleanType, + CtClass.floatType, + CtClass.floatType, + CtClass.floatType, + CtClass.intType, + classPool.get("java.lang.String"), + CtClass.byteType, + CtClass.byteType, + CtClass.byteType, + CtClass.booleanType, + CtClass.byteType, + CtClass.intType + }; + String desc2 = Descriptor.ofMethod(ctCreature, params2); + replace = "$10 = " + Bestiary.class.getName() + ".newCreatureType($1, $10);"; + Util.insertBeforeDescribed(thisClass, ctCreature, "doNew", desc2, replace); + } - Util.setReason("Enable archery against ghost targets."); - CtClass ctArchery = classPool.get("com.wurmonline.server.combat.Archery"); - CtMethod[] archeryAttacks = ctArchery.getDeclaredMethods("attack"); - for(CtMethod method : archeryAttacks){ - method.instrument(new ExprEditor(){ - public void edit(MethodCall m) throws CannotCompileException { - if (m.getMethodName().equals("isGhost")) { - m.replace("$_ = false;"); - logger.info("Enabled archery against ghost targets in archery attack method."); - } - } - }); - } + if (WyvernMods.allowGhostArchery) { + Util.setReason("Enable archery against ghost targets."); + CtMethod[] archeryAttacks = ctArchery.getDeclaredMethods("attack"); + for (CtMethod method : archeryAttacks) { + method.instrument(new ExprEditor() { + public void edit(MethodCall m) throws CannotCompileException { + if (m.getMethodName().equals("isGhost")) { + m.replace("$_ = false;"); + logger.info("Enabled archery against ghost targets in archery attack method."); + } + } + }); + } + } - Util.setReason("Disable archery altogether against certain creatures."); - CtClass[] params3 = { - ctCreature, - ctCreature, - ctItem, - CtClass.floatType, - ctAction - }; - String desc3 = Descriptor.ofMethod(CtClass.booleanType, params3); - replace = "if("+MethodsBestiary.class.getName()+".isArcheryImmune($1, $2)){" - + " return true;" - + "}"; - Util.insertBeforeDescribed(thisClass, ctArchery, "attack", desc3, replace); + if (WyvernMods.disableArcheryOnStrongCreatures) { + Util.setReason("Disable archery altogether against certain creatures."); + CtClass[] params3 = { + ctCreature, + ctCreature, + ctItem, + CtClass.floatType, + ctAction + }; + String desc3 = Descriptor.ofMethod(CtClass.booleanType, params3); + replace = "if(" + Bestiary.class.getName() + ".isArcheryImmune($1, $2)){" + + " return true;" + + "}"; + Util.insertBeforeDescribed(thisClass, ctArchery, "attack", desc3, replace); + } - Util.setReason("Auto-Genesis a creature born on enchanted grass"); - replace = MethodsBestiary.class.getName()+".checkEnchantedBreed(newCreature);" - + "$_ = $proceed($$);"; - Util.instrumentDeclared(thisClass, ctCreature, "checkPregnancy", "saveCreatureName", replace); + if (WyvernMods.genesisEnchantedGrassNewborns) { + Util.setReason("Auto-Genesis a creature born on enchanted grass"); + replace = Bestiary.class.getName() + ".checkEnchantedBreed(newCreature);" + + "$_ = $proceed($$);"; + Util.instrumentDeclared(thisClass, ctCreature, "checkPregnancy", "saveCreatureName", replace); + } - Util.setReason("Set custom corpse sizes."); - replace = "$_ = $proceed($$);" - + "if("+MethodsBestiary.class.getName()+".hasCustomCorpseSize(this)){" - + " "+MethodsBestiary.class.getName()+".setCorpseSizes(this, corpse);" - + "}"; - Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "addItem", replace); + if (WyvernMods.useCustomCorpseSizes) { + Util.setReason("Set custom corpse sizes."); + replace = "$_ = $proceed($$);" + + "if(" + Bestiary.class.getName() + ".hasCustomCorpseSize(this)){" + + " " + Bestiary.class.getName() + ".setCorpseSizes(this, corpse);" + + "}"; + Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "addItem", replace); + } + /* Disabled for 1.9 - Probably not necessary anymore. Remains for reference or re-implementation. Util.setReason("Add spell resistance to custom creatures."); - replace = "float cResist = "+MethodsBestiary.class.getName()+".getCustomSpellResistance(this);" + + replace = "float cResist = "+Bestiary.class.getName()+".getCustomSpellResistance(this);" + "if(cResist >= 0f){" + " return cResist;" + "}"; - Util.insertBeforeDeclared(thisClass, ctCreature, "addSpellResistance", replace); + Util.insertBeforeDeclared(thisClass, ctCreature, "addSpellResistance", replace);*/ - Util.setReason("Allow custom creatures to have breeding names."); - replace = "$_ = "+MethodsBestiary.class.getName()+".shouldBreedName(this);"; - Util.instrumentDeclared(thisClass, ctCreature, "checkPregnancy", "isHorse", replace); + if (WyvernMods.allowCustomCreatureBreedNames) { + Util.setReason("Allow custom creatures to have breeding names."); + replace = "$_ = " + Bestiary.class.getName() + ".shouldBreedName(this);"; + Util.instrumentDeclared(thisClass, ctCreature, "checkPregnancy", "isHorse", replace); + } - Util.setReason("Allow ghost creatures to breed (Chargers)."); - CtClass ctMethodsCreatures = classPool.get("com.wurmonline.server.behaviours.MethodsCreatures"); - replace = "$_ = false;"; - Util.instrumentDeclared(thisClass, ctMethodsCreatures, "breed", "isGhost", replace); + if (WyvernMods.allowGhostBreeding) { + Util.setReason("Allow ghost creatures to breed (Chargers)."); + CtClass ctMethodsCreatures = classPool.get("com.wurmonline.server.behaviours.MethodsCreatures"); + replace = "$_ = false;"; + Util.instrumentDeclared(thisClass, ctMethodsCreatures, "breed", "isGhost", replace); + } - Util.setReason("Allow ghost creatures to drop corpses."); - replace = "if("+MethodsBestiary.class.getName()+".isGhostCorpse(this)){" - + " $_ = false;" - + "}else{" - + " $_ = $proceed($$);" - + "}"; - Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "isGhost", replace); + if (WyvernMods.allowGhostCorpses) { + Util.setReason("Allow ghost creatures to drop corpses."); + replace = "if(" + Bestiary.class.getName() + ".isGhostCorpse(this)){" + + " $_ = false;" + + "}else{" + + " $_ = $proceed($$);" + + "}"; + Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "isGhost", replace); + } - Util.setReason("Attach special effects to creatures."); - CtClass ctVirtualZone = classPool.get("com.wurmonline.server.zones.VirtualZone"); - CtClass[] params4 = { - CtClass.longType, - CtClass.booleanType, - CtClass.longType, - CtClass.floatType, - CtClass.floatType, - CtClass.floatType - }; - String desc4 = Descriptor.ofMethod(CtClass.booleanType, params4); - replace = "$_ = $proceed($$);" + - MethodsBestiary.class.getName()+".addCreatureSpecialEffect(copyId != -10 ? copyId : creatureId, $0, creature);"; - Util.instrumentDescribed(thisClass, ctVirtualZone, "addCreature", desc4, "sendNewCreature", replace); + if (WyvernMods.useCustomCreatureSizes) { + Util.setReason("Enable custom sizes for creatures."); + replace = "{return " + Bestiary.class.getName() + ".getAdjustedSizeMod(this);}"; + Util.setBodyDeclared(thisClass, ctCreatureStatus, "getSizeMod", replace); + } - Util.setReason("Ensure unique creatures cannot be hitched to vehicles."); - CtClass ctVehicle = classPool.get("com.wurmonline.server.behaviours.Vehicle"); - replace = "if("+MethodsBestiary.class.getName()+".isNotHitchable($1)){" + - " return false;" + - "}"; - Util.insertBeforeDeclared(thisClass, ctVehicle, "addDragger", replace); + CtClass[] params2 = { + CtClass.intType, + CtClass.booleanType, + CtClass.floatType, + CtClass.floatType, + CtClass.floatType, + CtClass.intType, + classPool.get("java.lang.String"), + CtClass.byteType, + CtClass.byteType, + CtClass.byteType, + CtClass.booleanType, + CtClass.byteType, + CtClass.intType + }; + String desc2 = Descriptor.ofMethod(ctCreature, params2); + + if (WyvernMods.modifyNewCreatures) { + Util.setReason("Modify newly created creatures."); + replace = "$_ = $proceed($$);" + + Bestiary.class.getName() + ".modifyNewCreature($1);"; + Util.instrumentDescribed(thisClass, ctCreature, "doNew", desc2, "sendToWorld", replace); + } + + if (WyvernMods.useCustomCreatureSFX) { + Util.setReason("Attach special effects to creatures."); + CtClass[] params4 = { + CtClass.longType, + CtClass.booleanType, + CtClass.longType, + CtClass.floatType, + CtClass.floatType, + CtClass.floatType + }; + String desc4 = Descriptor.ofMethod(CtClass.booleanType, params4); + replace = "$_ = $proceed($$);" + + Bestiary.class.getName() + ".addCreatureSpecialEffect(copyId != -10 ? copyId : creatureId, $0, creature);"; + Util.instrumentDescribed(thisClass, ctVirtualZone, "addCreature", desc4, "sendNewCreature", replace); + } + + if (WyvernMods.preventLegendaryHitching) { + Util.setReason("Ensure unique creatures cannot be hitched to vehicles."); + replace = "if(" + Bestiary.class.getName() + ".isNotHitchable($1)){" + + " return false;" + + "}"; + Util.insertBeforeDeclared(thisClass, ctVehicle, "addDragger", replace); + } + + // 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[] params3 = { + CtClass.intType, + CtClass.booleanType, + CtClass.floatType, + CtClass.floatType, + CtClass.floatType, + CtClass.intType, + classPool.get("java.lang.String"), + CtClass.byteType, + CtClass.byteType, + CtClass.byteType, + CtClass.booleanType, + CtClass.byteType, + CtClass.intType + }; + String desc3 = Descriptor.ofMethod(ctCreature, params3); + + if (WyvernMods.logCreatureSpawns) { + 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", desc3, replace); + } } catch ( CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) { throw new HookException(e); diff --git a/src/main/java/mod/sin/wyvern/Bounty.java b/src/main/java/mod/sin/wyvern/Bounty.java index 2b5ab5a..2eae02f 100644 --- a/src/main/java/mod/sin/wyvern/Bounty.java +++ b/src/main/java/mod/sin/wyvern/Bounty.java @@ -17,7 +17,6 @@ import javassist.CtClass; import javassist.NotFoundException; import javassist.bytecode.Descriptor; import mod.sin.lib.Util; -import mod.sin.wyvern.bestiary.MethodsBestiary; import mod.sin.wyvern.bounty.LootBounty; import mod.sin.wyvern.bounty.PlayerBounty; @@ -95,9 +94,12 @@ public class Bounty { CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); - replace = PlayerBounty.class.getName()+".checkPlayerBounty(player, this);" - + "$_ = $proceed($$);"; - Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "checkCoinAward", replace); + if (WyvernMods.usePlayerBounty) { + Util.setReason("Hook for Player Bounty."); + replace = PlayerBounty.class.getName() + ".checkPlayerBounty(player, this);" + + "$_ = $proceed($$);"; + Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "checkCoinAward", replace); + } // Die method description CtClass ctString = classPool.get("java.lang.String"); @@ -113,60 +115,29 @@ public class Bounty { Util.instrumentDescribed(thisClass, ctCreature, "die", desc1, "setRotation", replace); // 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.intType, - CtClass.booleanType, - CtClass.floatType, - CtClass.floatType, - CtClass.floatType, - CtClass.intType, - classPool.get("java.lang.String"), - CtClass.byteType, - CtClass.byteType, - CtClass.byteType, - CtClass.booleanType, - CtClass.byteType, - CtClass.intType - }; - String desc2 = Descriptor.ofMethod(ctCreature, params2); - 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); - - // -- 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)){" - + " return "+MethodsBestiary.class.getName()+".getCreatureColorRed(this);" + replace = "if("+Bestiary.class.getName()+".checkColorTemplate(this)){" + + " return "+Bestiary.class.getName()+".getCreatureColorRed(this);" + "}"; Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorRed", replace); - replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){" - + " return "+MethodsBestiary.class.getName()+".getCreatureColorGreen(this);" + replace = "if("+Bestiary.class.getName()+".checkColorTemplate(this)){" + + " return "+Bestiary.class.getName()+".getCreatureColorGreen(this);" + "}"; Util.insertBeforeDeclared(thisClass, ctCreatureTemplate, "getColorGreen", replace); - replace = "if("+MethodsBestiary.class.getName()+".checkColorTemplate(this)){" - + " return "+MethodsBestiary.class.getName()+".getCreatureColorBlue(this);" + replace = "if("+Bestiary.class.getName()+".checkColorTemplate(this)){" + + " return "+Bestiary.class.getName()+".getCreatureColorBlue(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("getColorRed").insertBefore("if(mod.sin.wyvern.Bestiary.checkColorTemplate(this)){" + + " return mod.sin.wyvern.Bestiary.getCreatureColorRed(this);" + "}"); - ctCreatureTemplate.getDeclaredMethod("getColorGreen").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){" - + " return mod.sin.wyvern.bestiary.MethodsBestiary.getCreatureColorGreen(this);" + ctCreatureTemplate.getDeclaredMethod("getColorGreen").insertBefore("if(mod.sin.wyvern.Bestiary.checkColorTemplate(this)){" + + " return mod.sin.wyvern.Bestiary.getCreatureColorGreen(this);" + "}"); - ctCreatureTemplate.getDeclaredMethod("getColorBlue").insertBefore("if(mod.sin.wyvern.bestiary.MethodsBestiary.checkColorTemplate(this)){" - + " return mod.sin.wyvern.bestiary.MethodsBestiary.getCreatureColorBlue(this);" + ctCreatureTemplate.getDeclaredMethod("getColorBlue").insertBefore("if(mod.sin.wyvern.Bestiary.checkColorTemplate(this)){" + + " return mod.sin.wyvern.Bestiary.getCreatureColorBlue(this);" + "}");*/ // -- When a creature takes damage, track the damage taken -- // diff --git a/src/main/java/mod/sin/wyvern/ItemMod.java b/src/main/java/mod/sin/wyvern/ItemMod.java index 77ab7d7..b4e11fb 100644 --- a/src/main/java/mod/sin/wyvern/ItemMod.java +++ b/src/main/java/mod/sin/wyvern/ItemMod.java @@ -10,6 +10,7 @@ import java.util.logging.Logger; import com.wurmonline.server.Servers; import com.wurmonline.server.combat.ArmourTemplate; +import com.wurmonline.server.items.*; import mod.sin.items.caches.*; import org.gotti.wurmunlimited.modloader.ReflectionUtil; import org.gotti.wurmunlimited.modloader.classhooks.HookManager; @@ -19,11 +20,6 @@ import org.gotti.wurmunlimited.modsupport.actions.ModActions; import com.wurmonline.server.behaviours.ActionEntry; import com.wurmonline.server.combat.Weapon; import com.wurmonline.server.creatures.Creature; -import com.wurmonline.server.items.Item; -import com.wurmonline.server.items.ItemList; -import com.wurmonline.server.items.ItemTemplate; -import com.wurmonline.server.items.ItemTemplateFactory; -import com.wurmonline.server.items.NoSuchTemplateException; import javassist.CtClass; import javassist.bytecode.Descriptor; import mod.sin.actions.items.*; @@ -52,6 +48,7 @@ public class ItemMod { //public static TitaniumLump ELECTRUM_LUMP = new TitaniumLump(); public static EnchantOrb ENCHANT_ORB = new EnchantOrb(); public static EternalOrb ETERNAL_ORB = new EternalOrb(); + public static EternalReservoir ETERNAL_RESERVOIR = new EternalReservoir(); public static Eviscerator EVISCERATOR = new Eviscerator(); public static FriyanTablet FRIYAN_TABLET = new FriyanTablet(); public static HugeCrate HUGE_CRATE = new HugeCrate(); @@ -60,7 +57,6 @@ public class ItemMod { public static SealedMap SEALED_MAP = new SealedMap(); public static SkeletonDecoration SKELETON_DECORATION = new SkeletonDecoration(); public static Soul SOUL = new Soul(); - public static EternalReservoir SOUL_FORGE = new EternalReservoir(); public static StatuetteBreyk STATUETTE_BREYK = new StatuetteBreyk(); public static StatuetteCyberhusky STATUETTE_CYBERHUSKY = new StatuetteCyberhusky(); public static TreasureBox TREASURE_BOX = new TreasureBox(); @@ -117,6 +113,7 @@ public class ItemMod { DISINTEGRATION_ROD.createTemplate(); ENCHANT_ORB.createTemplate(); ETERNAL_ORB.createTemplate(); + ETERNAL_RESERVOIR.createTemplate(); EVISCERATOR.createTemplate(); FRIYAN_TABLET.createTemplate(); HUGE_CRATE.createTemplate(); @@ -125,7 +122,6 @@ public class ItemMod { SEALED_MAP.createTemplate(); SKELETON_DECORATION.createTemplate(); SOUL.createTemplate(); - SOUL_FORGE.createTemplate(); STATUETTE_BREYK.createTemplate(); STATUETTE_CYBERHUSKY.createTemplate(); TREASURE_BOX.createTemplate(); @@ -190,23 +186,44 @@ public class ItemMod { } public static void initCreationEntries(){ - logger.info("initCreationEntries()"); - ARROW_PACK_HUNTING.initCreationEntry(); - ARROW_PACK_WAR.initCreationEntry(); - BATTLE_YOYO.initCreationEntry(); - CLUB.initCreationEntry(); + if (WyvernMods.craftHuntingArrowPacks) { + ARROW_PACK_HUNTING.initCreationEntry(); + } + if (WyvernMods.craftWarArrowPacks) { + ARROW_PACK_WAR.initCreationEntry(); + } + if (WyvernMods.craftBattleYoyo) { + BATTLE_YOYO.initCreationEntry(); + } + if (WyvernMods.craftClub) { + CLUB.initCreationEntry(); + } //COIN_DECORATION.initCreationEntry(); //CORPSE_DECORATION.initCreationEntry(); - DEPTH_DRILL.initCreationEntry(); - EVISCERATOR.initCreationEntry(); - KNUCKLES.initCreationEntry(); - MASS_STORAGE_UNIT.initCreationEntry(); + if (WyvernMods.craftDepthDrill) { + DEPTH_DRILL.initCreationEntry(); + } + if (WyvernMods.craftEternalReservoir) { + ETERNAL_RESERVOIR.initCreationEntry(); + } + if (WyvernMods.craftEviscerator) { + EVISCERATOR.initCreationEntry(); + } + if (WyvernMods.craftKnuckles) { + KNUCKLES.initCreationEntry(); + } + if (WyvernMods.craftMassStorageUnit) { + MASS_STORAGE_UNIT.initCreationEntry(); + } //SKELETON_DECORATION.initCreationEntry(); - SOUL_FORGE.initCreationEntry(); - STATUETTE_BREYK.initCreationEntry(); - STATUETTE_CYBERHUSKY.initCreationEntry(); - WARHAMMER.initCreationEntry(); - WARHAMMER_HEAD.initCreationEntry(); + if (WyvernMods.craftStatuetteDeities) { + STATUETTE_BREYK.initCreationEntry(); + STATUETTE_CYBERHUSKY.initCreationEntry(); + } + if (WyvernMods.craftWarhammer) { + WARHAMMER.initCreationEntry(); + WARHAMMER_HEAD.initCreationEntry(); + } // Spectral set /*SPECTRAL_BOOT.initCreationEntry(); @@ -310,45 +327,66 @@ public class ItemMod { public static void modifyItems() throws NoSuchTemplateException, IllegalArgumentException, IllegalAccessException, ClassCastException, NoSuchFieldException{ // Make leather able to be combined. - ItemTemplate leather = ItemTemplateFactory.getInstance().getTemplate(ItemList.leather); - ReflectionUtil.setPrivateField(leather, ReflectionUtil.getField(leather.getClass(), "combine"), true); + if (WyvernMods.combineLeather) { + ItemTemplate leather = ItemTemplateFactory.getInstance().getTemplate(ItemList.leather); + ReflectionUtil.setPrivateField(leather, ReflectionUtil.getField(leather.getClass(), "combine"), true); + } // Make logs able to be combined. Also reduce their volume. ItemTemplate log = ItemTemplateFactory.getInstance().getTemplate(ItemList.log); - ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "combine"), true); - ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "centimetersZ"), 50); - int newVolume = log.getSizeX()*log.getSizeY()*log.getSizeZ(); - ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "volume"), newVolume); + if (WyvernMods.combineLogs) { + ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "combine"), true); + } + if (WyvernMods.reduceLogVolume) { + ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "centimetersZ"), 50); + int newVolume = log.getSizeX() * log.getSizeY() * log.getSizeZ(); + ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "volume"), newVolume); + } // Reduce kindling volume as well to make sure they're not larger than logs. - ItemTemplate kindling = ItemTemplateFactory.getInstance().getTemplate(ItemList.kindling); - ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "centimetersY"), 10); - ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "centimetersZ"), 10); - int newKindlingVolume = kindling.getSizeX()*kindling.getSizeY()*kindling.getSizeZ(); - ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "volume"), newKindlingVolume); + if (WyvernMods.reduceKindlingVolume) { + ItemTemplate kindling = ItemTemplateFactory.getInstance().getTemplate(ItemList.kindling); + ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "centimetersY"), 10); + ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "centimetersZ"), 10); + int newKindlingVolume = kindling.getSizeX() * kindling.getSizeY() * kindling.getSizeZ(); + ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "volume"), newKindlingVolume); + } // Allow sleep powder to be dropped. - ItemTemplate sleepPowder = ItemTemplateFactory.getInstance().getTemplate(ItemList.sleepPowder); - ReflectionUtil.setPrivateField(sleepPowder, ReflectionUtil.getField(sleepPowder.getClass(), "nodrop"), false); + if (WyvernMods.droppableSleepPowder) { + ItemTemplate sleepPowder = ItemTemplateFactory.getInstance().getTemplate(ItemList.sleepPowder); + ReflectionUtil.setPrivateField(sleepPowder, ReflectionUtil.getField(sleepPowder.getClass(), "nodrop"), false); + } - // Set silver mirror price to 10 silver instead of 1 iron. - ItemTemplate handMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.handMirror); - ReflectionUtil.setPrivateField(handMirror, ReflectionUtil.getField(handMirror.getClass(), "value"), 200000); - ItemTemplate goldMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.goldenMirror); - ReflectionUtil.setPrivateField(goldMirror, ReflectionUtil.getField(goldMirror.getClass(), "value"), 1000000); + // Set silver mirror price to 20 silver instead of 1 iron. + if (WyvernMods.setSilverMirrorPrice) { + ItemTemplate handMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.handMirror); + ReflectionUtil.setPrivateField(handMirror, ReflectionUtil.getField(handMirror.getClass(), "value"), 200000); + } + // Set golden mirror price to 1 gold instead of 1 iron. + if (WyvernMods.setGoldMirrorPrice) { + ItemTemplate goldMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.goldenMirror); + ReflectionUtil.setPrivateField(goldMirror, ReflectionUtil.getField(goldMirror.getClass(), "value"), 1000000); + } // Creature crates to 10 silver. - ItemTemplate creatureCage = ItemTemplateFactory.getInstance().getTemplate(ItemList.creatureCrate); - ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "value"), 100000); - ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "fullprice"), true); + if (WyvernMods.setCreatureCratePrice) { + ItemTemplate creatureCage = ItemTemplateFactory.getInstance().getTemplate(ItemList.creatureCrate); + ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "value"), 100000); + ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "fullprice"), true); + } // Resurrection Stones to 2 silver instead of 5 silver. - ItemTemplate resurrectionStone = ItemTemplateFactory.getInstance().getTemplate(ItemList.resurrectionStone); - ReflectionUtil.setPrivateField(resurrectionStone, ReflectionUtil.getField(resurrectionStone.getClass(), "value"), 20000); + if (WyvernMods.setResurrectionStonePrice) { + ItemTemplate resurrectionStone = ItemTemplateFactory.getInstance().getTemplate(ItemList.resurrectionStone); + ReflectionUtil.setPrivateField(resurrectionStone, ReflectionUtil.getField(resurrectionStone.getClass(), "value"), 20000); + } // Shaker Orbs to 2 silver instead of 5 silver. - ItemTemplate shakerOrb = ItemTemplateFactory.getInstance().getTemplate(ItemList.shakerOrb); - ReflectionUtil.setPrivateField(shakerOrb, ReflectionUtil.getField(shakerOrb.getClass(), "value"), 20000); + if (WyvernMods.setShakerOrbPrice) { + ItemTemplate shakerOrb = ItemTemplateFactory.getInstance().getTemplate(ItemList.shakerOrb); + ReflectionUtil.setPrivateField(shakerOrb, ReflectionUtil.getField(shakerOrb.getClass(), "value"), 20000); + } // Set transmutation rod to 2 gold instead of 50 silver. //ItemTemplate transmutationRod = ItemTemplateFactory.getInstance().getTemplate(668); @@ -356,7 +394,7 @@ public class ItemMod { // " return this.isTransportable || (this.getTemplateId() >= 510 && this.getTemplateId() <= 513) || this.getTemplateId() == 722 || this.getTemplateId() == 670;" // Make mailboxes loadable (PvE Only) - if(!Servers.localServer.PVPSERVER) { + if(WyvernMods.loadableMailbox && !Servers.localServer.PVPSERVER) { ItemTemplate mailboxWood = ItemTemplateFactory.getInstance().getTemplate(ItemList.mailboxWood); ReflectionUtil.setPrivateField(mailboxWood, ReflectionUtil.getField(mailboxWood.getClass(), "isTransportable"), true); ItemTemplate mailboxStone = ItemTemplateFactory.getInstance().getTemplate(ItemList.mailboxStone); @@ -368,79 +406,118 @@ public class ItemMod { } // Make bell towers and trash bins loadable - ItemTemplate bellTower = ItemTemplateFactory.getInstance().getTemplate(ItemList.bellTower); - ReflectionUtil.setPrivateField(bellTower, ReflectionUtil.getField(bellTower.getClass(), "isTransportable"), true); - ItemTemplate trashBin = ItemTemplateFactory.getInstance().getTemplate(ItemList.trashBin); - ReflectionUtil.setPrivateField(trashBin, ReflectionUtil.getField(trashBin.getClass(), "isTransportable"), true); + if (WyvernMods.loadableBellTower) { + ItemTemplate bellTower = ItemTemplateFactory.getInstance().getTemplate(ItemList.bellTower); + ReflectionUtil.setPrivateField(bellTower, ReflectionUtil.getField(bellTower.getClass(), "isTransportable"), true); + } + if (WyvernMods.loadableTrashBin) { + ItemTemplate trashBin = ItemTemplateFactory.getInstance().getTemplate(ItemList.trashBin); + ReflectionUtil.setPrivateField(trashBin, ReflectionUtil.getField(trashBin.getClass(), "isTransportable"), true); + } // Make altars loadable - ItemTemplate stoneAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarStone); - ReflectionUtil.setPrivateField(stoneAltar, ReflectionUtil.getField(stoneAltar.getClass(), "isTransportable"), true); - ItemTemplate woodAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarWood); - ReflectionUtil.setPrivateField(woodAltar, ReflectionUtil.getField(woodAltar.getClass(), "isTransportable"), true); - ItemTemplate silverAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarSilver); - ReflectionUtil.setPrivateField(silverAltar, ReflectionUtil.getField(silverAltar.getClass(), "isTransportable"), true); - ItemTemplate goldAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarGold); - ReflectionUtil.setPrivateField(goldAltar, ReflectionUtil.getField(goldAltar.getClass(), "isTransportable"), true); + if (WyvernMods.loadableAltars) { + ItemTemplate stoneAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarStone); + ReflectionUtil.setPrivateField(stoneAltar, ReflectionUtil.getField(stoneAltar.getClass(), "isTransportable"), true); + ItemTemplate woodAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarWood); + ReflectionUtil.setPrivateField(woodAltar, ReflectionUtil.getField(woodAltar.getClass(), "isTransportable"), true); + ItemTemplate silverAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarSilver); + ReflectionUtil.setPrivateField(silverAltar, ReflectionUtil.getField(silverAltar.getClass(), "isTransportable"), true); + ItemTemplate goldAltar = ItemTemplateFactory.getInstance().getTemplate(ItemList.altarGold); + ReflectionUtil.setPrivateField(goldAltar, ReflectionUtil.getField(goldAltar.getClass(), "isTransportable"), true); + } // Make long spears one-handed. - ItemTemplate longSpear = ItemTemplateFactory.getInstance().getTemplate(ItemList.spearLong); - ReflectionUtil.setPrivateField(longSpear, ReflectionUtil.getField(longSpear.getClass(), "isTwohanded"), false); + if (WyvernMods.oneHandedLongSpear) { + ItemTemplate longSpear = ItemTemplateFactory.getInstance().getTemplate(ItemList.spearLong); + ReflectionUtil.setPrivateField(longSpear, ReflectionUtil.getField(longSpear.getClass(), "isTwohanded"), false); + } // Make dirt/sand difficulty easier - ItemTemplate dirt = ItemTemplateFactory.getInstance().getTemplate(ItemList.dirtPile); - ReflectionUtil.setPrivateField(dirt, ReflectionUtil.getField(dirt.getClass(), "difficulty"), 50.0f); + if (WyvernMods.reduceDirtDifficulty) { + ItemTemplate dirt = ItemTemplateFactory.getInstance().getTemplate(ItemList.dirtPile); + ReflectionUtil.setPrivateField(dirt, ReflectionUtil.getField(dirt.getClass(), "difficulty"), 50.0f); + } - ItemTemplate sand = ItemTemplateFactory.getInstance().getTemplate(ItemList.sand); - ReflectionUtil.setPrivateField(sand, ReflectionUtil.getField(sand.getClass(), "difficulty"), 50.0f); + if (WyvernMods.reduceSandDifficulty) { + ItemTemplate sand = ItemTemplateFactory.getInstance().getTemplate(ItemList.sand); + ReflectionUtil.setPrivateField(sand, ReflectionUtil.getField(sand.getClass(), "difficulty"), 50.0f); + } - ItemTemplate sandstone = ItemTemplateFactory.getInstance().getTemplate(ItemList.sandstone); - ReflectionUtil.setPrivateField(sandstone, ReflectionUtil.getField(sandstone.getClass(), "difficulty"), 50.0f); + if (WyvernMods.reduceSandstoneDifficulty) { + ItemTemplate sandstone = ItemTemplateFactory.getInstance().getTemplate(ItemList.sandstone); + ReflectionUtil.setPrivateField(sandstone, ReflectionUtil.getField(sandstone.getClass(), "difficulty"), 50.0f); + } // Make some useless items decorations for added interior design. - ItemTemplate stoneKeystone = ItemTemplateFactory.getInstance().getTemplate(ItemList.stoneKeystone); - ReflectionUtil.setPrivateField(stoneKeystone, ReflectionUtil.getField(stoneKeystone.getClass(), "decoration"), true); - ItemTemplate marbleKeystone = ItemTemplateFactory.getInstance().getTemplate(ItemList.marbleKeystone); - ReflectionUtil.setPrivateField(marbleKeystone, ReflectionUtil.getField(marbleKeystone.getClass(), "decoration"), true); - ItemTemplate skull = ItemTemplateFactory.getInstance().getTemplate(ItemList.skull); - ReflectionUtil.setPrivateField(skull, ReflectionUtil.getField(skull.getClass(), "decoration"), true); + if (WyvernMods.decorationStoneKeystone) { + ItemTemplate stoneKeystone = ItemTemplateFactory.getInstance().getTemplate(ItemList.stoneKeystone); + ReflectionUtil.setPrivateField(stoneKeystone, ReflectionUtil.getField(stoneKeystone.getClass(), "decoration"), true); + } + if (WyvernMods.decorationMarbleKeystone) { + ItemTemplate marbleKeystone = ItemTemplateFactory.getInstance().getTemplate(ItemList.marbleKeystone); + ReflectionUtil.setPrivateField(marbleKeystone, ReflectionUtil.getField(marbleKeystone.getClass(), "decoration"), true); + } + if (WyvernMods.decorationSkull) { + ItemTemplate skull = ItemTemplateFactory.getInstance().getTemplate(ItemList.skull); + ReflectionUtil.setPrivateField(skull, ReflectionUtil.getField(skull.getClass(), "decoration"), true); + } // Modify fragment counts - setFragments(ArmourCache.templateId, 18); - setFragments(ArtifactCache.templateId, 33); - setFragments(CrystalCache.templateId, 11); - setFragments(DragonCache.templateId, 19); - setFragments(GemCache.templateId, 7); - setFragments(MoonCache.templateId, 14); - setFragments(PotionCache.templateId, 18); - setFragments(RiftCache.templateId, 24); - setFragments(TitanCache.templateId, 100); - setFragments(ToolCache.templateId, 27); - setFragments(TreasureMapCache.templateId, 38); + if (WyvernMods.useCustomCacheFragments) { + setFragments(ArmourCache.templateId, 18); + setFragments(ArtifactCache.templateId, 33); + setFragments(CrystalCache.templateId, 11); + setFragments(DragonCache.templateId, 19); + setFragments(GemCache.templateId, 7); + setFragments(MoonCache.templateId, 14); + setFragments(PotionCache.templateId, 18); + setFragments(RiftCache.templateId, 24); + setFragments(TitanCache.templateId, 100); + setFragments(ToolCache.templateId, 27); + setFragments(TreasureMapCache.templateId, 38); - setFragments(AffinityOrb.templateId, 20); + setFragments(AffinityOrb.templateId, 20); + } - // Tier 4 - setFragments(ItemList.statueWorg, 40); - setFragments(ItemList.statueEagle, 40); + if (WyvernMods.adjustStatueFragmentCount) { + // Tier 4 + setFragments(ItemList.statueWorg, 40); + setFragments(ItemList.statueEagle, 40); - // Tier 5 - setFragments(ItemList.statueHellHorse, 45); - setFragments(ItemList.statueDrake, 45); + // Tier 5 + setFragments(ItemList.statueHellHorse, 45); + setFragments(ItemList.statueDrake, 45); - // Tier 6 - setFragments(ItemList.statueFo, 50); - setFragments(ItemList.statueMagranon, 50); - setFragments(ItemList.statueLibila, 50); - setFragments(ItemList.statueVynora, 50); - - createCustomWeapons(); - createCustomArmours(); + // Tier 6 + setFragments(ItemList.statueFo, 50); + setFragments(ItemList.statueMagranon, 50); + setFragments(ItemList.statueLibila, 50); + setFragments(ItemList.statueVynora, 50); + } + + if (WyvernMods.enableCustomItemCreation) { + createCustomWeapons(); + createCustomArmours(); + } // Make huge crates larger //ItemTemplate hugeCrate = ItemTemplateFactory.getInstance().getTemplate(HUGE_CRATE.getTemplateId()); //ReflectionUtil.setPrivateField(hugeCrate, ReflectionUtil.getField(hugeCrate.getClass(), "combine"), true); } + + public static void onServerStarted(){ + if (WyvernMods.removeLockpickSkillRequirement) { + CreationEntry lockpicks = CreationMatrix.getInstance().getCreationEntry(ItemList.lockpick); + try { + ReflectionUtil.setPrivateField(lockpicks, ReflectionUtil.getField(lockpicks.getClass(), "hasMinimumSkillRequirement"), false); + ReflectionUtil.setPrivateField(lockpicks, ReflectionUtil.getField(lockpicks.getClass(), "minimumSkill"), 0.0); + } catch (IllegalAccessException | NoSuchFieldException e) { + logger.info("Failed to set lockpick creation entry changes!"); + e.printStackTrace(); + } + } + } public static void registerPermissionsHook(){ try { diff --git a/src/main/java/mod/sin/wyvern/Mastercraft.java b/src/main/java/mod/sin/wyvern/Mastercraft.java index 77b2486..ac551f7 100644 --- a/src/main/java/mod/sin/wyvern/Mastercraft.java +++ b/src/main/java/mod/sin/wyvern/Mastercraft.java @@ -67,17 +67,6 @@ public class Mastercraft { return mult; } - public static void changeExistingTitles(){ - for (Titles.Title title : Titles.Title.values()) { - if (Objects.equals("Pumpkin King", title.getFemaleName())){ - try { - ReflectionUtil.setPrivateField(title, ReflectionUtil.getField(title.getClass(), "femaleName"), "Pumpkin Queen"); - } catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) { - e.printStackTrace(); - } - } - } - } public static void preInit(){ try { ClassPool classPool = HookManager.getInstance().getClassPool(); diff --git a/src/main/java/mod/sin/wyvern/MiscChanges.java b/src/main/java/mod/sin/wyvern/MiscChanges.java index 65f9a76..6fd5b96 100644 --- a/src/main/java/mod/sin/wyvern/MiscChanges.java +++ b/src/main/java/mod/sin/wyvern/MiscChanges.java @@ -28,6 +28,7 @@ import javassist.expr.ExprEditor; import javassist.expr.FieldAccess; import javassist.expr.MethodCall; import mod.sin.lib.Util; +import org.gotti.wurmunlimited.modloader.ReflectionUtil; import org.gotti.wurmunlimited.modloader.classhooks.HookException; import org.gotti.wurmunlimited.modloader.classhooks.HookManager; import org.gotti.wurmunlimited.modsupport.ModSupportDb; @@ -326,6 +327,18 @@ public class MiscChanges { return true; } + public static void changeExistingTitles(){ + for (Titles.Title title : Titles.Title.values()) { + if (Objects.equals("Pumpkin King", title.getFemaleName())){ + try { + ReflectionUtil.setPrivateField(title, ReflectionUtil.getField(title.getClass(), "femaleName"), "Pumpkin Queen"); + } catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) { + e.printStackTrace(); + } + } + } + } + public static void preInit(){ try{ ClassPool classPool = HookManager.getInstance().getClassPool(); diff --git a/src/main/java/mod/sin/wyvern/WyvernMods.java b/src/main/java/mod/sin/wyvern/WyvernMods.java index 924ba91..a074bb3 100644 --- a/src/main/java/mod/sin/wyvern/WyvernMods.java +++ b/src/main/java/mod/sin/wyvern/WyvernMods.java @@ -3,7 +3,8 @@ package mod.sin.wyvern; import com.wurmonline.server.Message; import com.wurmonline.server.TimeConstants; import com.wurmonline.server.creatures.Creature; -import com.wurmonline.server.items.*; +import com.wurmonline.server.items.Item; +import com.wurmonline.server.items.NoSuchTemplateException; import com.wurmonline.server.players.Player; import javassist.CannotCompileException; import javassist.ClassPool; @@ -18,8 +19,6 @@ import mod.sin.creatures.titans.*; import mod.sin.lib.Prop; import mod.sin.lib.SkillAssist; import mod.sin.lib.Util; -import mod.sin.wyvern.bestiary.MethodsBestiary; -import org.gotti.wurmunlimited.modloader.ReflectionUtil; import org.gotti.wurmunlimited.modloader.classhooks.HookException; import org.gotti.wurmunlimited.modloader.classhooks.HookManager; import org.gotti.wurmunlimited.modloader.interfaces.*; @@ -95,6 +94,8 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea public static boolean disableSmeltingPots = true; public static boolean hideSorceryBuffBar = true; public static boolean sqlAchievementFix = true; + public static boolean changePumpkinKingTitle = true; + public static boolean changeDeityPassives = true; // Arena Module Configuration public static boolean enableArenaModule = true; @@ -265,6 +266,99 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea public static long captureMessageInterval = TimeConstants.MINUTE_MILLIS*3L; public static long depotRespawnTime = TimeConstants.HOUR_MILLIS*11L; + // Bestiary Module Configuration + public static boolean enableBestiaryModule = true; + public static boolean fixSacrificingStrongCreatures = true; + public static boolean disableAfkTraining = true; + public static boolean fixChargersWalkingThroughWalls = true; + public static boolean conditionWildCreatures = true; + public static boolean allowGhostArchery = true; + public static boolean disableArcheryOnStrongCreatures = true; + public static boolean genesisEnchantedGrassNewborns = true; + public static boolean useCustomCorpseSizes = true; + public static boolean allowCustomCreatureBreedNames = true; + public static boolean allowGhostBreeding = true; + public static boolean allowGhostCorpses = true; + public static boolean useCustomCreatureSizes = true; + public static boolean useCustomCreatureSFX = true; + public static boolean preventLegendaryHitching = true; + public static boolean modifyNewCreatures = true; + public static boolean logCreatureSpawns = true; + public static boolean allowEpicCreatureNaturalSpawns = true; + public static boolean enableCustomCreatures = true; + public static boolean enableWyverns = true; + public static boolean enableFlavorMobs = true; + public static boolean enableEventMobs = true; + public static boolean enableRareSpawns = true; + public static boolean enableCustomLegendaries = true; + public static boolean enableTitans = true; + + // Bounty Module Configuration + public static boolean enableBountyModule = true; + public static boolean usePlayerBounty = true; + public static boolean useLootTable = true; + + // Item Module Configuration + public static boolean enableItemModule = true; + public static boolean combineLeather = true; + public static boolean combineLogs = true; + public static boolean reduceLogVolume = true; + public static boolean reduceKindlingVolume = true; + public static boolean droppableSleepPowder = true; + public static boolean setSilverMirrorPrice = true; + public static boolean setGoldMirrorPrice = true; + public static boolean setCreatureCratePrice = true; + public static boolean setResurrectionStonePrice = true; + public static boolean setShakerOrbPrice = true; + public static boolean loadableMailbox = true; + public static boolean loadableBellTower = true; + public static boolean loadableTrashBin = true; + public static boolean loadableAltars = true; + public static boolean oneHandedLongSpear = true; + public static boolean reduceDirtDifficulty = true; + public static boolean reduceSandDifficulty = true; + public static boolean reduceSandstoneDifficulty = true; + public static boolean decorationStoneKeystone = true; + public static boolean decorationMarbleKeystone = true; + public static boolean decorationSkull = true; + public static boolean useCustomCacheFragments = true; + public static boolean adjustStatueFragmentCount = true; + public static boolean removeLockpickSkillRequirement = true; + public static boolean createCustomItemTemplates = true; + public static boolean enableCustomItemCreation = true; + public static boolean craftHuntingArrowPacks = true; + public static boolean craftWarArrowPacks = true; + public static boolean craftBattleYoyo = true; + public static boolean craftClub = true; + public static boolean craftDepthDrill = true; + public static boolean craftEternalReservoir = true; + public static boolean craftEviscerator = true; + public static boolean craftKnuckles = true; + public static boolean craftMassStorageUnit = true; + public static boolean craftStatuetteDeities = true; + public static boolean craftWarhammer = true; + + // Soulstealing Module Configuration + public static boolean enableSoulstealingModule = true; + public static long pollEternalReservoirTime = TimeConstants.MINUTE_MILLIS*10; + + // Action Module Configuration + public static boolean enableActionModule = true; + public static boolean actionUnequipAll = true; + public static boolean actionReceiveAllMail = true; + public static boolean actionSplitSorcery = true; + public static boolean actionLeaderboard = true; + public static boolean actionSorceryFragmentCombine = true; + public static boolean actionArenaTeleports = true; + public static boolean actionAddMissionDev = true; + public static boolean actionRemoveMissionDev = true; + public static boolean actionCreatureReportDev = true; + public static boolean actionSmoothTerrainDev = true; + + // Erosion Module Configuration + public static boolean enableErosionModule = true; + public static long pollTerrainSmoothTime = TimeConstants.SECOND_MILLIS*5; + // Treasure Chest Loot Module Configuration public static boolean enableTreasureChestLootModule = true; @@ -385,6 +479,8 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea disableSmeltingPots = Prop.getBooleanProperty("disableSmeltingPots", disableSmeltingPots); hideSorceryBuffBar = Prop.getBooleanProperty("hideSorceryBuffBar", hideSorceryBuffBar); sqlAchievementFix = Prop.getBooleanProperty("sqlAchievementFix", sqlAchievementFix); + changePumpkinKingTitle = Prop.getBooleanProperty("changePumpkinKingTitle", changePumpkinKingTitle); + changeDeityPassives = Prop.getBooleanProperty("changeDeityPassives", changeDeityPassives); // Arena Module enableArenaModule = Prop.getBooleanProperty("enableArenaModule", enableArenaModule); @@ -550,6 +646,98 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea captureMessageInterval = Prop.getLongProperty("captureMessageInterval", captureMessageInterval); depotRespawnTime = Prop.getLongProperty("depotRespawnTime", depotRespawnTime); + // Bestiary Module + enableBestiaryModule = Prop.getBooleanProperty("enableBestiaryModule", enableBestiaryModule); + fixSacrificingStrongCreatures = Prop.getBooleanProperty("fixSacrificingStrongCreatures", fixSacrificingStrongCreatures); + disableAfkTraining = Prop.getBooleanProperty("disableAfkTraining", disableAfkTraining); + fixChargersWalkingThroughWalls = Prop.getBooleanProperty("fixChargersWalkingThroughWalls", fixChargersWalkingThroughWalls); + conditionWildCreatures = Prop.getBooleanProperty("conditionWildCreatures", conditionWildCreatures); + allowGhostArchery = Prop.getBooleanProperty("allowGhostArchery", allowGhostArchery); + disableArcheryOnStrongCreatures = Prop.getBooleanProperty("disableArcheryOnStrongCreatures", disableArcheryOnStrongCreatures); + genesisEnchantedGrassNewborns = Prop.getBooleanProperty("genesisEnchantedGrassNewborns", genesisEnchantedGrassNewborns); + useCustomCorpseSizes = Prop.getBooleanProperty("useCustomCorpseSizes", useCustomCorpseSizes); + allowCustomCreatureBreedNames = Prop.getBooleanProperty("allowCustomCreatureBreedNames", allowCustomCreatureBreedNames); + allowGhostBreeding = Prop.getBooleanProperty("allowGhostBreeding", allowGhostBreeding); + useCustomCreatureSizes = Prop.getBooleanProperty("useCustomCreatureSizes", useCustomCreatureSizes); + useCustomCreatureSFX = Prop.getBooleanProperty("useCustomCreatureSFX", useCustomCreatureSFX); + preventLegendaryHitching = Prop.getBooleanProperty("preventLegendaryHitching", preventLegendaryHitching); + modifyNewCreatures = Prop.getBooleanProperty("modifyNewCreatures", modifyNewCreatures); + logCreatureSpawns = Prop.getBooleanProperty("logCreatureSpawns", logCreatureSpawns); + allowEpicCreatureNaturalSpawns = Prop.getBooleanProperty("allowEpicCreatureNaturalSpawns", allowEpicCreatureNaturalSpawns); + enableCustomCreatures = Prop.getBooleanProperty("enableCustomCreatures", enableCustomCreatures); + enableWyverns = Prop.getBooleanProperty("enableWyverns", enableWyverns); + enableFlavorMobs = Prop.getBooleanProperty("enableFlavorMobs", enableFlavorMobs); + enableEventMobs = Prop.getBooleanProperty("enableEventMobs", enableEventMobs); + enableRareSpawns = Prop.getBooleanProperty("enableRareSpawns", enableRareSpawns); + enableCustomLegendaries = Prop.getBooleanProperty("enableCustomLegendaries", enableCustomLegendaries); + enableTitans = Prop.getBooleanProperty("enableTitans", enableTitans); + + // Bounty Module + enableBountyModule = Prop.getBooleanProperty("enableBountyModule", enableBountyModule); + usePlayerBounty = Prop.getBooleanProperty("usePlayerBounty", usePlayerBounty); + useLootTable = Prop.getBooleanProperty("useLootTable", useLootTable); + + // Item Module + enableItemModule = Prop.getBooleanProperty("enableItemModule", enableItemModule); + combineLeather = Prop.getBooleanProperty("combineLeather", combineLeather); + combineLogs = Prop.getBooleanProperty("combineLogs", combineLogs); + reduceLogVolume = Prop.getBooleanProperty("reduceLogVolume", reduceLogVolume); + reduceKindlingVolume = Prop.getBooleanProperty("reduceKindlingVolume", reduceKindlingVolume); + droppableSleepPowder = Prop.getBooleanProperty("droppableSleepPowder", droppableSleepPowder); + setSilverMirrorPrice = Prop.getBooleanProperty("setSilverMirrorPrice", setSilverMirrorPrice); + setGoldMirrorPrice = Prop.getBooleanProperty("setGoldMirrorPrice", setGoldMirrorPrice); + setCreatureCratePrice = Prop.getBooleanProperty("setCreatureCratePrice", setCreatureCratePrice); + setResurrectionStonePrice = Prop.getBooleanProperty("setResurrectionStonePrice", setResurrectionStonePrice); + setShakerOrbPrice = Prop.getBooleanProperty("setShakerOrbPrice", setShakerOrbPrice); + loadableMailbox = Prop.getBooleanProperty("loadableMailbox", loadableMailbox); + loadableBellTower = Prop.getBooleanProperty("loadableBellTower", loadableBellTower); + loadableTrashBin = Prop.getBooleanProperty("loadableTrashBin", loadableTrashBin); + loadableAltars = Prop.getBooleanProperty("loadableAltars", loadableAltars); + oneHandedLongSpear = Prop.getBooleanProperty("oneHandedLongSpear", oneHandedLongSpear); + reduceDirtDifficulty = Prop.getBooleanProperty("reduceDirtDifficulty", reduceDirtDifficulty); + reduceSandDifficulty = Prop.getBooleanProperty("reduceSandDifficulty", reduceSandDifficulty); + reduceSandstoneDifficulty = Prop.getBooleanProperty("reduceSandstoneDifficulty", reduceSandstoneDifficulty); + decorationStoneKeystone = Prop.getBooleanProperty("decorationStoneKeystone", decorationStoneKeystone); + decorationMarbleKeystone = Prop.getBooleanProperty("decorationMarbleKeystone", decorationMarbleKeystone); + decorationSkull = Prop.getBooleanProperty("decorationSkull", decorationSkull); + useCustomCacheFragments = Prop.getBooleanProperty("useCustomCacheFragments", useCustomCacheFragments); + adjustStatueFragmentCount = Prop.getBooleanProperty("adjustStatueFragmentCount", adjustStatueFragmentCount); + removeLockpickSkillRequirement = Prop.getBooleanProperty("removeLockpickSkillRequirement", removeLockpickSkillRequirement); + createCustomItemTemplates = Prop.getBooleanProperty("createCustomItemTemplates", createCustomItemTemplates); + enableCustomItemCreation = Prop.getBooleanProperty("enableCustomItemCreation", enableCustomItemCreation); + craftHuntingArrowPacks = Prop.getBooleanProperty("craftHuntingArrowPacks", craftHuntingArrowPacks); + craftWarArrowPacks = Prop.getBooleanProperty("craftWarArrowPacks", craftWarArrowPacks); + craftBattleYoyo = Prop.getBooleanProperty("craftBattleYoyo", craftBattleYoyo); + craftClub = Prop.getBooleanProperty("craftClub", craftClub); + craftDepthDrill = Prop.getBooleanProperty("craftDepthDrill", craftDepthDrill); + craftEternalReservoir = Prop.getBooleanProperty("craftEternalReservoir", craftEternalReservoir); + craftEviscerator = Prop.getBooleanProperty("craftEviscerator", craftEviscerator); + craftKnuckles = Prop.getBooleanProperty("craftKnuckles", craftKnuckles); + craftMassStorageUnit = Prop.getBooleanProperty("craftMassStorageUnit", craftMassStorageUnit); + craftStatuetteDeities = Prop.getBooleanProperty("craftStatuetteDeities", craftStatuetteDeities); + craftWarhammer = Prop.getBooleanProperty("craftWarhammer", craftWarhammer); + + // Soulstealing Module + enableSoulstealingModule = Prop.getBooleanProperty("enableSoulstealingModule", enableSoulstealingModule); + pollEternalReservoirTime = Prop.getLongProperty("pollEternalReservoirTime", pollEternalReservoirTime); + + // Action Module + enableActionModule = Prop.getBooleanProperty("enableActionModule", enableActionModule); + actionUnequipAll = Prop.getBooleanProperty("actionUnequipAll", actionUnequipAll); + actionReceiveAllMail = Prop.getBooleanProperty("actionReceiveAllMail", actionReceiveAllMail); + actionSplitSorcery = Prop.getBooleanProperty("actionSplitSorcery", actionSplitSorcery); + actionLeaderboard = Prop.getBooleanProperty("actionLeaderboard", actionLeaderboard); + actionSorceryFragmentCombine = Prop.getBooleanProperty("actionSorceryFragmentCombine", actionSorceryFragmentCombine); + actionArenaTeleports = Prop.getBooleanProperty("actionArenaTeleports", actionArenaTeleports); + actionAddMissionDev = Prop.getBooleanProperty("actionAddMissionDev", actionAddMissionDev); + actionRemoveMissionDev = Prop.getBooleanProperty("actionRemoveMissionDev", actionRemoveMissionDev); + actionCreatureReportDev = Prop.getBooleanProperty("actionCreatureReportDev", actionCreatureReportDev); + actionSmoothTerrainDev = Prop.getBooleanProperty("actionSmoothTerrainDev", actionSmoothTerrainDev); + + // Erosion Module + enableErosionModule = Prop.getBooleanProperty("enableErosionModule", enableErosionModule); + pollTerrainSmoothTime = Prop.getLongProperty("pollTerrainSmoothTime", pollTerrainSmoothTime); + // Treasure Chest Loot Module enableTreasureChestLootModule = Prop.getBooleanProperty("enableTreasureChestLootModule", enableTreasureChestLootModule); @@ -716,6 +904,8 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea logger.info("Disable Smelting Pots: " + disableSmeltingPots); logger.info("Hide Sorcery Buff Bar: " + hideSorceryBuffBar); logger.info("SQL Achievement Fix: " + sqlAchievementFix); + logger.info("Change Pumpkin King Title: "+changePumpkinKingTitle); + logger.info("Change Deity Passives: "+changeDeityPassives); } logger.info("Arena Module: "+enableArenaModule); @@ -929,6 +1119,109 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea logger.info("Depot Respawn Timer: "+depotRespawnTime); } + logger.info("Bestiary Module: "+enableBestiaryModule); + if (enableBestiaryModule){ + logger.info("Fix Sacrificing Strong Creatures: "+fixSacrificingStrongCreatures); + logger.info("Disable AFK Training: "+disableAfkTraining); + logger.info("Fix Chargers Walking Through Walls: "+fixChargersWalkingThroughWalls); + logger.info("Condition Wild Creatures: "+conditionWildCreatures); + logger.info("Allow Ghost Archery: "+allowGhostArchery); + logger.info("Disable Archery On Strong Creatures: "+disableArcheryOnStrongCreatures); + logger.info("Genesis Enchanted Grass Newborns: "+genesisEnchantedGrassNewborns); + logger.info("Use Custom Corpse Sizes: "+useCustomCorpseSizes); + logger.info("Allow Custom Creature Breed Names: "+allowCustomCreatureBreedNames); + logger.info("Allow Ghost Breeding: "+allowGhostBreeding); + logger.info("Allow Ghost Corpses: "+allowGhostCorpses); + logger.info("Use Custom Creature Sizes: "+useCustomCreatureSizes); + logger.info("Use Custom Creature SFX: "+useCustomCreatureSFX); + logger.info("Prevent Legendary Hitching: "+preventLegendaryHitching); + logger.info("Modify New Creatures: "+modifyNewCreatures); + logger.info("Log Creature Spawns: "+logCreatureSpawns); + logger.info("Enable Epic Creature Natural Spawns: "+allowEpicCreatureNaturalSpawns); + logger.info("Custom Creatures: "+enableCustomCreatures); + if (enableCustomCreatures){ + logger.info("Enable Wyverns: "+enableWyverns); + logger.info("Enable Flavor Mobs: "+enableFlavorMobs); + logger.info("Enable Event Mobs: "+enableEventMobs); + logger.info("Enable Rare Spawn Mobs: "+enableRareSpawns); + logger.info("Enable Custom Legendaries: "+enableCustomLegendaries); + logger.info("Enable Titans: "+enableTitans); + } + } + + logger.info("Bounty Module: "+enableBountyModule); + if (enableBountyModule){ + logger.info("Use Player Bounty: "+usePlayerBounty); + logger.info("Use Loot Table: "+useLootTable); + } + + logger.info("Item Module: "+enableItemModule); + if (enableItemModule){ + logger.info("Combine Leather: "+combineLeather); + logger.info("Combine Logs: "+combineLogs); + logger.info("Reduce Log Volume: "+reduceLogVolume); + logger.info("Reduce Kindling Volume: "+reduceKindlingVolume); + logger.info("Droppable Sleep Powder: "+droppableSleepPowder); + logger.info("Set Silver Mirror Price: "+setSilverMirrorPrice); + logger.info("Set Gold Mirror Price: "+setGoldMirrorPrice); + logger.info("Set Creature Crate Price: "+setCreatureCratePrice); + logger.info("Set Resurrection Stone Price: "+setResurrectionStonePrice); + logger.info("Set Shaker Orb Price: "+setShakerOrbPrice); + logger.info("Loadable Mailbox: "+loadableMailbox); + logger.info("Loadable Bell Tower: "+loadableBellTower); + logger.info("Loadable Trash Bin: "+loadableTrashBin); + logger.info("Loadable Altars: "+loadableAltars); + logger.info("One Handed Long Spear: "+oneHandedLongSpear); + logger.info("Reduce Dirt Difficulty: "+reduceDirtDifficulty); + logger.info("Reduce Sand Difficulty: "+reduceSandDifficulty); + logger.info("Reduce Sandstone Difficulty: "+reduceSandstoneDifficulty); + logger.info("Decoration Stone Keystone: "+decorationStoneKeystone); + logger.info("Decoration Marble Keystone: "+decorationMarbleKeystone); + logger.info("Decoration Skull: "+decorationSkull); + logger.info("Use Custom Cache Fragments: "+useCustomCacheFragments); + logger.info("Adjust Statue Fragment Count: "+adjustStatueFragmentCount); + logger.info("Remove Lockpick Skill Requirement: "+removeLockpickSkillRequirement); + logger.info("Create Custom Item Templates: "+createCustomItemTemplates); + logger.info("Custom Item Creation: "+enableCustomItemCreation); + if (enableCustomItemCreation){ + logger.info("Craft Hunting Arrow Packs: "+craftHuntingArrowPacks); + logger.info("Craft War Arrow Packs: "+craftWarArrowPacks); + logger.info("Craft Battle Yoyo: "+craftBattleYoyo); + logger.info("Craft Club: "+craftClub); + logger.info("Craft Depth Drill: "+craftDepthDrill); + logger.info("Craft Eternal Reservoir: "+craftEternalReservoir); + logger.info("Craft Eviscerator: "+craftEviscerator); + logger.info("Craft Knuckles: "+craftKnuckles); + logger.info("Craft Mass Storage Unit: "+craftMassStorageUnit); + logger.info("Craft Statuette Deities: "+craftStatuetteDeities); + logger.info("Craft Warhammer: "+craftWarhammer); + } + } + + logger.info("Soulstealing Module: "+enableSoulstealingModule); + if (enableSoulstealingModule){ + logger.info("Poll Eternal Reservoir Timer: "+pollEternalReservoirTime); + } + + logger.info("Action Module: "+enableActionModule); + if (enableActionModule){ + logger.info("Unequip All Action: "+actionUnequipAll); + logger.info("Receive All Mail Action: "+actionReceiveAllMail); + logger.info("Split Sorcery Action: "+actionSplitSorcery); + logger.info("Leaderboard Action: "+actionLeaderboard); + logger.info("Sorcery Fragment Combine Action: "+actionSorceryFragmentCombine); + logger.info("Arena Teleport Actions: "+actionArenaTeleports); + logger.info("Add Mission Dev Action: "+actionAddMissionDev); + logger.info("Remove Mission Dev Action: "+actionRemoveMissionDev); + logger.info("Creature Report Dev Action: "+actionCreatureReportDev); + logger.info("Smooth Terrain Dev Action: "+actionSmoothTerrainDev); + } + + logger.info("Erosion Module: "+enableErosionModule); + if (enableErosionModule){ + logger.info("Poll Terrain Smooth Timer: "+pollTerrainSmoothTime); + } + logger.info("Treasure Chest Loot Module: "+enableTreasureChestLootModule); } @@ -1024,13 +1317,16 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea SupplyDepots.preInit(); } + // Bestiary Module Pre-Init + if (enableBestiaryModule) { + Bestiary.preInit(); + } + // Treasure Chest Loot Module Pre-Init if (enableTreasureChestLootModule) { TreasureChests.preInit(); } - MethodsBestiary.preInit(); - // Only clears responses, doesn't have any effect. Harmless to run even if key fragments are not used. KeyEvent.preInit(); @@ -1068,92 +1364,113 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea @Override public void init() { logger.info("Initializing."); + ModCreatures.init(); + ModVehicleBehaviours.init(); + if (WyvernMods.enableCustomTitlesModule) { PlayerTitles.init(); } - ModCreatures.init(); - ModVehicleBehaviours.init(); + + if (WyvernMods.enableMiscChangesModule) { + MiscChanges.changeExistingTitles(); + } + + if (WyvernMods.enableBountyModule) { + Bounty.init(); + } // Vanilla: - logger.info("Registering Vanilla creature changes."); - if (enableMountedModule && allowBisonMounts) { + if (WyvernMods.enableMountedModule && WyvernMods.allowBisonMounts) { logger.info("Allowing Bison to be mounted."); ModCreatures.addCreature(new Bison()); } // Epic: - logger.info("Registering Epic creatures."); - ModCreatures.addCreature(new LavaFiend()); - ModCreatures.addCreature(new SolDemon()); - ModCreatures.addCreature(new Worg()); - - // Wyverns: - logger.info("Registering Wyverns."); - ModCreatures.addCreature(new WyvernBlack()); - ModCreatures.addCreature(new WyvernGreen()); - ModCreatures.addCreature(new WyvernRed()); - ModCreatures.addCreature(new WyvernWhite()); - ModCreatures.addCreature(new WyvernBlue()); - - // Flavor Mobs: - logger.info("Registering Flavor creatures."); - ModCreatures.addCreature(new Avenger()); - ModCreatures.addCreature(new FireCrab()); - ModCreatures.addCreature(new ForestSpider()); - ModCreatures.addCreature(new Giant()); - ModCreatures.addCreature(new Charger()); - ModCreatures.addCreature(new HornedPony()); - ModCreatures.addCreature(new LargeBoar()); - ModCreatures.addCreature(new SpiritTroll()); + if (WyvernMods.enableBestiaryModule && WyvernMods.allowEpicCreatureNaturalSpawns) { + logger.info("Allowing epic creatures to spawn naturally."); + ModCreatures.addCreature(new LavaFiend()); + ModCreatures.addCreature(new SolDemon()); + ModCreatures.addCreature(new Worg()); + } - // Event Mobs: - logger.info("Registering Event creatures."); - ModCreatures.addCreature(new IceCat()); - ModCreatures.addCreature(new FireGiant()); - ModCreatures.addCreature(new GuardianMagranon()); - - // Bosses: - logger.info("Registering Custom Boss creatures."); - ModCreatures.addCreature(new Reaper()); - ModCreatures.addCreature(new SpectralDrake()); - // Uniques: - ModCreatures.addCreature(new Facebreyker()); - - // Titans: - ModCreatures.addCreature(new Ifrit()); - ModCreatures.addCreature(new Lilith()); - // Titan Spawns: - ModCreatures.addCreature(new IfritFiend()); - ModCreatures.addCreature(new IfritSpider()); - ModCreatures.addCreature(new LilithWraith()); - ModCreatures.addCreature(new LilithZombie()); - - // NPC's - logger.info("Registering Custom NPC creatures."); - //ModCreatures.addCreature(new RobZombie()); - //ModCreatures.addCreature(new MacroSlayer()); - ModCreatures.addCreature(new Terror()); - - Bounty.init(); - - Mastercraft.changeExistingTitles(); + if (WyvernMods.enableBestiaryModule && WyvernMods.enableCustomCreatures) { + // Wyverns: + if (WyvernMods.enableWyverns) { + logger.info("Registering Wyverns."); + ModCreatures.addCreature(new WyvernBlack()); + ModCreatures.addCreature(new WyvernGreen()); + ModCreatures.addCreature(new WyvernRed()); + ModCreatures.addCreature(new WyvernWhite()); + ModCreatures.addCreature(new WyvernBlue()); + } + + // Flavor Mobs: + if (WyvernMods.enableFlavorMobs) { + logger.info("Registering Flavor creatures."); + ModCreatures.addCreature(new Avenger()); + ModCreatures.addCreature(new FireCrab()); + ModCreatures.addCreature(new ForestSpider()); + ModCreatures.addCreature(new Giant()); + ModCreatures.addCreature(new Charger()); + ModCreatures.addCreature(new HornedPony()); + ModCreatures.addCreature(new LargeBoar()); + ModCreatures.addCreature(new SpiritTroll()); + } + + // Event Mobs: + if (WyvernMods.enableEventMobs) { + logger.info("Registering Event creatures."); + ModCreatures.addCreature(new IceCat()); + ModCreatures.addCreature(new FireGiant()); + ModCreatures.addCreature(new GuardianMagranon()); + ModCreatures.addCreature(new Terror()); + } + + // Rare Spawns: + if (WyvernMods.enableRareSpawns) { + logger.info("Registering Rare Spawn creatures."); + ModCreatures.addCreature(new Reaper()); + ModCreatures.addCreature(new SpectralDrake()); + } + + // Legendaries: + if (WyvernMods.enableCustomLegendaries) { + logger.info("Registering Legendary creatures."); + ModCreatures.addCreature(new Facebreyker()); + } + + // Titans: + if (WyvernMods.enableTitans) { + logger.info("Registering Titans."); + ModCreatures.addCreature(new Ifrit()); + ModCreatures.addCreature(new Lilith()); + // Titan Spawns: + logger.info("Register Titan Spawns."); + ModCreatures.addCreature(new IfritFiend()); + ModCreatures.addCreature(new IfritSpider()); + ModCreatures.addCreature(new LilithWraith()); + ModCreatures.addCreature(new LilithZombie()); + } + } } @Override public void onItemTemplatesCreated() { - logger.info("Creating Item Mod items."); - ItemMod.createItems(); - logger.info("Creating Cache items."); - Caches.createItems(); - logger.info("Initiating Title changes."); - //PlayerTitles.onItemTemplatesCreated(); - try { - logger.info("Editing existing item templates."); - ItemMod.modifyItems(); - logger.info("Registering permissions hook for custom items."); - ItemMod.registerPermissionsHook(); - } catch (NoSuchTemplateException | IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) { - e.printStackTrace(); + if (WyvernMods.enableItemModule) { + if (WyvernMods.createCustomItemTemplates) { + logger.info("Creating Item Mod item templates."); + ItemMod.createItems(); + logger.info("Creating Cache item templates."); + Caches.createItems(); + } + try { + logger.info("Editing existing item templates."); + ItemMod.modifyItems(); + logger.info("Registering permissions hook for custom items."); + ItemMod.registerPermissionsHook(); + } catch (NoSuchTemplateException | IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) { + e.printStackTrace(); + } } } @@ -1170,52 +1487,78 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea @Override public void onServerStarted() { try { - logger.info("Registering Item Mod creation entries."); - ItemMod.initCreationEntries(); - logger.info("Registering Item Mod actions."); - ItemMod.registerActions(); - logger.info("Registering Cache actions."); - Caches.registerActions(); - logger.info("Registering Soulstealer actions."); - Soulstealing.registerActions(); - logger.info("Registering Custom actions."); - ModActions.registerAction(new UnequipAllAction()); - ModActions.registerAction(new ReceiveMailAction()); - ModActions.registerAction(new LeaderboardAction()); - ModActions.registerAction(new AddSubGroupAction()); - ModActions.registerAction(new SorcerySplitAction()); - ModActions.registerAction(new LeaderboardSkillAction()); - logger.info("Registering Arena actions."); - ModActions.registerAction(new SorceryCombineAction()); - //ModActions.registerAction(new VillageTeleportAction()); // [3/28/18] Disabled - Highway Portals added instead. - ModActions.registerAction(new ArenaTeleportAction()); - ModActions.registerAction(new ArenaEscapeAction()); - logger.info("Registering Dev actions."); - ModActions.registerAction(new MissionAddAction()); - ModActions.registerAction(new MissionRemoveAction()); - ModActions.registerAction(new CreatureReportAction()); - ModActions.registerAction(new SmoothTerrainAction()); - logger.info("Setting custom creature corpse models."); - MethodsBestiary.setTemplateVariables(); - logger.info("Setting up Achievement templates."); - AchievementChanges.onServerStarted(); - - DeityChanges.onServerStarted(); - - //espCounter = Servers.localServer.PVPSERVER; // Enables on PvP server by default. - //espCounter = false; - - if (enableSkillModule) { - SkillChanges.onServerStarted(); + if (WyvernMods.enableBestiaryModule) { + logger.info("Setting custom creature template variables."); + Bestiary.setTemplateVariables(); + } + if (WyvernMods.enableItemModule) { + ItemMod.onServerStarted(); + if (WyvernMods.enableCustomItemCreation) { + logger.info("Registering Item Mod creation entries."); + ItemMod.initCreationEntries(); + } + if (WyvernMods.createCustomItemTemplates) { + logger.info("Registering Item Mod actions."); + ItemMod.registerActions(); + logger.info("Registering Cache actions."); + Caches.registerActions(); + } + } + if (WyvernMods.enableSoulstealingModule) { + logger.info("Registering Soulstealer actions."); + Soulstealing.registerActions(); + } + if (WyvernMods.enableActionModule) { + logger.info("Registering Custom actions."); + if (WyvernMods.actionUnequipAll) { + ModActions.registerAction(new UnequipAllAction()); + } + if (WyvernMods.actionReceiveAllMail) { + ModActions.registerAction(new ReceiveMailAction()); + } + if (WyvernMods.actionSplitSorcery) { + ModActions.registerAction(new SorcerySplitAction()); + } + if (WyvernMods.actionLeaderboard) { + ModActions.registerAction(new LeaderboardAction()); + ModActions.registerAction(new LeaderboardSkillAction()); + } + //ModActions.registerAction(new AddSubGroupAction()); // [5/14/19] Disabled - Added to base game. + logger.info("Registering Arena actions."); + if (WyvernMods.actionSorceryFragmentCombine) { + ModActions.registerAction(new SorceryCombineAction()); + } + if (WyvernMods.actionArenaTeleports) { + ModActions.registerAction(new ArenaTeleportAction()); + ModActions.registerAction(new ArenaEscapeAction()); + } + logger.info("Registering Dev actions."); + if (WyvernMods.actionAddMissionDev) { + ModActions.registerAction(new MissionAddAction()); + } + if (WyvernMods.actionRemoveMissionDev) { + ModActions.registerAction(new MissionRemoveAction()); + } + if (WyvernMods.actionCreatureReportDev) { + ModActions.registerAction(new CreatureReportAction()); + } + if (WyvernMods.actionSmoothTerrainDev) { + ModActions.registerAction(new SmoothTerrainAction()); + } } - CreationEntry lockpicks = CreationMatrix.getInstance().getCreationEntry(ItemList.lockpick); - try { - ReflectionUtil.setPrivateField(lockpicks, ReflectionUtil.getField(lockpicks.getClass(), "hasMinimumSkillRequirement"), false); - ReflectionUtil.setPrivateField(lockpicks, ReflectionUtil.getField(lockpicks.getClass(), "minimumSkill"), 0.0); - } catch (IllegalAccessException | NoSuchFieldException e) { - logger.info("Failed to set lockpick creation entry changes!"); - e.printStackTrace(); + // Sets up achievement changes specifically for the Leaderboard system. + if (WyvernMods.enableActionModule && WyvernMods.actionLeaderboard) { + logger.info("Setting up Leaderboard Achievement templates."); + AchievementChanges.onServerStarted(); + } + + if (WyvernMods.enableMiscChangesModule && WyvernMods.changeDeityPassives) { + DeityChanges.onServerStarted(); + } + + if (WyvernMods.enableSkillModule) { + SkillChanges.onServerStarted(); } } catch (IllegalArgumentException | ClassCastException e) { @@ -1230,7 +1573,6 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea public static long lastPolledDepots = 0; public static long lastPolledRareSpawns = 0; public static long lastPolledEternalReservoirs = 0; - public static final long pollEternalReservoirTime = TimeConstants.MINUTE_MILLIS*10; public static long lastPolledMissionCreator = 0; /* Disabled for now, might need to be revisited. public static long lastPolledBloodlust = 0; @@ -1240,31 +1582,30 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea public static long lastPolledUniqueCollection = 0; public static final long pollUniqueCollectionTime = TimeConstants.MINUTE_MILLIS*5; public static long lastPolledTerrainSmooth = 0; - public static final long pollTerrainSmoothTime = TimeConstants.SECOND_MILLIS*5; @Override public void onServerPoll() { if((lastSecondPolled + TimeConstants.SECOND_MILLIS) < System.currentTimeMillis()){ - if(enableSupplyDepotModule && lastPolledDepots + pollDepotTime < System.currentTimeMillis()){ + if(WyvernMods.enableSupplyDepotModule && lastPolledDepots + pollDepotTime < System.currentTimeMillis()){ SupplyDepots.pollDepotSpawn(); lastPolledDepots += pollDepotTime; } - if(enableTitanModule && lastPolledTitanSpawn + pollTitanSpawnTime < System.currentTimeMillis()){ + if(WyvernMods.enableTitanModule && lastPolledTitanSpawn + pollTitanSpawnTime < System.currentTimeMillis()){ Titans.pollTitanSpawn(); lastPolledTitanSpawn += pollTitanSpawnTime; } - if(enableTitanModule && lastPolledTitans + pollTitanTime < System.currentTimeMillis()){ + if(WyvernMods.enableTitanModule && lastPolledTitans + pollTitanTime < System.currentTimeMillis()){ Titans.pollTitans(); lastPolledTitans += pollTitanTime; } - if(enableRareSpawnModule && lastPolledRareSpawns + pollRareSpawnTime < System.currentTimeMillis()){ + if(WyvernMods.enableRareSpawnModule && lastPolledRareSpawns + pollRareSpawnTime < System.currentTimeMillis()){ RareSpawns.pollRareSpawns(); lastPolledRareSpawns += pollRareSpawnTime; } - if(lastPolledEternalReservoirs + pollEternalReservoirTime < System.currentTimeMillis()){ + if(WyvernMods.enableSoulstealingModule && lastPolledEternalReservoirs + pollEternalReservoirTime < System.currentTimeMillis()){ Soulstealing.pollSoulForges(); lastPolledEternalReservoirs += pollEternalReservoirTime; } - if(enableMissionModule && enableNewMissionCreator && lastPolledMissionCreator + pollMissionCreatorTime < System.currentTimeMillis()){ + if(WyvernMods.enableMissionModule && enableNewMissionCreator && lastPolledMissionCreator + pollMissionCreatorTime < System.currentTimeMillis()){ MissionCreator.pollMissions(); lastPolledMissionCreator += pollMissionCreatorTime; } @@ -1273,7 +1614,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea Bloodlust.pollLusts(); lastPolledBloodlust += pollBloodlustTime; }*/ - if(WyvernMods.useStaticLegendaryRegeneration && lastPolledUniqueRegeneration + pollUniqueRegenerationTime < System.currentTimeMillis()){ + if(WyvernMods.enableCombatModule && WyvernMods.useStaticLegendaryRegeneration && lastPolledUniqueRegeneration + pollUniqueRegenerationTime < System.currentTimeMillis()){ CombatChanges.pollUniqueRegeneration(); lastPolledUniqueRegeneration += pollUniqueRegenerationTime; } @@ -1281,7 +1622,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea CombatChanges.pollUniqueCollection(); lastPolledUniqueCollection += pollUniqueCollectionTime; } - if(lastPolledTerrainSmooth + pollTerrainSmoothTime < System.currentTimeMillis()){ + if(WyvernMods.enableErosionModule && lastPolledTerrainSmooth + pollTerrainSmoothTime < System.currentTimeMillis()){ SmoothTerrainAction.onServerPoll(); lastPolledTerrainSmooth += pollTerrainSmoothTime; }