Update to Wurm Unlimited 1.9 and latest code

This commit is contained in:
Sindusk
2019-03-22 11:56:31 -04:00
parent 23fac18308
commit 550ef20925
27 changed files with 397 additions and 119 deletions

View File

@@ -1,7 +1,7 @@
apply plugin: 'java' apply plugin: 'java'
group "mod.sin" group "mod.sin"
version "1.2" version "1.3"
repositories { repositories {
mavenCentral() mavenCentral()
@@ -11,8 +11,8 @@ repositories {
} }
dependencies { dependencies {
compile 'org.gotti.wurmunlimited:server-modlauncher:0.39-beta1' compile 'org.gotti.wurmunlimited:server-modlauncher:0.43-beta1'
compile 'com.github.Sindusk:sindusklibrary:v1.7' compile 'com.github.Sindusk:sindusklibrary:v2.2'
compile 'com.github.Sindusk:DiscordRelay:v1.2' compile 'com.github.Sindusk:DiscordRelay:v1.2'
compile 'com.github.Sindusk:DUSKombat:v1.0' compile 'com.github.Sindusk:DUSKombat:v1.0'
compile 'com.github.Sindusk:TreasureHunting:1.1.4' compile 'com.github.Sindusk:TreasureHunting:1.1.4'

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip

View File

@@ -39,7 +39,6 @@ public class AffinityOrbQuestion extends Question {
//logger.info("Converting "+player.getName()+" to " + Deities.getDeityName(deity)); //logger.info("Converting "+player.getName()+" to " + Deities.getDeityName(deity));
String skillName = SkillSystem.getNameFor(skillNum); String skillName = SkillSystem.getNameFor(skillNum);
logger.info("Adding affinity for skill "+skillName+" to "+player.getName()); logger.info("Adding affinity for skill "+skillName+" to "+player.getName());
Items.destroyItem(affinityOrb.getWurmId());
Affinity[] affs = Affinities.getAffinities(player.getWurmId()); Affinity[] affs = Affinities.getAffinities(player.getWurmId());
boolean found = false; boolean found = false;

View File

@@ -40,7 +40,7 @@ public class BookConversionQuestion extends Question {
Deity d = Deities.getDeity(deity); Deity d = Deities.getDeity(deity);
p.setDeity(d); p.setDeity(d);
p.setPriest(true); p.setPriest(true);
if(d.hateGod){ if(d.isHateGod()){
p.setAlignment(-Math.abs(p.getAlignment())); p.setAlignment(-Math.abs(p.getAlignment()));
}else{ }else{
p.setAlignment(Math.abs(p.getAlignment())); p.setAlignment(Math.abs(p.getAlignment()));

View File

@@ -38,7 +38,6 @@ public class ArenaEscapeAction implements ModAction {
ModActions.registerAction(actionEntry); ModActions.registerAction(actionEntry);
} }
@Override @Override
public BehaviourProvider getBehaviourProvider() public BehaviourProvider getBehaviourProvider()
{ {
@@ -93,6 +92,7 @@ public class ArenaEscapeAction implements ModAction {
} }
if(counter == 1.0f){ if(counter == 1.0f){
performer.getCommunicator().sendNormalServerMessage("You prepare your body and mind to transfer to another realm."); performer.getCommunicator().sendNormalServerMessage("You prepare your body and mind to transfer to another realm.");
performer.playAnimation("meditate", false);
act.setTimeLeft(1800); act.setTimeLeft(1800);
performer.sendActionControl("Preparing", true, act.getTimeLeft()); performer.sendActionControl("Preparing", true, act.getTimeLeft());
}else if(counter * 10f > performer.getCurrentAction().getTimeLeft()){ }else if(counter * 10f > performer.getCurrentAction().getTimeLeft()){

View File

@@ -86,18 +86,19 @@ public class ArenaTeleportAction implements ModAction {
} }
if(counter == 1.0f){ if(counter == 1.0f){
performer.getCommunicator().sendNormalServerMessage("You sit and begin to transfer your mind."); performer.getCommunicator().sendNormalServerMessage("You sit and begin to transfer your mind.");
performer.playAnimation("meditate", false);
act.setTimeLeft(600); act.setTimeLeft(600);
performer.sendActionControl("Transferring", true, act.getTimeLeft()); performer.sendActionControl("Transferring", true, act.getTimeLeft());
}else if(act.currentSecond() == 10){ }else if(act.currentSecond() == 10){
performer.getCommunicator().sendAlertServerMessage("You are about to enter a PvP environment.", (byte) 3); performer.getCommunicator().sendAlertServerMessage("You are about to enter a full PvP environment.", (byte) 3);
}else if(act.currentSecond() == 20){ }else if(act.currentSecond() == 20){
performer.getCommunicator().sendNormalServerMessage("Death will leave your corpse and return you here. Anyone may loot your corpse in the arena.", (byte) 3); performer.getCommunicator().sendNormalServerMessage("Death will not drop your items. Instead they will be damaged heavily and returned to you upon respawn.", (byte) 3);
}else if(act.currentSecond() == 30){ }else if(act.currentSecond() == 30){
performer.getCommunicator().sendNormalServerMessage("Upon transfer, you will be placed in a random location. This could be safely outside of danger, or directly on a group of enemies.", (byte) 3); performer.getCommunicator().sendNormalServerMessage("If you are part of a deed, you will arrive at the token. Otherwise, you will be placed in a random location.", (byte) 3);
}else if(act.currentSecond() == 40){ }else if(act.currentSecond() == 40){
performer.getCommunicator().sendNormalServerMessage("You can equip creatures such as horses by simply leading them. Taming is not required in the Arena.", (byte) 3); performer.getCommunicator().sendNormalServerMessage("You can equip creatures such as horses by simply leading them. Taming is not required in the Arena.", (byte) 3);
}else if(act.currentSecond() == 55){ }else if(act.currentSecond() == 55){
performer.getCommunicator().sendNormalServerMessage("It appears you have accepted these conditions. Transferring to the arena. Good luck.", (byte) 3); performer.getCommunicator().sendNormalServerMessage("It appears you have accepted these conditions. Transferring to the Revenant Arena. Good luck.", (byte) 3);
}else if(counter * 10f > performer.getCurrentAction().getTimeLeft()){ }else if(counter * 10f > performer.getCurrentAction().getTimeLeft()){
ServerEntry targetserver = Servers.localServer.serverNorth; ServerEntry targetserver = Servers.localServer.serverNorth;
if(targetserver == null){ if(targetserver == null){

View File

@@ -5,10 +5,7 @@ import com.wurmonline.server.Items;
import com.wurmonline.server.behaviours.Action; import com.wurmonline.server.behaviours.Action;
import com.wurmonline.server.behaviours.ActionEntry; import com.wurmonline.server.behaviours.ActionEntry;
import com.wurmonline.server.creatures.Creature; import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.items.Item; import com.wurmonline.server.items.*;
import com.wurmonline.server.items.ItemFactory;
import com.wurmonline.server.items.ItemSpellEffects;
import com.wurmonline.server.items.NoSuchTemplateException;
import com.wurmonline.server.players.Player; import com.wurmonline.server.players.Player;
import com.wurmonline.server.skills.Skill; import com.wurmonline.server.skills.Skill;
import com.wurmonline.server.spells.Spell; import com.wurmonline.server.spells.Spell;
@@ -90,6 +87,10 @@ public class EternalOrbAction implements ModAction {
player.getCommunicator().sendNormalServerMessage("You cannot absorb the orb with itself!"); player.getCommunicator().sendNormalServerMessage("You cannot absorb the orb with itself!");
return true; return true;
} }
if(target.getTemplateId() == ItemList.arrowHunting || target.getTemplateId() == ItemList.arrowWar){
player.getCommunicator().sendNormalServerMessage("You cannot use Eternal Orbs on arrows.");
return true;
}
ItemSpellEffects teffs = target.getSpellEffects(); ItemSpellEffects teffs = target.getSpellEffects();
if(teffs == null || teffs.getEffects().length == 0){ if(teffs == null || teffs.getEffects().length == 0){
player.getCommunicator().sendNormalServerMessage("The "+target.getTemplate().getName()+" has no enchants."); player.getCommunicator().sendNormalServerMessage("The "+target.getTemplate().getName()+" has no enchants.");

View File

@@ -91,7 +91,7 @@ public class Charger implements ModCreature, CreatureTypes {
vehicle.createPassengerSeats(0); vehicle.createPassengerSeats(0);
vehicle.setSeatFightMod(0, 0.8f, 1.1f); vehicle.setSeatFightMod(0, 0.8f, 1.1f);
vehicle.setSeatOffset(0, 0.0f, 0.0f, 0.5f); vehicle.setSeatOffset(0, 0.0f, 0.0f, 0.0f);
vehicle.setCreature(true); vehicle.setCreature(true);
vehicle.setSkillNeeded(Servers.localServer.PVPSERVER ? 25.0f : 37.0f); vehicle.setSkillNeeded(Servers.localServer.PVPSERVER ? 25.0f : 37.0f);
vehicle.setName(creature.getName()); vehicle.setName(creature.getName());

View File

@@ -20,7 +20,6 @@ public class AffinityOrb implements ItemTypes, MiscConstants {
itemBuilder.name(name, "affinity orbs", "A valuable orb that infuses the user with hidden knowledge."); itemBuilder.name(name, "affinity orbs", "A valuable orb that infuses the user with hidden knowledge.");
itemBuilder.descriptions("brilliantly glowing", "strongly glowing", "faintly glowing", "barely glowing"); itemBuilder.descriptions("brilliantly glowing", "strongly glowing", "faintly glowing", "barely glowing");
itemBuilder.itemTypes(new short[]{ itemBuilder.itemTypes(new short[]{
ItemTypes.ITEM_TYPE_NODROP,
ItemTypes.ITEM_TYPE_FULLPRICE, ItemTypes.ITEM_TYPE_FULLPRICE,
ItemTypes.ITEM_TYPE_NOSELLBACK ItemTypes.ITEM_TYPE_NOSELLBACK
}); });

View File

@@ -427,6 +427,15 @@ public class Arena {
} }
});*/ });*/
// Die method description
CtClass ctString = classPool.get("java.lang.String");
CtClass[] params8 = new CtClass[]{
CtClass.booleanType,
ctString,
CtClass.booleanType
};
String desc8 = Descriptor.ofMethod(CtClass.voidType, params8);
// - Ensure corpses are not loot protected on PvP - // // - Ensure corpses are not loot protected on PvP - //
Util.setReason("Ensure corpses are not loot protected."); Util.setReason("Ensure corpses are not loot protected.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
@@ -434,13 +443,13 @@ public class Arena {
+ "}else{" + "}else{"
+ " $_ = $proceed($$);" + " $_ = $proceed($$);"
+ "}"; + "}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "setProtected", replace); Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "setProtected", replace);
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
+ " $_ = true;" + " $_ = true;"
+ "}else{" + "}else{"
+ " $_ = $proceed($$);" + " $_ = $proceed($$);"
+ "}"; + "}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "isInPvPZone", replace); Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "isInPvPZone", replace);
// - Allow players to do actions in PvP houses - // // - Allow players to do actions in PvP houses - //
CtClass ctMethods = classPool.get("com.wurmonline.server.behaviours.Methods"); CtClass ctMethods = classPool.get("com.wurmonline.server.behaviours.Methods");
@@ -680,15 +689,7 @@ public class Arena {
"}else{" + "}else{" +
" $_ = $proceed($$);" + " $_ = $proceed($$);" +
"}"; "}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "getFavor", replace); Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "getFavor", replace);
/*Util.setReason("Nerf resurrection stones.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
" $_ = com.wurmonline.server.Server.rand.nextInt(40) > 35;" +
"}else{" +
" $_ = $proceed($$);" +
"}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "isDeathProtected", replace);*/
Util.setReason("Adjust spawn question mechanics."); Util.setReason("Adjust spawn question mechanics.");
CtClass ctSpawnQuestion = classPool.get("com.wurmonline.server.questions.SpawnQuestion"); CtClass ctSpawnQuestion = classPool.get("com.wurmonline.server.questions.SpawnQuestion");
@@ -770,7 +771,7 @@ public class Arena {
" keepItems = true;" + " keepItems = true;" +
"}" + "}" +
"$_ = $proceed($$);"; "$_ = $proceed($$);";
Util.instrumentDeclaredCount(thisClass, ctCreature, "die", "isOnCurrentServer", 1, replace); Util.instrumentDescribedCount(thisClass, ctCreature, "die", desc8, "isOnCurrentServer", 1, replace);
Util.setReason("Disable player skill loss on Arena."); Util.setReason("Disable player skill loss on Arena.");
replace = "if(this.isPlayer() && this.isDeathProtected()){" + replace = "if(this.isPlayer() && this.isDeathProtected()){" +

View File

@@ -67,6 +67,8 @@ public class Bloodlust {
final Class<Bloodlust> thisClass = Bloodlust.class; final Class<Bloodlust> thisClass = Bloodlust.class;
String replace; String replace;
/* Disabled in Wurm Unlimited 1.9 - May need to be revisited in the future.
Util.setReason("Hook for bloodlust system."); Util.setReason("Hook for bloodlust system.");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
CtClass ctString = classPool.get("java.lang.String"); CtClass ctString = classPool.get("java.lang.String");
@@ -97,8 +99,8 @@ public class Bloodlust {
" float lustMult = "+Bloodlust.class.getName()+".getLustMult($1);" + " float lustMult = "+Bloodlust.class.getName()+".getLustMult($1);" +
" $5 = $5 * lustMult;" + " $5 = $5 * lustMult;" +
"}"; "}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace); Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);*/
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) { } catch ( IllegalArgumentException | ClassCastException e) {
throw new HookException(e); throw new HookException(e);
} }
} }

View File

@@ -119,10 +119,20 @@ public class Bounty {
} }
} }
});*/ });*/
// Die method description
CtClass ctString = classPool.get("java.lang.String");
CtClass[] params1 = new CtClass[]{
CtClass.booleanType,
ctString,
CtClass.booleanType
};
String desc1 = Descriptor.ofMethod(CtClass.voidType, params1);
replace = "$_ = $proceed($$);" replace = "$_ = $proceed($$);"
//+ "mod.sin.wyvern.bounty.MethodsBounty.checkLootTable(this, corpse);"; //+ "mod.sin.wyvern.bounty.MethodsBounty.checkLootTable(this, corpse);";
+ LootBounty.class.getName()+".checkLootTable(this, corpse);"; + LootBounty.class.getName()+".checkLootTable(this, corpse);";
Util.instrumentDeclared(thisClass, ctCreature, "die", "setRotation", replace); Util.instrumentDescribed(thisClass, ctCreature, "die", desc1, "setRotation", replace);
/*ctCreature.getDeclaredMethod("die").instrument(new ExprEditor(){ /*ctCreature.getDeclaredMethod("die").instrument(new ExprEditor(){
public void edit(MethodCall m) throws CannotCompileException { public void edit(MethodCall m) throws CannotCompileException {
if (m.getMethodName().equals("setRotation")) { if (m.getMethodName().equals("setRotation")) {
@@ -135,7 +145,7 @@ public class Bounty {
});*/ });*/
// doNew(int templateid, boolean createPossessions, float aPosX, float aPosY, float aRot, int layer, String name, byte gender, byte kingdom, byte ctype, boolean reborn, byte age) // doNew(int templateid, boolean createPossessions, float aPosX, float aPosY, float aRot, int layer, String name, byte gender, byte kingdom, byte ctype, boolean reborn, byte age)
CtClass[] params = { CtClass[] params2 = {
CtClass.intType, CtClass.intType,
CtClass.booleanType, CtClass.booleanType,
CtClass.floatType, CtClass.floatType,
@@ -150,8 +160,8 @@ public class Bounty {
CtClass.byteType, CtClass.byteType,
CtClass.intType CtClass.intType
}; };
String desc = Descriptor.ofMethod(ctCreature, params); String desc2 = Descriptor.ofMethod(ctCreature, params2);
Util.insertBeforeDescribed(thisClass, ctCreature, "doNew", desc, "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, "logger.info(\"Creating new creature: \"+templateid+\" - \"+(aPosX/4)+\", \"+(aPosY/4)+\" [\"+com.wurmonline.server.creatures.CreatureTemplateFactory.getInstance().getTemplate(templateid).getName()+\"]\");");
// Debugging to show all new creatures created. // Debugging to show all new creatures created.
//CtMethod ctDoNew = ctCreature.getMethod("doNew", "(IZFFFILjava/lang/String;BBBZB)Lcom/wurmonline/server/creatures/Creature;"); //CtMethod ctDoNew = ctCreature.getMethod("doNew", "(IZFFFILjava/lang/String;BBBZB)Lcom/wurmonline/server/creatures/Creature;");
//ctDoNew.insertBefore("logger.info(\"Creating new creature: \"+templateid+\" - \"+(aPosX/4)+\", \"+(aPosY/4)+\" [\"+com.wurmonline.server.creatures.CreatureTemplateFactory.getInstance().getTemplate(templateid).getName()+\"]\");"); //ctDoNew.insertBefore("logger.info(\"Creating new creature: \"+templateid+\" - \"+(aPosX/4)+\", \"+(aPosY/4)+\" [\"+com.wurmonline.server.creatures.CreatureTemplateFactory.getInstance().getTemplate(templateid).getName()+\"]\");");
@@ -159,7 +169,7 @@ public class Bounty {
replace = "$_ = $proceed($$);" replace = "$_ = $proceed($$);"
//+ "mod.sin.wyvern.bestiary.MethodsBestiary.modifyNewCreature($1);"; //+ "mod.sin.wyvern.bestiary.MethodsBestiary.modifyNewCreature($1);";
+ MethodsBestiary.class.getName()+".modifyNewCreature($1);"; + MethodsBestiary.class.getName()+".modifyNewCreature($1);";
Util.instrumentDescribed(thisClass, ctCreature, "doNew", desc, "sendToWorld", replace); Util.instrumentDescribed(thisClass, ctCreature, "doNew", desc2, "sendToWorld", replace);
/*ctDoNew.instrument(new ExprEditor(){ /*ctDoNew.instrument(new ExprEditor(){
public void edit(MethodCall m) throws CannotCompileException { public void edit(MethodCall m) throws CannotCompileException {
if (m.getMethodName().equals("sendToWorld")) { if (m.getMethodName().equals("sendToWorld")) {

View File

@@ -9,16 +9,16 @@ import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.items.Item; import com.wurmonline.server.items.Item;
import com.wurmonline.server.players.Player; import com.wurmonline.server.players.Player;
import com.wurmonline.shared.constants.Enchants; import com.wurmonline.shared.constants.Enchants;
import javassist.*; import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;
import javassist.bytecode.*; import javassist.bytecode.*;
import javassist.expr.ExprEditor;
import javassist.expr.FieldAccess;
import mod.sin.lib.Util; import mod.sin.lib.Util;
import org.gotti.wurmunlimited.modloader.classhooks.HookException; import org.gotti.wurmunlimited.modloader.classhooks.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager; import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import java.util.logging.Logger; import java.util.logging.Logger;
public class CombatChanges { public class CombatChanges {
@@ -151,6 +151,8 @@ public class CombatChanges {
return damage > 1D; return damage > 1D;
} }
/* Disabled as of WU 1.9 - No longer necessary and no longer functions.
static void patchCombatDamageCheckCombatEngine(ClassPool classPool) throws NotFoundException, BadBytecode { static void patchCombatDamageCheckCombatEngine(ClassPool classPool) throws NotFoundException, BadBytecode {
CtClass cls = classPool.getCtClass("com.wurmonline.server.combat.CombatEngine"); CtClass cls = classPool.getCtClass("com.wurmonline.server.combat.CombatEngine");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
@@ -213,9 +215,9 @@ public class CombatChanges {
} }
} }
} }
} }*/
static void patchCombatDamageCheckCombatHandler(ClassPool classPool) throws NotFoundException, BadBytecode { /*static void patchCombatDamageCheckCombatHandler(ClassPool classPool) throws NotFoundException, BadBytecode {
CtClass cls = classPool.getCtClass("com.wurmonline.server.creatures.CombatHandler"); CtClass cls = classPool.getCtClass("com.wurmonline.server.creatures.CombatHandler");
CtMethod method = cls.getMethod("setDamage", "(Lcom/wurmonline/server/creatures/Creature;Lcom/wurmonline/server/items/Item;DBB)Z"); CtMethod method = cls.getMethod("setDamage", "(Lcom/wurmonline/server/creatures/Creature;Lcom/wurmonline/server/items/Item;DBB)Z");
MethodInfo methodInfo = method.getMethodInfo(); MethodInfo methodInfo = method.getMethodInfo();
@@ -255,7 +257,7 @@ public class CombatChanges {
} }
} }
} }
} }*/
// Added to CombatHandled // Added to CombatHandled
public static void pollCreatureActionStacks(){ public static void pollCreatureActionStacks(){
@@ -283,8 +285,11 @@ public class CombatChanges {
"$_ = $proceed($$);"; "$_ = $proceed($$);";
Util.instrumentDeclared(thisClass, ctCombatHandler, "getCombatRating", "getFlankingModifier", replace); Util.instrumentDeclared(thisClass, ctCombatHandler, "getCombatRating", "getFlankingModifier", replace);
Util.setReason("Increase unique damage to pets.");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
/* Disabled in Wurm Unlimited 1.9 - No longer necessary while using DUSKombat.
Util.setReason("Increase unique damage to pets.");
CtClass ctString = classPool.get("java.lang.String"); CtClass ctString = classPool.get("java.lang.String");
CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle"); CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle");
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine"); CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
@@ -313,7 +318,7 @@ public class CombatChanges {
" logger.info(\"Detected pet hit on a unique. Reducing damage.\");" + " logger.info(\"Detected pet hit on a unique. Reducing damage.\");" +
" $5 = $5 * 0.5d;" + " $5 = $5 * 0.5d;" +
"}"; "}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace); Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);*/
Util.setReason("Adjust weapon damage type based on the potion/salve applied."); Util.setReason("Adjust weapon damage type based on the potion/salve applied.");
replace = "int wt = "+CombatChanges.class.getName()+".getWeaponType($1);" replace = "int wt = "+CombatChanges.class.getName()+".getWeaponType($1);"
@@ -323,7 +328,6 @@ public class CombatChanges {
+ "}"; + "}";
Util.insertBeforeDeclared(thisClass, ctCombatHandler, "getType", replace); Util.insertBeforeDeclared(thisClass, ctCombatHandler, "getType", replace);
Util.setReason("Adjust bloodthirst to epic settings.");
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item"); CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
CtClass[] params2 = { CtClass[] params2 = {
ctCreature, ctCreature,
@@ -331,8 +335,12 @@ public class CombatChanges {
ctCreature ctCreature
}; };
String desc2 = Descriptor.ofMethod(CtClass.doubleType, params2); String desc2 = Descriptor.ofMethod(CtClass.doubleType, params2);
/* Disabled in Wurm Unlimited 1.9 - Priest Rework adjusted Bloodthirst in an identical way.
Util.setReason("Adjust bloodthirst to epic settings.");
replace = "$_ = true;"; replace = "$_ = true;";
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "isThisAnEpicOrChallengeServer", replace); Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "isThisAnEpicOrChallengeServer", replace);*/
Util.setReason("Fix magranon damage bonus stacking."); Util.setReason("Fix magranon damage bonus stacking.");
replace = "if(mildStack){" + replace = "if(mildStack){" +
@@ -342,7 +350,6 @@ public class CombatChanges {
"}"; "}";
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "getModifiedFloatEffect", replace); Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "getModifiedFloatEffect", replace);
Util.setReason("Adjust bloodthirst to epic settings.");
CtClass ctAttackAction = classPool.get("com.wurmonline.server.creatures.AttackAction"); CtClass ctAttackAction = classPool.get("com.wurmonline.server.creatures.AttackAction");
CtClass[] params3 = { CtClass[] params3 = {
ctCreature, ctCreature,
@@ -350,8 +357,12 @@ public class CombatChanges {
ctCreature ctCreature
}; };
String desc3 = Descriptor.ofMethod(CtClass.doubleType, params3); String desc3 = Descriptor.ofMethod(CtClass.doubleType, params3);
/* Disabled in Wurm Unlimited 1.9 - Priest Rework adjusted Bloodthirst in an identical way.
Util.setReason("Adjust bloodthirst to epic settings.");
replace = "$_ = true;"; replace = "$_ = true;";
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc3, "isThisAnEpicOrChallengeServer", replace); Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc3, "isThisAnEpicOrChallengeServer", replace);*/
Util.setReason("Fix magranon damage bonus stacking."); Util.setReason("Fix magranon damage bonus stacking.");
replace = "if(mildStack){" + replace = "if(mildStack){" +
@@ -451,13 +462,11 @@ public class CombatChanges {
CombatChanges.class.getName()+".goodLog(\"Zones.pollNextZones(\"+sleepTime+\") call to Creatures.getInstance().pollAllCreatures(\"+$1+\") [time \"+java.lang.System.currentTimeMillis()+\"]\");"; CombatChanges.class.getName()+".goodLog(\"Zones.pollNextZones(\"+sleepTime+\") call to Creatures.getInstance().pollAllCreatures(\"+$1+\") [time \"+java.lang.System.currentTimeMillis()+\"]\");";
Util.instrumentDeclared(thisClass, ctZones, "pollNextZones", "pollAllCreatures", replace);*/ Util.instrumentDeclared(thisClass, ctZones, "pollNextZones", "pollAllCreatures", replace);*/
patchCombatDamageCheckCombatEngine(classPool); //patchCombatDamageCheckCombatEngine(classPool);
patchCombatDamageCheckCombatHandler(classPool); //patchCombatDamageCheckCombatHandler(classPool);
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) { } catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e); throw new HookException(e);
} catch (BadBytecode badBytecode) {
badBytecode.printStackTrace();
} }
} }
} }

View File

@@ -11,18 +11,19 @@ public class DeityChanges {
public static void onServerStarted(){ public static void onServerStarted(){
if(Deities.getDeity(101) != null){ // Edit Thelastdab Player God if(Deities.getDeity(101) != null){ // Edit Thelastdab Player God
Deity thelastdab = Deities.getDeity(101); Deity thelastdab = Deities.getDeity(101);
// Set template deity
thelastdab.setMountainGod(true);
// Add some defining affinities // Add some defining affinities
thelastdab.metalAffinity = true; thelastdab.setMetalAffinity(true);
thelastdab.deathProtector = true; thelastdab.setDeathProtector(true);
thelastdab.mountainGod = true; thelastdab.setWarrior(true);
thelastdab.warrior = true;
// Remove some affinities // Remove some affinities
thelastdab.learner = false; thelastdab.setLearner(false);
thelastdab.repairer = false; thelastdab.setRepairer(false);
thelastdab.befriendCreature = false; thelastdab.setBefriendCreature(false);
thelastdab.healer = false; thelastdab.setHealer(false);
thelastdab.clayAffinity = false; thelastdab.setClayAffinity(false);
thelastdab.waterGod = false; thelastdab.setWaterGod(false);
} }
/*if(Deities.getDeity(102) != null){ // Edit Cyberhusky player god /*if(Deities.getDeity(102) != null){ // Edit Cyberhusky player god
Deity cyberhusky = Deities.getDeity(102); Deity cyberhusky = Deities.getDeity(102);

View File

@@ -43,7 +43,7 @@ public class EconomicChanges {
float dam = item.getDamage(); float dam = item.getDamage();
// =($A$25*A2*A2 / 10000) // =($A$25*A2*A2 / 10000)
float initialValue = ((float)item.getTemplate().getValue())*qual*qual/10000f; float initialValue = ((float)item.getTemplate().getValue())*qual*qual/10000f;
float baseCost = 100000f; float baseCost = 50000f;
float power = 6.0f; float power = 6.0f;
// =((10+B2/4.5)*(1-POW(A2/100, $A$27)) + B2*POW(A2/100, $A$27)) * ((100 - $A$29) / 100) // =((10+B2/4.5)*(1-POW(A2/100, $A$27)) + B2*POW(A2/100, $A$27)) * ((100 - $A$29) / 100)
return (int) (((baseCost+(initialValue/4.5f)) * (1f-Math.pow(qual/100f, power)) + initialValue*Math.pow(qual/100f, power)) * ((100f-dam)/100f) * PRICE_MARKUP); return (int) (((baseCost+(initialValue/4.5f)) * (1f-Math.pow(qual/100f, power)) + initialValue*Math.pow(qual/100f, power)) * ((100f-dam)/100f) * PRICE_MARKUP);
@@ -87,11 +87,13 @@ public class EconomicChanges {
final Class<EconomicChanges> thisClass = EconomicChanges.class; final Class<EconomicChanges> thisClass = EconomicChanges.class;
String replace; String replace;
/* [2/4/19] Disabled - Likely causing issues with upkeep fluctuation.
Util.setReason("Increase deed upkeep by modifying the amount of tiles it thinks it has."); Util.setReason("Increase deed upkeep by modifying the amount of tiles it thinks it has.");
CtClass ctGuardPlan = classPool.get("com.wurmonline.server.villages.GuardPlan"); CtClass ctGuardPlan = classPool.get("com.wurmonline.server.villages.GuardPlan");
replace = "$_ = "+EconomicChanges.class.getName()+".getNewVillageTiles(vill.getNumTiles());"; replace = "$_ = "+EconomicChanges.class.getName()+".getNewVillageTiles(vill.getNumTiles());";
Util.instrumentDeclared(thisClass, ctGuardPlan, "getMonthlyCost", "getNumTiles", replace); Util.instrumentDeclared(thisClass, ctGuardPlan, "getMonthlyCost", "getNumTiles", replace);*/
/* [2/4/19] Disabled - Probably not necessary anymore.
Util.setReason("Disable upkeep on arena for now until a fix can be found."); Util.setReason("Disable upkeep on arena for now until a fix can be found.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
+ " $_ = false;" + " $_ = false;"
@@ -99,7 +101,7 @@ public class EconomicChanges {
" $_ = $proceed($$);" + " $_ = $proceed($$);" +
"}"; "}";
//replace = "$_ = false;"; //replace = "$_ = false;";
Util.instrumentDeclared(thisClass, ctGuardPlan, "getMonthlyCost", "isUpkeep", replace); Util.instrumentDeclared(thisClass, ctGuardPlan, "getMonthlyCost", "isUpkeep", replace);*/
/*Util.setReason("Allow players to get a full deed refund."); /*Util.setReason("Allow players to get a full deed refund.");
replace = "{ return "+EconomicChanges.class.getName()+".getNewDisbandMoney(this, this.getVillage()); }"; replace = "{ return "+EconomicChanges.class.getName()+".getNewDisbandMoney(this, this.getVillage()); }";

View File

@@ -253,10 +253,10 @@ public class ItemMod {
public static void createCustomWeapons(){ public static void createCustomWeapons(){
try { try {
logger.info("Beginning custom weapon creation."); logger.info("Beginning custom weapon creation.");
new Weapon(BattleYoyo.templateId, 6.85f, 3.85f, 0.008f, 2, 2, 0.0f, 0d); new Weapon(BattleYoyo.templateId, 6.85f, 3.75f, 0.012f, 2, 2, 0.0f, 0d);
new Weapon(Club.templateId, 8.1f, 4.5f, 0.002f, 3, 3, 0.4f, 0.5d); new Weapon(Club.templateId, 8.3f, 4.5f, 0.002f, 3, 3, 0.4f, 0.5d);
new Weapon(Knuckles.templateId, 3.7f, 2.2f, 0.002f, 1, 1, 0.2f, 0.5d); new Weapon(Knuckles.templateId, 3.8f, 2.2f, 0.002f, 1, 1, 0.2f, 0.5d);
new Weapon(Warhammer.templateId, 9.40f, 5.6f, 0.008f, 4, 3, 1f, 0d); new Weapon(Warhammer.templateId, 9.50f, 5.6f, 0.015f, 4, 3, 1f, 0d);
//new Weapon(ItemList.stoneChisel, 50f, 1f, 0.5f, 8, 1, 3f, -5f); //new Weapon(ItemList.stoneChisel, 50f, 1f, 0.5f, 8, 1, 3f, -5f);
// Titan weaponry // Titan weaponry
new Weapon(MaartensMight.templateId, 11, 5, 0.02f, 4, 4, 1.0f, 0d); new Weapon(MaartensMight.templateId, 11, 5, 0.02f, 4, 4, 1.0f, 0d);
@@ -327,6 +327,10 @@ public class ItemMod {
int newKindlingVolume = kindling.getSizeX()*kindling.getSizeY()*kindling.getSizeZ(); int newKindlingVolume = kindling.getSizeX()*kindling.getSizeY()*kindling.getSizeZ();
ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "volume"), newKindlingVolume); 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);
// Set silver mirror price to 10 silver instead of 1 iron. // Set silver mirror price to 10 silver instead of 1 iron.
ItemTemplate handMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.handMirror); ItemTemplate handMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.handMirror);
ReflectionUtil.setPrivateField(handMirror, ReflectionUtil.getField(handMirror.getClass(), "value"), 200000); ReflectionUtil.setPrivateField(handMirror, ReflectionUtil.getField(handMirror.getClass(), "value"), 200000);
@@ -342,6 +346,10 @@ public class ItemMod {
ItemTemplate resurrectionStone = ItemTemplateFactory.getInstance().getTemplate(ItemList.resurrectionStone); ItemTemplate resurrectionStone = ItemTemplateFactory.getInstance().getTemplate(ItemList.resurrectionStone);
ReflectionUtil.setPrivateField(resurrectionStone, ReflectionUtil.getField(resurrectionStone.getClass(), "value"), 20000); 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);
// Set transmutation rod to 2 gold instead of 50 silver. // Set transmutation rod to 2 gold instead of 50 silver.
//ItemTemplate transmutationRod = ItemTemplateFactory.getInstance().getTemplate(668); //ItemTemplate transmutationRod = ItemTemplateFactory.getInstance().getTemplate(668);
//ReflectionUtil.setPrivateField(transmutationRod, ReflectionUtil.getField(transmutationRod.getClass(), "value"), 2000000); //ReflectionUtil.setPrivateField(transmutationRod, ReflectionUtil.getField(transmutationRod.getClass(), "value"), 2000000);

View File

@@ -5,6 +5,7 @@ import com.wurmonline.server.bodys.Wound;
import com.wurmonline.server.creatures.Creature; import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.creatures.Creatures; import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.creatures.NoSuchCreatureException; import com.wurmonline.server.creatures.NoSuchCreatureException;
import com.wurmonline.server.creatures.SpellEffectsEnum;
import com.wurmonline.server.items.Item; import com.wurmonline.server.items.Item;
import com.wurmonline.server.items.ItemTemplate; import com.wurmonline.server.items.ItemTemplate;
import com.wurmonline.server.items.SimpleCreationEntry; import com.wurmonline.server.items.SimpleCreationEntry;
@@ -14,6 +15,7 @@ import com.wurmonline.server.players.PlayerInfoFactory;
import com.wurmonline.server.players.Titles; import com.wurmonline.server.players.Titles;
import com.wurmonline.server.skills.Skill; import com.wurmonline.server.skills.Skill;
import com.wurmonline.server.skills.SkillList; import com.wurmonline.server.skills.SkillList;
import com.wurmonline.server.spells.SpellEffect;
import com.wurmonline.server.villages.Village; import com.wurmonline.server.villages.Village;
import com.wurmonline.server.webinterface.WcKingdomChat; import com.wurmonline.server.webinterface.WcKingdomChat;
import com.wurmonline.server.zones.VolaTile; import com.wurmonline.server.zones.VolaTile;
@@ -310,6 +312,20 @@ public class MiscChanges {
return arrTitles.toArray(new Titles.Title[0]); return arrTitles.toArray(new Titles.Title[0]);
} }
public static boolean shouldSendBuff(SpellEffectsEnum effect){
// Continue not showing any that don't have a buff in the first place
if (!effect.isSendToBuffBar()){
return false;
}
// Resistances and vulnerabilities are 20 - 43
if (effect.getTypeId() <= 43 && effect.getTypeId() >= 20){
return false;
}
// Is send to buff bar and not something we're stopping, so allow it.
return true;
}
public static void preInit(){ public static void preInit(){
try{ try{
ClassPool classPool = HookManager.getInstance().getClassPool(); ClassPool classPool = HookManager.getInstance().getClassPool();
@@ -325,7 +341,8 @@ public class MiscChanges {
"Website/Maps: https://www.sarcasuals.com/", "Website/Maps: https://www.sarcasuals.com/",
"Server Discord: https://discord.gg/r8QNXAC", "Server Discord: https://discord.gg/r8QNXAC",
"Server Data: https://docs.google.com/spreadsheets/d/1yjqTHoxUan4LIldI3jgrXZgXj1M2ENQ4MXniPUz0rE4", "Server Data: https://docs.google.com/spreadsheets/d/1yjqTHoxUan4LIldI3jgrXZgXj1M2ENQ4MXniPUz0rE4",
"Server Wiki/Documentation: https://docs.google.com/document/d/1cbPi7-vZnjaiYrENhaefzjK_Wz7_F1CcPYJtC6uCi98/edit?usp=sharing"}; "Server Wiki/Documentation: https://docs.google.com/document/d/1cbPi7-vZnjaiYrENhaefzjK_Wz7_F1CcPYJtC6uCi98/edit?usp=sharing",
"Patreon: https://www.patreon.com/sindusk"};
StringBuilder str = new StringBuilder("{" StringBuilder str = new StringBuilder("{"
+ " com.wurmonline.server.Message mess;"); + " com.wurmonline.server.Message mess;");
for (String anInfoTabLine : infoTabLine) { for (String anInfoTabLine : infoTabLine) {
@@ -844,13 +861,13 @@ public class MiscChanges {
"}"; "}";
Util.insertBeforeDeclared(thisClass, ctEpicServerStatus, "getRandomItemTemplateUsed", replace); Util.insertBeforeDeclared(thisClass, ctEpicServerStatus, "getRandomItemTemplateUsed", replace);
Util.setReason("Fix bug causing high cast spells to reduce power."); /*Util.setReason("Fix bug causing high cast spells to reduce power.");
CtClass ctSpellEffect = classPool.get("com.wurmonline.server.spells.SpellEffect"); CtClass ctSpellEffect = classPool.get("com.wurmonline.server.spells.SpellEffect");
replace = "{" + replace = "{" +
" final float mod = 5.0f * (1.0f - java.lang.Math.min($0.getPower(), 100f) / 100.0f);" + " final float mod = 5.0f * (1.0f - java.lang.Math.min($0.getPower(), 100f) / 100.0f);" +
" $0.setPower(mod + $1);" + " $0.setPower(mod + $1);" +
"}"; "}";
Util.setBodyDeclared(thisClass, ctSpellEffect, "improvePower", replace); Util.setBodyDeclared(thisClass, ctSpellEffect, "improvePower", replace);*/
Util.setReason("Disable smelting pots from being used."); Util.setReason("Disable smelting pots from being used.");
CtClass ctItemBehaviour = classPool.get("com.wurmonline.server.behaviours.ItemBehaviour"); CtClass ctItemBehaviour = classPool.get("com.wurmonline.server.behaviours.ItemBehaviour");
@@ -880,6 +897,29 @@ public class MiscChanges {
"$_ = $proceed($$);"; "$_ = $proceed($$);";
Util.instrumentDeclared(thisClass, ctTitleCompoundQuestion, "sendQuestion", "sort", replace);*/ Util.instrumentDeclared(thisClass, ctTitleCompoundQuestion, "sendQuestion", "sort", replace);*/
/*Util.setReason("Remove buff bar spam from sorceries.");
replace = "$_ = false;";
Util.instrumentDeclared(thisClass, ctAbilities, "sendEffectsToCreature", "hasAnyAbility", replace);*/
Util.setReason("Hide buff bar icons for sorceries.");
CtClass ctSpellEffectsEnum = classPool.get("com.wurmonline.server.creatures.SpellEffectsEnum");
CtClass ctString = classPool.get("java.lang.String");
CtClass[] params15 = {
ctSpellEffectsEnum,
CtClass.intType,
ctString
};
String desc15 = Descriptor.ofMethod(CtClass.voidType, params15);
CtClass[] params16 = {
ctSpellEffectsEnum,
CtClass.intType
};
String desc16 = Descriptor.ofMethod(CtClass.voidType, params16);
replace = "$_ = "+MiscChanges.class.getName()+".shouldSendBuff($0);";
Util.instrumentDescribed(thisClass, ctCommunicator, "sendAddStatusEffect", desc15, "isSendToBuffBar", replace);
Util.setReason("Hide buff bar icons for sorceries.");
Util.instrumentDescribed(thisClass, ctCommunicator, "sendAddStatusEffect", desc16, "isSendToBuffBar", replace);
} catch (CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) { } catch (CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e); throw new HookException(e);
} }

View File

@@ -27,25 +27,25 @@ public class MountedChanges {
Item leftFoot = creature.getEquippedItem(BodyPartConstants.LEFT_FOOT); Item leftFoot = creature.getEquippedItem(BodyPartConstants.LEFT_FOOT);
leftFoot.setDamage(leftFoot.getDamage()+(leftFoot.getDamageModifier()*0.002f)); leftFoot.setDamage(leftFoot.getDamage()+(leftFoot.getDamageModifier()*0.002f));
gear.add(leftFoot); gear.add(leftFoot);
} catch (NoSuchItemException | NoSpaceException ignored) { } catch (NoSpaceException ignored) {
} }
try { try {
Item rightFoot = creature.getEquippedItem(BodyPartConstants.RIGHT_FOOT); Item rightFoot = creature.getEquippedItem(BodyPartConstants.RIGHT_FOOT);
rightFoot.setDamage(rightFoot.getDamage()+(rightFoot.getDamageModifier()*0.002f)); rightFoot.setDamage(rightFoot.getDamage()+(rightFoot.getDamageModifier()*0.002f));
gear.add(rightFoot); gear.add(rightFoot);
} catch (NoSuchItemException | NoSpaceException ignored) { } catch (NoSpaceException ignored) {
} }
try { try {
Item leftHand = creature.getEquippedItem(BodyPartConstants.LEFT_HAND); Item leftHand = creature.getEquippedItem(BodyPartConstants.LEFT_HAND);
leftHand.setDamage(leftHand.getDamage()+(leftHand.getDamageModifier()*0.002f)); leftHand.setDamage(leftHand.getDamage()+(leftHand.getDamageModifier()*0.002f));
gear.add(leftHand); gear.add(leftHand);
} catch (NoSuchItemException | NoSpaceException ignored) { } catch (NoSpaceException ignored) {
} }
try { try {
Item rightHand = creature.getEquippedItem(BodyPartConstants.RIGHT_HAND); Item rightHand = creature.getEquippedItem(BodyPartConstants.RIGHT_HAND);
rightHand.setDamage(rightHand.getDamage()+(rightHand.getDamageModifier()*0.002f)); rightHand.setDamage(rightHand.getDamage()+(rightHand.getDamageModifier()*0.002f));
gear.add(rightHand); gear.add(rightHand);
} catch (NoSuchItemException | NoSpaceException ignored) { } catch (NoSpaceException ignored) {
} }
for(Item shoe : gear){ for(Item shoe : gear){
factor += Math.max(10f, shoe.getCurrentQualityLevel()) / 2000f; factor += Math.max(10f, shoe.getCurrentQualityLevel()) / 2000f;
@@ -96,7 +96,7 @@ public class MountedChanges {
saddleFactor += saddle.getRarity() * 0.03f; saddleFactor += saddle.getRarity() * 0.03f;
factor *= saddleFactor; factor *= saddleFactor;
} }
} catch (NoSuchItemException | NoSpaceException ignored) { } catch (NoSpaceException ignored) {
} }
factor *= creature.getMovementScheme().getSpeedModifier(); factor *= creature.getMovementScheme().getSpeedModifier();
} }

