Testing Bdew's title injector, might work better now that EnumExtend seems to be broken
This commit is contained in:
@@ -66,6 +66,10 @@ public class StableContractAction implements ModAction, BehaviourProvider, Actio
|
|||||||
performer.getCommunicator().sendNormalServerMessage("You cannot summon the stable master right now!");
|
performer.getCommunicator().sendNormalServerMessage("You cannot summon the stable master right now!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(performer.getCurrentVillage() == null) {
|
||||||
|
performer.getCommunicator().sendNormalServerMessage("You must be part of a settlement to summon a stablemaster.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if(counter == 1.0f) {
|
if(counter == 1.0f) {
|
||||||
performer.getCommunicator().sendNormalServerMessage("You begin reading the contract...");
|
performer.getCommunicator().sendNormalServerMessage("You begin reading the contract...");
|
||||||
final int time = 5;
|
final int time = 5;
|
||||||
|
|||||||
@@ -313,8 +313,9 @@ public class AchievementChanges {
|
|||||||
public static Titles.Title getAwardedTitle(Achievement a) {
|
public static Titles.Title getAwardedTitle(Achievement a) {
|
||||||
int count = a.getCounter();
|
int count = a.getCounter();
|
||||||
if(a.getTemplate() == gremlinSlayer) {
|
if(a.getTemplate() == gremlinSlayer) {
|
||||||
|
logger.info("Achievement at " + count);
|
||||||
if(count >= 100) {
|
if(count >= 100) {
|
||||||
return Titles.Title.getTitle(Mastercraft.GremlinSlayer);
|
return Titles.Title.getTitle(704);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -325,8 +326,10 @@ public class AchievementChanges {
|
|||||||
Achievements achievments = Achievements.getAchievementObject(player.getWurmId());
|
Achievements achievments = Achievements.getAchievementObject(player.getWurmId());
|
||||||
Achievement achievment = achievments.getAchievement(tpl.getNumber());
|
Achievement achievment = achievments.getAchievement(tpl.getNumber());
|
||||||
if (achievment != null) {
|
if (achievment != null) {
|
||||||
|
logger.info("Achievemtn found");
|
||||||
Titles.Title title = getAwardedTitle(achievment);
|
Titles.Title title = getAwardedTitle(achievment);
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
|
logger.info("Adding title");
|
||||||
player.addTitle(title);
|
player.addTitle(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,6 +334,26 @@ public class CombatChanges {
|
|||||||
replace = "$_ = true;";
|
replace = "$_ = true;";
|
||||||
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "isThisAnEpicOrChallengeServer", replace);
|
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "isThisAnEpicOrChallengeServer", replace);
|
||||||
|
|
||||||
|
CtClass ctAttackAction = classPool.get("com.wurmonline.server.creatures.AttackAction");
|
||||||
|
CtClass[] paramsWoa1 = {
|
||||||
|
ctAttackAction,
|
||||||
|
ctItem
|
||||||
|
};
|
||||||
|
CtClass[] paramsWoa2 = {
|
||||||
|
ctItem
|
||||||
|
};
|
||||||
|
String descWoa1 = Descriptor.ofMethod(CtClass.floatType, paramsWoa1);
|
||||||
|
String descWoa2 = Descriptor.ofMethod(CtClass.floatType, paramsWoa2);
|
||||||
|
Util.setReason("Adjust WoA effect on weapons to be more noticeable");
|
||||||
|
replace = "$_ = $proceed($$) * 2;";
|
||||||
|
Util.instrumentDescribedCount(thisClass, ctCombatHandler, "getSpeed", descWoa1,"getSpellSpeedBonus", 2, replace);
|
||||||
|
Util.instrumentDescribedCount(thisClass, ctCombatHandler, "getSpeed", descWoa2,"getSpellSpeedBonus", 2, replace);
|
||||||
|
|
||||||
|
Util.setReason("Adjust bloodthirst cap up to 17k from 10k");
|
||||||
|
replace = "$1 = 17000;" +
|
||||||
|
"$_ = $proceed($$);";
|
||||||
|
Util.instrumentDeclaredCount(thisClass, ctCombatHandler, "setDamage", "min", 5, replace);
|
||||||
|
|
||||||
Util.setReason("Fix magranon damage bonus stacking.");
|
Util.setReason("Fix magranon damage bonus stacking.");
|
||||||
replace = "if(mildStack){" +
|
replace = "if(mildStack){" +
|
||||||
" $_ = $proceed($$) * 8 / 5;" +
|
" $_ = $proceed($$) * 8 / 5;" +
|
||||||
@@ -343,7 +363,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.");
|
Util.setReason("Adjust bloodthirst to epic settings.");
|
||||||
CtClass ctAttackAction = classPool.get("com.wurmonline.server.creatures.AttackAction");
|
|
||||||
CtClass[] params3 = {
|
CtClass[] params3 = {
|
||||||
ctCreature,
|
ctCreature,
|
||||||
ctAttackAction,
|
ctAttackAction,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.List;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.wurmonline.server.Servers;
|
import com.wurmonline.server.Servers;
|
||||||
|
import com.wurmonline.server.combat.ArmourTemplate;
|
||||||
import mod.sin.actions.items.magicitems.MagicItemMenuProvider;
|
import mod.sin.actions.items.magicitems.MagicItemMenuProvider;
|
||||||
import mod.sin.actions.items.magicitems.MagicItemRechargeAction;
|
import mod.sin.actions.items.magicitems.MagicItemRechargeAction;
|
||||||
import mod.sin.items.schematicitems.SchematicItems;
|
import mod.sin.items.schematicitems.SchematicItems;
|
||||||
|
|||||||
@@ -284,9 +284,7 @@ public class MiscChanges {
|
|||||||
// Sleep powder added
|
// Sleep powder added
|
||||||
toRestock.add(new TraderItem(ItemList.sleepPowder, 99, false, 99, 99, 20));
|
toRestock.add(new TraderItem(ItemList.sleepPowder, 99, false, 99, 99, 20));
|
||||||
logger.info("Adding sleep powder to trader restock list");
|
logger.info("Adding sleep powder to trader restock list");
|
||||||
// Kingdom tokens added
|
// Kingdom tokens Removed
|
||||||
toRestock.add(new TraderItem(ItemCreator.KINGDOM_TOKEN.getTemplateId(), 99, false, 99, 99, 20));
|
|
||||||
logger.info("Adding kingdom tokens to trader restock list");
|
|
||||||
// Sealed maps added, use ranom qualities between 10 and 100 (inclusive)
|
// Sealed maps added, use ranom qualities between 10 and 100 (inclusive)
|
||||||
toRestock.add(new TraderItem(SealedMap.templateId, 99, true, 10, 101, 3));
|
toRestock.add(new TraderItem(SealedMap.templateId, 99, true, 10, 101, 3));
|
||||||
logger.info("Adding sealed maps to trader restock list");
|
logger.info("Adding sealed maps to trader restock list");
|
||||||
@@ -400,14 +398,14 @@ public class MiscChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void preInit(){
|
public static void preInit(){
|
||||||
try{
|
try {
|
||||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||||
final Class<MiscChanges> thisClass = MiscChanges.class;
|
final Class<MiscChanges> thisClass = MiscChanges.class;
|
||||||
String replace;
|
String replace;
|
||||||
|
|
||||||
// - Create Server tab with initial messages - //
|
// - Create Server tab with initial messages - //
|
||||||
CtClass ctVehicle = classPool.get("com.wurmonline.server.behaviours.Vehicle");
|
CtClass ctVehicle = classPool.get("com.wurmonline.server.behaviours.Vehicle");
|
||||||
CtClass ctPlayers = classPool.get("com.wurmonline.server.Players");
|
CtClass ctPlayers = classPool.get("com.wurmonline.server.Players");
|
||||||
CtMethod m = ctPlayers.getDeclaredMethod("sendStartGlobalKingdomChat");
|
CtMethod m = ctPlayers.getDeclaredMethod("sendStartGlobalKingdomChat");
|
||||||
String infoTabTitle = "Server";
|
String infoTabTitle = "Server";
|
||||||
// Initial messages:
|
// Initial messages:
|
||||||
@@ -432,13 +430,13 @@ public class MiscChanges {
|
|||||||
// - Disable mailboxes from being used while loaded - //
|
// - Disable mailboxes from being used while loaded - //
|
||||||
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
|
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
|
||||||
replace = "$_ = $proceed($$);"
|
replace = "$_ = $proceed($$);"
|
||||||
+ "com.wurmonline.server.items.Item theTarget = com.wurmonline.server.Items.getItem(targetId);"
|
+ "com.wurmonline.server.items.Item theTarget = com.wurmonline.server.Items.getItem(targetId);"
|
||||||
+ "if(theTarget != null && theTarget.getTemplateId() >= 510 && theTarget.getTemplateId() <= 513){"
|
+ "if(theTarget != null && theTarget.getTemplateId() >= 510 && theTarget.getTemplateId() <= 513){"
|
||||||
+ " if(theTarget.getTopParent() != theTarget.getWurmId()){"
|
+ " if(theTarget.getTopParent() != theTarget.getWurmId()){"
|
||||||
+ " mover.getCommunicator().sendNormalServerMessage(\"Mailboxes cannot be used while loaded.\");"
|
+ " mover.getCommunicator().sendNormalServerMessage(\"Mailboxes cannot be used while loaded.\");"
|
||||||
+ " return false;"
|
+ " return false;"
|
||||||
+ " }"
|
+ " }"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.instrumentDeclared(thisClass, ctItem, "moveToItem", "getOwnerId", replace);
|
Util.instrumentDeclared(thisClass, ctItem, "moveToItem", "getOwnerId", replace);
|
||||||
|
|
||||||
// - Enable creature custom colors - (Used for creating custom color creatures eg. Lilith) - //
|
// - Enable creature custom colors - (Used for creating custom color creatures eg. Lilith) - //
|
||||||
@@ -449,8 +447,8 @@ public class MiscChanges {
|
|||||||
// - Increase the amount of checks for new unique spawns by 5x - //
|
// - Increase the amount of checks for new unique spawns by 5x - //
|
||||||
CtClass ctServer = classPool.get("com.wurmonline.server.Server");
|
CtClass ctServer = classPool.get("com.wurmonline.server.Server");
|
||||||
replace = "for(int i = 0; i < 5; i++){"
|
replace = "for(int i = 0; i < 5; i++){"
|
||||||
+ " $_ = $proceed($$);"
|
+ " $_ = $proceed($$);"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.instrumentDeclared(thisClass, ctServer, "run", "checkDens", replace);
|
Util.instrumentDeclared(thisClass, ctServer, "run", "checkDens", replace);
|
||||||
|
|
||||||
// - Add Facebreyker to the list of spawnable uniques - //
|
// - Add Facebreyker to the list of spawnable uniques - //
|
||||||
@@ -462,31 +460,31 @@ public class MiscChanges {
|
|||||||
// - Announce player titles in the Server tab - //
|
// - Announce player titles in the Server tab - //
|
||||||
CtClass ctPlayer = classPool.get("com.wurmonline.server.players.Player");
|
CtClass ctPlayer = classPool.get("com.wurmonline.server.players.Player");
|
||||||
replace = "$_ = $proceed($$);"
|
replace = "$_ = $proceed($$);"
|
||||||
+ "if(!com.wurmonline.server.Servers.localServer.PVPSERVER && this.getPower() < 1){"
|
+ "if(!com.wurmonline.server.Servers.localServer.PVPSERVER && this.getPower() < 1){"
|
||||||
+ " "+MiscChanges.class.getName()+".sendServerTabMessage(\"event\", this.getName()+\" just earned the title of \"+title.getName(this.isNotFemale())+\"!\", 200, 100, 0);"
|
+ " " + MiscChanges.class.getName() + ".sendServerTabMessage(\"event\", this.getName()+\" just earned the title of \"+title.getName(this.isNotFemale())+\"!\", 200, 100, 0);"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.instrumentDeclared(thisClass, ctPlayer, "addTitle", "sendNormalServerMessage", replace);
|
Util.instrumentDeclared(thisClass, ctPlayer, "addTitle", "sendNormalServerMessage", replace);
|
||||||
|
|
||||||
// - Make leather not suck even after it's able to be combined. - //
|
// - Make leather not suck even after it's able to be combined. - //
|
||||||
CtClass ctMethodsItems = classPool.get("com.wurmonline.server.behaviours.MethodsItems");
|
CtClass ctMethodsItems = classPool.get("com.wurmonline.server.behaviours.MethodsItems");
|
||||||
replace = "if(com.wurmonline.server.behaviours.MethodsItems.getImproveTemplateId(target) != 72){"
|
replace = "if(com.wurmonline.server.behaviours.MethodsItems.getImproveTemplateId(target) != 72){"
|
||||||
+ " $_ = $proceed($$);"
|
+ " $_ = $proceed($$);"
|
||||||
+ "}else{"
|
+ "}else{"
|
||||||
+ " $_ = false;"
|
+ " $_ = false;"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "isCombine", replace);
|
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "isCombine", replace);
|
||||||
|
|
||||||
// - Check new improve materials - //
|
// - Check new improve materials - //
|
||||||
replace = "int temp = "+ItemMod.class.getName()+".getModdedImproveTemplateId($1);"
|
replace = "int temp = " + ItemMod.class.getName() + ".getModdedImproveTemplateId($1);"
|
||||||
+ "if(temp != -10){"
|
+ "if(temp != -10){"
|
||||||
+ " return temp;"
|
+ " return temp;"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.insertBeforeDeclared(thisClass, ctMethodsItems, "getImproveTemplateId", replace);
|
Util.insertBeforeDeclared(thisClass, ctMethodsItems, "getImproveTemplateId", replace);
|
||||||
|
|
||||||
// - Remove fatiguing actions requiring you to be on the ground - //
|
// - Remove fatiguing actions requiring you to be on the ground - //
|
||||||
CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action");
|
CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action");
|
||||||
CtConstructor[] ctActionConstructors = ctAction.getConstructors();
|
CtConstructor[] ctActionConstructors = ctAction.getConstructors();
|
||||||
for(CtConstructor constructor : ctActionConstructors) {
|
for (CtConstructor constructor : ctActionConstructors) {
|
||||||
constructor.instrument(new ExprEditor() {
|
constructor.instrument(new ExprEditor() {
|
||||||
public void edit(MethodCall m) throws CannotCompileException {
|
public void edit(MethodCall m) throws CannotCompileException {
|
||||||
if (m.getMethodName().equals("isFatigue")) {
|
if (m.getMethodName().equals("isFatigue")) {
|
||||||
@@ -513,46 +511,46 @@ public class MiscChanges {
|
|||||||
Util.instrumentDeclared(thisClass, ctPortal, "sendQuestion", "getKnowledge", "$_ = true;");
|
Util.instrumentDeclared(thisClass, ctPortal, "sendQuestion", "getKnowledge", "$_ = true;");
|
||||||
|
|
||||||
Util.setReason("Disable the minimum 0.01 damage on shield damage, allowing damage modifiers to rule.");
|
Util.setReason("Disable the minimum 0.01 damage on shield damage, allowing damage modifiers to rule.");
|
||||||
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
||||||
replace = "if($1 < 0.5f){"
|
replace = "if($1 < 0.5f){"
|
||||||
+ " $_ = $proceed((float) 0, (float) $2);"
|
+ " $_ = $proceed((float) 0, (float) $2);"
|
||||||
+ "}else{"
|
+ "}else{"
|
||||||
+ " $_ = $proceed($$);"
|
+ " $_ = $proceed($$);"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.instrumentDeclared(thisClass, ctCombatHandler, "checkShield", "max", replace);
|
Util.instrumentDeclared(thisClass, ctCombatHandler, "checkShield", "max", replace);
|
||||||
|
|
||||||
// - Allow GM's to bypass the 5 second emote sound limit. - //
|
// - Allow GM's to bypass the 5 second emote sound limit. - //
|
||||||
replace = "if(this.getPower() > 0){"
|
replace = "if(this.getPower() > 0){"
|
||||||
+ " return true;"
|
+ " return true;"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "mayEmote", replace);
|
Util.insertBeforeDeclared(thisClass, ctPlayer, "mayEmote", replace);
|
||||||
|
|
||||||
// - Make creatures wander slightly if they are shot from afar by an arrow - //
|
// - Make creatures wander slightly if they are shot from afar by an arrow - //
|
||||||
CtClass ctArrows = classPool.get("com.wurmonline.server.combat.Arrows");
|
CtClass ctArrows = classPool.get("com.wurmonline.server.combat.Arrows");
|
||||||
replace = "if(!defender.isPathing()){"
|
replace = "if(!defender.isPathing()){"
|
||||||
+ " defender.startPathing(com.wurmonline.server.Server.rand.nextInt(100));"
|
+ " defender.startPathing(com.wurmonline.server.Server.rand.nextInt(100));"
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "$_ = $proceed($$);";
|
+ "$_ = $proceed($$);";
|
||||||
Util.instrumentDeclared(thisClass, ctArrows, "addToHitCreature", "addAttacker", replace);
|
Util.instrumentDeclared(thisClass, ctArrows, "addToHitCreature", "addAttacker", replace);
|
||||||
|
|
||||||
Util.setReason("Broadcast death tabs to GL-Freedom.");
|
Util.setReason("Broadcast death tabs to GL-Freedom.");
|
||||||
replace = MiscChanges.class.getName()+".broadCastDeaths($1, $2);";
|
replace = MiscChanges.class.getName() + ".broadCastDeaths($1, $2);";
|
||||||
Util.insertBeforeDeclared(thisClass, ctPlayers, "broadCastDeathInfo", replace);
|
Util.insertBeforeDeclared(thisClass, ctPlayers, "broadCastDeathInfo", replace);
|
||||||
|
|
||||||
Util.setReason("Broadcast player death tabs always.");
|
Util.setReason("Broadcast player death tabs always.");
|
||||||
replace = MiscChanges.class.getName()+".broadCastDeathsPvE($0, $0.attackers);";
|
replace = MiscChanges.class.getName() + ".broadCastDeathsPvE($0, $0.attackers);";
|
||||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "modifyRanking", replace);
|
Util.insertBeforeDeclared(thisClass, ctPlayer, "modifyRanking", replace);
|
||||||
|
|
||||||
Util.setReason("Disable PvP only death tabs.");
|
Util.setReason("Disable PvP only death tabs.");
|
||||||
replace = "$_ = true;";
|
replace = "$_ = true;";
|
||||||
Util.instrumentDeclared(thisClass, ctPlayers, "broadCastDeathInfo", "isThisAPvpServer", replace);
|
Util.instrumentDeclared(thisClass, ctPlayers, "broadCastDeathInfo", "isThisAPvpServer", replace);
|
||||||
|
|
||||||
Util.setReason("Attempt to prevent libila from losing faith when crossing servers.");
|
Util.setReason("Attempt to prevent libila from losing faith when crossing servers.");
|
||||||
CtClass ctIntraServerConnection = classPool.get("com.wurmonline.server.intra.IntraServerConnection");
|
CtClass ctIntraServerConnection = classPool.get("com.wurmonline.server.intra.IntraServerConnection");
|
||||||
ctIntraServerConnection.getDeclaredMethod("savePlayerToDisk").instrument(new ExprEditor() {
|
ctIntraServerConnection.getDeclaredMethod("savePlayerToDisk").instrument(new ExprEditor() {
|
||||||
@Override
|
@Override
|
||||||
public void edit(FieldAccess fieldAccess) throws CannotCompileException {
|
public void edit(FieldAccess fieldAccess) throws CannotCompileException {
|
||||||
if (Objects.equals("PVPSERVER", fieldAccess.getFieldName())){
|
if (Objects.equals("PVPSERVER", fieldAccess.getFieldName())) {
|
||||||
fieldAccess.replace("$_ = false;");
|
fieldAccess.replace("$_ = false;");
|
||||||
logger.info("Instrumented PVPSERVER = false for Libila faith transfers.");
|
logger.info("Instrumented PVPSERVER = false for Libila faith transfers.");
|
||||||
}
|
}
|
||||||
@@ -561,7 +559,7 @@ public class MiscChanges {
|
|||||||
ctIntraServerConnection.getDeclaredMethod("savePlayerToDisk").instrument(new ExprEditor() {
|
ctIntraServerConnection.getDeclaredMethod("savePlayerToDisk").instrument(new ExprEditor() {
|
||||||
@Override
|
@Override
|
||||||
public void edit(FieldAccess fieldAccess) throws CannotCompileException {
|
public void edit(FieldAccess fieldAccess) throws CannotCompileException {
|
||||||
if (Objects.equals("HOMESERVER", fieldAccess.getFieldName())){
|
if (Objects.equals("HOMESERVER", fieldAccess.getFieldName())) {
|
||||||
fieldAccess.replace("$_ = false;");
|
fieldAccess.replace("$_ = false;");
|
||||||
logger.info("Instrumented HOMESERVER = false for Libila faith transfers.");
|
logger.info("Instrumented HOMESERVER = false for Libila faith transfers.");
|
||||||
}
|
}
|
||||||
@@ -569,60 +567,60 @@ public class MiscChanges {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Util.setReason("Increase food affinity to give 30% increased skillgain instead of 10%.");
|
Util.setReason("Increase food affinity to give 30% increased skillgain instead of 10%.");
|
||||||
CtClass ctSkill = classPool.get("com.wurmonline.server.skills.Skill");
|
CtClass ctSkill = classPool.get("com.wurmonline.server.skills.Skill");
|
||||||
CtClass[] params4 = {
|
CtClass[] params4 = {
|
||||||
CtClass.doubleType,
|
CtClass.doubleType,
|
||||||
CtClass.booleanType,
|
CtClass.booleanType,
|
||||||
CtClass.floatType,
|
CtClass.floatType,
|
||||||
CtClass.booleanType,
|
CtClass.booleanType,
|
||||||
CtClass.doubleType
|
CtClass.doubleType
|
||||||
};
|
};
|
||||||
String desc4 = Descriptor.ofMethod(CtClass.voidType, params4);
|
String desc4 = Descriptor.ofMethod(CtClass.voidType, params4);
|
||||||
replace = "int timedAffinity = (com.wurmonline.server.skills.AffinitiesTimed.isTimedAffinity(pid, this.getNumber()) ? 2 : 0);"
|
replace = "int timedAffinity = (com.wurmonline.server.skills.AffinitiesTimed.isTimedAffinity(pid, this.getNumber()) ? 2 : 0);"
|
||||||
+ "advanceMultiplicator *= (double)(1.0f + (float)timedAffinity * 0.1f);"
|
+ "advanceMultiplicator *= (double)(1.0f + (float)timedAffinity * 0.1f);"
|
||||||
+ "$_ = $proceed($$);";
|
+ "$_ = $proceed($$);";
|
||||||
Util.instrumentDescribed(thisClass, ctSkill, "alterSkill", desc4, "hasSleepBonus", replace);
|
Util.instrumentDescribed(thisClass, ctSkill, "alterSkill", desc4, "hasSleepBonus", replace);
|
||||||
|
|
||||||
Util.setReason("Double the rate at which charcoal piles produce items.");
|
Util.setReason("Double the rate at which charcoal piles produce items.");
|
||||||
CtClass[] params5 = {
|
CtClass[] params5 = {
|
||||||
CtClass.booleanType,
|
CtClass.booleanType,
|
||||||
CtClass.booleanType,
|
CtClass.booleanType,
|
||||||
CtClass.longType
|
CtClass.longType
|
||||||
};
|
};
|
||||||
String desc5 = Descriptor.ofMethod(CtClass.booleanType, params5);
|
String desc5 = Descriptor.ofMethod(CtClass.booleanType, params5);
|
||||||
replace = "this.createDaleItems();"
|
replace = "this.createDaleItems();"
|
||||||
+ "decayed = this.setDamage(this.damage + 1.0f * this.getDamageModifier());"
|
+ "decayed = this.setDamage(this.damage + 1.0f * this.getDamageModifier());"
|
||||||
+ "$_ = $proceed($$);";
|
+ "$_ = $proceed($$);";
|
||||||
Util.instrumentDescribed(thisClass, ctItem, "poll", desc5, "createDaleItems", replace);
|
Util.instrumentDescribed(thisClass, ctItem, "poll", desc5, "createDaleItems", replace);
|
||||||
|
|
||||||
Util.setReason("Allow traders to display more than 9 items of a single type.");
|
Util.setReason("Allow traders to display more than 9 items of a single type.");
|
||||||
CtClass ctTradeHandler = classPool.get("com.wurmonline.server.creatures.TradeHandler");
|
CtClass ctTradeHandler = classPool.get("com.wurmonline.server.creatures.TradeHandler");
|
||||||
ctTradeHandler.getDeclaredMethod("addItemsToTrade").instrument(new ExprEditor(){
|
ctTradeHandler.getDeclaredMethod("addItemsToTrade").instrument(new ExprEditor() {
|
||||||
public void edit(MethodCall m) throws CannotCompileException {
|
public void edit(MethodCall m) throws CannotCompileException {
|
||||||
if(m.getMethodName().equals("size") && m.getLineNumber() > 200){ // I don't think the line number check matters, but I'm leaving it here anyway.
|
if (m.getMethodName().equals("size") && m.getLineNumber() > 200) { // I don't think the line number check matters, but I'm leaving it here anyway.
|
||||||
m.replace("$_ = 1;");
|
m.replace("$_ = 1;");
|
||||||
logger.info("Instrumented size for trades to allow traders to show more than 9 items at a time.");
|
logger.info("Instrumented size for trades to allow traders to show more than 9 items at a time.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// -- Identify players making over 10 commands per second and causing the server log message -- //
|
// -- Identify players making over 10 commands per second and causing the server log message -- //
|
||||||
CtClass ctCommunicator = classPool.get("com.wurmonline.server.creatures.Communicator");
|
CtClass ctCommunicator = classPool.get("com.wurmonline.server.creatures.Communicator");
|
||||||
replace = "$_ = $proceed($$);"
|
replace = "$_ = $proceed($$);"
|
||||||
+ "if(this.player != null){"
|
+ "if(this.player != null){"
|
||||||
+ " logger.info(\"Potential player macro: \"+this.player.getName()+\" [\"+this.commandsThisSecond+\" commands]\");"
|
+ " logger.info(\"Potential player macro: \"+this.player.getName()+\" [\"+this.commandsThisSecond+\" commands]\");"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.instrumentDeclared(thisClass, ctCommunicator, "reallyHandle_CMD_ITEM_CREATION_LIST", "log", replace);
|
Util.instrumentDeclared(thisClass, ctCommunicator, "reallyHandle_CMD_ITEM_CREATION_LIST", "log", replace);
|
||||||
|
|
||||||
//1f+0.5f*(1f-Math.pow(2, -Math.pow((eff-1f), pow1)/pow2))
|
//1f+0.5f*(1f-Math.pow(2, -Math.pow((eff-1f), pow1)/pow2))
|
||||||
Util.setReason("Fix 100+ quality or power making certain interaction broken.");
|
Util.setReason("Fix 100+ quality or power making certain interaction broken.");
|
||||||
replace = "{"
|
replace = "{"
|
||||||
+ "double pow1 = 1.0;"
|
+ "double pow1 = 1.0;"
|
||||||
+ "double pow2 = 3.0;"
|
+ "double pow2 = 3.0;"
|
||||||
+ "double newEff = $1 >= 1.0 ? 1.0+0.5*(1.0-Math.pow(2.0, -Math.pow(($1-1.0), pow1)/pow2)) : Math.max(0.05, 1.0 - (1.0 - $1) * (1.0 - $1));"
|
+ "double newEff = $1 >= 1.0 ? 1.0+0.5*(1.0-Math.pow(2.0, -Math.pow(($1-1.0), pow1)/pow2)) : Math.max(0.05, 1.0 - (1.0 - $1) * (1.0 - $1));"
|
||||||
+ "return newEff;"
|
+ "return newEff;"
|
||||||
+ "}";
|
+ "}";
|
||||||
Util.setBodyDeclared(thisClass, ctServer, "getBuffedQualityEffect", replace);
|
Util.setBodyDeclared(thisClass, ctServer, "getBuffedQualityEffect", replace);
|
||||||
|
|
||||||
// double advanceMultiplicator, boolean decay, float times, boolean useNewSystem, double skillDivider)
|
// double advanceMultiplicator, boolean decay, float times, boolean useNewSystem, double skillDivider)
|
||||||
CtClass[] params = {
|
CtClass[] params = {
|
||||||
@@ -642,35 +640,35 @@ public class MiscChanges {
|
|||||||
"double maxRate = " + String.valueOf(maxRate) + ";" +
|
"double maxRate = " + String.valueOf(maxRate) + ";" +
|
||||||
"double newPower = " + String.valueOf(newPower) + ";" +
|
"double newPower = " + String.valueOf(newPower) + ";" +
|
||||||
"$1 = $1*(minRate+(maxRate-minRate)*Math.pow((100-this.knowledge)*0.01, newPower));";
|
"$1 = $1*(minRate+(maxRate-minRate)*Math.pow((100-this.knowledge)*0.01, newPower));";
|
||||||
Util.insertBeforeDescribed(thisClass, ctSkill,"alterSkill", desc, replace);
|
Util.insertBeforeDescribed(thisClass, ctSkill, "alterSkill", desc, replace);
|
||||||
|
|
||||||
Util.setReason("Reduce chance of lockpicks breaking.");
|
Util.setReason("Reduce chance of lockpicks breaking.");
|
||||||
replace = "$_ = 40f + $proceed($$);";
|
replace = "$_ = 40f + $proceed($$);";
|
||||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "checkLockpickBreakage", "getCurrentQualityLevel", replace);
|
Util.instrumentDeclared(thisClass, ctMethodsItems, "checkLockpickBreakage", "getCurrentQualityLevel", replace);
|
||||||
|
|
||||||
CtClass ctTileBehaviour = classPool.get("com.wurmonline.server.behaviours.TileBehaviour");
|
CtClass ctTileBehaviour = classPool.get("com.wurmonline.server.behaviours.TileBehaviour");
|
||||||
CtMethod[] ctGetBehavioursFors = ctTileBehaviour.getDeclaredMethods("getBehavioursFor");
|
CtMethod[] ctGetBehavioursFors = ctTileBehaviour.getDeclaredMethods("getBehavioursFor");
|
||||||
for(CtMethod method : ctGetBehavioursFors){
|
for (CtMethod method : ctGetBehavioursFors) {
|
||||||
method.instrument(new ExprEditor(){
|
method.instrument(new ExprEditor() {
|
||||||
public void edit(MethodCall m) throws CannotCompileException {
|
public void edit(MethodCall m) throws CannotCompileException {
|
||||||
if (m.getMethodName().equals("getKingdomTemplateId")) {
|
if (m.getMethodName().equals("getKingdomTemplateId")) {
|
||||||
m.replace("$_ = 3;");
|
m.replace("$_ = 3;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
CtClass ctMethodsStructure = classPool.get("com.wurmonline.server.behaviours.MethodsStructure");
|
CtClass ctMethodsStructure = classPool.get("com.wurmonline.server.behaviours.MethodsStructure");
|
||||||
Util.setReason("Allow players to construct larger houses.");
|
Util.setReason("Allow players to construct larger houses.");
|
||||||
float carpentryMultiplier = 2f;
|
float carpentryMultiplier = 2f;
|
||||||
replace = "if(!com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
replace = "if(!com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||||
" $_ = $proceed($$)*"+String.valueOf(carpentryMultiplier)+";" +
|
" $_ = $proceed($$)*" + String.valueOf(carpentryMultiplier) + ";" +
|
||||||
"}else{" +
|
"}else{" +
|
||||||
" $_ = $proceed($$);" +
|
" $_ = $proceed($$);" +
|
||||||
"}";
|
"}";
|
||||||
Util.instrumentDeclared(thisClass, ctMethodsStructure, "hasEnoughSkillToExpandStructure", "getKnowledge", replace);
|
Util.instrumentDeclared(thisClass, ctMethodsStructure, "hasEnoughSkillToExpandStructure", "getKnowledge", replace);
|
||||||
Util.setReason("Allow players to construct larger houses.");
|
Util.setReason("Allow players to construct larger houses.");
|
||||||
Util.instrumentDeclared(thisClass, ctMethodsStructure, "hasEnoughSkillToContractStructure", "getKnowledge", replace);
|
Util.instrumentDeclared(thisClass, ctMethodsStructure, "hasEnoughSkillToContractStructure", "getKnowledge", replace);
|
||||||
|
|
||||||
Util.setReason("Reduce power of imbues.");
|
Util.setReason("Reduce power of imbues.");
|
||||||
replace = "$_ = Math.max(-80d, -80d+$2);";
|
replace = "$_ = Math.max(-80d, -80d+$2);";
|
||||||
@@ -691,7 +689,7 @@ public class MiscChanges {
|
|||||||
|
|
||||||
Util.setReason("Remove guard tower guards helping against certain types of enemies.");
|
Util.setReason("Remove guard tower guards helping against certain types of enemies.");
|
||||||
CtClass ctGuardTower = classPool.get("com.wurmonline.server.kingdom.GuardTower");
|
CtClass ctGuardTower = classPool.get("com.wurmonline.server.kingdom.GuardTower");
|
||||||
replace = "if($0.isUnique() || "+Titans.class.getName()+".isTitan($0) || "+RareSpawns.class.getName()+".isRareCreature($0)){" +
|
replace = "if($0.isUnique() || " + Titans.class.getName() + ".isTitan($0) || " + RareSpawns.class.getName() + ".isRareCreature($0)){" +
|
||||||
" $_ = false;" +
|
" $_ = false;" +
|
||||||
"}else{" +
|
"}else{" +
|
||||||
" $_ = $proceed($$);" +
|
" $_ = $proceed($$);" +
|
||||||
@@ -726,7 +724,7 @@ public class MiscChanges {
|
|||||||
CtClass ctVehicles = classPool.get("com.wurmonline.server.behaviours.Vehicles");
|
CtClass ctVehicles = classPool.get("com.wurmonline.server.behaviours.Vehicles");
|
||||||
replace = "$_ = $proceed($1, $2);" +
|
replace = "$_ = $proceed($1, $2);" +
|
||||||
"" + MiscChanges.class.getName() + ".buffBoat($2, $1);";
|
"" + MiscChanges.class.getName() + ".buffBoat($2, $1);";
|
||||||
Util.instrumentDescribed(thisClass, ctVehicles, "createVehicle", desc13, "setSettingsForVehicle", replace);
|
Util.instrumentDescribed(thisClass, ctVehicles, "createVehicle", desc13, "setSettingsForVehicle", replace);
|
||||||
|
|
||||||
Util.setReason("Stop royal food decay.");
|
Util.setReason("Stop royal food decay.");
|
||||||
// Item parent, int parentTemp, boolean insideStructure, boolean deeded, boolean saveLastMaintained, boolean inMagicContainer, boolean inTrashbin
|
// Item parent, int parentTemp, boolean insideStructure, boolean deeded, boolean saveLastMaintained, boolean inMagicContainer, boolean inTrashbin
|
||||||
@@ -748,18 +746,18 @@ public class MiscChanges {
|
|||||||
Util.instrumentDescribed(thisClass, ctItem, "poll", desc11, "setDamage", replace);
|
Util.instrumentDescribed(thisClass, ctItem, "poll", desc11, "setDamage", replace);
|
||||||
|
|
||||||
Util.setReason("Allow mayors to command abandoned vehicles off their deed.");
|
Util.setReason("Allow mayors to command abandoned vehicles off their deed.");
|
||||||
replace = "if("+MiscChanges.class.getName()+".checkMayorCommand($0, $1)){" +
|
replace = "if(" + MiscChanges.class.getName() + ".checkMayorCommand($0, $1)){" +
|
||||||
" return true;" +
|
" return true;" +
|
||||||
"}";
|
"}";
|
||||||
Util.insertBeforeDeclared(thisClass, ctItem, "mayCommand", replace);
|
Util.insertBeforeDeclared(thisClass, ctItem, "mayCommand", replace);
|
||||||
|
|
||||||
Util.setReason("Modify timed affinity timer.");
|
Util.setReason("Modify timed affinity timer.");
|
||||||
CtClass ctAffinitiesTimed = classPool.get("com.wurmonline.server.skills.AffinitiesTimed");
|
CtClass ctAffinitiesTimed = classPool.get("com.wurmonline.server.skills.AffinitiesTimed");
|
||||||
replace = "$_ = "+MiscChanges.class.getName()+".getFoodOpulenceBonus($0);";
|
replace = "$_ = " + MiscChanges.class.getName() + ".getFoodOpulenceBonus($0);";
|
||||||
Util.instrumentDeclared(thisClass, ctAffinitiesTimed, "addTimedAffinityFromBonus", "getFoodComplexity", replace);
|
Util.instrumentDeclared(thisClass, ctAffinitiesTimed, "addTimedAffinityFromBonus", "getFoodComplexity", replace);
|
||||||
|
|
||||||
Util.setReason("Food affinity timer normalization.");
|
Util.setReason("Food affinity timer normalization.");
|
||||||
replace = "long time = "+WurmCalendar.class.getName()+".getCurrentTime();" +
|
replace = "long time = " + WurmCalendar.class.getName() + ".getCurrentTime();" +
|
||||||
"if($0.getExpires($1) == null){" +
|
"if($0.getExpires($1) == null){" +
|
||||||
" $_ = Long.valueOf(time);" +
|
" $_ = Long.valueOf(time);" +
|
||||||
"}else{" +
|
"}else{" +
|
||||||
@@ -775,7 +773,7 @@ public class MiscChanges {
|
|||||||
|
|
||||||
Util.setReason("Make bed QL affect sleep bonus timer.");
|
Util.setReason("Make bed QL affect sleep bonus timer.");
|
||||||
CtClass ctPlayerInfo = classPool.get("com.wurmonline.server.players.PlayerInfo");
|
CtClass ctPlayerInfo = classPool.get("com.wurmonline.server.players.PlayerInfo");
|
||||||
replace = "long secs2 = "+MiscChanges.class.getName()+".getBedBonus(secs, this.bed);" +
|
replace = "long secs2 = " + MiscChanges.class.getName() + ".getBedBonus(secs, this.bed);" +
|
||||||
"$_ = $proceed((int)(this.sleep + secs2));";
|
"$_ = $proceed((int)(this.sleep + secs2));";
|
||||||
Util.instrumentDeclared(thisClass, ctPlayerInfo, "calculateSleep", "setSleep", replace);
|
Util.instrumentDeclared(thisClass, ctPlayerInfo, "calculateSleep", "setSleep", replace);
|
||||||
|
|
||||||
@@ -788,7 +786,7 @@ public class MiscChanges {
|
|||||||
Util.insertBeforeDeclared(thisClass, ctCreature, "intraTeleport", replace);
|
Util.insertBeforeDeclared(thisClass, ctCreature, "intraTeleport", replace);
|
||||||
|
|
||||||
Util.setReason("Allow royal smith to improve smithing items faster.");
|
Util.setReason("Allow royal smith to improve smithing items faster.");
|
||||||
replace = "if("+MiscChanges.class.getName()+".royalSmithImprove($1, improve)){" +
|
replace = "if(" + MiscChanges.class.getName() + ".royalSmithImprove($1, improve)){" +
|
||||||
" $_ = $proceed($$) * 0.9f;" +
|
" $_ = $proceed($$) * 0.9f;" +
|
||||||
"}else{" +
|
"}else{" +
|
||||||
" $_ = $proceed($$);" +
|
" $_ = $proceed($$);" +
|
||||||
@@ -797,7 +795,7 @@ public class MiscChanges {
|
|||||||
Util.setReason("Allow royal smith to improve smithing items faster.");
|
Util.setReason("Allow royal smith to improve smithing items faster.");
|
||||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "polishItem", "getImproveActionTime", replace);
|
Util.instrumentDeclared(thisClass, ctMethodsItems, "polishItem", "getImproveActionTime", replace);
|
||||||
Util.setReason("Allow royal smith to improve smithing items faster. Also make tempering use water enchants.");
|
Util.setReason("Allow royal smith to improve smithing items faster. Also make tempering use water enchants.");
|
||||||
replace = "if("+MiscChanges.class.getName()+".royalSmithImprove($1, improve)){" +
|
replace = "if(" + MiscChanges.class.getName() + ".royalSmithImprove($1, improve)){" +
|
||||||
" $_ = $proceed($1, target) * 0.9f;" +
|
" $_ = $proceed($1, target) * 0.9f;" +
|
||||||
"}else{" +
|
"}else{" +
|
||||||
" $_ = $proceed($1, target);" +
|
" $_ = $proceed($1, target);" +
|
||||||
@@ -828,7 +826,7 @@ public class MiscChanges {
|
|||||||
CtClass.floatType
|
CtClass.floatType
|
||||||
};
|
};
|
||||||
String desc12 = Descriptor.ofMethod(CtClass.booleanType, params12);
|
String desc12 = Descriptor.ofMethod(CtClass.booleanType, params12);
|
||||||
replace = "$_ = $proceed($1, $2, $3, $4, "+MiscChanges.class.getName()+".getNewFoodFill(qlevel));";
|
replace = "$_ = $proceed($1, $2, $3, $4, " + MiscChanges.class.getName() + ".getNewFoodFill(qlevel));";
|
||||||
Util.instrumentDescribed(thisClass, ctMethodsItems, "eat", desc12, "modifyHunger", replace);
|
Util.instrumentDescribed(thisClass, ctMethodsItems, "eat", desc12, "modifyHunger", replace);
|
||||||
|
|
||||||
// Fix for butchering not giving skill gain when butchering too many items
|
// Fix for butchering not giving skill gain when butchering too many items
|
||||||
@@ -840,7 +838,7 @@ public class MiscChanges {
|
|||||||
if (m.getMethodName().equals("skillCheck")) {
|
if (m.getMethodName().equals("skillCheck")) {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
}else {
|
} else {
|
||||||
m.replace("$_ = $proceed($1, $2, $3, false, $5);");
|
m.replace("$_ = $proceed($1, $2, $3, false, $5);");
|
||||||
logger.info("Replaced filet skill check to ensure butchering skill is always gained.");
|
logger.info("Replaced filet skill check to ensure butchering skill is always gained.");
|
||||||
}
|
}
|
||||||
@@ -855,7 +853,7 @@ public class MiscChanges {
|
|||||||
\"Battle Yoyos\", 4000.0f, new int[]{1022}, 1209600000l, (short) 4, true, true));");*/
|
\"Battle Yoyos\", 4000.0f, new int[]{1022}, 1209600000l, (short) 4, true, true));");*/
|
||||||
|
|
||||||
Util.setReason("Hook for rare material usage in improvement.");
|
Util.setReason("Hook for rare material usage in improvement.");
|
||||||
replace = "if("+MiscChanges.class.getName()+".rollRarityImprove($0, usedWeight)){" +
|
replace = "if(" + MiscChanges.class.getName() + ".rollRarityImprove($0, usedWeight)){" +
|
||||||
" rarity = source.getRarity();" +
|
" rarity = source.getRarity();" +
|
||||||
"}" +
|
"}" +
|
||||||
"$_ = $proceed($$);";
|
"$_ = $proceed($$);";
|
||||||
@@ -863,7 +861,7 @@ public class MiscChanges {
|
|||||||
|
|
||||||
Util.setReason("Bad luck protection on rarity windows.");
|
Util.setReason("Bad luck protection on rarity windows.");
|
||||||
replace = "if($1 == 3600){" +
|
replace = "if($1 == 3600){" +
|
||||||
" $_ = "+MiscChanges.class.getName()+".getRarityWindowChance(this.getWurmId());" +
|
" $_ = " + MiscChanges.class.getName() + ".getRarityWindowChance(this.getWurmId());" +
|
||||||
"}else{" +
|
"}else{" +
|
||||||
" $_ = $proceed($$);" +
|
" $_ = $proceed($$);" +
|
||||||
"}";
|
"}";
|
||||||
@@ -882,11 +880,10 @@ public class MiscChanges {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void edit(MethodCall m) throws CannotCompileException {
|
public void edit(MethodCall m) throws CannotCompileException {
|
||||||
if(m.getMethodName().equals("min")) {
|
if (m.getMethodName().equals("min")) {
|
||||||
if(first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
m.replace("$_ = $proceed($1, $2 * " + MiscChanges.class.getName() + ".boatSpeedBonus(this));");
|
m.replace("$_ = $proceed($1, $2 * " + MiscChanges.class.getName() + ".boatSpeedBonus(this));");
|
||||||
logger.info("Allowing preists of vynora to gain 20% boat speed above 60 faith.");
|
logger.info("Allowing preists of vynora to gain 20% boat speed above 60 faith.");
|
||||||
}
|
}
|
||||||
@@ -902,7 +899,7 @@ public class MiscChanges {
|
|||||||
public void edit(MethodCall m) throws CannotCompileException {
|
public void edit(MethodCall m) throws CannotCompileException {
|
||||||
if (m.getMethodName().equals("getRarity")) {
|
if (m.getMethodName().equals("getRarity")) {
|
||||||
if (first) {
|
if (first) {
|
||||||
m.replace("byte newRarity = "+MiscChanges.class.getName()+".getNewCreationRarity(this, source, target, template);" +
|
m.replace("byte newRarity = " + MiscChanges.class.getName() + ".getNewCreationRarity(this, source, target, template);" +
|
||||||
"if(newRarity > 0){" +
|
"if(newRarity > 0){" +
|
||||||
" act.setRarity(newRarity);" +
|
" act.setRarity(newRarity);" +
|
||||||
"}" +
|
"}" +
|
||||||
@@ -1000,6 +997,18 @@ public class MiscChanges {
|
|||||||
"}";
|
"}";
|
||||||
Util.insertBeforeDescribed(thisClass, ctItemBehaviour, "action", desc15, replace);
|
Util.insertBeforeDescribed(thisClass, ctItemBehaviour, "action", desc15, replace);
|
||||||
|
|
||||||
|
Util.setReason("Change fantastic items to red.");
|
||||||
|
CtClass ctManageObjectList = classPool.get("com.wurmonline.server.questions.ManageObjectList");
|
||||||
|
/* This is for adding a new rarity!
|
||||||
|
replace = "if (item.getRarity() == 4) {" +
|
||||||
|
"return \"label{color=\\\"66,153,225\\\";text=\\\"rare \" + name + \"\\\"};\";" +
|
||||||
|
"}";
|
||||||
|
*/
|
||||||
|
replace = "if (item.getRarity() == 3) {" +
|
||||||
|
"return \"label{color=\\\"255,53,0\\\";text=\\\"fantastic \" + name + \"\\\"};\";" +
|
||||||
|
"}";
|
||||||
|
Util.insertBeforeDeclared(thisClass, ctManageObjectList, "addRariryColour", replace);
|
||||||
|
|
||||||
} catch (CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
|
} catch (CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||||
throw new HookException(e);
|
throw new HookException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.wurmonline.server.Items;
|
|||||||
import com.wurmonline.server.Server;
|
import com.wurmonline.server.Server;
|
||||||
import com.wurmonline.server.creatures.Communicator;
|
import com.wurmonline.server.creatures.Communicator;
|
||||||
import com.wurmonline.server.creatures.Creature;
|
import com.wurmonline.server.creatures.Creature;
|
||||||
|
import com.wurmonline.server.deities.Deities;
|
||||||
import com.wurmonline.server.items.*;
|
import com.wurmonline.server.items.*;
|
||||||
import com.wurmonline.server.kingdom.Kingdoms;
|
import com.wurmonline.server.kingdom.Kingdoms;
|
||||||
import mod.sin.actions.items.SorcerySplitAction;
|
import mod.sin.actions.items.SorcerySplitAction;
|
||||||
@@ -325,9 +326,6 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
|||||||
// Stable master contract
|
// Stable master contract
|
||||||
item = Creature.createItem(StableContract.templateId, 50);
|
item = Creature.createItem(StableContract.templateId, 50);
|
||||||
inventory.insertItem(item);
|
inventory.insertItem(item);
|
||||||
// Kingdom token
|
|
||||||
item = Creature.createItem(ItemCreator.KINGDOM_TOKEN.getTemplateId(), 50);
|
|
||||||
inventory.insertItem(item);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ItemBonusOverhaul {
|
|||||||
*/
|
*/
|
||||||
public static void initializeBonuses() throws NoSuchTemplateException {
|
public static void initializeBonuses() throws NoSuchTemplateException {
|
||||||
itemBonuses.add(new ItemBonusWrapper(GlimmerscaleVest.templateId, SpellEffectsEnum.ITEM_RING_CR, false, 1.0f, false));
|
itemBonuses.add(new ItemBonusWrapper(GlimmerscaleVest.templateId, SpellEffectsEnum.ITEM_RING_CR, false, 1.0f, false));
|
||||||
itemBonuses.add(new ItemBonusWrapper(ArcaniteNecklaceFocus.templateId, SpellEffectsEnum.ITEM_NECKLACE_FOCUS, false, .2f, true));
|
itemBonuses.add(new ItemBonusWrapper(ArcaniteNecklaceFocus.templateId, SpellEffectsEnum.ITEM_NECKLACE_FOCUS, false, 20.0f, true));
|
||||||
|
|
||||||
batteries = new Battery[] {
|
batteries = new Battery[] {
|
||||||
new Battery(Soul.templateId, 30),
|
new Battery(Soul.templateId, 30),
|
||||||
|
|||||||
@@ -216,9 +216,11 @@ public class PlayerBounty {
|
|||||||
strBuilder += " for slaying the " + mob.getName() + ".";
|
strBuilder += " for slaying the " + mob.getName() + ".";
|
||||||
player.getCommunicator().sendSafeServerMessage(strBuilder);
|
player.getCommunicator().sendSafeServerMessage(strBuilder);
|
||||||
long playerSteamId = steamIdMap.get(player.getName());
|
long playerSteamId = steamIdMap.get(player.getName());
|
||||||
|
/* Maybe re-enable kingdom titles when they can be interesting again
|
||||||
Item creatureToken = ItemFactory.createItem(ItemCreator.CREATURE_TOKEN.getTemplateId(), 50, (byte)0, "");
|
Item creatureToken = ItemFactory.createItem(ItemCreator.CREATURE_TOKEN.getTemplateId(), 50, (byte)0, "");
|
||||||
inventory.insertItem(creatureToken);
|
inventory.insertItem(creatureToken);
|
||||||
player.getCommunicator().sendSafeServerMessage("You also receive a " + creatureToken.getName() + "!");
|
player.getCommunicator().sendSafeServerMessage("You also receive a " + creatureToken.getName() + "!");
|
||||||
|
*/
|
||||||
if(playersRewarded.containsKey(mobWurmId)){
|
if(playersRewarded.containsKey(mobWurmId)){
|
||||||
playersRewarded.get(mobWurmId).add(playerSteamId);
|
playersRewarded.get(mobWurmId).add(playerSteamId);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package mod.sin.wyvern.mastercraft;
|
||||||
|
|
||||||
|
import javassist.CannotCompileException;
|
||||||
|
import javassist.ClassPool;
|
||||||
|
import javassist.NotFoundException;
|
||||||
|
import javassist.bytecode.BadBytecode;
|
||||||
|
|
||||||
|
public class AchievementTitles {
|
||||||
|
public static int gremlinSlayerTitleID = 704;
|
||||||
|
public static void register(ClassPool cp) throws NotFoundException, BadBytecode, CannotCompileException {
|
||||||
|
TitleInjector injector = new TitleInjector(cp);
|
||||||
|
injector.addTitle("GremlinSlayer", gremlinSlayerTitleID, "Gremlin Slayer", "Gremlin Slayer", -1, "NORMAL");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -491,4 +491,71 @@ public class BytecodeTools extends Bytecode {
|
|||||||
}
|
}
|
||||||
logger.log(Level.INFO,name + " : " + Arrays.toString(a));
|
logger.log(Level.INFO,name + " : " + Arrays.toString(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BDEW EXTRAS
|
||||||
|
public static void putInteger(ConstPool cp, Bytecode code, int val) {
|
||||||
|
switch (val) {
|
||||||
|
case -1:
|
||||||
|
code.add(Bytecode.ICONST_M1);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
code.add(Bytecode.ICONST_0);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
code.add(Bytecode.ICONST_1);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
code.add(Bytecode.ICONST_2);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
code.add(Bytecode.ICONST_3);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
code.add(Bytecode.ICONST_4);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
code.add(Bytecode.ICONST_5);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (val >= Byte.MIN_VALUE && val <= Byte.MAX_VALUE) {
|
||||||
|
code.add(Bytecode.BIPUSH);
|
||||||
|
code.add(val);
|
||||||
|
} else if (val >= Short.MIN_VALUE && val <= Short.MAX_VALUE) {
|
||||||
|
code.add(Bytecode.SIPUSH);
|
||||||
|
code.add(val >> 8 & 0xFF, val & 0xFF);
|
||||||
|
} else {
|
||||||
|
code.addLdc(cp.addIntegerInfo(val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getInteger(ConstPool cp, CodeIterator iterator, int pos) {
|
||||||
|
int op = iterator.byteAt(pos);
|
||||||
|
switch (op) {
|
||||||
|
case Bytecode.ICONST_M1:
|
||||||
|
return -1;
|
||||||
|
case Bytecode.ICONST_0:
|
||||||
|
return 0;
|
||||||
|
case Bytecode.ICONST_1:
|
||||||
|
return 1;
|
||||||
|
case Bytecode.ICONST_2:
|
||||||
|
return 2;
|
||||||
|
case Bytecode.ICONST_3:
|
||||||
|
return 3;
|
||||||
|
case Bytecode.ICONST_4:
|
||||||
|
return 4;
|
||||||
|
case Bytecode.ICONST_5:
|
||||||
|
return 5;
|
||||||
|
case Bytecode.BIPUSH:
|
||||||
|
return iterator.byteAt(pos + 1);
|
||||||
|
case Bytecode.SIPUSH:
|
||||||
|
return iterator.s16bitAt(pos + 1);
|
||||||
|
case Bytecode.LDC:
|
||||||
|
return cp.getIntegerInfo(iterator.byteAt(pos + 1));
|
||||||
|
case Bytecode.LDC_W:
|
||||||
|
return cp.getIntegerInfo(iterator.u16bitAt(pos + 1));
|
||||||
|
default:
|
||||||
|
throw new RuntimeException(String.format("Failed to decode integer. Pos = %d, Bytecode = %d", pos, op));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,6 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
public class Mastercraft {
|
public class Mastercraft {
|
||||||
private static Logger logger = Logger.getLogger(Mastercraft.class.getName());
|
private static Logger logger = Logger.getLogger(Mastercraft.class.getName());
|
||||||
public static int GremlinSlayer = 704;
|
|
||||||
public static double getNewDifficulty(Skill skill, double diff, Item item){
|
public static double getNewDifficulty(Skill skill, double diff, Item item){
|
||||||
if(skill.affinity > 0){
|
if(skill.affinity > 0){
|
||||||
diff -= skill.affinity;
|
diff -= skill.affinity;
|
||||||
@@ -100,7 +99,7 @@ public class Mastercraft {
|
|||||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Spectral_Slayer", 701, "Spectral Warrior", "Spectral Warrior", -1, "NORMAL");
|
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Spectral_Slayer", 701, "Spectral Warrior", "Spectral Warrior", -1, "NORMAL");
|
||||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Holdstrong_Architect", 702, "Holdstrong Architect", "Holdstrong Architect", -1, "NORMAL");
|
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Holdstrong_Architect", 702, "Holdstrong Architect", "Holdstrong Architect", -1, "NORMAL");
|
||||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Stronghold_Architect", 703, "Stronghold Architect", "Stronghold Architect", -1, "NORMAL");
|
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Stronghold_Architect", 703, "Stronghold Architect", "Stronghold Architect", -1, "NORMAL");
|
||||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Gremlin_Slayer", GremlinSlayer, "Gremlin Slayer", "Gremlin Slayer", -1, "NORMAL");
|
//ExtendTitleEnum.getSingletonInstance().addExtendEntry("Gremlin_Slayer", 704, "Gremlin Slayer", "Gremlin Slayer", -1, "NORMAL");
|
||||||
|
|
||||||
// Donation titles
|
// Donation titles
|
||||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Donator", 800, "Donator", "Donator", -1, "NORMAL");
|
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Donator", 800, "Donator", "Donator", -1, "NORMAL");
|
||||||
|
|||||||
96
src/main/java/mod/sin/wyvern/mastercraft/TitleInjector.java
Normal file
96
src/main/java/mod/sin/wyvern/mastercraft/TitleInjector.java
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
package mod.sin.wyvern.mastercraft;
|
||||||
|
|
||||||
|
import javassist.ClassPool;
|
||||||
|
import javassist.*;
|
||||||
|
import javassist.bytecode.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class TitleInjector {
|
||||||
|
private final CtClass titleCls;
|
||||||
|
private final ConstPool constPool;
|
||||||
|
private final CodeIterator codeIterator;
|
||||||
|
private int insertPos = -1;
|
||||||
|
private int lastOrd = -1;
|
||||||
|
private int arraySizePos = -1;
|
||||||
|
|
||||||
|
|
||||||
|
public TitleInjector(ClassPool classPool) throws NotFoundException, BadBytecode {
|
||||||
|
titleCls = classPool.getCtClass("com.wurmonline.server.players.Titles$Title");
|
||||||
|
CtConstructor initializer = titleCls.getClassInitializer();
|
||||||
|
CodeAttribute codeAttr = initializer.getMethodInfo().getCodeAttribute();
|
||||||
|
constPool = codeAttr.getConstPool();
|
||||||
|
codeIterator = codeAttr.iterator();
|
||||||
|
|
||||||
|
BytecodeTools b = new BytecodeTools(constPool);
|
||||||
|
|
||||||
|
// My code needs a bit more stack space than javac-generated one
|
||||||
|
codeAttr.setMaxStack(codeAttr.getMaxStack() + 3);
|
||||||
|
|
||||||
|
while (codeIterator.hasNext()) {
|
||||||
|
int pos = codeIterator.next();
|
||||||
|
int op = codeIterator.byteAt(pos);
|
||||||
|
if (op == Bytecode.AASTORE) {
|
||||||
|
insertPos = codeIterator.next();
|
||||||
|
} else if (op == Bytecode.ANEWARRAY) {
|
||||||
|
arraySizePos = pos - 2;
|
||||||
|
} else if (op == Bytecode.NEW) {
|
||||||
|
pos = codeIterator.next(); // dup
|
||||||
|
pos = codeIterator.next(); // ldc of ident
|
||||||
|
pos = codeIterator.next(); // here's the ordinal
|
||||||
|
lastOrd = BytecodeTools.getInteger(constPool, codeIterator, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insertPos == -1) throw new RuntimeException("Failed to find AASTORE");
|
||||||
|
if (lastOrd == -1) throw new RuntimeException("Failed to find ordinals");
|
||||||
|
if (arraySizePos == -1) throw new RuntimeException("Failed to array size position");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveDebug() throws IOException, CannotCompileException, NotFoundException {
|
||||||
|
titleCls.writeFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addTitle(String ident, int id, String name, String femaleName, int skillId, String type) throws BadBytecode, CannotCompileException {
|
||||||
|
int ordinal = ++lastOrd;
|
||||||
|
Bytecode code = new Bytecode(constPool);
|
||||||
|
|
||||||
|
// When starting the values array is on stack, dup it for later use
|
||||||
|
code.add(Bytecode.DUP);
|
||||||
|
|
||||||
|
// Put out ordinal, will be used by AASTORE
|
||||||
|
BytecodeTools.putInteger(constPool, code, ordinal);
|
||||||
|
|
||||||
|
// Make new instance, and dupe that too
|
||||||
|
code.addNew("com.wurmonline.server.players.Titles$Title");
|
||||||
|
code.add(Bytecode.DUP);
|
||||||
|
|
||||||
|
// Put constructor parameters into stack
|
||||||
|
code.addLdc(ident);
|
||||||
|
BytecodeTools.putInteger(constPool, code, ordinal);
|
||||||
|
BytecodeTools.putInteger(constPool, code, id);
|
||||||
|
code.addLdc(name);
|
||||||
|
code.addLdc(femaleName);
|
||||||
|
BytecodeTools.putInteger(constPool, code, skillId);
|
||||||
|
code.addGetstatic("com.wurmonline.server.players.Titles$TitleType", type, "Lcom/wurmonline/server/players/Titles$TitleType;");
|
||||||
|
|
||||||
|
// Call constructor, this will use one copy of our instance duped above, we need 2 more so dup it again
|
||||||
|
code.addInvokespecial("com.wurmonline.server.players.Titles$Title", "<init>", "(Ljava/lang/String;IILjava/lang/String;Ljava/lang/String;ILcom/wurmonline/server/players/Titles$TitleType;)V");
|
||||||
|
code.add(Bytecode.DUP);
|
||||||
|
|
||||||
|
// Put instance into static field - this will use the second copy of our instance
|
||||||
|
//code.addPutstatic("net.bdew.wurm.halloween.titles.TitlesExtended", ident, "Lcom/wurmonline/server/players/Titles$Title;");
|
||||||
|
|
||||||
|
// And finally stick it into values array, this will use the duped array, ordinal and the final copy of our instance
|
||||||
|
code.add(Bytecode.AASTORE);
|
||||||
|
|
||||||
|
// End of bytecode gen, insert it into the initializer
|
||||||
|
byte[] bytes = code.get();
|
||||||
|
codeIterator.insertAt(insertPos, bytes);
|
||||||
|
insertPos += bytes.length;
|
||||||
|
|
||||||
|
// And increase array size
|
||||||
|
codeIterator.write16bit(codeIterator.u16bitAt(arraySizePos) + 1, arraySizePos);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user