WyvernMods Configurable Phase 1
This commit is contained in:
@@ -28,7 +28,8 @@ public class ArrowPackHunting {
|
||||
itemBuilder.itemTypes(new short[]{ // {108, 146, 44, 21, 147, 113} - War Arrow
|
||||
ItemTypes.ITEM_TYPE_NAMED,
|
||||
ItemTypes.ITEM_TYPE_REPAIRABLE,
|
||||
ItemTypes.ITEM_TYPE_WOOD
|
||||
ItemTypes.ITEM_TYPE_WOOD,
|
||||
ItemTypes.ITEM_TYPE_WEAPON
|
||||
});
|
||||
itemBuilder.imageNumber((short) 760);
|
||||
itemBuilder.behaviourType((short) 1);
|
||||
|
||||
@@ -28,7 +28,8 @@ public class ArrowPackWar {
|
||||
itemBuilder.itemTypes(new short[]{ // {108, 146, 44, 21, 147, 113} - War Arrow
|
||||
ItemTypes.ITEM_TYPE_NAMED,
|
||||
ItemTypes.ITEM_TYPE_REPAIRABLE,
|
||||
ItemTypes.ITEM_TYPE_WOOD
|
||||
ItemTypes.ITEM_TYPE_WOOD,
|
||||
ItemTypes.ITEM_TYPE_WEAPON
|
||||
});
|
||||
itemBuilder.imageNumber((short) 760);
|
||||
itemBuilder.behaviourType((short) 1);
|
||||
|
||||
@@ -17,10 +17,10 @@ import com.wurmonline.server.skills.SkillList;
|
||||
public class StatuetteCyberhusky implements ItemTypes, MiscConstants {
|
||||
public static Logger logger = Logger.getLogger(StatuetteCyberhusky.class.getName());
|
||||
public static int templateId;
|
||||
private String name = "statuette of Cyberhusky";
|
||||
private String name = "statuette of Reevi";
|
||||
public void createTemplate() throws IOException{
|
||||
ItemTemplateBuilder itemBuilder = new ItemTemplateBuilder("mod.item.statuette.cyberhusky");
|
||||
itemBuilder.name(name, "statuettes", "A statuette resembling the artists interpretation of the deity Cyberhusky.");
|
||||
itemBuilder.name(name, "statuettes", "A statuette resembling the artists interpretation of the deity Reevi.");
|
||||
itemBuilder.itemTypes(new short[]{ // {108, 52, 22, 44, 87, 92, 147} - Statuette
|
||||
ItemTypes.ITEM_TYPE_NAMED,
|
||||
ItemTypes.ITEM_TYPE_DECORATION,
|
||||
|
||||
@@ -121,7 +121,7 @@ public class AntiCheat {
|
||||
return false;
|
||||
}
|
||||
private static int getDummyWallAntiCheat(int tilex, int tiley){
|
||||
return Tiles.encode(Tiles.decodeHeight(Server.caveMesh.data[tilex | tiley << Constants.meshSize]), Tiles.Tile.TILE_CAVE_WALL.id, Tiles.decodeData((int)Server.caveMesh.data[tilex | tiley << Constants.meshSize]));
|
||||
return Tiles.encode(Tiles.decodeHeight(Server.caveMesh.data[tilex | tiley << Constants.meshSize]), Tiles.Tile.TILE_CAVE_WALL.id, Tiles.decodeData(Server.caveMesh.data[tilex | tiley << Constants.meshSize]));
|
||||
}
|
||||
public static void sendCaveStripAntiCheat(Communicator comm, short xStart, short yStart, int width, int height){
|
||||
if (comm.player != null && comm.player.hasLink()) {
|
||||
@@ -149,7 +149,7 @@ public class AntiCheat {
|
||||
if(!(Tiles.decodeType(Server.caveMesh.getTile(xx, yy)) == Tiles.Tile.TILE_CAVE_EXIT.id)){
|
||||
if(prospecting < 20 && isSurroundedByCaveWalls(xx, yy)){
|
||||
bb.putInt(getDummyWallAntiCheat(xx, yy));
|
||||
}else if(prospecting > 20 && playerCanSeeVein(xx, yy, distance)){
|
||||
}else if(WyvernMods.prospectingVision && prospecting > 20 && playerCanSeeVein(xx, yy, distance)){
|
||||
bb.putInt(Server.caveMesh.data[xx | yy << Constants.meshSize]);
|
||||
}else if(!isSurroundedByCaveWalls(xx, yy)){
|
||||
bb.putInt(Server.caveMesh.data[xx | yy << Constants.meshSize]);
|
||||
@@ -178,6 +178,8 @@ public class AntiCheat {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean isVisibleThroughTerrain(Creature performer, Creature defender){
|
||||
int trees = 0;
|
||||
//int treetilex = -1;
|
||||
@@ -230,6 +232,8 @@ public class AntiCheat {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean isVisibleToAntiCheat(Creature cret, Creature watcher) {
|
||||
if (!cret.isVisible()) {
|
||||
return cret.getPower() > 0 && cret.getPower() <= watcher.getPower();
|
||||
@@ -276,17 +280,18 @@ public class AntiCheat {
|
||||
String replace;
|
||||
|
||||
// - Change the caveStrip method to the custom one, so we can edit what the clients see! - //
|
||||
CtClass ctCommunicator = classPool.get("com.wurmonline.server.creatures.Communicator");
|
||||
replace = "{ mod.sin.wyvern.AntiCheat.sendCaveStripAntiCheat(this, $$); }";
|
||||
Util.setBodyDeclared(thisClass, ctCommunicator, "sendCaveStrip", replace);
|
||||
/*ctCommunicator.getDeclaredMethod("sendCaveStrip").setBody("{"
|
||||
+ " mod.sin.wyvern.AntiCheat.sendCaveStripAntiCheat(this, $$);"
|
||||
+ "}");*/
|
||||
if (WyvernMods.enableSpoofHiddenOre) {
|
||||
CtClass ctCommunicator = classPool.get("com.wurmonline.server.creatures.Communicator");
|
||||
replace = "{ mod.sin.wyvern.AntiCheat.sendCaveStripAntiCheat(this, $$); }";
|
||||
Util.setBodyDeclared(thisClass, ctCommunicator, "sendCaveStrip", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Map Steam ID's to Modsupport table.");
|
||||
CtClass ctLoginHandler = classPool.get("com.wurmonline.server.LoginHandler");
|
||||
replace = AntiCheat.class.getName()+".mapPlayerSteamId($1, $2);";
|
||||
Util.insertBeforeDeclared(thisClass, ctLoginHandler, "preValidateLogin", replace);
|
||||
if (WyvernMods.mapSteamIds) {
|
||||
Util.setReason("Map Steam ID's to Modsupport table.");
|
||||
CtClass ctLoginHandler = classPool.get("com.wurmonline.server.LoginHandler");
|
||||
replace = AntiCheat.class.getName() + ".mapPlayerSteamId($1, $2);";
|
||||
Util.insertBeforeDeclared(thisClass, ctLoginHandler, "preValidateLogin", replace);
|
||||
}
|
||||
|
||||
// - Change the creature isVisibleTo method to the custom one, so we can edit what the clients see! - //
|
||||
/*CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
||||
|
||||
@@ -216,31 +216,19 @@ public class Arena {
|
||||
|
||||
// - Allow horse gear to be added/removed from horses without branding or taming (PvP Only) - //
|
||||
CtClass ctCommunicator = classPool.get("com.wurmonline.server.creatures.Communicator");
|
||||
replace = "if(this.player.getPower() > 0){" +
|
||||
" $_ = this.player;" +
|
||||
"}else if(com.wurmonline.server.Servers.isThisAPvpServer() && owner.getDominator() != this.player){"
|
||||
+ " $_ = owner.getLeader();"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctCommunicator, "reallyHandle_CMD_MOVE_INVENTORY", "getDominator", replace);
|
||||
Util.instrumentDeclared(thisClass, ctCommunicator, "equipCreatureCheck", "getDominator", replace);
|
||||
/*ctCommunicator.getDeclaredMethod("reallyHandle_CMD_MOVE_INVENTORY").instrument(new ExprEditor(){
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("getDominator")) {
|
||||
m.replace("if(com.wurmonline.server.Servers.isThisAPvpServer() && owner.getDominator() != this.player){"
|
||||
+ " $_ = owner.getLeader();"
|
||||
+ "}else{"
|
||||
+ " if(this.player.getPower() > 0){"
|
||||
+ " $_ = this.player;"
|
||||
+ " }else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ " }"
|
||||
+ "}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});*/
|
||||
if (WyvernMods.equipHorseGearByLeading) {
|
||||
Util.setReason("Allow equipping horse gear without taming.");
|
||||
replace = "if(this.player.getPower() > 0){" +
|
||||
" $_ = this.player;" +
|
||||
"}else if(com.wurmonline.server.Servers.isThisAPvpServer() && owner.getDominator() != this.player){"
|
||||
+ " $_ = owner.getLeader();"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctCommunicator, "reallyHandle_CMD_MOVE_INVENTORY", "getDominator", replace);
|
||||
Util.setReason("Allow equipping horse gear without taming.");
|
||||
Util.instrumentDeclared(thisClass, ctCommunicator, "equipCreatureCheck", "getDominator", replace);
|
||||
}
|
||||
|
||||
// - Allow lockpicking on PvP server, as well as treasure chests on PvE - //
|
||||
CtClass ctItemBehaviour = classPool.get("com.wurmonline.server.behaviours.ItemBehaviour");
|
||||
@@ -256,69 +244,72 @@ public class Arena {
|
||||
CtClass.floatType
|
||||
};
|
||||
String desc1 = Descriptor.ofMethod(CtClass.booleanType, params1);
|
||||
Util.setReason("Allow lockpicking on the PvP server and improve PvE treasure chest lockpicking.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = true;"
|
||||
+ "}else{"
|
||||
+ " $_ = target.getLastOwnerId() == -10 || target.getLastOwnerId() == 0 || target.getTemplateId() == 995;"
|
||||
+ "}";
|
||||
Util.instrumentDescribed(thisClass, ctItemBehaviour, "action", desc1, "isInPvPZone", replace);
|
||||
|
||||
CtClass ctMethodsItems = classPool.get("com.wurmonline.server.behaviours.MethodsItems");
|
||||
replace = "$_ = $proceed($$);"
|
||||
+ "if($_ == -10 || $_ == 0){ ok = true; }";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "picklock", "getLastOwnerId", replace);
|
||||
/*ctMethodsItems.getDeclaredMethod("picklock").instrument(new ExprEditor(){
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("getLastOwnerId")) {
|
||||
m.replace("$_ = $proceed($$);"
|
||||
+ "if($_ == -10 || $_ == 0){ ok = true; }");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});*/
|
||||
if (WyvernMods.lockpickingImprovements) {
|
||||
Util.setReason("Allow lockpicking on the PvP server and improve PvE treasure chest lockpicking.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = true;"
|
||||
+ "}else{"
|
||||
+ " $_ = target.getLastOwnerId() == -10 || target.getLastOwnerId() == 0 || target.getTemplateId() == 995;"
|
||||
+ "}";
|
||||
Util.instrumentDescribed(thisClass, ctItemBehaviour, "action", desc1, "isInPvPZone", replace);
|
||||
|
||||
Util.setReason("Allow lockpicking if a container is not owned by a player.");
|
||||
replace = "$_ = $proceed($$);"
|
||||
+ "if($_ == -10 || $_ == 0){ ok = true; }";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "picklock", "getLastOwnerId", replace);
|
||||
}
|
||||
|
||||
// - Disable villages and PMK's on the PvP server - //
|
||||
CtClass ctVillageFoundationQuestion = classPool.get("com.wurmonline.server.questions.VillageFoundationQuestion");
|
||||
Util.setReason("Allow placing deed outside of kingdom border.");
|
||||
replace = "$_ = (byte) 4;";
|
||||
Util.instrumentDeclared(thisClass, ctVillageFoundationQuestion, "checkSize", "getKingdom", replace);
|
||||
if (WyvernMods.placeDeedsOutsideKingdomInfluence) {
|
||||
Util.setReason("Allow placing deed outside of kingdom border.");
|
||||
replace = "$_ = (byte) 4;";
|
||||
Util.instrumentDeclared(thisClass, ctVillageFoundationQuestion, "checkSize", "getKingdom", replace);
|
||||
}
|
||||
|
||||
CtClass ctKingdomFoundationQuestion = classPool.get("com.wurmonline.server.questions.KingdomFoundationQuestion");
|
||||
Util.setReason("Disable PMK's on the Arena server.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " this.getResponder().getCommunicator().sendSafeServerMessage(\"Player-Made Kingdoms are disabled on this server.\");"
|
||||
+ " return;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctKingdomFoundationQuestion, "sendQuestion", replace);
|
||||
if (WyvernMods.disablePMKs) {
|
||||
Util.setReason("Disable PMK's on the Arena server.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " this.getResponder().getCommunicator().sendSafeServerMessage(\"Player-Made Kingdoms are disabled on this server.\");"
|
||||
+ " return;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctKingdomFoundationQuestion, "sendQuestion", replace);
|
||||
}
|
||||
|
||||
// - Disable champion players altogether - //
|
||||
CtClass ctRealDeathQuestion = classPool.get("com.wurmonline.server.questions.RealDeathQuestion");
|
||||
Util.setReason("Disable player champions.");
|
||||
replace = "this.getResponder().getCommunicator().sendSafeServerMessage(\"Champion players are disabled on this server.\");"
|
||||
+ "return;";
|
||||
Util.insertBeforeDeclared(thisClass, ctRealDeathQuestion, "sendQuestion", replace);
|
||||
if (WyvernMods.disablePlayerChampions) {
|
||||
Util.setReason("Disable player champions.");
|
||||
replace = "this.getResponder().getCommunicator().sendSafeServerMessage(\"Champion players are disabled on this server.\");"
|
||||
+ "return;";
|
||||
Util.insertBeforeDeclared(thisClass, ctRealDeathQuestion, "sendQuestion", replace);
|
||||
}
|
||||
|
||||
// - Re-sort player aggression on the PvP server - //
|
||||
CtClass ctPlayer = classPool.get("com.wurmonline.server.players.Player");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return "+Arena.class.getName()+".getArenaAttitude(this, $1);"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "getAttitude", replace);
|
||||
if (WyvernMods.arenaAggression) {
|
||||
Util.setReason("Adjust creature-player aggression on the PvP server.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return " + Arena.class.getName() + ".getArenaAttitude(this, $1);"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "getAttitude", replace);
|
||||
|
||||
Util.setReason("Re-sort creature-player aggression on the PvP server.");
|
||||
replace = "" +
|
||||
"if(com.wurmonline.server.Servers.localServer.PVPSERVER && ($1.isPlayer() || this.isPlayer())){" +
|
||||
" if($1.citizenVillage != null && this.citizenVillage != null){" +
|
||||
" if($1.citizenVillage == this.citizenVillage){" +
|
||||
" return 1;" +
|
||||
" }" +
|
||||
" if($1.citizenVillage.isAlly(this.citizenVillage)){" +
|
||||
" return 1;" +
|
||||
" }" +
|
||||
" }" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "getAttitude", replace);
|
||||
Util.setReason("Re-sort creature-player aggression on the PvP server.");
|
||||
replace = "" +
|
||||
"if(com.wurmonline.server.Servers.localServer.PVPSERVER && ($1.isPlayer() || this.isPlayer())){" +
|
||||
" if($1.citizenVillage != null && this.citizenVillage != null){" +
|
||||
" if($1.citizenVillage == this.citizenVillage){" +
|
||||
" return 1;" +
|
||||
" }" +
|
||||
" if($1.citizenVillage.isAlly(this.citizenVillage)){" +
|
||||
" return 1;" +
|
||||
" }" +
|
||||
" }" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "getAttitude", replace);
|
||||
}
|
||||
|
||||
// - Hook for (ENEMY) declaration to allow for enemy presence blocking - //
|
||||
CtClass ctVirtualZone = classPool.get("com.wurmonline.server.zones.VirtualZone");
|
||||
@@ -331,101 +322,71 @@ public class Arena {
|
||||
CtClass.floatType
|
||||
};
|
||||
String desc2 = Descriptor.ofMethod(CtClass.booleanType, params2);
|
||||
replace = "if(this.watcher.isPlayer()){" +
|
||||
" if("+PlayerTitles.class.getName()+".hasCustomTitle(creature)){" +
|
||||
" suff = suff + "+PlayerTitles.class.getName()+".getCustomTitle(creature);" +
|
||||
" }" +
|
||||
" if(com.wurmonline.server.Servers.localServer.PVPSERVER && creature.isPlayer() && "+Arena.class.getName()+".getArenaAttitude((com.wurmonline.server.players.Player)this.watcher, creature) == 2){"
|
||||
+ " suff = suff + \" (ENEMY)\";"
|
||||
+ " enemy = true;" +
|
||||
" }"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);";
|
||||
Util.instrumentDescribed(thisClass, ctVirtualZone, "addCreature", desc2, "isChampion", replace);
|
||||
if (WyvernMods.enemyTitleHook) {
|
||||
Util.setReason("Add hook for custom titles on all servers and arena aggression ENEMY suffix on PvP servers.");
|
||||
replace = "if(this.watcher.isPlayer()){" +
|
||||
" if(" + PlayerTitles.class.getName() + ".hasCustomTitle(creature)){" +
|
||||
" suff = suff + " + PlayerTitles.class.getName() + ".getCustomTitle(creature);" +
|
||||
" }" +
|
||||
" if(com.wurmonline.server.Servers.localServer.PVPSERVER && creature.isPlayer() && " + Arena.class.getName() + ".getArenaAttitude((com.wurmonline.server.players.Player)this.watcher, creature) == 2){"
|
||||
+ " suff = suff + \" (ENEMY)\";"
|
||||
+ " enemy = true;" +
|
||||
" }"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);";
|
||||
Util.instrumentDescribed(thisClass, ctVirtualZone, "addCreature", desc2, "isChampion", replace);
|
||||
}
|
||||
|
||||
// - Modify when an enemy is present or not to use attitude instead of kingdom - //
|
||||
replace = "if(this.watcher.isPlayer() && creature.isPlayer() && com.wurmonline.server.Servers.localServer.PVPSERVER && "+Arena.class.getName()+".getArenaAttitude((com.wurmonline.server.players.Player)this.watcher, creature) == 2){"
|
||||
+ " $_ = 1;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctVirtualZone, "checkIfEnemyIsPresent", "getKingdomId", replace);
|
||||
/*ctVirtualZone.getDeclaredMethod("checkIfEnemyIsPresent").instrument(new ExprEditor(){
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("getKingdomId")) {
|
||||
m.replace("if(this.watcher.isPlayer() && creature.isPlayer() && com.wurmonline.server.Servers.localServer.PVPSERVER && mod.sin.wyvern.Arena.getArenaAttitude((com.wurmonline.server.players.Player)this.watcher, creature) == 2){"
|
||||
+ " $_ = 1;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});*/
|
||||
if (WyvernMods.enemyPresenceOnAggression) {
|
||||
Util.setReason("Apply enemy presence based on aggression instead of kingdom.");
|
||||
replace = "if(this.watcher.isPlayer() && creature.isPlayer() && com.wurmonline.server.Servers.localServer.PVPSERVER && " + Arena.class.getName() + ".getArenaAttitude((com.wurmonline.server.players.Player)this.watcher, creature) == 2){"
|
||||
+ " $_ = 1;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctVirtualZone, "checkIfEnemyIsPresent", "getKingdomId", replace);
|
||||
}
|
||||
|
||||
// - Block twigs and stones on the PvP server - //
|
||||
CtClass ctMethodsCreatures = classPool.get("com.wurmonline.server.behaviours.MethodsCreatures");
|
||||
Util.setReason("Block farwalker twigs and stones on PvP.");
|
||||
replace = "$_ = com.wurmonline.server.Servers.localServer.PVPSERVER;";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsCreatures, "teleportCreature", "isInPvPZone", replace);
|
||||
/*ctMethodsCreatures.getDeclaredMethod("teleportCreature").instrument(new ExprEditor(){
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("isInPvPZone")) {
|
||||
m.replace("$_ = com.wurmonline.server.Servers.localServer.PVPSERVER;");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
// - After respawn on PvP, send directly to PvE server - //
|
||||
/*CtClass ctSpawnQuestion = classPool.get("com.wurmonline.server.questions.SpawnQuestion");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " "+Arena.class.getName()+".respawnPlayer(this.getResponder(), com.wurmonline.server.Servers.localServer);"
|
||||
+ " return;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctSpawnQuestion, "sendQuestion", replace);*/
|
||||
/*ctSpawnQuestion.getDeclaredMethod("sendQuestion").insertBefore(""
|
||||
+ "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " mod.sin.wyvern.Arena.respawnPlayer(this.getResponder(), com.wurmonline.server.Servers.localServer);"
|
||||
+ " return;"
|
||||
+ "}");*/
|
||||
if (WyvernMods.disableFarwalkerItems) {
|
||||
Util.setReason("Block farwalker twigs and stones on PvP.");
|
||||
replace = "$_ = com.wurmonline.server.Servers.localServer.PVPSERVER;";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsCreatures, "teleportCreature", "isInPvPZone", replace);
|
||||
}
|
||||
|
||||
// - Allow affinity stealing and battle rank changes - //
|
||||
Util.setReason("Allow affinity stealing and battle rank changes.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = true;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctPlayer, "modifyRanking", "isEnemyOnChaos", replace);
|
||||
if (WyvernMods.alwaysAllowAffinitySteal) {
|
||||
Util.setReason("Allow affinity stealing and battle rank changes.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = true;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctPlayer, "modifyRanking", "isEnemyOnChaos", replace);
|
||||
}
|
||||
|
||||
//CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
||||
Util.setReason("Increase fight skill gain on PvP server.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " p.getFightingSkill().setKnowledge(pskill + (skillGained*1.5d), false);"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "checkInitialTitle", replace);
|
||||
if (WyvernMods.adjustFightSkillGain) {
|
||||
Util.setReason("Adjust fight skill gain on PvP server.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " p.getFightingSkill().setKnowledge(pskill + (skillGained*1.5d), false);"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "checkInitialTitle", replace);
|
||||
}
|
||||
|
||||
// - Fix nearby enemy check to find aggression instead of kingdom - //
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = c.getAttitude(performer) != 2 && c.getAttitude(performer) != 1;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "isEnemiesNearby", "isFriendlyKingdom", replace);
|
||||
/*ctMethodsItems.getDeclaredMethod("isEnemiesNearby").instrument(new ExprEditor(){
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("isFriendlyKingdom")) {
|
||||
m.replace("if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = c.getAttitude(performer) != 2;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});*/
|
||||
if (WyvernMods.useAggressionForNearbyEnemies) {
|
||||
Util.setReason("Fix nearby enemy check to use aggression instead of kingdom.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = c.getAttitude(performer) != 2 && c.getAttitude(performer) != 1;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "isEnemiesNearby", "isFriendlyKingdom", replace);
|
||||
}
|
||||
|
||||
// Die method description
|
||||
CtClass ctString = classPool.get("java.lang.String");
|
||||
@@ -437,144 +398,137 @@ public class Arena {
|
||||
String desc8 = Descriptor.ofMethod(CtClass.voidType, params8);
|
||||
|
||||
// - Ensure corpses are not loot protected on PvP - //
|
||||
Util.setReason("Ensure corpses are not loot protected.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = $proceed(false);"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "setProtected", replace);
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = true;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "isInPvPZone", replace);
|
||||
if (WyvernMods.disablePvPCorpseProtection) {
|
||||
Util.setReason("Ensure corpses are not loot protected.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = $proceed(false);"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "setProtected", replace);
|
||||
Util.setReason("Ensure corpses are not loot protected.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " $_ = true;"
|
||||
+ "}else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "isInPvPZone", replace);
|
||||
}
|
||||
|
||||
// - Allow players to do actions in PvP houses - //
|
||||
CtClass ctMethods = classPool.get("com.wurmonline.server.behaviours.Methods");
|
||||
Util.setReason("Enable players to do actions in PvP houses.");
|
||||
replace = "$_ = com.wurmonline.server.Servers.localServer.PVPSERVER;";
|
||||
Util.instrumentDeclared(thisClass, ctMethods, "isNotAllowedMessage", "isEnemy", replace);
|
||||
if (WyvernMods.bypassHousePermissions) {
|
||||
Util.setReason("Enable players to do actions in PvP houses.");
|
||||
replace = "$_ = com.wurmonline.server.Servers.localServer.PVPSERVER;";
|
||||
Util.instrumentDeclared(thisClass, ctMethods, "isNotAllowedMessage", "isEnemy", replace);
|
||||
}
|
||||
|
||||
// - Allow stealing against deity wishes without being punished on Arena - //
|
||||
//CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action");
|
||||
Util.setReason("Allow stealing against deity wishes without being punished.");
|
||||
replace = "$_ = $proceed($$) || com.wurmonline.server.Servers.localServer.PVPSERVER;";
|
||||
Util.instrumentDeclared(thisClass, ctAction, "checkLegalMode", "isLibila", replace);
|
||||
/*ctAction.getDeclaredMethod("checkLegalMode").instrument(new ExprEditor(){
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("isLibila")) {
|
||||
m.replace("$_ = $proceed($$) || com.wurmonline.server.Servers.localServer.PVPSERVER;");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});*/
|
||||
if (WyvernMods.allowStealingAgainstDeityWishes) {
|
||||
Util.setReason("Allow stealing against deity wishes without being punished.");
|
||||
replace = "$_ = $proceed($$) || com.wurmonline.server.Servers.localServer.PVPSERVER;";
|
||||
Util.instrumentDeclared(thisClass, ctAction, "checkLegalMode", "isLibila", replace);
|
||||
}
|
||||
|
||||
// - Allow taking ownership of vehicles on Arena - //
|
||||
// TODO: Fix.
|
||||
Util.setReason("Allow taking ownership of vehicles on Arena.");
|
||||
CtClass[] params3 = new CtClass[]{
|
||||
CtClass.longType,
|
||||
CtClass.booleanType,
|
||||
CtClass.byteType,
|
||||
CtClass.intType,
|
||||
CtClass.intType
|
||||
};
|
||||
String desc3 = Descriptor.ofMethod(CtClass.voidType, params3);
|
||||
replace = "$_ = com.wurmonline.server.Servers.localServer.PVPSERVER && !lVehicle.isLocked();";
|
||||
Util.instrumentDescribed(thisClass, ctCreature, "setVehicle", desc3, "isThisAChaosServer", replace);
|
||||
if (WyvernMods.sameKingdomVehicleTheft) {
|
||||
Util.setReason("Allow taking ownership of vehicles on Arena.");
|
||||
CtClass[] params3 = new CtClass[]{
|
||||
CtClass.longType,
|
||||
CtClass.booleanType,
|
||||
CtClass.byteType,
|
||||
CtClass.intType,
|
||||
CtClass.intType
|
||||
};
|
||||
String desc3 = Descriptor.ofMethod(CtClass.voidType, params3);
|
||||
replace = "$_ = com.wurmonline.server.Servers.localServer.PVPSERVER && !lVehicle.isLocked();";
|
||||
Util.instrumentDescribed(thisClass, ctCreature, "setVehicle", desc3, "isThisAChaosServer", replace);
|
||||
}
|
||||
|
||||
// - Multiply mine door bash damage by 3 on Arena - //
|
||||
CtClass ctTerraforming = classPool.get("com.wurmonline.server.behaviours.Terraforming");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " damage *= 3d;"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctTerraforming, "destroyMineDoor", "getOrCreateTile", replace);
|
||||
/*ctTerraforming.getDeclaredMethod("destroyMineDoor").instrument(new ExprEditor(){
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("getOrCreateTile")) {
|
||||
m.replace("if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " damage *= 3d;"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);");
|
||||
return;
|
||||
}
|
||||
}
|
||||
});*/
|
||||
if (WyvernMods.adjustMineDoorDamage) {
|
||||
Util.setReason("Adjust mine door bash damage.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " damage *= 3d;"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctTerraforming, "destroyMineDoor", "getOrCreateTile", replace);
|
||||
}
|
||||
|
||||
// - Prevent tons of errors for legality on Arena. - //
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return true;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "isOkToKillBy", replace);
|
||||
/*ctCreature.getDeclaredMethod("isOkToKillBy").insertBefore(""
|
||||
+ "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return true;"
|
||||
+ "}");*/
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "hasBeenAttackedBy", replace);
|
||||
/*ctCreature.getDeclaredMethod("hasBeenAttackedBy").insertBefore(""
|
||||
+ "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return true;"
|
||||
+ "}");*/
|
||||
if (WyvernMods.sameKingdomPermissionsAdjustments) {
|
||||
Util.setReason("Adjust same-kingdom permissions on Arena.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return true;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "isOkToKillBy", replace);
|
||||
Util.setReason("Adjust same-kingdom permissions on Arena.");
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "hasBeenAttackedBy", replace);
|
||||
}
|
||||
|
||||
// - Disable CA Help on Arena - //
|
||||
Util.setReason("Disable CA HELP on Arena.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return false;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "seesPlayerAssistantWindow", replace);
|
||||
if (WyvernMods.disableCAHelpOnPvP) {
|
||||
Util.setReason("Disable CA HELP on PvP servers.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
|
||||
+ " return false;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "seesPlayerAssistantWindow", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Make players who are non-allied enemies of villages.");
|
||||
CtClass ctVillage = classPool.get("com.wurmonline.server.villages.Village");
|
||||
CtClass[] params4 = new CtClass[]{
|
||||
ctCreature,
|
||||
CtClass.booleanType
|
||||
};
|
||||
String desc4 = Descriptor.ofMethod(CtClass.booleanType, params4);
|
||||
replace = "" +
|
||||
"if(com.wurmonline.server.Servers.localServer.PVPSERVER && $1.isPlayer()){" +
|
||||
" if($1.getPower() > 0){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if(this.isCitizen($1) || this.isAlly($1)){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" return true;" +
|
||||
"}" +
|
||||
// Additional code added to ensure village guards do not attack titans or rare creatures.
|
||||
"if("+Titans.class.getName()+".isTitan($1) || "+RareSpawns.class.getName()+".isRareCreature($1)){" +
|
||||
" return false;" +
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctVillage, "isEnemy", desc4, replace);
|
||||
CtClass ctVillage = classPool.get("com.wurmonline.server.villages.Village");
|
||||
if (WyvernMods.sameKingdomVillageWarfare) {
|
||||
Util.setReason("Make players who are non-allied enemies of villages.");
|
||||
CtClass[] params4 = new CtClass[]{
|
||||
ctCreature,
|
||||
CtClass.booleanType
|
||||
};
|
||||
String desc4 = Descriptor.ofMethod(CtClass.booleanType, params4);
|
||||
replace = "" +
|
||||
"if(com.wurmonline.server.Servers.localServer.PVPSERVER && $1.isPlayer()){" +
|
||||
" if($1.getPower() > 0){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if(this.isCitizen($1) || this.isAlly($1)){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" return true;" +
|
||||
"}" +
|
||||
// Additional code added to ensure village guards do not attack titans or rare creatures.
|
||||
"if(" + Titans.class.getName() + ".isTitan($1) || " + RareSpawns.class.getName() + ".isRareCreature($1)){" +
|
||||
" return false;" +
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctVillage, "isEnemy", desc4, replace);
|
||||
|
||||
Util.setReason("Make all deeds enemies of eachother unless allied.");
|
||||
CtClass[] params5 = new CtClass[]{
|
||||
ctVillage
|
||||
};
|
||||
String desc5 = Descriptor.ofMethod(CtClass.booleanType, params5);
|
||||
replace = "{ if($1 == null){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if($1.kingdom != this.kingdom){" +
|
||||
" return true;" +
|
||||
" }" +
|
||||
" if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" if(this.isAlly($1)){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if($0 == $1){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" return true;" +
|
||||
"}" +
|
||||
"return false; }";
|
||||
Util.setBodyDescribed(thisClass, ctVillage, "isEnemy", desc5, replace);
|
||||
Util.setReason("Make all deeds enemies of eachother unless allied.");
|
||||
CtClass[] params5 = new CtClass[]{
|
||||
ctVillage
|
||||
};
|
||||
String desc5 = Descriptor.ofMethod(CtClass.booleanType, params5);
|
||||
replace = "{ if($1 == null){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if($1.kingdom != this.kingdom){" +
|
||||
" return true;" +
|
||||
" }" +
|
||||
" if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" if(this.isAlly($1)){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if($0 == $1){" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" return true;" +
|
||||
"}" +
|
||||
"return false; }";
|
||||
Util.setBodyDescribed(thisClass, ctVillage, "isEnemy", desc5, replace);
|
||||
}
|
||||
|
||||
Util.setReason("Change HotA reward");
|
||||
replace = Arena.class.getName()+".createNewHotaPrize(this, $1);";
|
||||
Util.setBodyDeclared(thisClass, ctVillage, "createHotaPrize", replace);
|
||||
if (WyvernMods.adjustHotARewards) {
|
||||
Util.setReason("Adjust HotA rewards.");
|
||||
replace = Arena.class.getName() + ".createNewHotaPrize(this, $1);";
|
||||
Util.setBodyDeclared(thisClass, ctVillage, "createHotaPrize", replace);
|
||||
}
|
||||
|
||||
CtClass ctGuardPlan = classPool.get("com.wurmonline.server.villages.GuardPlan");
|
||||
CtClass[] params6 = new CtClass[]{
|
||||
@@ -582,122 +536,140 @@ public class Arena {
|
||||
CtClass.intType
|
||||
};
|
||||
String desc6 = Descriptor.ofMethod(CtClass.intType, params6);
|
||||
Util.setReason("Cap maximum guards to 5.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" return Math.min(5, Math.max(3, $1 * $2 / 49));" +
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctGuardPlan, "getMaxGuards", desc6, replace);
|
||||
if (WyvernMods.capMaximumGuards) {
|
||||
Util.setReason("Cap maximum guards to 5.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" return Math.min(5, Math.max(3, $1 * $2 / 49));" +
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctGuardPlan, "getMaxGuards", desc6, replace);
|
||||
}
|
||||
|
||||
Util.setReason("Disable towers");
|
||||
CtClass ctAdvancedCreationEntry = classPool.get("com.wurmonline.server.items.AdvancedCreationEntry");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" performer.getCommunicator().sendAlertServerMessage(\"Towers are disabled for now. A new system is in progress.\");" +
|
||||
" throw new com.wurmonline.server.NoSuchItemException(\"Towers are disabled.\");" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctAdvancedCreationEntry, "cont", "isTowerTooNear", replace);
|
||||
Util.instrumentDeclared(thisClass, ctAdvancedCreationEntry, "run", "isTowerTooNear", replace);
|
||||
if (WyvernMods.disableTowerConstruction) {
|
||||
Util.setReason("Disable towers from being constructed.");
|
||||
CtClass ctAdvancedCreationEntry = classPool.get("com.wurmonline.server.items.AdvancedCreationEntry");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" performer.getCommunicator().sendAlertServerMessage(\"Towers are disabled.\");" +
|
||||
" throw new com.wurmonline.server.NoSuchItemException(\"Towers are disabled.\");" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctAdvancedCreationEntry, "cont", "isTowerTooNear", replace);
|
||||
Util.setReason("Disable towers from being constructed.");
|
||||
Util.instrumentDeclared(thisClass, ctAdvancedCreationEntry, "run", "isTowerTooNear", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Reduce local range (player).");
|
||||
replace = "if($3 > 5){" +
|
||||
" $_ = $proceed($1, $2, 50);" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctVirtualZone, "coversCreature", "isWithinDistanceTo", replace);
|
||||
Util.setReason("Reduce local range (creature).");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctVirtualZone, "coversCreature", "isPlayer", replace);
|
||||
if (WyvernMods.adjustLocalRange) {
|
||||
Util.setReason("Reduce local range (player).");
|
||||
replace = "if($3 > 5){" +
|
||||
" $_ = $proceed($1, $2, 50);" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctVirtualZone, "coversCreature", "isWithinDistanceTo", replace);
|
||||
Util.setReason("Reduce local range (creature).");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctVirtualZone, "coversCreature", "isPlayer", replace);
|
||||
}
|
||||
|
||||
CtClass ctKarmaQuestion = classPool.get("com.wurmonline.server.questions.KarmaQuestion");
|
||||
Util.setReason("Disable Karma teleport.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" $_ = true;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctKarmaQuestion, "answer", "isInPvPZone", replace);
|
||||
if (WyvernMods.disableKarmaTeleport) {
|
||||
CtClass ctKarmaQuestion = classPool.get("com.wurmonline.server.questions.KarmaQuestion");
|
||||
Util.setReason("Disable Karma teleport.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" $_ = true;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctKarmaQuestion, "answer", "isInPvPZone", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Make players only able to lead one creature.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" return this.followers == null || this.followers.size() < 1;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "mayLeadMoreCreatures", replace);
|
||||
if (WyvernMods.limitLeadCreatures) {
|
||||
Util.setReason("Make players only able to lead one creature.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" return this.followers == null || this.followers.size() < 1;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctPlayer, "mayLeadMoreCreatures", replace);
|
||||
}
|
||||
|
||||
CtClass ctMethodsStructure = classPool.get("com.wurmonline.server.behaviours.MethodsStructure");
|
||||
Util.setReason("Increase bash timer to 15 seconds.");
|
||||
replace = "time = 600;" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsStructure, "destroyWall", "getStructure", replace);
|
||||
if (WyvernMods.adjustBashTimer) {
|
||||
CtClass ctMethodsStructure = classPool.get("com.wurmonline.server.behaviours.MethodsStructure");
|
||||
Util.setReason("Increase bash timer.");
|
||||
replace = "time = 600;" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsStructure, "destroyWall", "getStructure", replace);
|
||||
}
|
||||
|
||||
CtClass ctHota = classPool.get("com.wurmonline.server.epic.Hota");
|
||||
Util.setReason("Display discord message for HotA announcements.");
|
||||
replace = Arena.class.getName()+".sendHotaMessage($1);" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctHota, "poll", "broadCastSafe", replace);
|
||||
Util.setReason("Display discord message for HotA wins.");
|
||||
Util.instrumentDeclared(thisClass, ctHota, "win", "broadCastSafe", replace);
|
||||
Util.setReason("Display discord message for HotA conquers & neutralizes.");
|
||||
replace = "if($2.getData1() == 0){" +
|
||||
" "+Arena.class.getName()+".sendHotaMessage($1.getName() + \" neutralizes the \" + $2.getName() + \".\");" +
|
||||
"}else{" +
|
||||
" "+Arena.class.getName()+".sendHotaMessage($1.getName() + \" conquers the \" + $2.getName() + \".\");" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctHota, "addPillarConquered", replace);
|
||||
if (WyvernMods.discordRelayHotAMessages) {
|
||||
CtClass ctHota = classPool.get("com.wurmonline.server.epic.Hota");
|
||||
Util.setReason("Display discord message for HotA announcements.");
|
||||
replace = Arena.class.getName() + ".sendHotaMessage($1);" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctHota, "poll", "broadCastSafe", replace);
|
||||
Util.setReason("Display discord message for HotA wins.");
|
||||
Util.instrumentDeclared(thisClass, ctHota, "win", "broadCastSafe", replace);
|
||||
Util.setReason("Display discord message for HotA conquers & neutralizes.");
|
||||
replace = "if($2.getData1() == 0){" +
|
||||
" " + Arena.class.getName() + ".sendHotaMessage($1.getName() + \" neutralizes the \" + $2.getName() + \".\");" +
|
||||
"}else{" +
|
||||
" " + Arena.class.getName() + ".sendHotaMessage($1.getName() + \" conquers the \" + $2.getName() + \".\");" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctHota, "addPillarConquered", replace);
|
||||
}
|
||||
|
||||
// handle_TARGET_and_TARGET_HOSTILE
|
||||
CtClass ctCreatureBehaviour = classPool.get("com.wurmonline.server.behaviours.CreatureBehaviour");
|
||||
Util.setReason("Allow players to attack enemy guards.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" $_ = false;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctCreatureBehaviour, "handle_TARGET_and_TARGET_HOSTILE", "isFriendlyKingdom", replace);
|
||||
if (WyvernMods.allowAttackingSameKingdomGuards) {
|
||||
CtClass ctCreatureBehaviour = classPool.get("com.wurmonline.server.behaviours.CreatureBehaviour");
|
||||
Util.setReason("Allow players to attack enemy guards.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" $_ = false;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctCreatureBehaviour, "handle_TARGET_and_TARGET_HOSTILE", "isFriendlyKingdom", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Fix templars attacking themselves.");
|
||||
replace = "if($1.isSpiritGuard()){" +
|
||||
" return;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctVillage, "addTarget", replace);
|
||||
if (WyvernMods.fixGuardsAttackingThemselves) {
|
||||
Util.setReason("Fix templars attacking themselves.");
|
||||
replace = "if($1.isSpiritGuard()){" +
|
||||
" return;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctVillage, "addTarget", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Keep mine doors open for shorter durations.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctCreature, "checkOpenMineDoor", "isThisAChaosServer", replace);
|
||||
if (WyvernMods.reducedMineDoorOpenTime) {
|
||||
Util.setReason("Keep mine doors open for 30 seconds instead of 120 seconds.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctCreature, "checkOpenMineDoor", "isThisAChaosServer", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Fix fight skill gains against enemy players.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" if($0 == this){" +
|
||||
" $_ = -1;" +
|
||||
" }else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
" }" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "getKingdomId", replace);
|
||||
if (WyvernMods.allowSameKingdomFightSkillGains) {
|
||||
Util.setReason("Fix fight skill gains against enemy players.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" if($0 == this){" +
|
||||
" $_ = -1;" +
|
||||
" }else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
" }" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctCreature, "modifyFightSkill", "getKingdomId", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Enable archering enemies on deeds.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctVillage, "mayAttack", "isEnemyOnChaos", replace);
|
||||
if (WyvernMods.allowArcheringOnSameKingdomDeeds) {
|
||||
Util.setReason("Enable archering enemies on deeds.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctVillage, "mayAttack", "isEnemyOnChaos", replace);
|
||||
}
|
||||
|
||||
// Server.rand.nextFloat()*(35/(1-2*desiredPercent))
|
||||
Util.setReason("Nerf magranon faith protection.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" $_ = com.wurmonline.server.Server.rand.nextInt(40);" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDescribed(thisClass, ctCreature, "die", desc8, "getFavor", replace);
|
||||
if (WyvernMods.sendNewSpawnQuestionOnPvP) {
|
||||
Util.setReason("Adjust spawn question mechanics.");
|
||||
CtClass ctSpawnQuestion = classPool.get("com.wurmonline.server.questions.SpawnQuestion");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
Arena.class.getName() + ".sendNewSpawnQuestion(this);" +
|
||||
"return;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctSpawnQuestion, "sendQuestion", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Adjust spawn question mechanics.");
|
||||
CtClass ctSpawnQuestion = classPool.get("com.wurmonline.server.questions.SpawnQuestion");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
Arena.class.getName()+".sendNewSpawnQuestion(this);" +
|
||||
"return;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctSpawnQuestion, "sendQuestion", replace);
|
||||
CtClass ctMeshIO = classPool.get("com.wurmonline.mesh.MeshIO");
|
||||
CtClass[] params7 = new CtClass[]{
|
||||
ctCreature,
|
||||
@@ -711,20 +683,25 @@ public class Arena {
|
||||
CtClass.booleanType
|
||||
};
|
||||
String desc7 = Descriptor.ofMethod(CtClass.booleanType, params7);
|
||||
replace = Arena.class.getName()+".sendHotaMessage($1+\" \"+$2);" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDescribed(thisClass, ctTerraforming, "dig", desc7, "addHistory", replace);
|
||||
if (WyvernMods.sendArtifactDigsToDiscord) {
|
||||
Util.setReason("Announce digging up artifacts on Discord.");
|
||||
replace = Arena.class.getName() + ".sendHotaMessage($1+\" \"+$2);" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDescribed(thisClass, ctTerraforming, "dig", desc7, "addHistory", replace);
|
||||
}
|
||||
|
||||
// Creature performer, Item source, int tilex, int tiley, int tile, float counter, boolean corner, MeshIO mesh, boolean toPile
|
||||
Util.setReason("Set favored kingdom for PvP");
|
||||
CtClass ctDeities = classPool.get("com.wurmonline.server.deities.Deities");
|
||||
replace = "{ return (byte) 4; }";
|
||||
Util.setBodyDeclared(thisClass, ctDeities, "getFavoredKingdom", replace);
|
||||
if (WyvernMods.makeFreedomFavoredKingdom) {
|
||||
CtClass ctDeities = classPool.get("com.wurmonline.server.deities.Deities");
|
||||
Util.setReason("Set favored kingdom for PvP");
|
||||
replace = "{ return (byte) 4; }";
|
||||
Util.setBodyDeclared(thisClass, ctDeities, "getFavoredKingdom", replace);
|
||||
|
||||
Util.setReason("Set favored kingdom for PvP");
|
||||
CtClass ctDeity = classPool.get("com.wurmonline.server.deities.Deity");
|
||||
replace = "{ return (byte) 4; }";
|
||||
Util.setBodyDeclared(thisClass, ctDeities, "getFavoredKingdom", replace);
|
||||
CtClass ctDeity = classPool.get("com.wurmonline.server.deities.Deity");
|
||||
Util.setReason("Set favored kingdom for PvP");
|
||||
replace = "{ return (byte) 4; }";
|
||||
Util.setBodyDeclared(thisClass, ctDeities, "getFavoredKingdom", replace);
|
||||
}
|
||||
|
||||
/*Util.setReason("Decrease PvP combat damage.");
|
||||
CtClass ctString = classPool.get("java.lang.String");
|
||||
@@ -753,51 +730,62 @@ public class Arena {
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc8, replace);*/
|
||||
|
||||
/* Removed in favor of DUSKombat.
|
||||
Util.setReason("Reduce player vs player damage by half.");
|
||||
CtClass ctCombatHandler = classPool.get("com.wurmonline.server.creatures.CombatHandler");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && ($1.isDominated() || $1.isPlayer()) && $0.creature.isPlayer()){" +
|
||||
//" logger.info(\"Detected player hit against player/pet opponent. Halving damage.\");" +
|
||||
" $3 = $3 * 0.7d;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCombatHandler, "setDamage", replace);
|
||||
Util.insertBeforeDeclared(thisClass, ctCombatHandler, "setDamage", replace);*/
|
||||
|
||||
Util.setReason("Disable crown influence from spreading to enemies.");
|
||||
replace = "$_ = $0.getAttitude(this) == 1;";
|
||||
Util.instrumentDeclared(thisClass, ctPlayer, "spreadCrownInfluence", "isFriendlyKingdom", replace);
|
||||
if (WyvernMods.crownInfluenceOnAggression) {
|
||||
Util.setReason("Disable crown influence from spreading to enemies.");
|
||||
replace = "$_ = $0.getAttitude(this) == 1;";
|
||||
Util.instrumentDeclared(thisClass, ctPlayer, "spreadCrownInfluence", "isFriendlyKingdom", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Disable item drops from players on Arena.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && this.isPlayer()){" +
|
||||
" this.getCommunicator().sendSafeServerMessage(\"You have died on the Arena server and your items are kept safe.\");" +
|
||||
" keepItems = true;" +
|
||||
"}" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDescribedCount(thisClass, ctCreature, "die", desc8, "isOnCurrentServer", 1, replace);
|
||||
if (WyvernMods.disableOWFL) {
|
||||
Util.setReason("Disable item drops from players on Arena.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && this.isPlayer()){" +
|
||||
" this.getCommunicator().sendSafeServerMessage(\"You have died on the Arena server and your items are kept safe.\");" +
|
||||
" keepItems = true;" +
|
||||
"}" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDescribedCount(thisClass, ctCreature, "die", desc8, "isOnCurrentServer", 1, replace);
|
||||
}
|
||||
|
||||
Util.setReason("Disable player skill loss on Arena.");
|
||||
replace = "if(this.isPlayer() && this.isDeathProtected()){" +
|
||||
" this.getCommunicator().sendSafeServerMessage(\"You have died with a Resurrection Stone and your knowledge is kept safe.\");" +
|
||||
" return;" +
|
||||
"}else{" +
|
||||
" this.getCommunicator().sendAlertServerMessage(\"You have died without a Resurrection Stone, resulting in some of your knowledge being lost.\");" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "punishSkills", replace);
|
||||
if (WyvernMods.resurrectionStonesProtectSkill) {
|
||||
Util.setReason("Disable player skill loss on Arena.");
|
||||
replace = "if(this.isPlayer() && this.isDeathProtected()){" +
|
||||
" this.getCommunicator().sendSafeServerMessage(\"You have died with a Resurrection Stone and your knowledge is kept safe.\");" +
|
||||
" return;" +
|
||||
"}else{" +
|
||||
" this.getCommunicator().sendAlertServerMessage(\"You have died without a Resurrection Stone, resulting in some of your knowledge being lost.\");" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "punishSkills", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Disable player fight skill loss on Arena.");
|
||||
replace = "if(this.isPlayer() && this.isDeathProtected()){" +
|
||||
" $_ = null;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclaredCount(thisClass, ctCreature, "modifyFightSkill", "setKnowledge", 1, replace);
|
||||
if (WyvernMods.resurrectionStonesProtectFightSkill) {
|
||||
Util.setReason("Disable player fight skill loss if they have a resurrection stone.");
|
||||
replace = "if(this.isPlayer() && this.isDeathProtected()){" +
|
||||
" $_ = null;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclaredCount(thisClass, ctCreature, "modifyFightSkill", "setKnowledge", 1, replace);
|
||||
}
|
||||
|
||||
Util.setReason("Disable player affinity loss on Arena.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && this.isPlayer() && this.isDeathProtected()){" +
|
||||
" this.getCommunicator().sendSafeServerMessage(\"Your resurrection stone keeps your affinities safe from your slayers.\");" +
|
||||
" $_ = "+Arena.class.getName()+".getNullAffinities();" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctPlayer, "modifyRanking", "getAffinities", replace);
|
||||
if (WyvernMods.resurrectionStonesProtectAffinities) {
|
||||
Util.setReason("Disable player affinity loss on Arena.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && this.isPlayer() && this.isDeathProtected()){" +
|
||||
" this.getCommunicator().sendSafeServerMessage(\"Your resurrection stone keeps your affinities safe from your slayers.\");" +
|
||||
" $_ = " + Arena.class.getName() + ".getNullAffinities();" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctPlayer, "modifyRanking", "getAffinities", replace);
|
||||
}
|
||||
|
||||
/*Util.setReason("Enable stealing from deeds.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
@@ -807,6 +795,14 @@ public class Arena {
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "checkIfStealing", "mayPass", replace);*/
|
||||
|
||||
if (WyvernMods.bypassPlantedPermissionChecks) {
|
||||
Util.setReason("Allow movement of planted items on Arena regardless of permission status.");
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
|
||||
" return true;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctItem, "checkPlantedPermissions", replace);
|
||||
}
|
||||
|
||||
|
||||
}catch (NotFoundException e) {
|
||||
throw new HookException(e);
|
||||
|
||||
@@ -25,6 +25,11 @@ public class GemAugmentation {
|
||||
Class<GemAugmentation> thisClass = GemAugmentation.class;
|
||||
String replace;
|
||||
|
||||
Util.setReason("Disable Gem Augmentation skill from converting.");
|
||||
CtClass ctMethodsReligion = classPool.get("com.wurmonline.server.behaviours.MethodsReligion");
|
||||
replace = "$_ = $proceed($1, $2, true, $4);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsReligion, "listen", "skillCheck", replace);
|
||||
|
||||
Util.setReason("Primary Gem Augmentation Hook.");
|
||||
CtClass ctMethodsItems = classPool.get("com.wurmonline.server.behaviours.MethodsItems");
|
||||
replace = "$_ = "+GemAugmentation.class.getName()+".setGemmedQuality($0, power, maxGain, modifier);";
|
||||
|
||||
@@ -204,7 +204,7 @@ public class ItemMod {
|
||||
//SKELETON_DECORATION.initCreationEntry();
|
||||
SOUL_FORGE.initCreationEntry();
|
||||
STATUETTE_BREYK.initCreationEntry();
|
||||
//STATUETTE_CYBERHUSKY.initCreationEntry();
|
||||
STATUETTE_CYBERHUSKY.initCreationEntry();
|
||||
WARHAMMER.initCreationEntry();
|
||||
WARHAMMER_HEAD.initCreationEntry();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,18 @@
|
||||
package mod.sin.wyvern;
|
||||
|
||||
import com.wurmonline.server.DbConnector;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import com.wurmonline.server.players.PlayerInfo;
|
||||
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 net.bdew.wurm.tools.server.ModTitles;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class PlayerTitles {
|
||||
public static Logger logger = Logger.getLogger(PlayerTitles.class.getName());
|
||||
private static Titles.Title[] titleArray;
|
||||
|
||||
// Player Title Maps
|
||||
protected static ArrayList<String> donatorTitles = new ArrayList<>();
|
||||
@@ -37,10 +23,10 @@ public class PlayerTitles {
|
||||
// Event Title ID's
|
||||
public static int TITAN_SLAYER = 10000;
|
||||
public static int SPECTRAL = 10001;
|
||||
public static int PASTAMANCER = 10002;
|
||||
//public static int PASTAMANCER = 10002;
|
||||
|
||||
// Player Donation Title ID's
|
||||
public static int PATRON = 19999;
|
||||
/*public static int PATRON = 19999;
|
||||
public static int DONATOR = 20000;
|
||||
public static int PAZZA_FAVORITE_GM = 20001;
|
||||
public static int WARRIORGEN_THAT_GUY = 20002;
|
||||
@@ -53,138 +39,43 @@ public class PlayerTitles {
|
||||
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);
|
||||
public static int ATTICUS_THE_GREAT_ILLUMINATY = 20012;*/
|
||||
|
||||
public static void init(){
|
||||
for (WyvernMods.CustomTitle title : WyvernMods.customTitles){
|
||||
createTitle(title.getTitleId(), title.getMaleTitle(), title.getFemaleTitle(), title.getSkillId(), title.getType());
|
||||
}
|
||||
// Event Titles
|
||||
createTitle(buster, "Titan_Slayer", TITAN_SLAYER, "Titanslayer", "Titanslayer", -1, Titles.TitleType.NORMAL);
|
||||
createTitle(buster, "Spectral", SPECTRAL, "Spectral", "Spectral", -1, Titles.TitleType.NORMAL);
|
||||
createTitle(TITAN_SLAYER, "Titanslayer", "Titanslayer", -1, "NORMAL");
|
||||
createTitle(SPECTRAL, "Spectral", "Spectral", -1, "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);
|
||||
//createTitle(PASTAMANCER, "Pastamancer", "Pastamancer", -1, "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);
|
||||
/* Moved to configuration
|
||||
createTitle(PATRON, "Patron", "Patron", -1, "NORMAL");
|
||||
createTitle(DONATOR, "Donator", "Donator", -1, "NORMAL");
|
||||
createTitle(PAZZA_FAVORITE_GM, "Sindusks Favourite GM", "Sindusks Favourite GM", -1, "NORMAL");
|
||||
createTitle(WARRIORGEN_THAT_GUY, "That Guy", "That Guy", -1, "NORMAL");
|
||||
createTitle(ETERNALLOVE_WARRIORGENS_WIFE, "Warriorgens Wife", "Warriorgens Wife", -1, "NORMAL");
|
||||
createTitle(BAMBAM_THORN_ONE, "Thorn One", "Thorn One", -1, "NORMAL");
|
||||
createTitle(SVENJA_CARE_DEPENDANT, "The care-dependent", "The care-dependent", -1, "NORMAL");
|
||||
createTitle(ALEXIA_THE_TREASURING, "The Treasuring", "The Treasuring", -1, "NORMAL");
|
||||
createTitle(REEVI_SCIENCE_GUY, "Science Guy", "Science Guy", -1, "NORMAL");
|
||||
createTitle(GENOCIDE_GRAND_DESIGNER, "Grand Designer", "Grand Designer", -1, "NORMAL");
|
||||
createTitle(SELEAS_CRAZY_CAT_LORD, "The Crazy Cat Lord", "The Crazy Cat Lord", -1, "NORMAL");
|
||||
createTitle(PIRATEMAX_SLAVE, "Slave", "Slave", -1, "NORMAL");
|
||||
createTitle(ELTACOLAD_TRUE_TACO, "The One True Taco", "The One True Taco", -1, "NORMAL");
|
||||
createTitle(ATTICUS_THE_GREAT_ILLUMINATY, "The Great Illuminaty", "The Great Illuminaty", -1, "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);
|
||||
private static void createTitle(int id, String titleMale, String titleFemale, int skillId, String type) {
|
||||
ModTitles.addTitle(id, titleMale, titleFemale, skillId, type);
|
||||
logger.log(Level.INFO, String.format("Created new title with ID #%d: [\"%s\", \"%s\"]", id, titleMale, titleFemale));
|
||||
}
|
||||
|
||||
public static boolean hasCustomTitle(Creature creature){
|
||||
@@ -203,22 +94,33 @@ public class PlayerTitles {
|
||||
}
|
||||
public static void awardCustomTitles(Player p){
|
||||
String name = p.getName();
|
||||
if(donatorTitles.contains(name)){
|
||||
Titles.Title donator = getTitle(DONATOR);
|
||||
for (int titleId : WyvernMods.awardTitles.keySet()){
|
||||
try {
|
||||
Titles.Title theTitle = Titles.Title.getTitle(titleId);
|
||||
ArrayList<String> playerList = WyvernMods.awardTitles.get(titleId);
|
||||
if (playerList.contains(name)){
|
||||
p.addTitle(theTitle);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.warning("Failed to get title with ID "+titleId);
|
||||
}
|
||||
}
|
||||
/*if(donatorTitles.contains(name)){
|
||||
Titles.Title donator = Titles.Title.getTitle(DONATOR);
|
||||
p.addTitle(donator);
|
||||
}
|
||||
if(patronTitles.contains(name)){
|
||||
Titles.Title patron = getTitle(PATRON);
|
||||
Titles.Title patron = Titles.Title.getTitle(PATRON);
|
||||
p.addTitle(patron);
|
||||
}
|
||||
if(customTitles.containsKey(name)){
|
||||
Titles.Title customTitle = getTitle(customTitles.get(name));
|
||||
Titles.Title customTitle = Titles.Title.getTitle(customTitles.get(name));
|
||||
p.addTitle(customTitle);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
public static void preInit(){
|
||||
// Donations
|
||||
donatorTitles.add("Pazza");
|
||||
/*donatorTitles.add("Pazza");
|
||||
customTitles.put("Pazza", PAZZA_FAVORITE_GM); // Sindusks Favorite GM
|
||||
|
||||
donatorTitles.add("Warriorgen");
|
||||
@@ -258,6 +160,6 @@ public class PlayerTitles {
|
||||
customTitles.put("Atticus", ATTICUS_THE_GREAT_ILLUMINATY); // The Great Illuminaty
|
||||
|
||||
// Other rewards
|
||||
customTitles.put("Critias", PASTAMANCER);
|
||||
customTitles.put("Critias", PASTAMANCER);*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ public class QualityOfLife {
|
||||
final Class<QualityOfLife> thisClass = QualityOfLife.class;
|
||||
String replace;
|
||||
|
||||
Util.setReason("Allow players to mine directly into vehicles.");
|
||||
CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action");
|
||||
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
||||
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
|
||||
@@ -106,45 +105,35 @@ public class QualityOfLife {
|
||||
CtClass.floatType
|
||||
};
|
||||
String desc1 = Descriptor.ofMethod(CtClass.booleanType, params1);
|
||||
replace = "$_ = null;"
|
||||
+ QualityOfLife.class.getName()+".vehicleHook(performer, $0);";
|
||||
Util.instrumentDescribed(thisClass, ctCaveWallBehaviour, "action", desc1, "putItemInfrontof", replace);
|
||||
if (WyvernMods.mineCaveToVehicle) {
|
||||
Util.setReason("Allow players to mine directly into vehicles.");
|
||||
replace = "$_ = null;"
|
||||
+ QualityOfLife.class.getName() + ".vehicleHook(performer, $0);";
|
||||
Util.instrumentDescribed(thisClass, ctCaveWallBehaviour, "action", desc1, "putItemInfrontof", replace);
|
||||
}
|
||||
|
||||
/*Util.setReason("Allow players to surface mine directly into vehicles.");
|
||||
CtClass ctTileRockBehaviour = classPool.get("com.wurmonline.server.behaviours.TileRockBehaviour");
|
||||
CtClass[] params2 = {
|
||||
ctAction,
|
||||
ctCreature,
|
||||
ctItem,
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
CtClass.booleanType,
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
CtClass.shortType,
|
||||
CtClass.floatType
|
||||
};
|
||||
String desc2 = Descriptor.ofMethod(CtClass.booleanType, params2);
|
||||
replace = "$_ = $proceed($$);" +
|
||||
QualityOfLife.class.getName()+".vehicleHook(performer, $0);";
|
||||
Util.instrumentDescribed(thisClass, ctTileRockBehaviour, "action", desc2, "setDataXY", replace);*/
|
||||
if (WyvernMods.mineSurfaceToVehicle) {
|
||||
Util.setReason("Allow players to surface mine directly into vehicles.");
|
||||
replace = "$_ = $proceed($$);" +
|
||||
QualityOfLife.class.getName() + ".vehicleHook(performer, $0);";
|
||||
Util.instrumentDeclared(thisClass, ctTileRockBehaviour, "mine", "setDataXY", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Allow players to surface mine directly into vehicles.");
|
||||
CtClass ctTileRockBehaviour = classPool.get("com.wurmonline.server.behaviours.TileRockBehaviour");
|
||||
replace = "$_ = $proceed($$);" +
|
||||
QualityOfLife.class.getName()+".vehicleHook(performer, $0);";
|
||||
Util.instrumentDeclared(thisClass, ctTileRockBehaviour, "mine", "setDataXY", replace);
|
||||
|
||||
Util.setReason("Allow players to chop logs directly into vehicles.");
|
||||
CtClass ctMethodsItems = classPool.get("com.wurmonline.server.behaviours.MethodsItems");
|
||||
replace = "$_ = null;" +
|
||||
QualityOfLife.class.getName()+".vehicleHook(performer, $0);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "chop", "putItemInfrontof", replace);
|
||||
if (WyvernMods.chopLogsToVehicle) {
|
||||
Util.setReason("Allow players to chop logs directly into vehicles.");
|
||||
replace = "$_ = null;" +
|
||||
QualityOfLife.class.getName() + ".vehicleHook(performer, $0);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "chop", "putItemInfrontof", replace);
|
||||
}
|
||||
|
||||
Util.setReason("Allow statuettes to be used when not gold/silver.");
|
||||
String desc100 = Descriptor.ofMethod(CtClass.booleanType, new CtClass[]{});
|
||||
replace = "{ return this.template.holyItem; }";
|
||||
Util.setBodyDescribed(thisClass, ctItem, "isHolyItem", desc100, replace);
|
||||
if (WyvernMods.statuetteAnyMaterial) {
|
||||
Util.setReason("Allow statuettes to be used when not gold/silver.");
|
||||
String desc100 = Descriptor.ofMethod(CtClass.booleanType, new CtClass[]{});
|
||||
replace = "{ return this.template.holyItem; }";
|
||||
Util.setBodyDescribed(thisClass, ctItem, "isHolyItem", desc100, replace);
|
||||
}
|
||||
|
||||
/* Disabled in Wurm Unlimited 1.9 - Priest Rework changes removed this restriction.
|
||||
|
||||
@@ -153,30 +142,34 @@ public class QualityOfLife {
|
||||
replace = "$_ = false;";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsCreatures, "tame", "isPriest", replace);*/
|
||||
|
||||
Util.setReason("Send gems, source crystals, flint, etc. into vehicle.");
|
||||
CtClass[] params2 = {
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
ctCreature,
|
||||
CtClass.doubleType,
|
||||
CtClass.booleanType,
|
||||
ctAction
|
||||
};
|
||||
String desc2 = Descriptor.ofMethod(ctItem, params2);
|
||||
replace = "$_ = null;" +
|
||||
QualityOfLife.class.getName()+".vehicleHook(performer, $0);";
|
||||
Util.instrumentDescribed(thisClass, ctTileRockBehaviour, "createGem", desc2, "putItemInfrontof", replace);
|
||||
if (WyvernMods.mineGemsToVehicle) {
|
||||
Util.setReason("Send gems, source crystals, flint, etc. into vehicle.");
|
||||
CtClass[] params2 = {
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
ctCreature,
|
||||
CtClass.doubleType,
|
||||
CtClass.booleanType,
|
||||
ctAction
|
||||
};
|
||||
String desc2 = Descriptor.ofMethod(ctItem, params2);
|
||||
replace = "$_ = null;" +
|
||||
QualityOfLife.class.getName() + ".vehicleHook(performer, $0);";
|
||||
Util.instrumentDescribed(thisClass, ctTileRockBehaviour, "createGem", desc2, "putItemInfrontof", replace);
|
||||
}
|
||||
|
||||
CtClass ctPlayer = classPool.get("com.wurmonline.server.players.Player");
|
||||
ctPlayer.getMethod("poll", "()Z").instrument(new ExprEditor() {
|
||||
@Override
|
||||
public void edit(FieldAccess f) throws CannotCompileException {
|
||||
if (f.getFieldName().equals("vehicle") && f.isReader())
|
||||
f.replace("$_ = -10L;");
|
||||
}
|
||||
});
|
||||
if (WyvernMods.regenerateStaminaOnVehicleAnySlope) {
|
||||
CtClass ctPlayer = classPool.get("com.wurmonline.server.players.Player");
|
||||
ctPlayer.getMethod("poll", "()Z").instrument(new ExprEditor() {
|
||||
@Override
|
||||
public void edit(FieldAccess f) throws CannotCompileException {
|
||||
if (f.getFieldName().equals("vehicle") && f.isReader())
|
||||
f.replace("$_ = -10L;");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package mod.sin.wyvern;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
|
||||
import com.wurmonline.server.Message;
|
||||
import com.wurmonline.server.TimeConstants;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.items.*;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import javassist.expr.ExprEditor;
|
||||
import javassist.expr.MethodCall;
|
||||
import mod.sin.actions.*;
|
||||
import mod.sin.actions.items.SorcerySplitAction;
|
||||
import mod.sin.creatures.*;
|
||||
import mod.sin.creatures.titans.*;
|
||||
import mod.sin.lib.Prop;
|
||||
import mod.sin.lib.Util;
|
||||
import mod.sin.wyvern.bestiary.MethodsBestiary;
|
||||
import mod.sin.wyvern.mastercraft.Mastercraft;
|
||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
@@ -24,28 +27,177 @@ import org.gotti.wurmunlimited.modsupport.actions.ModActions;
|
||||
import org.gotti.wurmunlimited.modsupport.creatures.ModCreatures;
|
||||
import org.gotti.wurmunlimited.modsupport.vehicles.ModVehicleBehaviours;
|
||||
|
||||
import com.wurmonline.server.TimeConstants;
|
||||
import com.wurmonline.server.players.Player;
|
||||
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import javassist.expr.ExprEditor;
|
||||
import javassist.expr.MethodCall;
|
||||
import mod.sin.actions.*;
|
||||
import mod.sin.creatures.*;
|
||||
import mod.sin.creatures.titans.*;
|
||||
import mod.sin.wyvern.bestiary.MethodsBestiary;
|
||||
import mod.sin.wyvern.mastercraft.Mastercraft;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class WyvernMods
|
||||
implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCreatedListener, ServerStartedListener, ServerPollListener, PlayerLoginListener, ChannelMessageListener {
|
||||
private static Logger logger = Logger.getLogger(WyvernMods.class.getName());
|
||||
public static boolean espCounter = false;
|
||||
public static boolean enableDepots = false;
|
||||
|
||||
boolean bDebug = false;
|
||||
|
||||
// Miscellaneous Changes Module Configuration
|
||||
public static boolean enableMiscChangesModule = true;
|
||||
public static boolean enableInfoTab = true;
|
||||
public static String infoTabName = "Server";
|
||||
public static ArrayList<String> infoTabLines = new ArrayList<>();
|
||||
public static boolean ignoreBridgeChecks = true;
|
||||
public static boolean disableMailboxUsageWhileLoaded = true;
|
||||
public static boolean increasedLegendaryCreatures = true;
|
||||
public static int increasedLegendaryFrequency = 5;
|
||||
public static boolean allowFacebreykerNaturalSpawn = true;
|
||||
public static boolean announcePlayerTitles = true;
|
||||
public static boolean improveCombinedLeather = true;
|
||||
public static boolean allowModdedImproveTemplates = true;
|
||||
public static boolean fatigueActionOverride = true;
|
||||
public static boolean fixPortalIssues = true;
|
||||
public static boolean disableMinimumShieldDamage = true;
|
||||
public static boolean disableGMEmoteLimit = true;
|
||||
public static boolean creatureArcheryWander = true;
|
||||
public static boolean globalDeathTabs = true;
|
||||
public static boolean disablePvPOnlyDeathTabs = true;
|
||||
public static boolean fixLibilaCrossingIssues = true;
|
||||
public static boolean higherFoodAffinities = true;
|
||||
public static boolean fasterCharcoalBurn = true;
|
||||
public static boolean uncapTraderItemCount = true;
|
||||
public static boolean logExcessiveActions = true;
|
||||
public static boolean useDynamicSkillRate = true;
|
||||
public static boolean reduceLockpickBreaking = true;
|
||||
public static boolean allowFreedomMyceliumAbsorb = true;
|
||||
public static boolean largerHouses = true;
|
||||
public static boolean reduceImbuePower = true;
|
||||
public static boolean fixVehicleSpeeds = true;
|
||||
public static boolean reduceMailingCosts = true;
|
||||
public static boolean guardTargetChanges = true;
|
||||
public static boolean enableLibilaStrongwallPvE = true;
|
||||
public static boolean royalCookNoFoodDecay = true;
|
||||
public static boolean mayorsCommandAbandonedVehicles = true;
|
||||
public static boolean opulenceFoodAffinityTimerIncrease = true;
|
||||
public static boolean disableFoodFirstBiteBonus = true;
|
||||
public static boolean bedQualitySleepBonus = true;
|
||||
public static boolean royalSmithImproveFaster = true;
|
||||
public static boolean fixMountedBodyStrength = true;
|
||||
public static boolean adjustedFoodBiteFill = true;
|
||||
public static boolean rareMaterialImprove = true;
|
||||
public static boolean rarityWindowBadLuckProtection = true;
|
||||
public static boolean rareCreationAdjustments = true;
|
||||
public static boolean alwaysArmourTitleBenefits = true;
|
||||
public static boolean tomeUsageAnyAltar = true;
|
||||
public static boolean keyOfHeavensLoginOnly = true;
|
||||
public static boolean lessFillingDrinks = true;
|
||||
public static boolean disableHelpGMCommands = true;
|
||||
public static boolean reduceActionInterruptOnDamage = true;
|
||||
public static boolean fixMissionNullPointerException = true;
|
||||
public static boolean disableSmeltingPots = true;
|
||||
public static boolean hideSorceryBuffBar = true;
|
||||
public static boolean sqlAchievementFix = true;
|
||||
|
||||
// Arena Module Configuration
|
||||
public static boolean enableArenaModule = true;
|
||||
public static boolean equipHorseGearByLeading = true;
|
||||
public static boolean lockpickingImprovements = true;
|
||||
public static boolean placeDeedsOutsideKingdomInfluence = true;
|
||||
public static boolean disablePMKs = true;
|
||||
public static boolean disablePlayerChampions = true;
|
||||
public static boolean arenaAggression = true;
|
||||
public static boolean enemyTitleHook = true;
|
||||
public static boolean enemyPresenceOnAggression = true;
|
||||
public static boolean disableFarwalkerItems = true;
|
||||
public static boolean alwaysAllowAffinitySteal = true;
|
||||
public static boolean adjustFightSkillGain = true;
|
||||
public static boolean useAggressionForNearbyEnemies = true;
|
||||
public static boolean disablePvPCorpseProtection = true;
|
||||
public static boolean bypassHousePermissions = true;
|
||||
public static boolean allowStealingAgainstDeityWishes = true;
|
||||
public static boolean sameKingdomVehicleTheft = true;
|
||||
public static boolean adjustMineDoorDamage = true;
|
||||
public static boolean sameKingdomPermissionsAdjustments = true;
|
||||
public static boolean disableCAHelpOnPvP = true;
|
||||
public static boolean sameKingdomVillageWarfare = true;
|
||||
public static boolean adjustHotARewards = true;
|
||||
public static boolean capMaximumGuards = true;
|
||||
public static boolean disableTowerConstruction = true;
|
||||
public static boolean adjustLocalRange = true;
|
||||
public static boolean disableKarmaTeleport = true;
|
||||
public static boolean limitLeadCreatures = true;
|
||||
public static boolean adjustBashTimer = true;
|
||||
public static boolean discordRelayHotAMessages = true;
|
||||
public static boolean allowAttackingSameKingdomGuards = true;
|
||||
public static boolean fixGuardsAttackingThemselves = true;
|
||||
public static boolean reducedMineDoorOpenTime = true;
|
||||
public static boolean allowSameKingdomFightSkillGains = true;
|
||||
public static boolean allowArcheringOnSameKingdomDeeds = true;
|
||||
public static boolean sendNewSpawnQuestionOnPvP = true;
|
||||
public static boolean sendArtifactDigsToDiscord = true;
|
||||
public static boolean makeFreedomFavoredKingdom = true;
|
||||
public static boolean crownInfluenceOnAggression = true;
|
||||
public static boolean disableOWFL = true;
|
||||
public static boolean resurrectionStonesProtectSkill = true;
|
||||
public static boolean resurrectionStonesProtectFightSkill = true;
|
||||
public static boolean resurrectionStonesProtectAffinities = true;
|
||||
public static boolean bypassPlantedPermissionChecks = true;
|
||||
|
||||
// Custom Titles Module Configuration
|
||||
public static boolean enableCustomTitlesModule = true;
|
||||
public static ArrayList<CustomTitle> customTitles = new ArrayList<>();
|
||||
public static HashMap<Integer,ArrayList<String>> awardTitles = new HashMap<>();
|
||||
|
||||
// Anti-Cheat Module Configuration
|
||||
public static boolean enableAntiCheatModule = true;
|
||||
public static boolean enableSpoofHiddenOre = true;
|
||||
public static boolean prospectingVision = true;
|
||||
public static boolean mapSteamIds = true;
|
||||
|
||||
// Quality Of Life Module Configuration
|
||||
public static boolean enableQualityOfLifeModule = true;
|
||||
public static boolean mineCaveToVehicle = true;
|
||||
public static boolean mineSurfaceToVehicle = true;
|
||||
public static boolean chopLogsToVehicle = true;
|
||||
public static boolean statuetteAnyMaterial = true;
|
||||
public static boolean mineGemsToVehicle = true;
|
||||
public static boolean regenerateStaminaOnVehicleAnySlope = true;
|
||||
|
||||
// Treasure Chest Loot Module Configuration
|
||||
public static boolean enableTreasureChestLootModule = true;
|
||||
|
||||
public static class CustomTitle{
|
||||
protected int titleId;
|
||||
protected String maleTitle;
|
||||
protected String femaleTitle;
|
||||
protected int skillId;
|
||||
protected String type;
|
||||
public CustomTitle(int titleId, String maleTitle, String femaleTitle, int skillId, String type){
|
||||
this.titleId = titleId;
|
||||
this.maleTitle = maleTitle;
|
||||
this.femaleTitle = femaleTitle;
|
||||
this.skillId = skillId;
|
||||
if (type.equals("NORMAL") || type.equals("MINOR") || type.equals("MASTER") || type.equals("LEGENDARY")){
|
||||
this.type = type;
|
||||
}else{
|
||||
logger.info("Failed to register proper custom title type \""+type+"\" for title ID "+titleId+". Defaulting to \"NORMAL\"");
|
||||
this.type = "NORMAL";
|
||||
}
|
||||
}
|
||||
public int getTitleId(){
|
||||
return titleId;
|
||||
}
|
||||
public String getMaleTitle(){
|
||||
return maleTitle;
|
||||
}
|
||||
public String getFemaleTitle(){
|
||||
return femaleTitle;
|
||||
}
|
||||
public int getSkillId(){
|
||||
return skillId;
|
||||
}
|
||||
public String getType(){
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean customCommandHandler(ByteBuffer byteBuffer, Player player) throws UnsupportedEncodingException{
|
||||
byte[] tempStringArr = new byte[byteBuffer.get() & 255];
|
||||
@@ -71,35 +223,331 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
}
|
||||
|
||||
public void configure(Properties properties) {
|
||||
this.bDebug = Boolean.parseBoolean(properties.getProperty("debug", Boolean.toString(this.bDebug)));
|
||||
try {
|
||||
String logsPath = Paths.get("mods", new String[0]) + "/logs/";
|
||||
File newDirectory = new File(logsPath);
|
||||
if (!newDirectory.exists()) {
|
||||
newDirectory.mkdirs();
|
||||
}
|
||||
FileHandler fh = new FileHandler(String.valueOf(String.valueOf(logsPath)) + this.getClass().getSimpleName() + ".log", 10240000, 200, true);
|
||||
if (this.bDebug) {
|
||||
fh.setLevel(Level.INFO);
|
||||
} else {
|
||||
fh.setLevel(Level.WARNING);
|
||||
}
|
||||
fh.setFormatter(new SimpleFormatter());
|
||||
logger.addHandler(fh);
|
||||
}
|
||||
catch (IOException ie) {
|
||||
System.err.println(String.valueOf(this.getClass().getName()) + ": Unable to add file handler to logger");
|
||||
}
|
||||
//this.logger.log(Level.INFO, "Property: " + this.somevalue);
|
||||
this.Debug("Debugging messages are enabled.");
|
||||
}
|
||||
Prop.properties = properties;
|
||||
|
||||
private void Debug(String x) {
|
||||
if (this.bDebug) {
|
||||
System.out.println(String.valueOf(this.getClass().getSimpleName()) + ": " + x);
|
||||
System.out.flush();
|
||||
logger.log(Level.INFO, x);
|
||||
}
|
||||
// -- Configuration Setting -- //
|
||||
|
||||
// Miscellaneous Changes Module
|
||||
enableMiscChangesModule = Prop.getBooleanProperty("enableMiscChangesModule", enableMiscChangesModule);
|
||||
enableInfoTab = Prop.getBooleanProperty("enableInfoTab", enableInfoTab);
|
||||
infoTabName = Prop.getStringProperty("infoTabName", infoTabName);
|
||||
ignoreBridgeChecks = Prop.getBooleanProperty("ignoreBridgeChecks", ignoreBridgeChecks);
|
||||
disableMailboxUsageWhileLoaded = Prop.getBooleanProperty("disableMailboxUsageWhileLoaded", disableMailboxUsageWhileLoaded);
|
||||
increasedLegendaryCreatures = Prop.getBooleanProperty("increasedLegendaryCreatures", increasedLegendaryCreatures);
|
||||
increasedLegendaryFrequency = Prop.getIntegerProperty("increasedLegendaryFrequency", increasedLegendaryFrequency);
|
||||
allowFacebreykerNaturalSpawn = Prop.getBooleanProperty("allowFacebreykerNaturalSpawn", allowFacebreykerNaturalSpawn);
|
||||
announcePlayerTitles = Prop.getBooleanProperty("announcePlayerTitles", announcePlayerTitles);
|
||||
improveCombinedLeather = Prop.getBooleanProperty("improveCombinedLeather", improveCombinedLeather);
|
||||
allowModdedImproveTemplates = Prop.getBooleanProperty("allowModdedImproveTemplates", allowModdedImproveTemplates);
|
||||
fatigueActionOverride = Prop.getBooleanProperty("fatigueActionOverride", fatigueActionOverride);
|
||||
fixPortalIssues = Prop.getBooleanProperty("fixPortalIssues", fixPortalIssues);
|
||||
disableMinimumShieldDamage = Prop.getBooleanProperty("disableMinimumShieldDamage", disableMinimumShieldDamage);
|
||||
disableGMEmoteLimit = Prop.getBooleanProperty("disableGMEmoteLimit", disableGMEmoteLimit);
|
||||
creatureArcheryWander = Prop.getBooleanProperty("creatureArcheryWander", creatureArcheryWander);
|
||||
globalDeathTabs = Prop.getBooleanProperty("globalDeathTabs", globalDeathTabs);
|
||||
disablePvPOnlyDeathTabs = Prop.getBooleanProperty("disablePvPOnlyDeathTabs", disablePvPOnlyDeathTabs);
|
||||
fixLibilaCrossingIssues = Prop.getBooleanProperty("fixLibilaCrossingIssues", fixLibilaCrossingIssues);
|
||||
higherFoodAffinities = Prop.getBooleanProperty("higherFoodAffinities", higherFoodAffinities);
|
||||
fasterCharcoalBurn = Prop.getBooleanProperty("fasterCharcoalBurn", fasterCharcoalBurn);
|
||||
uncapTraderItemCount = Prop.getBooleanProperty("uncapTraderItemCount", uncapTraderItemCount);
|
||||
logExcessiveActions = Prop.getBooleanProperty("logExcessiveActions", logExcessiveActions);
|
||||
useDynamicSkillRate = Prop.getBooleanProperty("useDynamicSkillRate", useDynamicSkillRate);
|
||||
reduceLockpickBreaking = Prop.getBooleanProperty("reduceLockpickBreaking", reduceLockpickBreaking);
|
||||
allowFreedomMyceliumAbsorb = Prop.getBooleanProperty("allowFreedomMyceliumAbsorb", allowFreedomMyceliumAbsorb);
|
||||
largerHouses = Prop.getBooleanProperty("largerHouses", largerHouses);
|
||||
reduceImbuePower = Prop.getBooleanProperty("reduceImbuePower", reduceImbuePower);
|
||||
fixVehicleSpeeds = Prop.getBooleanProperty("fixVehicleSpeeds", fixVehicleSpeeds);
|
||||
reduceMailingCosts = Prop.getBooleanProperty("reduceMailingCosts", reduceMailingCosts);
|
||||
guardTargetChanges = Prop.getBooleanProperty("guardTargetChanges", guardTargetChanges);
|
||||
enableLibilaStrongwallPvE = Prop.getBooleanProperty("enableLibilaStrongwallPvE", enableLibilaStrongwallPvE);
|
||||
royalCookNoFoodDecay = Prop.getBooleanProperty("royalCookNoFoodDecay", royalCookNoFoodDecay);
|
||||
mayorsCommandAbandonedVehicles = Prop.getBooleanProperty("mayorsCommandAbandonedVehicles", mayorsCommandAbandonedVehicles);
|
||||
opulenceFoodAffinityTimerIncrease = Prop.getBooleanProperty("opulenceFoodAffinityTimerIncrease", opulenceFoodAffinityTimerIncrease);
|
||||
disableFoodFirstBiteBonus = Prop.getBooleanProperty("disableFoodFirstBiteBonus", disableFoodFirstBiteBonus);
|
||||
bedQualitySleepBonus = Prop.getBooleanProperty("bedQualitySleepBonus", bedQualitySleepBonus);
|
||||
royalSmithImproveFaster = Prop.getBooleanProperty("royalSmithImproveFaster", royalSmithImproveFaster);
|
||||
fixMountedBodyStrength = Prop.getBooleanProperty("fixMountedBodyStrength", fixMountedBodyStrength);
|
||||
adjustedFoodBiteFill = Prop.getBooleanProperty("adjustedFoodBiteFill", adjustedFoodBiteFill);
|
||||
rareMaterialImprove = Prop.getBooleanProperty("rareMaterialImprove", rareMaterialImprove);
|
||||
rarityWindowBadLuckProtection = Prop.getBooleanProperty("rarityWindowBadLuckProtection", rarityWindowBadLuckProtection);
|
||||
rareCreationAdjustments = Prop.getBooleanProperty("rareCreationAdjustments", rareCreationAdjustments);
|
||||
alwaysArmourTitleBenefits = Prop.getBooleanProperty("alwaysArmourTitleBenefits", alwaysArmourTitleBenefits);
|
||||
tomeUsageAnyAltar = Prop.getBooleanProperty("tomeUsageAnyAltar", tomeUsageAnyAltar);
|
||||
keyOfHeavensLoginOnly = Prop.getBooleanProperty("keyOfHeavensLoginOnly", keyOfHeavensLoginOnly);
|
||||
lessFillingDrinks = Prop.getBooleanProperty("lessFillingDrinks", lessFillingDrinks);
|
||||
disableHelpGMCommands = Prop.getBooleanProperty("disableHelpGMCommands", disableHelpGMCommands);
|
||||
reduceActionInterruptOnDamage = Prop.getBooleanProperty("reduceActionInterruptOnDamage", reduceActionInterruptOnDamage);
|
||||
fixMissionNullPointerException = Prop.getBooleanProperty("fixMissionNullPointerException", fixMissionNullPointerException);
|
||||
disableSmeltingPots = Prop.getBooleanProperty("disableSmeltingPots", disableSmeltingPots);
|
||||
hideSorceryBuffBar = Prop.getBooleanProperty("hideSorceryBuffBar", hideSorceryBuffBar);
|
||||
sqlAchievementFix = Prop.getBooleanProperty("sqlAchievementFix", sqlAchievementFix);
|
||||
|
||||
// Arena Module
|
||||
enableArenaModule = Prop.getBooleanProperty("enableArenaModule", enableArenaModule);
|
||||
equipHorseGearByLeading = Prop.getBooleanProperty("equipHorseGearByLeading", equipHorseGearByLeading);
|
||||
lockpickingImprovements = Prop.getBooleanProperty("lockpickingImprovements", lockpickingImprovements);
|
||||
placeDeedsOutsideKingdomInfluence = Prop.getBooleanProperty("placeDeedsOutsideKingdomInfluence", placeDeedsOutsideKingdomInfluence);
|
||||
disablePMKs = Prop.getBooleanProperty("disablePMKs", disablePMKs);
|
||||
disablePlayerChampions = Prop.getBooleanProperty("disablePlayerChampions", disablePlayerChampions);
|
||||
arenaAggression = Prop.getBooleanProperty("arenaAggression", arenaAggression);
|
||||
enemyTitleHook = Prop.getBooleanProperty("enemyTitleHook", enemyTitleHook);
|
||||
enemyPresenceOnAggression = Prop.getBooleanProperty("enemyPresenceOnAggression", enemyPresenceOnAggression);
|
||||
disableFarwalkerItems = Prop.getBooleanProperty("disableFarwalkerItems", disableFarwalkerItems);
|
||||
alwaysAllowAffinitySteal = Prop.getBooleanProperty("alwaysAllowAffinitySteal", alwaysAllowAffinitySteal);
|
||||
adjustFightSkillGain = Prop.getBooleanProperty("adjustFightSkillGain", adjustFightSkillGain);
|
||||
useAggressionForNearbyEnemies = Prop.getBooleanProperty("useAggressionForNearbyEnemies", useAggressionForNearbyEnemies);
|
||||
disablePvPCorpseProtection = Prop.getBooleanProperty("disablePvPCorpseProtection", disablePvPCorpseProtection);
|
||||
bypassHousePermissions = Prop.getBooleanProperty("bypassHousePermissions", bypassHousePermissions);
|
||||
allowStealingAgainstDeityWishes = Prop.getBooleanProperty("allowStealingAgainstDeityWishes", allowStealingAgainstDeityWishes);
|
||||
sameKingdomVehicleTheft = Prop.getBooleanProperty("sameKingdomVehicleTheft", sameKingdomVehicleTheft);
|
||||
adjustMineDoorDamage = Prop.getBooleanProperty("adjustMineDoorDamage", adjustMineDoorDamage);
|
||||
sameKingdomPermissionsAdjustments = Prop.getBooleanProperty("sameKingdomPermissionsAdjustments", sameKingdomPermissionsAdjustments);
|
||||
disableCAHelpOnPvP = Prop.getBooleanProperty("disableCAHelpOnPvP", disableCAHelpOnPvP);
|
||||
sameKingdomVillageWarfare = Prop.getBooleanProperty("sameKingdomVillageWarfare", sameKingdomVillageWarfare);
|
||||
adjustHotARewards = Prop.getBooleanProperty("adjustHotARewards", adjustHotARewards);
|
||||
capMaximumGuards = Prop.getBooleanProperty("capMaximumGuards", capMaximumGuards);
|
||||
disableTowerConstruction = Prop.getBooleanProperty("disableTowerConstruction", disableTowerConstruction);
|
||||
adjustLocalRange = Prop.getBooleanProperty("adjustLocalRange", adjustLocalRange);
|
||||
disableKarmaTeleport = Prop.getBooleanProperty("disableKarmaTeleport", disableKarmaTeleport);
|
||||
limitLeadCreatures = Prop.getBooleanProperty("limitLeadCreatures", limitLeadCreatures);
|
||||
adjustBashTimer = Prop.getBooleanProperty("adjustBashTimer", adjustBashTimer);
|
||||
discordRelayHotAMessages = Prop.getBooleanProperty("discordRelayHotAMessages", discordRelayHotAMessages);
|
||||
allowAttackingSameKingdomGuards = Prop.getBooleanProperty("allowAttackingSameKingdomGuards", allowAttackingSameKingdomGuards);
|
||||
fixGuardsAttackingThemselves = Prop.getBooleanProperty("fixGuardsAttackingThemselves", fixGuardsAttackingThemselves);
|
||||
reducedMineDoorOpenTime = Prop.getBooleanProperty("reducedMineDoorOpenTime", reducedMineDoorOpenTime);
|
||||
allowSameKingdomFightSkillGains = Prop.getBooleanProperty("allowSameKingdomFightSkillGains", allowSameKingdomFightSkillGains);
|
||||
allowArcheringOnSameKingdomDeeds = Prop.getBooleanProperty("allowArcheringOnSameKingdomDeeds", allowArcheringOnSameKingdomDeeds);
|
||||
sendNewSpawnQuestionOnPvP = Prop.getBooleanProperty("sendNewSpawnQuestionOnPvP", sendNewSpawnQuestionOnPvP);
|
||||
sendArtifactDigsToDiscord = Prop.getBooleanProperty("sendArtifactDigsToDiscord", sendArtifactDigsToDiscord);
|
||||
makeFreedomFavoredKingdom = Prop.getBooleanProperty("makeFreedomFavoredKingdom", makeFreedomFavoredKingdom);
|
||||
crownInfluenceOnAggression = Prop.getBooleanProperty("crownInfluenceOnAggression", crownInfluenceOnAggression);
|
||||
disableOWFL = Prop.getBooleanProperty("disableOWFL", disableOWFL);
|
||||
resurrectionStonesProtectSkill = Prop.getBooleanProperty("resurrectionStonesProtectSkill", resurrectionStonesProtectSkill);
|
||||
resurrectionStonesProtectFightSkill = Prop.getBooleanProperty("resurrectionStonesProtectFightSkill", resurrectionStonesProtectFightSkill);
|
||||
resurrectionStonesProtectAffinities = Prop.getBooleanProperty("resurrectionStonesProtectAffinities", resurrectionStonesProtectAffinities);
|
||||
bypassPlantedPermissionChecks = Prop.getBooleanProperty("bypassPlantedPermissionChecks", bypassPlantedPermissionChecks);
|
||||
|
||||
// Custom Titles Module
|
||||
enableCustomTitlesModule = Prop.getBooleanProperty("enableCustomTitlesModule", enableCustomTitlesModule);
|
||||
|
||||
// Anti-Cheat Module
|
||||
enableAntiCheatModule = Prop.getBooleanProperty("enableAntiCheatModule", enableAntiCheatModule);
|
||||
enableSpoofHiddenOre = Prop.getBooleanProperty("enableSpoofHiddenOre", enableSpoofHiddenOre);
|
||||
prospectingVision = Prop.getBooleanProperty("prospectingVision", prospectingVision);
|
||||
mapSteamIds = Prop.getBooleanProperty("mapSteamIds", mapSteamIds);
|
||||
|
||||
// Quality Of Life Module
|
||||
enableQualityOfLifeModule = Prop.getBooleanProperty("enableQualityOfLifeModule", enableQualityOfLifeModule);
|
||||
mineCaveToVehicle = Prop.getBooleanProperty("mineCaveToVehicle", mineCaveToVehicle);
|
||||
mineSurfaceToVehicle = Prop.getBooleanProperty("mineSurfaceToVehicle", mineSurfaceToVehicle);
|
||||
chopLogsToVehicle = Prop.getBooleanProperty("chopLogsToVehicle", chopLogsToVehicle);
|
||||
statuetteAnyMaterial = Prop.getBooleanProperty("statuetteAnyMaterial", statuetteAnyMaterial);
|
||||
mineGemsToVehicle = Prop.getBooleanProperty("mineGemsToVehicle", mineGemsToVehicle);
|
||||
regenerateStaminaOnVehicleAnySlope = Prop.getBooleanProperty("regenerateStaminaOnVehicleAnySlope", regenerateStaminaOnVehicleAnySlope);
|
||||
|
||||
// Treasure Chest Loot Module
|
||||
enableTreasureChestLootModule = Prop.getBooleanProperty("enableTreasureChestLootModule", enableTreasureChestLootModule);
|
||||
|
||||
// Multiple-option Configuration Parsing
|
||||
// This handles all the configurations that allow multiple different configurations to be applied.
|
||||
for (String name : properties.stringPropertyNames()) {
|
||||
try {
|
||||
String value = properties.getProperty(name);
|
||||
switch (name) {
|
||||
case "debug":
|
||||
case "classname":
|
||||
case "classpath":
|
||||
case "sharedClassLoader":
|
||||
case "depend.requires":
|
||||
case "depend.import":
|
||||
case "depend.suggests":
|
||||
break; //ignore
|
||||
default:
|
||||
if (name.startsWith("infoTabLine")) {
|
||||
infoTabLines.add(value);
|
||||
}else if (name.startsWith("addCustomTitle")) {
|
||||
String[] values = value.split(",");
|
||||
if(values.length > 5 || values.length < 5){
|
||||
logger.warning("Error parsing Custom Title: Invalid amount of arguments for following property: "+value);
|
||||
}
|
||||
int titleId = Integer.valueOf(values[0]);
|
||||
String maleTitle = values[1];
|
||||
String femaleTitle = values[2];
|
||||
int skillId = Integer.valueOf(values[3]);
|
||||
String titleType = values[4];
|
||||
customTitles.add(new CustomTitle(titleId, maleTitle, femaleTitle, skillId, titleType));
|
||||
}else if (name.startsWith("awardTitle")) {
|
||||
String[] values = value.split(",");
|
||||
if(values.length < 2){
|
||||
logger.warning("Error parsing Award Title: Invalid amount of arguments for following property: "+value);
|
||||
}
|
||||
int titleId = Integer.valueOf(values[0]);
|
||||
ArrayList<String> playerList;
|
||||
if (awardTitles.containsKey(titleId)){
|
||||
// Has an entry already, add to the existing list.
|
||||
playerList = awardTitles.get(titleId);
|
||||
}else{
|
||||
// No entry, should create a new array and add it to the map
|
||||
playerList = new ArrayList<>();
|
||||
}
|
||||
for (int i = 1; i < values.length; i++){
|
||||
if(playerList.contains(values[i])){
|
||||
logger.warning("Duplicate player entry for single title: "+values[i]+" for title "+titleId+".");
|
||||
}else{
|
||||
playerList.add(values[i]);
|
||||
}
|
||||
}
|
||||
awardTitles.put(titleId, playerList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.severe("Error processing property " + name);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// -- Configuration Print -- //
|
||||
logger.info("Miscellaneous Changes Module: "+enableMiscChangesModule);
|
||||
if(enableMiscChangesModule) {
|
||||
logger.info("Information Tab: " + enableInfoTab);
|
||||
if (enableInfoTab) {
|
||||
logger.info("> Information Tab Name: " + infoTabName);
|
||||
for (String tabLine : infoTabLines) {
|
||||
logger.info("> Information Tab Line: " + tabLine);
|
||||
}
|
||||
}
|
||||
logger.info("Ignore Bridge Checks: " + ignoreBridgeChecks);
|
||||
logger.info("Disable Mailbox Usage While Loaded: " + disableMailboxUsageWhileLoaded);
|
||||
logger.info("Increased Legendary Creatures: " + increasedLegendaryCreatures);
|
||||
logger.info("Increased Legendary Frequency: " + increasedLegendaryFrequency + "x");
|
||||
logger.info("Allow Facebreyker Natural Spawn: " + allowFacebreykerNaturalSpawn);
|
||||
logger.info("Announce Player Titles: " + announcePlayerTitles);
|
||||
logger.info("Improve Combined Leather: " + improveCombinedLeather);
|
||||
logger.info("Allow Modded Improve Templates: " + allowModdedImproveTemplates);
|
||||
logger.info("Fatigue Action Override: " + fatigueActionOverride);
|
||||
logger.info("Fix Portal Issues: " + fixPortalIssues);
|
||||
logger.info("Disable Minimum Shield Damage: " + disableMinimumShieldDamage);
|
||||
logger.info("Disable GM Emote Limit: " + disableGMEmoteLimit);
|
||||
logger.info("Creature Archery Wander: " + creatureArcheryWander);
|
||||
logger.info("Global Death Tabs: " + globalDeathTabs);
|
||||
logger.info("Disable PvP Only Death Tabs: " + disablePvPOnlyDeathTabs);
|
||||
logger.info("Fix Libila Crossing Issues: " + fixLibilaCrossingIssues);
|
||||
logger.info("Higher Food Affinities: " + higherFoodAffinities);
|
||||
logger.info("Faster Charcoal Burn: " + fasterCharcoalBurn);
|
||||
logger.info("Uncap Trader Item Count: " + uncapTraderItemCount);
|
||||
logger.info("Log Excessive Actions: " + logExcessiveActions);
|
||||
logger.info("Use Dynamic Skill Rate: " + useDynamicSkillRate);
|
||||
logger.info("Reduce Lockpick Breaking: " + reduceLockpickBreaking);
|
||||
logger.info("Allow Freedom Mycelium Absorb: " + allowFreedomMyceliumAbsorb);
|
||||
logger.info("Larger Houses: " + largerHouses);
|
||||
logger.info("Reduce Imbue Power: " + reduceImbuePower);
|
||||
logger.info("Fix Vehicle Speeds: " + fixVehicleSpeeds);
|
||||
logger.info("Reduce Mailing Costs: " + reduceMailingCosts);
|
||||
logger.info("Guard Target Changes: " + guardTargetChanges);
|
||||
logger.info("Enable Libila Strongwall on PvE: " + enableLibilaStrongwallPvE);
|
||||
logger.info("Royal Cook No Food Decay: " + royalCookNoFoodDecay);
|
||||
logger.info("Mayors Command Abandoned Vehicles: " + mayorsCommandAbandonedVehicles);
|
||||
logger.info("Opulence Food Affinity Timer Increase: " + opulenceFoodAffinityTimerIncrease);
|
||||
logger.info("Disable Food First Bite Bonus: " + disableFoodFirstBiteBonus);
|
||||
logger.info("Bed Quality Sleep Bonus: " + bedQualitySleepBonus);
|
||||
logger.info("Royal Smith Improve Faster: " + royalSmithImproveFaster);
|
||||
logger.info("Fix Mounted Body Strength: " + fixMountedBodyStrength);
|
||||
logger.info("Adjusted Food Bite Fill: " + adjustedFoodBiteFill);
|
||||
logger.info("Rare Material Improve: " + rareMaterialImprove);
|
||||
logger.info("Rarity Window Bad Luck Protection: " + rarityWindowBadLuckProtection);
|
||||
logger.info("Rare Creation Adjustments: " + rareCreationAdjustments);
|
||||
logger.info("Always Armour Title Benefits: " + alwaysArmourTitleBenefits);
|
||||
logger.info("Tome Usage Any Altar: " + tomeUsageAnyAltar);
|
||||
logger.info("Key Of Heavens Login Only: " + keyOfHeavensLoginOnly);
|
||||
logger.info("Less Filling Drinks: " + lessFillingDrinks);
|
||||
logger.info("Disable Help GM Commands: " + disableHelpGMCommands);
|
||||
logger.info("Reduce Action Interrupt On Damage: " + reduceActionInterruptOnDamage);
|
||||
logger.info("Fix Mission Null Pointer Exception: " + fixMissionNullPointerException);
|
||||
logger.info("Disable Smelting Pots: " + disableSmeltingPots);
|
||||
logger.info("Hide Sorcery Buff Bar: " + hideSorceryBuffBar);
|
||||
logger.info("SQL Achievement Fix: " + sqlAchievementFix);
|
||||
}
|
||||
|
||||
logger.info("Arena Module: "+enableArenaModule);
|
||||
if(enableArenaModule) {
|
||||
logger.info("Equip Horse Gear By Leading: " + equipHorseGearByLeading);
|
||||
logger.info("Lockpicking Improvements: "+lockpickingImprovements);
|
||||
logger.info("Place Deeds Outside Kingdom Influence: "+placeDeedsOutsideKingdomInfluence);
|
||||
logger.info("Disable PMK's: "+disablePMKs);
|
||||
logger.info("Disable Player Champions: "+disablePlayerChampions);
|
||||
logger.info("Arena Aggression: "+arenaAggression);
|
||||
logger.info("Enemy Title Hook: "+enemyTitleHook);
|
||||
logger.info("Enemy Presence On Aggression: "+enemyPresenceOnAggression);
|
||||
logger.info("Disable Farwalker Items: "+disableFarwalkerItems);
|
||||
logger.info("Always Allow Affinity Steal: "+alwaysAllowAffinitySteal);
|
||||
logger.info("Adjust Fight Skill Gain: "+adjustFightSkillGain);
|
||||
logger.info("Use Aggression For Nearby Enemies: "+useAggressionForNearbyEnemies);
|
||||
logger.info("Disable PvP Corpse Protection: "+disablePvPCorpseProtection);
|
||||
logger.info("Bypass House Permissions: "+bypassHousePermissions);
|
||||
logger.info("Allow Stealing Against Deity Wishes: "+allowStealingAgainstDeityWishes);
|
||||
logger.info("Same Kingdom Vehicle Theft: "+sameKingdomVehicleTheft);
|
||||
logger.info("Adjust Mine Door Damage: "+adjustMineDoorDamage);
|
||||
logger.info("Same Kingdom Permission Adjustments: "+sameKingdomPermissionsAdjustments);
|
||||
logger.info("Disable CA Help On PvP: "+disableCAHelpOnPvP);
|
||||
logger.info("Same Kingdom Village Warfare: "+sameKingdomVillageWarfare);
|
||||
logger.info("Adjust HotA Rewards: "+adjustHotARewards);
|
||||
logger.info("Cap Maximum Guards: "+capMaximumGuards);
|
||||
logger.info("Disable Tower Construction: "+disableTowerConstruction);
|
||||
logger.info("Adjust Local Range: "+adjustLocalRange);
|
||||
logger.info("Disable Karma Teleport: "+disableKarmaTeleport);
|
||||
logger.info("Limit Lead Creatures: "+limitLeadCreatures);
|
||||
logger.info("Adjust Bash Timer: "+adjustBashTimer);
|
||||
logger.info("Discord Relay HotA Messages: "+discordRelayHotAMessages);
|
||||
logger.info("Allow Attacking Same Kingdom Guards: "+allowAttackingSameKingdomGuards);
|
||||
logger.info("Fix Guards Attacking Themselves: "+fixGuardsAttackingThemselves);
|
||||
logger.info("Reduced Mine Door Open Time: "+reducedMineDoorOpenTime);
|
||||
logger.info("Allow Same Kingdom Fight Skill Gains: "+allowSameKingdomFightSkillGains);
|
||||
logger.info("Allow Archering On Same Kingdom Deeds: "+allowArcheringOnSameKingdomDeeds);
|
||||
logger.info("Send New Spawn Question On PvP: "+sendNewSpawnQuestionOnPvP);
|
||||
logger.info("Send Artifact Digs To Discord: "+sendArtifactDigsToDiscord);
|
||||
logger.info("Make Freedom Favored Kingdom: "+makeFreedomFavoredKingdom);
|
||||
logger.info("Crown Influence On Aggression: "+crownInfluenceOnAggression);
|
||||
logger.info("Disable Open World Full Loot: "+disableOWFL);
|
||||
logger.info("Resurrection Stones Protect Skill: "+resurrectionStonesProtectSkill);
|
||||
logger.info("Resurrection Stones Protect Fight Skill: "+resurrectionStonesProtectFightSkill);
|
||||
logger.info("Resurrection Stones Protect Affinities: "+resurrectionStonesProtectAffinities);
|
||||
logger.info("Bypass Planted Permission Checks: "+bypassPlantedPermissionChecks);
|
||||
}
|
||||
|
||||
logger.info("Custom Titles Module: "+enableCustomTitlesModule);
|
||||
if (enableCustomTitlesModule){
|
||||
for (CustomTitle title : customTitles){
|
||||
logger.info(String.format("Custom Title ID #%d: %s / %s for skill ID #%d of type %s.",
|
||||
title.getTitleId(), title.getMaleTitle(), title.getFemaleTitle(), title.getSkillId(), title.getType()));
|
||||
}
|
||||
for (int titleId : awardTitles.keySet()){
|
||||
logger.info(String.format("Awarding Title ID #%d to players: %s",
|
||||
titleId, awardTitles.get(titleId).toString()));
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Anti-Cheat Module: "+enableAntiCheatModule);
|
||||
if (enableAntiCheatModule){
|
||||
logger.info("Spoof Hidden Ore: "+enableSpoofHiddenOre);
|
||||
if (enableSpoofHiddenOre){
|
||||
logger.info("Prospecting Vision: "+prospectingVision);
|
||||
}
|
||||
logger.info("Map Steam IDs: "+mapSteamIds);
|
||||
}
|
||||
|
||||
logger.info("Quality Of Life Module: "+enableQualityOfLifeModule);
|
||||
if (enableQualityOfLifeModule){
|
||||
logger.info("Mine Cave To Vehicle: "+mineCaveToVehicle);
|
||||
logger.info("Mine Surface To Vehicle: "+mineSurfaceToVehicle);
|
||||
logger.info("Chop Logs To Vehicle: "+chopLogsToVehicle);
|
||||
logger.info("Statuette Any Material: "+statuetteAnyMaterial);
|
||||
logger.info("Mine Gems To Vehicle: "+mineGemsToVehicle);
|
||||
logger.info("Regenerate Stamina On Vehicle Any Slope: "+regenerateStaminaOnVehicleAnySlope);
|
||||
}
|
||||
|
||||
logger.info("Treasure Chest Loot Module: "+enableTreasureChestLootModule);
|
||||
|
||||
//this.logger.log(Level.INFO, "Property: " + this.somevalue);
|
||||
}
|
||||
|
||||
public static void handleExamine(Creature performer, Item target) {
|
||||
@@ -122,29 +570,54 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
public void preInit() {
|
||||
logger.info("Pre-Initializing.");
|
||||
try {
|
||||
ModActions.init();
|
||||
//Bounty.preInit(this);
|
||||
TreasureChests.preInit();
|
||||
MiscChanges.preInit();
|
||||
Arena.preInit();
|
||||
ModActions.init(); // Initialize ModActions from Modloader
|
||||
|
||||
// Misc Changes Module Pre-Init
|
||||
if (enableMiscChangesModule) {
|
||||
MiscChanges.preInit();
|
||||
}
|
||||
|
||||
// Arena Module Pre-Init
|
||||
if (enableArenaModule) {
|
||||
Arena.preInit();
|
||||
}
|
||||
|
||||
// Custom Titles Module Pre-Init
|
||||
if (enableCustomTitlesModule) {
|
||||
PlayerTitles.preInit();
|
||||
}
|
||||
|
||||
// Anti-Cheat Module Pre-Init
|
||||
if (enableAntiCheatModule) {
|
||||
AntiCheat.preInit();
|
||||
}
|
||||
|
||||
// Quality Of Life Module Pre-Init
|
||||
if (enableQualityOfLifeModule) {
|
||||
QualityOfLife.preInit();
|
||||
}
|
||||
|
||||
// Treasure Chest Loot Module Pre-Init
|
||||
if (enableTreasureChestLootModule) {
|
||||
TreasureChests.preInit();
|
||||
}
|
||||
|
||||
Titans.preInit();
|
||||
RareSpawns.preInit();
|
||||
PlayerTitles.preInit();
|
||||
TeleportHandler.preInit();
|
||||
MethodsBestiary.preInit();
|
||||
MissionCreator.preInit();
|
||||
CombatChanges.preInit();
|
||||
SkillChanges.preInit();
|
||||
MeditationPerks.preInit();
|
||||
MountedChanges.preInit();
|
||||
EconomicChanges.preInit();
|
||||
QualityOfLife.preInit();
|
||||
Bloodlust.preInit();
|
||||
AntiCheat.preInit();
|
||||
Mastercraft.preInit();
|
||||
//Mastercraft.addNewTitles();
|
||||
SupplyDepots.preInit();
|
||||
KeyEvent.preInit();
|
||||
CombatChanges.preInit();
|
||||
|
||||
// Gem Augmentation is not complete.
|
||||
//GemAugmentation.preInit();
|
||||
|
||||
Class<WyvernMods> thisClass = WyvernMods.class;
|
||||
@@ -175,6 +648,9 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
@Override
|
||||
public void init() {
|
||||
logger.info("Initializing.");
|
||||
if (WyvernMods.enableCustomTitlesModule) {
|
||||
PlayerTitles.init();
|
||||
}
|
||||
ModCreatures.init();
|
||||
ModVehicleBehaviours.init();
|
||||
|
||||
@@ -247,7 +723,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
logger.info("Creating Cache items.");
|
||||
Caches.createItems();
|
||||
logger.info("Initiating Title changes.");
|
||||
PlayerTitles.onItemTemplatesCreated();
|
||||
//PlayerTitles.onItemTemplatesCreated();
|
||||
try {
|
||||
logger.info("Editing existing item templates.");
|
||||
ItemMod.modifyItems();
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.wurmonline.server.items.ItemFactory;
|
||||
import com.wurmonline.server.items.ItemTemplate;
|
||||
import com.wurmonline.server.items.NoSuchTemplateException;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import com.wurmonline.server.players.Titles;
|
||||
import mod.piddagoras.duskombat.DamageEngine;
|
||||
import mod.sin.armour.SpectralHide;
|
||||
import mod.sin.creatures.Reaper;
|
||||
@@ -106,7 +107,7 @@ public class PlayerBounty {
|
||||
fightStrength = "legendary";
|
||||
}
|
||||
player.getCommunicator().sendSafeServerMessage("The spirit recognizes you as a "+fightStrength+" warrior, and rewards you accordingly.");
|
||||
player.addTitle(PlayerTitles.getTitle(PlayerTitles.SPECTRAL));
|
||||
player.addTitle(Titles.Title.getTitle(PlayerTitles.SPECTRAL));
|
||||
}catch (NoSuchTemplateException | FailedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -145,7 +146,7 @@ public class PlayerBounty {
|
||||
player.getInventory().insertItem(riftCache, true);
|
||||
}
|
||||
if(Titans.isTitan(mob)){
|
||||
player.addTitle(PlayerTitles.getTitle(PlayerTitles.TITAN_SLAYER));
|
||||
player.addTitle(Titles.Title.getTitle(PlayerTitles.TITAN_SLAYER));
|
||||
Item affinityOrb = ItemFactory.createItem(AffinityOrb.templateId, 99f, mob.getName());
|
||||
player.getInventory().insertItem(affinityOrb, true);
|
||||
Item titanCache = ItemFactory.createItem(TitanCache.templateId, 99f, mob.getName());
|
||||
|
||||
Reference in New Issue
Block a user