View File

@@ -1,20 +1,192 @@
package mod.sin.wyvern; package mod.sin.wyvern;
import com.wurmonline.server.DbConnector;
import com.wurmonline.server.creatures.Creature; import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.players.Player; import com.wurmonline.server.players.Player;
import com.wurmonline.server.players.PlayerInfo;
import com.wurmonline.server.players.Titles; import com.wurmonline.server.players.Titles;
import com.wurmonline.server.utils.DbUtilities;
import javassist.CtClass;
import javassist.CtPrimitiveType;
import javassist.bytecode.Descriptor;
import mod.enumbuster.EnumBuster;
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modloader.classhooks.InvocationHandlerFactory;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
public class PlayerTitles { public class PlayerTitles {
public static Logger logger = Logger.getLogger(PlayerTitles.class.getName()); public static Logger logger = Logger.getLogger(PlayerTitles.class.getName());
private static Titles.Title[] titleArray;
// Player Title Maps
protected static ArrayList<String> donatorTitles = new ArrayList<>(); protected static ArrayList<String> donatorTitles = new ArrayList<>();
protected static ArrayList<String> patronTitles = new ArrayList<>();
protected static HashMap<String,Integer> customTitles = new HashMap<>(); protected static HashMap<String,Integer> customTitles = new HashMap<>();
protected static HashMap<String,String> playerTitles = new HashMap<>(); protected static HashMap<String,String> playerTitles = new HashMap<>();
// Event Title ID's
public static int TITAN_SLAYER = 10000;
public static int SPECTRAL = 10001;
public static int PASTAMANCER = 10002;
// Player Donation Title ID's
public static int PATRON = 19999;
public static int DONATOR = 20000;
public static int PAZZA_FAVORITE_GM = 20001;
public static int WARRIORGEN_THAT_GUY = 20002;
public static int ETERNALLOVE_WARRIORGENS_WIFE = 20003;
public static int BAMBAM_THORN_ONE = 20004;
public static int SVENJA_CARE_DEPENDANT = 20005;
public static int ALEXIA_THE_TREASURING = 20006;
public static int REEVI_SCIENCE_GUY = 20007;
public static int GENOCIDE_GRAND_DESIGNER = 20008;
public static int SELEAS_CRAZY_CAT_LORD = 20009;
public static int PIRATEMAX_SLAVE = 20010;
public static int ELTACOLAD_TRUE_TACO = 20011;
public static int ATTICUS_THE_GREAT_ILLUMINATY = 20012;
public static void onItemTemplatesCreated(){
interceptLoadTitles();
EnumBuster<Titles.Title> buster = new EnumBuster<>(Titles.Title.class, Titles.Title.class);
// Random titles for fun
//PlayerTitles.createTitle(buster, "Game_Master", 2500, "Game Master", "Game Master", -1, Titles.TitleType.NORMAL);
//PlayerTitles.createTitle(buster, "Developer", 2501, "Developer", "Developer", -1, Titles.TitleType.NORMAL);
//PlayerTitles.createTitle(buster, "Pet_Me", 2502, "Pet Me", "Pet Me", -1, Titles.TitleType.NORMAL);
// Event Titles
createTitle(buster, "Titan_Slayer", TITAN_SLAYER, "Titanslayer", "Titanslayer", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Spectral", SPECTRAL, "Spectral", "Spectral", -1, Titles.TitleType.NORMAL);
//PlayerTitles.createTitle(buster, "Holdstrong_Architect", 702, "Holdstrong Architect", "Holdstrong Architect", -1, Titles.TitleType.NORMAL);
//PlayerTitles.createTitle(buster, "Stronghold_Architect", 703, "Stronghold Architect", "Stronghold Architect", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Pastamancer", PASTAMANCER, "Pastamancer", "Pastamancer", -1, Titles.TitleType.NORMAL);
// Donation Titles
createTitle(buster, "Patron", PATRON, "Patron", "Patron", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Donator", DONATOR, "Donator", "Donator", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Pazza_FavoriteGM", PAZZA_FAVORITE_GM, "Sindusks Favourite GM", "Sindusks Favourite GM", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Warriorgen_ThatGuy", WARRIORGEN_THAT_GUY, "That Guy", "That Guy", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Eternallove_WarriorgensWife", ETERNALLOVE_WARRIORGENS_WIFE, "Warriorgens Wife", "Warriorgens Wife", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Bambam_ThornOne", BAMBAM_THORN_ONE, "Thorn One", "Thorn One", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Svenja_CareDependant", SVENJA_CARE_DEPENDANT, "The care-dependent", "The care-dependent", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Alexia_TheTreasuring", ALEXIA_THE_TREASURING, "The Treasuring", "The Treasuring", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Reevi_ScienceGuy", REEVI_SCIENCE_GUY, "Science Guy", "Science Guy", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Genocide_GrandDesigner", GENOCIDE_GRAND_DESIGNER, "Grand Designer", "Grand Designer", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Seleas_CrazyCatLord", SELEAS_CRAZY_CAT_LORD, "The Crazy Cat Lord", "The Crazy Cat Lord", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Piratemax_Slave", PIRATEMAX_SLAVE, "Slave", "Slave", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Eltacolad_TrueTaco", ELTACOLAD_TRUE_TACO, "The One True Taco", "The One True Taco", -1, Titles.TitleType.NORMAL);
createTitle(buster, "Atticus_The_Great_Illuminaty", ATTICUS_THE_GREAT_ILLUMINATY, "The Great Illuminaty", "The Great Illuminaty", -1, Titles.TitleType.NORMAL);
// Supporter titles
logger.info(Arrays.toString(Titles.Title.values()));
titleArray = Titles.Title.values();
}
private static void createTitle(EnumBuster<Titles.Title> buster, String enumName, int id, String titleMale, String titleFemale, int skillId, Titles.TitleType type) {
Titles.Title testTitle = buster.make(enumName, 0, new Class[]{Integer.TYPE, String.class, String.class, Integer.TYPE, Titles.TitleType.class}, new Object[]{id, titleMale, titleFemale, skillId, type});
buster.addByValue(testTitle);
logger.log(Level.INFO, String.format("Created new title with ID #%d: %s [\"%s\", \"%s\"]", id, enumName, titleMale, titleFemale));
}
public static boolean hasTitle(Creature c, int titleId) {
if (c.isPlayer()) {
Titles.Title[] titles;
Titles.Title[] arrtitle = titles = ((Player)c).getTitles();
int n = arrtitle.length;
int n2 = 0;
while (n2 < n) {
Titles.Title title = arrtitle[n2];
if (title == null) {
throw new RuntimeException("We have NULL in titles collection, that is not nice at all!");
}
if (title.getTitleId() == titleId) {
return true;
}
++n2;
}
} else {
return true;
}
return false;
}
private static void interceptLoadTitles() {
String descriptor = Descriptor.ofMethod((CtClass)CtPrimitiveType.voidType, (CtClass[])new CtClass[]{CtClass.longType});
HookManager.getInstance().registerHook("com.wurmonline.server.players.DbPlayerInfo", "loadTitles", descriptor, new InvocationHandlerFactory(){
public InvocationHandler createInvocationHandler() {
return new InvocationHandler(){
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Object result;
block8 : {
ResultSet rs;
Connection dbcon;
PreparedStatement ps;
result = method.invoke(proxy, args);
PlayerInfo pi = (PlayerInfo)proxy;
Set<Titles.Title> titles = ReflectionUtil.getPrivateField(pi, ReflectionUtil.getField(pi.getClass(), "titles"));
titles.remove(null);
dbcon = null;
ps = null;
rs = null;
try {
try {
dbcon = DbConnector.getPlayerDbCon();
ps = dbcon.prepareStatement("select TITLEID from TITLES where WURMID=?");
ps.setLong(1, pi.getPlayerId());
rs = ps.executeQuery();
while (rs.next()) {
if (Titles.Title.getTitle(rs.getInt("TITLEID")) != null){
continue;
}
titles.add(PlayerTitles.getTitle(rs.getInt("TITLEID")));
}
}
catch (SQLException ex) {
logger.log(Level.INFO, "Failed to load titles for " + pi.getPlayerId(), ex);
DbUtilities.closeDatabaseObjects(ps, rs);
DbConnector.returnConnection(dbcon);
break block8;
}
}
catch (Throwable throwable) {
DbUtilities.closeDatabaseObjects(ps, rs);
DbConnector.returnConnection(dbcon);
throw throwable;
}
DbUtilities.closeDatabaseObjects(ps, rs);
DbConnector.returnConnection(dbcon);
}
return result;
}
};
}
});
}
public static Titles.Title getTitle(int titleAsInt) {
int i = 0;
while (i < titleArray.length) {
if (titleAsInt == titleArray[i].getTitleId()) {
return titleArray[i];
}
++i;
}
throw new RuntimeException("Could not find title: " + titleAsInt);
}
public static boolean hasCustomTitle(Creature creature){ public static boolean hasCustomTitle(Creature creature){
if(creature instanceof Player){ if(creature instanceof Player){
Player p = (Player) creature; Player p = (Player) creature;
@@ -30,61 +202,62 @@ public class PlayerTitles {
return ""; return "";
} }
public static void awardCustomTitles(Player p){ public static void awardCustomTitles(Player p){
/* Disabled until a fix for title implementations is done.
String name = p.getName(); String name = p.getName();
if(donatorTitles.contains(name)){ if(donatorTitles.contains(name)){
Titles.Title donator = Titles.Title.getTitle(800); Titles.Title donator = getTitle(DONATOR);
p.addTitle(donator); p.addTitle(donator);
} }
if(patronTitles.contains(name)){
Titles.Title patron = getTitle(PATRON);
p.addTitle(patron);
}
if(customTitles.containsKey(name)){ if(customTitles.containsKey(name)){
Titles.Title customTitle = Titles.Title.getTitle(customTitles.get(name)); Titles.Title customTitle = getTitle(customTitles.get(name));
p.addTitle(customTitle); p.addTitle(customTitle);
}*/ }
} }
public static void preInit(){ public static void preInit(){
// Donations // Donations
playerTitles.put("Sindusk", "Phenomenal Feline");
customTitles.put("Sindawn", 501); // Developer
playerTitles.put("Sindawn", "Pet Me");
donatorTitles.add("Pazza"); donatorTitles.add("Pazza");
customTitles.put("Pazza", 801); // Sindusks Favorite GM customTitles.put("Pazza", PAZZA_FAVORITE_GM); // Sindusks Favorite GM
donatorTitles.add("Warriorgen"); donatorTitles.add("Warriorgen");
customTitles.put("Warriorgen", 802); // That Guy customTitles.put("Warriorgen", WARRIORGEN_THAT_GUY); // That Guy
donatorTitles.add("Eternallove"); donatorTitles.add("Eternallove");
customTitles.put("Eternallove", 803); // Warriorgens Wife customTitles.put("Eternallove", ETERNALLOVE_WARRIORGENS_WIFE); // Warriorgens Wife
donatorTitles.add("Bambam"); donatorTitles.add("Bambam");
customTitles.put("Bambam", 804); // Thorn One customTitles.put("Bambam", BAMBAM_THORN_ONE); // Thorn One
donatorTitles.add("Svenja"); donatorTitles.add("Svenja");
customTitles.put("Svenja", 805); // The care-dependent customTitles.put("Svenja", SVENJA_CARE_DEPENDANT); // The care-dependent
playerTitles.put("Svenja", "Akuma"); playerTitles.put("Svenja", "Akuma");
donatorTitles.add("Alexiaselena"); donatorTitles.add("Alexiaselena");
customTitles.put("Alexiaselena", 806); // The Treasuring customTitles.put("Alexiaselena", ALEXIA_THE_TREASURING); // The Treasuring
playerTitles.put("Alexiaselena", "Kami"); playerTitles.put("Alexiaselena", "Kami");
donatorTitles.add("Reevi"); donatorTitles.add("Reevi");
customTitles.put("Reevi", 807); // Science Guy customTitles.put("Reevi", REEVI_SCIENCE_GUY); // Science Guy
customTitles.put("Genocide", 808); // Grand Designer customTitles.put("Genocide", GENOCIDE_GRAND_DESIGNER); // Grand Designer
donatorTitles.add("Seleas"); donatorTitles.add("Seleas");
customTitles.put("Seleas", 809); // The Crazy Cat Lord customTitles.put("Seleas", SELEAS_CRAZY_CAT_LORD); // The Crazy Cat Lord
playerTitles.put("Seleas", "No, Really"); playerTitles.put("Seleas", "No, Really");
donatorTitles.add("Piratemax"); donatorTitles.add("Piratemax");
customTitles.put("Piratemax", 810); // Slave customTitles.put("Piratemax", PIRATEMAX_SLAVE); // Slave
playerTitles.put("Piratemax", "Boy Next Door"); playerTitles.put("Piratemax", "Boy Next Door");
donatorTitles.add("Eltacolad"); donatorTitles.add("Eltacolad");
customTitles.put("Eltacolad", 811); // The One True Taco customTitles.put("Eltacolad", ELTACOLAD_TRUE_TACO); // The One True Taco
patronTitles.add("Atticus");
customTitles.put("Atticus", ATTICUS_THE_GREAT_ILLUMINATY); // The Great Illuminaty
// Other rewards // Other rewards
customTitles.put("Critias", 602); customTitles.put("Critias", PASTAMANCER);
} }
} }

View File

@@ -146,10 +146,12 @@ public class QualityOfLife {
replace = "{ return this.template.holyItem; }"; replace = "{ return this.template.holyItem; }";
Util.setBodyDescribed(thisClass, ctItem, "isHolyItem", desc100, replace); Util.setBodyDescribed(thisClass, ctItem, "isHolyItem", desc100, replace);
/* Disabled in Wurm Unlimited 1.9 - Priest Rework changes removed this restriction.
Util.setReason("Remove requirement for Libila priests to bless creatures before taming."); Util.setReason("Remove requirement for Libila priests to bless creatures before taming.");
CtClass ctMethodsCreatures = classPool.get("com.wurmonline.server.behaviours.MethodsCreatures"); CtClass ctMethodsCreatures = classPool.get("com.wurmonline.server.behaviours.MethodsCreatures");
replace = "$_ = false;"; replace = "$_ = false;";
Util.instrumentDeclared(thisClass, ctMethodsCreatures, "tame", "isPriest", replace); Util.instrumentDeclared(thisClass, ctMethodsCreatures, "tame", "isPriest", replace);*/
Util.setReason("Send gems, source crystals, flint, etc. into vehicle."); Util.setReason("Send gems, source crystals, flint, etc. into vehicle.");
CtClass[] params2 = { CtClass[] params2 = {

View File

@@ -122,6 +122,8 @@ public class RareSpawns {
+ "}"; + "}";
Util.insertBeforeDeclared(thisClass, ctWormBrains, "precondition", replace); Util.insertBeforeDeclared(thisClass, ctWormBrains, "precondition", replace);
/* Disabled in Wurm Unlimited 1.9 - No longer necessary while using DUSKombat.
Util.setReason("Increase titan extra damage to pets."); Util.setReason("Increase titan extra damage to pets.");
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
CtClass ctString = classPool.get("java.lang.String"); CtClass ctString = classPool.get("java.lang.String");
@@ -148,7 +150,7 @@ public class RareSpawns {
//" logger.info(\"Detected rare spawn hit on a pet. Adding damage.\");" + //" logger.info(\"Detected rare spawn hit on a pet. Adding damage.\");" +
" $5 = $5 * 2d;" + " $5 = $5 * 2d;" +
"}"; "}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace); Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);*/
}catch (NotFoundException e) { }catch (NotFoundException e) {
throw new HookException(e); throw new HookException(e);
} }

View File

@@ -153,7 +153,7 @@ public class Titans {
if (lCret.isUnique() || lCret.isInvulnerable() || lCret == titan || isTitanMinion(lCret)){ if (lCret.isUnique() || lCret.isInvulnerable() || lCret == titan || isTitanMinion(lCret)){
return; return;
} }
lCret.addWoundOfType(lCret, Wound.TYPE_INFECTION, 1, true, 1.0f, true, 50000f); lCret.addWoundOfType(lCret, Wound.TYPE_INFECTION, 1, true, 1.0f, true, 50000f, 0f, 0f, true, true);
/*if (!lCret.addWoundOfType(lCret, Wound.TYPE_INFECTION, 1, true, 1.0f, true, 50000f)) { /*if (!lCret.addWoundOfType(lCret, Wound.TYPE_INFECTION, 1, true, 1.0f, true, 50000f)) {
Creatures.getInstance().setCreatureDead(lCret); Creatures.getInstance().setCreatureDead(lCret);
Players.getInstance().setCreatureDead(lCret); Players.getInstance().setCreatureDead(lCret);
@@ -291,7 +291,7 @@ public class Titans {
} }
t.sendAttachCreatureEffect(lCret, (byte) 8, (byte) 0, (byte) 0, (byte) 0, (byte) 0); t.sendAttachCreatureEffect(lCret, (byte) 8, (byte) 0, (byte) 0, (byte) 0, (byte) 0);
try { try {
if (lCret.addWoundOfType(titan, Wound.TYPE_INFECTION, lCret.getBody().getRandomWoundPos(), false, 1.0f, false, 25000.0 * (double)lCret.addSpellResistance((short) 448))){ if (lCret.addWoundOfType(titan, Wound.TYPE_INFECTION, lCret.getBody().getRandomWoundPos(), false, 1.0f, false, 25000.0 * (double)lCret.addSpellResistance((short) 448), 0f, 0f, true, true)){
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
@@ -389,7 +389,7 @@ public class Titans {
Server.getInstance().broadCastAction(titan.getName() + " picks a target at random and Smites "+target.getName()+"!", titan, 50); Server.getInstance().broadCastAction(titan.getName() + " picks a target at random and Smites "+target.getName()+"!", titan, 50);
target.getCommunicator().sendAlertServerMessage(titan.getName() + " smites you.", (byte) 4); target.getCommunicator().sendAlertServerMessage(titan.getName() + " smites you.", (byte) 4);
try { try {
target.addWoundOfType(titan, Wound.TYPE_BURN, target.getBody().getRandomWoundPos(), false, 1.0f, false, maxdam); target.addWoundOfType(titan, Wound.TYPE_BURN, target.getBody().getRandomWoundPos(), false, 1.0f, false, maxdam, 0f, 0f, true, true);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -830,13 +830,15 @@ public class Titans {
+ "}"; + "}";
Util.insertBeforeDeclared(thisClass, ctSmite, "precondition", replace);*/ Util.insertBeforeDeclared(thisClass, ctSmite, "precondition", replace);*/
/* Disabled in Wurm Unlimited 1.9 - No longer necessary as spells are balanced.
Util.setReason("Disable casting Worm Brains on titans."); Util.setReason("Disable casting Worm Brains on titans.");
CtClass ctWormBrains = classPool.get("com.wurmonline.server.spells.WormBrains"); CtClass ctWormBrains = classPool.get("com.wurmonline.server.spells.WormBrains");
replace = "if("+Titans.class.getName()+".isTitan($3)){" replace = "if("+Titans.class.getName()+".isTitan($3)){"
+ " $2.getCommunicator().sendNormalServerMessage(\"Titans are immune to that spell.\");" + " $2.getCommunicator().sendNormalServerMessage(\"Titans are immune to that spell.\");"
+ " return false;" + " return false;"
+ "}"; + "}";
Util.insertBeforeDeclared(thisClass, ctWormBrains, "precondition", replace); Util.insertBeforeDeclared(thisClass, ctWormBrains, "precondition", replace);*/
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature"); CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
Util.setReason("Add spell resistance to titans."); Util.setReason("Add spell resistance to titans.");
@@ -845,6 +847,8 @@ public class Titans {
"}"; "}";
Util.insertBeforeDeclared(thisClass, ctCreature, "addSpellResistance", replace); Util.insertBeforeDeclared(thisClass, ctCreature, "addSpellResistance", replace);
/* Disabled in Wurm Unlimited 1.9 - No longer needed while using DUSKombat.
Util.setReason("Increase titan extra damage to pets."); Util.setReason("Increase titan extra damage to pets.");
CtClass ctString = classPool.get("java.lang.String"); CtClass ctString = classPool.get("java.lang.String");
CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle"); CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle");
@@ -870,7 +874,7 @@ public class Titans {
" logger.info(\"Detected titan hit on a pet. Adding damage.\");" + " logger.info(\"Detected titan hit on a pet. Adding damage.\");" +
" $5 = $5 * 2d;" + " $5 = $5 * 2d;" +
"}"; "}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace); Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);*/
}catch (NotFoundException e) { }catch (NotFoundException e) {
throw new HookException(e); throw new HookException(e);

View File

@@ -12,10 +12,8 @@ import java.util.logging.Logger;
import java.util.logging.SimpleFormatter; import java.util.logging.SimpleFormatter;
import com.wurmonline.server.Message; import com.wurmonline.server.Message;
import com.wurmonline.server.creatures.Communicator;
import com.wurmonline.server.creatures.Creature; import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.items.*; import com.wurmonline.server.items.*;
import com.wurmonline.server.kingdom.Kingdoms;
import mod.sin.actions.items.SorcerySplitAction; import mod.sin.actions.items.SorcerySplitAction;
import mod.sin.lib.Util; import mod.sin.lib.Util;
import org.gotti.wurmunlimited.modloader.ReflectionUtil; import org.gotti.wurmunlimited.modloader.ReflectionUtil;
@@ -248,6 +246,8 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
ItemMod.createItems(); ItemMod.createItems();
logger.info("Creating Cache items."); logger.info("Creating Cache items.");
Caches.createItems(); Caches.createItems();
logger.info("Initiating Title changes.");
PlayerTitles.onItemTemplatesCreated();
try { try {
logger.info("Editing existing item templates."); logger.info("Editing existing item templates.");
ItemMod.modifyItems(); ItemMod.modifyItems();

View File

@@ -458,6 +458,17 @@ public class MethodsBestiary {
} }
} }
private static void setCombatRating(int templateId, float value){
try{
CreatureTemplate template = CreatureTemplateFactory.getInstance().getTemplate(templateId);
if(template != null){
ReflectionUtil.setPrivateField(template, ReflectionUtil.getField(template.getClass(), "baseCombatRating"), value);
}
} catch (NoSuchCreatureTemplateException | IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
e.printStackTrace();
}
}
private static void setNaturalArmour(int templateId, float value){ private static void setNaturalArmour(int templateId, float value){
try{ try{
CreatureTemplate template = CreatureTemplateFactory.getInstance().getTemplate(templateId); CreatureTemplate template = CreatureTemplateFactory.getInstance().getTemplate(templateId);
@@ -646,6 +657,9 @@ public class MethodsBestiary {
// Set skills for certain creatures // Set skills for certain creatures
setSkill(CreatureTemplate.CYCLOPS_CID, SkillList.GROUP_FIGHTING, 80.0f); setSkill(CreatureTemplate.CYCLOPS_CID, SkillList.GROUP_FIGHTING, 80.0f);
// Set combat rating for valrei creatures to improve their bounty
setCombatRating(CreatureTemplate.SON_OF_NOGUMP_CID, 30.0f);
} }
protected static void sendParticleEffect(Communicator comm, long creatureId, Creature creature, String particle, float duration){ protected static void sendParticleEffect(Communicator comm, long creatureId, Creature creature, String particle, float duration){
@@ -737,6 +751,15 @@ public class MethodsBestiary {
}); });
} }
// Die method description
CtClass ctString = classPool.get("java.lang.String");
CtClass[] params5 = new CtClass[]{
CtClass.booleanType,
ctString,
CtClass.booleanType
};
String desc5 = Descriptor.ofMethod(CtClass.voidType, params5);
Util.setReason("Deny chargers walking through walls."); Util.setReason("Deny chargers walking through walls.");
CtClass ctPathFinder = classPool.get("com.wurmonline.server.creatures.ai.PathFinder"); CtClass ctPathFinder = classPool.get("com.wurmonline.server.creatures.ai.PathFinder");
replace = "if("+MethodsBestiary.class.getName()+".denyPathingOverride($0)){" + replace = "if("+MethodsBestiary.class.getName()+".denyPathingOverride($0)){" +
@@ -749,7 +772,7 @@ public class MethodsBestiary {
Util.instrumentDeclared(thisClass, ctCreature, "startPathingToTile", "isGhost", replace); Util.instrumentDeclared(thisClass, ctCreature, "startPathingToTile", "isGhost", replace);
Util.instrumentDeclared(thisClass, ctCreature, "moveAlongPath", "isGhost", replace); Util.instrumentDeclared(thisClass, ctCreature, "moveAlongPath", "isGhost", replace);
Util.instrumentDeclared(thisClass, ctCreature, "takeSimpleStep", "isGhost", replace); Util.instrumentDeclared(thisClass, ctCreature, "takeSimpleStep", "isGhost", replace);
Util.instrumentDeclared(thisClass, ctCreature, "die", "isGhost", replace); Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "isGhost", replace);
Util.setReason("Apply random types to creatures in the wilderness."); Util.setReason("Apply random types to creatures in the wilderness.");
CtClass[] params2 = { CtClass[] params2 = {
@@ -809,7 +832,7 @@ public class MethodsBestiary {
+ "if("+MethodsBestiary.class.getName()+".hasCustomCorpseSize(this)){" + "if("+MethodsBestiary.class.getName()+".hasCustomCorpseSize(this)){"
+ " "+MethodsBestiary.class.getName()+".setCorpseSizes(this, corpse);" + " "+MethodsBestiary.class.getName()+".setCorpseSizes(this, corpse);"
+ "}"; + "}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "addItem", replace); Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "addItem", replace);
Util.setReason("Add spell resistance to custom creatures."); Util.setReason("Add spell resistance to custom creatures.");
replace = "float cResist = "+MethodsBestiary.class.getName()+".getCustomSpellResistance(this);" + replace = "float cResist = "+MethodsBestiary.class.getName()+".getCustomSpellResistance(this);" +
@@ -833,7 +856,7 @@ public class MethodsBestiary {
+ "}else{" + "}else{"
+ " $_ = $proceed($$);" + " $_ = $proceed($$);"
+ "}"; + "}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "isGhost", replace); Util.instrumentDescribed(thisClass, ctCreature, "die", desc5, "isGhost", replace);
Util.setReason("Attach special effects to creatures."); Util.setReason("Attach special effects to creatures.");
CtClass ctVirtualZone = classPool.get("com.wurmonline.server.zones.VirtualZone"); CtClass ctVirtualZone = classPool.get("com.wurmonline.server.zones.VirtualZone");

View File

@@ -307,9 +307,12 @@ public class LootBounty {
if(crystalStr > 10000){ // 1 silver if(crystalStr > 10000){ // 1 silver
numCrystals += doRollingCrystalReward(mob, corpse, crystalStr, EnchantersCrystal.templateId, 5, 20000); numCrystals += doRollingCrystalReward(mob, corpse, crystalStr, EnchantersCrystal.templateId, 5, 20000);
}*/ }*/
boolean sendLootHelp = false; boolean sendLootHelp = false;
// Begin loot table drops // Begin loot table drops
int templateId = mob.getTemplate().getTemplateId(); int templateId = mob.getTemplate().getTemplateId();
// Arena damages player equipment on death
if(Servers.localServer.PVPSERVER && mob.isPlayer()){ if(Servers.localServer.PVPSERVER && mob.isPlayer()){
if(mob.isDeathProtected()) { if(mob.isDeathProtected()) {
logger.info("Death protection was active for " + mob.getName() + ". Inserting silver coin reward."); logger.info("Death protection was active for " + mob.getName() + ". Inserting silver coin reward.");

View File

@@ -17,10 +17,7 @@ import mod.sin.creatures.SpectralDrake;
import mod.sin.items.AffinityOrb; import mod.sin.items.AffinityOrb;
import mod.sin.items.caches.RiftCache; import mod.sin.items.caches.RiftCache;
import mod.sin.items.caches.TitanCache; import mod.sin.items.caches.TitanCache;
import mod.sin.wyvern.Bounty; import mod.sin.wyvern.*;
import mod.sin.wyvern.MiscChanges;
import mod.sin.wyvern.RareSpawns;
import mod.sin.wyvern.Titans;
import mod.sin.wyvern.util.ItemUtil; import mod.sin.wyvern.util.ItemUtil;
import java.io.IOException; import java.io.IOException;
@@ -109,7 +106,7 @@ public class PlayerBounty {
fightStrength = "legendary"; fightStrength = "legendary";
} }
player.getCommunicator().sendSafeServerMessage("The spirit recognizes you as a "+fightStrength+" warrior, and rewards you accordingly."); player.getCommunicator().sendSafeServerMessage("The spirit recognizes you as a "+fightStrength+" warrior, and rewards you accordingly.");
//player.addTitle(Title.getTitle(701)); player.addTitle(PlayerTitles.getTitle(PlayerTitles.SPECTRAL));
}catch (NoSuchTemplateException | FailedException e) { }catch (NoSuchTemplateException | FailedException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -148,7 +145,7 @@ public class PlayerBounty {
player.getInventory().insertItem(riftCache, true); player.getInventory().insertItem(riftCache, true);
} }
if(Titans.isTitan(mob)){ if(Titans.isTitan(mob)){
//player.addTitle(Title.getTitle(700)); player.addTitle(PlayerTitles.getTitle(PlayerTitles.TITAN_SLAYER));
Item affinityOrb = ItemFactory.createItem(AffinityOrb.templateId, 99f, mob.getName()); Item affinityOrb = ItemFactory.createItem(AffinityOrb.templateId, 99f, mob.getName());
player.getInventory().insertItem(affinityOrb, true); player.getInventory().insertItem(affinityOrb, true);
Item titanCache = ItemFactory.createItem(TitanCache.templateId, 99f, mob.getName()); Item titanCache = ItemFactory.createItem(TitanCache.templateId, 99f, mob.getName());

View File

@@ -68,7 +68,7 @@ public class Mastercraft {
} }
return mult; return mult;
} }
public static void addNewTitles(){ /*public static void addNewTitles(){
try { try {
ExtendTitleEnum.builder("com.wurmonline.server.players.Titles$Title"); ExtendTitleEnum.builder("com.wurmonline.server.players.Titles$Title");
// GM/Developer Titles // GM/Developer Titles
@@ -146,7 +146,8 @@ public class Mastercraft {
} catch (BadBytecode | ClassNotFoundException | NotFoundException | CannotCompileException e) { } catch (BadBytecode | ClassNotFoundException | NotFoundException | CannotCompileException e) {
logger.warning(e.getMessage()); logger.warning(e.getMessage());
} }
} }*/
public static void changeExistingTitles(){ public static void changeExistingTitles(){
for (Titles.Title title : Titles.Title.values()) { for (Titles.Title title : Titles.Title.values()) {
if (Objects.equals("Pumpkin King", title.getFemaleName())){ if (Objects.equals("Pumpkin King", title.getFemaleName())){