Update to latest version.
This commit is contained in:
@@ -1,45 +1,30 @@
|
||||
package mod.sin.wyvern;
|
||||
|
||||
import com.wurmonline.mesh.Tiles;
|
||||
import com.wurmonline.server.*;
|
||||
import com.wurmonline.server.bodys.Wound;
|
||||
import com.wurmonline.server.Server;
|
||||
import com.wurmonline.server.ServerEntry;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.creatures.Creatures;
|
||||
import com.wurmonline.server.creatures.MineDoorPermission;
|
||||
import com.wurmonline.server.creatures.SpellEffects;
|
||||
import com.wurmonline.server.economy.Economy;
|
||||
import com.wurmonline.server.epic.Hota;
|
||||
import com.wurmonline.server.items.*;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import com.wurmonline.server.questions.NewSpawnQuestion;
|
||||
import com.wurmonline.server.questions.SpawnQuestion;
|
||||
import com.wurmonline.server.spells.SpellEffect;
|
||||
import com.wurmonline.server.villages.Citizen;
|
||||
import com.wurmonline.server.villages.Village;
|
||||
import com.wurmonline.server.zones.AreaSpellEffect;
|
||||
import com.wurmonline.server.zones.VolaTile;
|
||||
import com.wurmonline.server.zones.Zone;
|
||||
import com.wurmonline.server.zones.Zones;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import javassist.bytecode.Descriptor;
|
||||
import mod.sin.creatures.titans.*;
|
||||
import mod.sin.items.AffinityOrb;
|
||||
import mod.sin.items.KeyFragment;
|
||||
import mod.sin.items.caches.*;
|
||||
import mod.sin.lib.Util;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
import org.gotti.wurmunlimited.modsupport.ModSupportDb;
|
||||
import org.nyxcode.wurm.discordrelay.DiscordRelay;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Arena {
|
||||
@@ -156,14 +141,14 @@ public class Arena {
|
||||
for (x = 0; x < 5; ++x) {
|
||||
lump = ItemFactory.createItem(ItemList.adamantineBar, Math.min(99, 50 + winStreak), null);
|
||||
float baseWeight = lump.getWeightGrams();
|
||||
float multiplier = 1f+(winStreak*0.4f*Server.rand.nextFloat());
|
||||
float multiplier = 1f;//+(winStreak*0.4f*Server.rand.nextFloat());
|
||||
lump.setWeight((int) (baseWeight*multiplier), true);
|
||||
statue.insertItem(lump, true);
|
||||
}
|
||||
for (x = 0; x < 5; ++x) {
|
||||
lump = ItemFactory.createItem(ItemList.glimmerSteelBar, Math.min(99, 50 + winStreak), null);
|
||||
float baseWeight = lump.getWeightGrams();
|
||||
float multiplier = 1f+(winStreak*0.2f*Server.rand.nextFloat());
|
||||
float multiplier = 1f;//+(winStreak*0.2f*Server.rand.nextFloat());
|
||||
lump.setWeight((int) (baseWeight*multiplier), true);
|
||||
statue.insertItem(lump, true);
|
||||
}
|
||||
@@ -232,14 +217,12 @@ 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(com.wurmonline.server.Servers.isThisAPvpServer() && owner.getDominator() != this.player){"
|
||||
replace = "if(this.player.getPower() > 0){" +
|
||||
" $_ = this.player;" +
|
||||
"}else if(com.wurmonline.server.Servers.isThisAPvpServer() && owner.getDominator() != this.player){"
|
||||
+ " $_ = owner.getLeader();"
|
||||
+ "}else{"
|
||||
+ " if(this.player.getPower() > 0){"
|
||||
+ " $_ = this.player;"
|
||||
+ " }else{"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ " }"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctCommunicator, "reallyHandle_CMD_MOVE_INVENTORY", "getDominator", replace);
|
||||
/*ctCommunicator.getDeclaredMethod("reallyHandle_CMD_MOVE_INVENTORY").instrument(new ExprEditor(){
|
||||
@@ -348,11 +331,11 @@ public class Arena {
|
||||
CtClass.floatType
|
||||
};
|
||||
String desc2 = Descriptor.ofMethod(CtClass.booleanType, params2);
|
||||
replace = "if(this.watcher.isPlayer() && creature.isPlayer()){" +
|
||||
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 && "+Arena.class.getName()+".getArenaAttitude((com.wurmonline.server.players.Player)this.watcher, creature) == 2){"
|
||||
" 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;" +
|
||||
" }"
|
||||
@@ -748,6 +731,46 @@ public class Arena {
|
||||
replace = "{ return (byte) 4; }";
|
||||
Util.setBodyDeclared(thisClass, ctDeities, "getFavoredKingdom", replace);
|
||||
|
||||
/*Util.setReason("Decrease PvP combat damage.");
|
||||
CtClass ctString = classPool.get("java.lang.String");
|
||||
CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle");
|
||||
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
|
||||
// @Nullable Creature performer, Creature defender, byte type, int pos, double damage, float armourMod,
|
||||
// String attString, @Nullable Battle battle, float infection, float poison, boolean archery, boolean alreadyCalculatedResist
|
||||
CtClass[] params8 = {
|
||||
ctCreature,
|
||||
ctCreature,
|
||||
CtClass.byteType,
|
||||
CtClass.intType,
|
||||
CtClass.doubleType,
|
||||
CtClass.floatType,
|
||||
ctString,
|
||||
ctBattle,
|
||||
CtClass.floatType,
|
||||
CtClass.floatType,
|
||||
CtClass.booleanType,
|
||||
CtClass.booleanType
|
||||
};
|
||||
String desc8 = Descriptor.ofMethod(CtClass.booleanType, params8);
|
||||
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && ($2.isDominated() || $2.isPlayer()) && $1 != null && $1.isPlayer()){" +
|
||||
" logger.info(\"Detected player hit against player/pet opponent. Halving damage.\");" +
|
||||
" $5 = $5 * 0.5d;" +
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc8, replace);*/
|
||||
|
||||
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.5d;" +
|
||||
"}";
|
||||
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);
|
||||
|
||||
|
||||
}catch (NotFoundException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
|
||||
105
src/main/java/mod/sin/wyvern/Bloodlust.java
Normal file
105
src/main/java/mod/sin/wyvern/Bloodlust.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package mod.sin.wyvern;
|
||||
|
||||
import com.wurmonline.server.Server;
|
||||
import com.wurmonline.server.TimeConstants;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.creatures.Creatures;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import javassist.bytecode.Descriptor;
|
||||
import mod.sin.lib.Util;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Bloodlust {
|
||||
public static Logger logger = Logger.getLogger(Bloodlust.class.getName());
|
||||
|
||||
protected static HashMap<Long,Float> lusts = new HashMap<>();
|
||||
protected static HashMap<Long,Long> lastLusted = new HashMap<>();
|
||||
public static float lustUnique(Creature creature){
|
||||
long wurmid = creature.getWurmId();
|
||||
if(lusts.containsKey(wurmid)){
|
||||
float currentLust = lusts.get(wurmid);
|
||||
if(currentLust >= 1.0f){ // When dealing more than 100% extra damage
|
||||
Server.getInstance().broadCastAction(creature.getName()+" becomes enraged!", creature, 50);
|
||||
}else if(currentLust >= 0.49f){ // When dealing between 50% and 100% extra damage.
|
||||
Server.getInstance().broadCastAction(creature.getName()+" is becoming enraged!", creature, 50);
|
||||
}else{
|
||||
Server.getInstance().broadCastAction(creature.getName()+" is beginning to see red!", creature, 50);
|
||||
}
|
||||
lusts.put(wurmid, currentLust+0.01f);
|
||||
}else{
|
||||
lusts.put(wurmid, 0.01f);
|
||||
}
|
||||
lastLusted.put(wurmid, System.currentTimeMillis());
|
||||
return 1.0f+lusts.get(wurmid);
|
||||
}
|
||||
|
||||
public static float getLustMult(Creature creature){
|
||||
long wurmid = creature.getWurmId();
|
||||
if(lusts.containsKey(wurmid)){
|
||||
return 1.0f+lusts.get(wurmid);
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public static void pollLusts(){
|
||||
for(Long wurmid : lastLusted.keySet()){
|
||||
if(System.currentTimeMillis() >= lastLusted.get(wurmid) + TimeConstants.MINUTE_MILLIS*10){
|
||||
logger.info("Bloodlust for "+wurmid+" expired. Removing from lists.");
|
||||
Creature creature = Creatures.getInstance().getCreatureOrNull(wurmid);
|
||||
if(creature != null && !creature.isDead()){
|
||||
Server.getInstance().broadCastAction(creature.getName()+" calms down and is no longer enraged.", creature, 50);
|
||||
}
|
||||
lastLusted.remove(wurmid);
|
||||
lusts.remove(wurmid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void preInit(){
|
||||
try{
|
||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||
final Class<Bloodlust> thisClass = Bloodlust.class;
|
||||
String replace;
|
||||
|
||||
Util.setReason("Hook for bloodlust system.");
|
||||
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
||||
CtClass ctString = classPool.get("java.lang.String");
|
||||
CtClass ctBattle = classPool.get("com.wurmonline.server.combat.Battle");
|
||||
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
|
||||
// @Nullable Creature performer, Creature defender, byte type, int pos, double damage, float armourMod,
|
||||
// String attString, @Nullable Battle battle, float infection, float poison, boolean archery, boolean alreadyCalculatedResist
|
||||
CtClass[] params1 = {
|
||||
ctCreature,
|
||||
ctCreature,
|
||||
CtClass.byteType,
|
||||
CtClass.intType,
|
||||
CtClass.doubleType,
|
||||
CtClass.floatType,
|
||||
ctString,
|
||||
ctBattle,
|
||||
CtClass.floatType,
|
||||
CtClass.floatType,
|
||||
CtClass.booleanType,
|
||||
CtClass.booleanType
|
||||
};
|
||||
String desc1 = Descriptor.ofMethod(CtClass.booleanType, params1);
|
||||
replace = "if($2.isDominated() && $1 != null && ($1.isUnique() || "+RareSpawns.class.getName()+".isRareCreature($1))){" +
|
||||
//" logger.info(\"Detected unique hit on a pet. Adding damage.\");" +
|
||||
" "+Bloodlust.class.getName()+".lustUnique($1);" +
|
||||
"}" +
|
||||
"if($1 != null && ($1.isUnique() || "+RareSpawns.class.getName()+".isRareCreature($1))){" +
|
||||
" float lustMult = "+Bloodlust.class.getName()+".getLustMult($1);" +
|
||||
" $5 = $5 * lustMult;" +
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);
|
||||
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.wurmonline.server.TimeConstants;
|
||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
@@ -51,10 +52,11 @@ public class Bounty {
|
||||
public static boolean isCombatant(Map<Long, Long> attackers, long playerId){
|
||||
long now = System.currentTimeMillis();
|
||||
long delta = now-attackers.get(playerId);
|
||||
if(delta > 120000){
|
||||
return delta < TimeConstants.MINUTE_MILLIS*2;
|
||||
/*if(delta > 120000){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true;*/
|
||||
}
|
||||
|
||||
public static Map<Long, Long> getAttackers(Creature mob){
|
||||
@@ -242,7 +244,7 @@ public class Bounty {
|
||||
|
||||
}
|
||||
catch (NotFoundException e) {
|
||||
throw new HookException((Throwable)e);
|
||||
throw new HookException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,13 +90,15 @@ public class Caches {
|
||||
int templateId = cache.getTemplateId();
|
||||
if(templateId == TitanCache.templateId){
|
||||
Item efficiencyTool = ItemUtil.createRandomToolWeapon(20f, 40f, cache.getCreatorName());
|
||||
ItemUtil.applyEnchant(efficiencyTool, (byte) 114, 40f+(20f*Server.rand.nextFloat())); // Efficiency enchant is 114
|
||||
if(efficiencyTool.isMetal()){
|
||||
efficiencyTool.setMaterial(Server.rand.nextBoolean() ? Materials.MATERIAL_ADAMANTINE : Materials.MATERIAL_GLIMMERSTEEL);
|
||||
}else if(efficiencyTool.isWood()){
|
||||
efficiencyTool.setMaterial(Materials.MATERIAL_WOOD_WILLOW);
|
||||
if(efficiencyTool != null) {
|
||||
ItemUtil.applyEnchant(efficiencyTool, (byte) 120, 40f + (20f * Server.rand.nextFloat())); // Titanforged enchant is 120
|
||||
if(efficiencyTool.isMetal()){
|
||||
efficiencyTool.setMaterial(Server.rand.nextBoolean() ? Materials.MATERIAL_ADAMANTINE : Materials.MATERIAL_GLIMMERSTEEL);
|
||||
}else if(efficiencyTool.isWood()){
|
||||
efficiencyTool.setMaterial(Materials.MATERIAL_WOOD_WILLOW);
|
||||
}
|
||||
performer.getInventory().insertItem(efficiencyTool, true);
|
||||
}
|
||||
performer.getInventory().insertItem(efficiencyTool, true);
|
||||
}else if(templateId == TreasureMapCache.templateId){
|
||||
Item map = Treasuremap.CreateTreasuremap(performer, cache, null, null, true);
|
||||
map.setRarity(cache.getRarity());
|
||||
@@ -237,7 +239,6 @@ public class Caches {
|
||||
ItemUtil.applyEnchant(item, Enchants.BUFF_LIFETRANSFER, quality*0.6f+(quality*0.6f*Server.rand.nextFloat()));
|
||||
}
|
||||
}else if(templateId == CrystalCache.templateId){
|
||||
item.setQualityLevel(Server.rand.nextFloat()*quality);
|
||||
if(Server.rand.nextInt(500) < quality){
|
||||
item.setRarity(MiscConstants.RARE);
|
||||
}
|
||||
@@ -245,7 +246,7 @@ public class Caches {
|
||||
}
|
||||
public static int getBasicNums(int templateId){
|
||||
if(templateId == CrystalCache.templateId){
|
||||
return Server.rand.nextInt(5)+5;
|
||||
return Server.rand.nextInt(5)+8;
|
||||
}else if(templateId == GemCache.templateId){
|
||||
return 2;
|
||||
}
|
||||
@@ -378,7 +379,9 @@ public class Caches {
|
||||
float basicQuality = Math.max(baseQL+(randQL*Server.rand.nextFloat()), baseQL+(randQL*Server.rand.nextFloat()));
|
||||
basicQuality = Math.min(minimumQuality+basicQuality, 100f);
|
||||
Item basicItem = ItemFactory.createItem(basicTemplates[Server.rand.nextInt(basicTemplates.length)], basicQuality, "");
|
||||
basicItem.setRarity(cache.getRarity());
|
||||
if(cache.getRarity() > basicItem.getRarity()) {
|
||||
basicItem.setRarity(cache.getRarity());
|
||||
}
|
||||
adjustBasicItem(templateId, quality, basicItem);
|
||||
if(adjustBasicWeight(templateId)){
|
||||
float weightMult = getWeightMultiplier(templateId, quality);
|
||||
@@ -400,7 +403,9 @@ public class Caches {
|
||||
float extraQuality = Math.max(baseQL+(randQL*Server.rand.nextFloat()), baseQL+(randQL*Server.rand.nextFloat()));
|
||||
extraQuality = Math.min(minimumQuality+extraQuality, 100f);
|
||||
Item extraItem = ItemFactory.createItem(extraTemplates[Server.rand.nextInt(extraTemplates.length)], extraQuality, "");
|
||||
extraItem.setRarity(cache.getRarity());
|
||||
if(cache.getRarity() > extraItem.getRarity()) {
|
||||
extraItem.setRarity(cache.getRarity());
|
||||
}
|
||||
adjustExtraItem(templateId, extraItem);
|
||||
inv.insertItem(extraItem, true);
|
||||
}
|
||||
|
||||
@@ -1,25 +1,43 @@
|
||||
package mod.sin.wyvern;
|
||||
|
||||
import com.wurmonline.server.Server;
|
||||
import com.wurmonline.server.bodys.Wound;
|
||||
import com.wurmonline.server.bodys.Wounds;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.creatures.Creatures;
|
||||
import com.wurmonline.server.items.Item;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import javassist.CannotCompileException;
|
||||
import com.wurmonline.shared.constants.Enchants;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.CtMethod;
|
||||
import javassist.NotFoundException;
|
||||
import javassist.bytecode.Descriptor;
|
||||
import javassist.bytecode.*;
|
||||
import mod.sin.lib.Util;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class CombatChanges {
|
||||
public static Logger logger = Logger.getLogger(CombatChanges.class.getName());
|
||||
|
||||
public static int getWeaponType(Item weapon){
|
||||
if(weapon.enchantment == Enchants.ACID_DAM){
|
||||
return Wound.TYPE_ACID;
|
||||
}else if(weapon.enchantment == Enchants.FROST_DAM){
|
||||
return Wound.TYPE_COLD;
|
||||
}else if(weapon.enchantment == Enchants.FIRE_DAM){
|
||||
return Wound.TYPE_BURN;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static float combatRatingAdditive(float combatRating, Creature cret, Creature opponent){
|
||||
//logger.info("Checking additive ("+cret.getName()+" vs "+opponent.getName()+"), combatRating = "+combatRating);
|
||||
float add = 0.0f;
|
||||
if((cret != null && !cret.isPlayer()) || (opponent != null && !opponent.isPlayer())){
|
||||
if(cret != null && cret.isPlayer() && (opponent != null && !opponent.isPlayer())){
|
||||
if(cret.isRoyalExecutioner()){
|
||||
add += 2.0f;
|
||||
}
|
||||
@@ -29,9 +47,9 @@ public class CombatChanges {
|
||||
public static float combatRatingMultiplicative(float combatRating, Creature cret, Creature opponent){
|
||||
//logger.info("Checking mult ("+cret.getName()+" vs "+opponent.getName()+"), combatRating = "+combatRating);
|
||||
float mult = 1.0f;
|
||||
if(cret != null && cret.isDominated()){
|
||||
if(cret != null){
|
||||
//logger.info("Cret is a pet.");
|
||||
if(cret.getDominator() != null) {
|
||||
if(cret.isDominated() && cret.getDominator() != null) {
|
||||
if (cret.getDominator() instanceof Player) {
|
||||
Player owner = (Player) cret.getDominator();
|
||||
double depth = owner.getSoulDepth().getKnowledge();
|
||||
@@ -41,10 +59,107 @@ public class CombatChanges {
|
||||
logger.info("Somehow a pet is dominated by a non-player? (" + cret.getDominator().getName() + ")");
|
||||
}
|
||||
}
|
||||
if(QualityOfLife.getVehicleSafe(cret) != null){
|
||||
mult *= 0.75f;
|
||||
}
|
||||
}
|
||||
return mult;
|
||||
}
|
||||
|
||||
public static float getAdjustedOakshell(Creature defender, Item armour, float armourMod){
|
||||
if(defender != null && armour == null){
|
||||
float oakshellPower = defender.getBonusForSpellEffect(Enchants.CRET_OAKSHELL);
|
||||
if(oakshellPower > 0f){
|
||||
return (float) (1-(0.8f*Math.pow((oakshellPower/(oakshellPower+80)), 0.5d)));
|
||||
}
|
||||
}
|
||||
return armourMod; // Returns previous armourMod if the target has armour.
|
||||
}
|
||||
|
||||
protected static ArrayList<Creature> uniques = new ArrayList<>();
|
||||
public static void pollUniqueCollection(){
|
||||
for(Creature cret : Creatures.getInstance().getCreatures()){
|
||||
if(cret.isUnique() && !uniques.contains(cret)){
|
||||
logger.info("Found unique not in unique list, adding now: "+cret.getName());
|
||||
uniques.add(cret);
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
while(i < uniques.size()){
|
||||
if(uniques.get(i).isDead()){
|
||||
logger.info("Unique was found dead ("+uniques.get(i).getName()+"). Removing from uniques list.");
|
||||
uniques.remove(uniques.get(i));
|
||||
}else{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void pollUniqueRegeneration(){
|
||||
if(!uniques.isEmpty()) {
|
||||
for (Creature cret : uniques) {
|
||||
if (cret.getBody().isWounded()) {
|
||||
Wounds tWounds = cret.getBody().getWounds();
|
||||
int toHeal = 75;
|
||||
Wound w = tWounds.getWounds()[Server.rand.nextInt(tWounds.getWounds().length)];
|
||||
if (w.getSeverity() > toHeal) {
|
||||
w.modifySeverity(-toHeal);
|
||||
break;
|
||||
} else {
|
||||
w.heal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canDoDamage(double damage, Creature attacker, Creature defender, Item weapon) {
|
||||
logger.info(String.format("canDoDamage from %s to %s with %s - %.1f", attacker.getName(), defender.getName(), weapon.getName(), damage));
|
||||
return damage > 1D;
|
||||
}
|
||||
|
||||
static void patchCombatDamageCheck(ClassPool classPool) throws NotFoundException, BadBytecode {
|
||||
CtClass cls = classPool.getCtClass("com.wurmonline.server.creatures.CombatHandler");
|
||||
CtMethod method = cls.getMethod("setDamage", "(Lcom/wurmonline/server/creatures/Creature;Lcom/wurmonline/server/items/Item;DBB)Z");
|
||||
MethodInfo methodInfo = method.getMethodInfo();
|
||||
CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
|
||||
ConstPool constPool = codeAttribute.getConstPool();
|
||||
CodeIterator codeIterator = codeAttribute.iterator();
|
||||
|
||||
// Scan through all the bytecode - look for a multiplication followed by comparing
|
||||
while (codeIterator.hasNext()) {
|
||||
int pos = codeIterator.next();
|
||||
int op = codeIterator.byteAt(pos);
|
||||
if (op != CodeIterator.DMUL) continue; // not multiplication - continue
|
||||
op = codeIterator.byteAt(++pos);
|
||||
if (op == CodeIterator.LDC2_W && codeIterator.byteAt(pos + 3) == CodeIterator.DCMPL) {
|
||||
// found the pattern, check the value it's comparing to
|
||||
int ref = codeIterator.u16bitAt(pos + 1);
|
||||
double val = constPool.getDoubleInfo(ref);
|
||||
if (val == 500.0) {
|
||||
// here it is, generate new code to insert
|
||||
// We'll be calling canDoDamage, the first parameter (damage) is already on the stack, prepare the rest
|
||||
Bytecode newCode = new Bytecode(constPool);
|
||||
newCode.add(Bytecode.ALOAD_0); // this
|
||||
newCode.addGetfield(cls, "creature", "Lcom/wurmonline/server/creatures/Creature;"); // this.creature
|
||||
newCode.add(Bytecode.ALOAD_1); // defender - first parameter of setDamage
|
||||
newCode.add(Bytecode.ALOAD_2); // weapon - second parameter of setDamage
|
||||
|
||||
// call our methor, result is left on the stack
|
||||
newCode.addInvokestatic(
|
||||
CombatChanges.class.getName(), "canDoDamage",
|
||||
"(DLcom/wurmonline/server/creatures/Creature;Lcom/wurmonline/server/creatures/Creature;Lcom/wurmonline/server/items/Item;)Z");
|
||||
|
||||
// The code we're replacing is 4 bytes - LDC2_W, 2byte reference and DCMPL
|
||||
// Insert a gap for to match the size of the new code
|
||||
codeIterator.insertGap(pos, newCode.getSize() - 4);
|
||||
|
||||
// And put the new code
|
||||
codeIterator.write(newCode.get(), pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void preInit(){
|
||||
try{
|
||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||
@@ -83,11 +198,86 @@ public class CombatChanges {
|
||||
replace = "if($2.isDominated() && $1 != null && $1.isUnique()){" +
|
||||
//" logger.info(\"Detected unique hit on a pet. Adding damage.\");" +
|
||||
" $5 = $5 * 2d;" +
|
||||
"}" +
|
||||
"if($2.isUnique() && $1 != null && $1.isDominated()){" +
|
||||
" logger.info(\"Detected pet hit on a unique. Reducing damage.\");" +
|
||||
" $5 = $5 * 0.5d;" +
|
||||
"}";
|
||||
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc1, replace);
|
||||
|
||||
Util.setReason("Adjust weapon damage type based on the potion/salve applied.");
|
||||
replace = "int wt = "+CombatChanges.class.getName()+".getWeaponType($1);"
|
||||
+ "if(wt != -1){"
|
||||
+ " type = wt;"
|
||||
+ " return wt;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCombatHandler, "getType", replace);
|
||||
|
||||
Util.setReason("Adjust bloodthirst to epic settings.");
|
||||
CtClass ctItem = classPool.get("com.wurmonline.server.items.Item");
|
||||
CtClass[] params2 = {
|
||||
ctCreature,
|
||||
ctItem,
|
||||
ctCreature
|
||||
};
|
||||
String desc2 = Descriptor.ofMethod(CtClass.doubleType, params2);
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "isThisAnEpicOrChallengeServer", replace);
|
||||
|
||||
Util.setReason("Fix magranon damage bonus stacking.");
|
||||
replace = "if(mildStack){" +
|
||||
" $_ = $proceed($$) * 8 / 5;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc2, "getModifiedFloatEffect", replace);
|
||||
|
||||
Util.setReason("Adjust bloodthirst to epic settings.");
|
||||
CtClass ctAttackAction = classPool.get("com.wurmonline.server.creatures.AttackAction");
|
||||
CtClass[] params3 = {
|
||||
ctCreature,
|
||||
ctAttackAction,
|
||||
ctCreature
|
||||
};
|
||||
String desc3 = Descriptor.ofMethod(CtClass.doubleType, params3);
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc3, "isThisAnEpicOrChallengeServer", replace);
|
||||
|
||||
Util.setReason("Fix magranon damage bonus stacking.");
|
||||
replace = "if(mildStack){" +
|
||||
" $_ = $proceed($$) * 8 / 5;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDescribed(thisClass, ctCombatHandler, "getDamage", desc3, "getModifiedFloatEffect", replace);
|
||||
|
||||
Util.setReason("Nerf truehit/excel.");
|
||||
replace = "$_ = $proceed($$) * 0.5f;";
|
||||
Util.instrumentDeclared(thisClass, ctCombatHandler, "getCombatRating", "getBonusForSpellEffect", replace);
|
||||
|
||||
Util.setReason("Nerf oakshell.");
|
||||
replace = "if(defender.isPlayer() && defender.getBonusForSpellEffect((byte)22) > 0f){" +
|
||||
" armourMod = "+CombatChanges.class.getName()+".getAdjustedOakshell(defender, armour, armourMod);" +
|
||||
"}" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctCombatHandler, "setDamage", "getDamReductionBonusFor", replace);
|
||||
|
||||
Util.setReason("Disable natural regeneration on uniques.");
|
||||
CtClass ctWound = classPool.get("com.wurmonline.server.bodys.Wound");
|
||||
replace = "if(!this.creature.isUnique()){"
|
||||
+ " $_ = $proceed($$);"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctWound, "poll", "modifySeverity", replace);
|
||||
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkInfection", replace);
|
||||
Util.instrumentDeclared(thisClass, ctWound, "poll", "checkPoison", replace);
|
||||
|
||||
//patchCombatDamageCheck(classPool);
|
||||
//patchCombatDamageCheckAddWound(classPool);
|
||||
|
||||
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
}/* catch (BadBytecode badBytecode) {
|
||||
badBytecode.printStackTrace();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package mod.sin.wyvern;
|
||||
|
||||
import com.wurmonline.server.Server;
|
||||
import com.wurmonline.server.Servers;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.items.Item;
|
||||
import com.wurmonline.server.items.ItemSpellEffects;
|
||||
import com.wurmonline.server.items.NotOwnedException;
|
||||
import com.wurmonline.server.skills.NoSuchSkillException;
|
||||
import com.wurmonline.server.skills.SkillList;
|
||||
import com.wurmonline.shared.constants.Enchants;
|
||||
|
||||
import mod.sin.items.ChaosCrystal;
|
||||
import mod.sin.items.EnchantersCrystal;
|
||||
|
||||
@@ -43,16 +43,27 @@ public class Crystals {
|
||||
return -10;
|
||||
}
|
||||
public static double getInfusionDifficulty(Creature performer, Item source, Item target){
|
||||
double diff = 100-source.getCurrentQualityLevel();
|
||||
diff += source.getRarity()*20;
|
||||
diff += 40f - (target.getCurrentQualityLevel()*0.4f);
|
||||
diff -= performer.getMindLogical().getKnowledge()*0.3f;
|
||||
double diff = 80-source.getCurrentQualityLevel();
|
||||
diff += source.getRarity()*25;
|
||||
diff += 30f - (target.getCurrentQualityLevel()*0.3f);
|
||||
try {
|
||||
diff -= performer.getSkills().getSkill(SkillList.MIND).getKnowledge()*0.3f;
|
||||
} catch (NoSuchSkillException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
public static double getEnchantersInfusionDifficulty(Creature performer, Item source, Item target){
|
||||
double diff = 160-source.getCurrentQualityLevel();
|
||||
double diff = 120-source.getCurrentQualityLevel();
|
||||
diff += 40f - (target.getCurrentQualityLevel()*0.4f);
|
||||
diff -= performer.getMindLogical().getKnowledge()*0.3f;
|
||||
try {
|
||||
diff -= performer.getSkills().getSkill(SkillList.MIND).getKnowledge()*0.3f;
|
||||
} catch (NoSuchSkillException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(target.getSpellEffects() != null){
|
||||
diff += target.getSpellEffects().getEffects().length*10;
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
public static boolean shouldCancelEnchantersInfusion(Creature performer, Item target){
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.wurmonline.server.items.Item;
|
||||
import com.wurmonline.server.villages.GuardPlan;
|
||||
import com.wurmonline.server.villages.Village;
|
||||
import com.wurmonline.server.villages.Villages;
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
@@ -72,6 +71,11 @@ public class EconomicChanges {
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctItem, "getValue", replace);
|
||||
|
||||
Util.setReason("Remove trader refilling off kings coffers.");
|
||||
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
||||
replace = "$_ = 1;";
|
||||
Util.instrumentDeclared(thisClass, ctCreature, "removeRandomItems", "nextInt", replace);
|
||||
|
||||
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public class ItemMod {
|
||||
new Weapon(BattleYoyo.templateId, 6.85f, 3.85f, 0.008f, 2, 2, 0.0f, 0d);
|
||||
new Weapon(Club.templateId, 8.1f, 4.5f, 0.002f, 3, 3, 0.4f, 0.5d);
|
||||
new Weapon(Knuckles.templateId, 3.6f, 2.2f, 0.002f, 1, 1, 0.2f, 0.5d);
|
||||
new Weapon(Warhammer.templateId, 9.55f, 5.5f, 0.008f, 4, 3, 1f, 0d);
|
||||
new Weapon(Warhammer.templateId, 9.40f, 5.6f, 0.008f, 4, 3, 1f, 0d);
|
||||
// Titan weaponry
|
||||
new Weapon(MaartensMight.templateId, 11, 5, 0.02f, 4, 4, 1.0f, 0d);
|
||||
new Weapon(RaffehsRage.templateId, 9.5f, 4.25f, 0.02f, 3, 3, 1.0f, 0d);
|
||||
@@ -315,7 +315,10 @@ public class ItemMod {
|
||||
|
||||
// Make logs able to be combined.
|
||||
ItemTemplate log = ItemTemplateFactory.getInstance().getTemplate(ItemList.log);
|
||||
ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "combine"), true);
|
||||
ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "combine"), true);
|
||||
ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "centimetersZ"), 50);
|
||||
int newVolume = log.getSizeX()*log.getSizeY()*log.getSizeZ();
|
||||
ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "volume"), newVolume);
|
||||
|
||||
// Set silver mirror price to 10 silver instead of 1 iron.
|
||||
ItemTemplate handMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.handMirror);
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.wurmonline.server.creatures.SpellEffectsEnum;
|
||||
import com.wurmonline.server.players.Cultist;
|
||||
import com.wurmonline.server.players.Cults;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
|
||||
@@ -4,9 +4,13 @@ import com.wurmonline.server.*;
|
||||
import com.wurmonline.server.bodys.Wound;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.items.Item;
|
||||
import com.wurmonline.server.items.ItemTemplate;
|
||||
import com.wurmonline.server.items.SimpleCreationEntry;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import com.wurmonline.server.players.PlayerInfo;
|
||||
import com.wurmonline.server.players.PlayerInfoFactory;
|
||||
import com.wurmonline.server.skills.Skill;
|
||||
import com.wurmonline.server.skills.SkillList;
|
||||
import com.wurmonline.server.villages.Village;
|
||||
import com.wurmonline.server.webinterface.WcKingdomChat;
|
||||
import com.wurmonline.server.zones.VolaTile;
|
||||
@@ -26,7 +30,9 @@ import org.nyxcode.wurm.discordrelay.DiscordRelay;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MiscChanges {
|
||||
@@ -39,17 +45,6 @@ public class MiscChanges {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getWeaponType(Item weapon){
|
||||
if(weapon.enchantment == Enchants.ACID_DAM){
|
||||
return Wound.TYPE_ACID;
|
||||
}else if(weapon.enchantment == Enchants.FROST_DAM){
|
||||
return Wound.TYPE_COLD;
|
||||
}else if(weapon.enchantment == Enchants.FIRE_DAM){
|
||||
return Wound.TYPE_BURN;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void sendServerTabMessage(String channel, final String message, final int red, final int green, final int blue){
|
||||
DiscordRelay.sendToDiscord(channel, message, true);
|
||||
// WARNING: Never change this from a new Runnable. Lambdas are a lie and will break everything.
|
||||
@@ -92,6 +87,20 @@ public class MiscChanges {
|
||||
DiscordRelay.sendToDiscord("deaths", player.getName()+" "+slayMessage+slayers, true);
|
||||
}
|
||||
|
||||
public static void addPlayerStat(String playerName, String stat){
|
||||
Connection dbcon;
|
||||
PreparedStatement ps;
|
||||
try {
|
||||
dbcon = ModSupportDb.getModSupportDb();
|
||||
ps = dbcon.prepareStatement("UPDATE PlayerStats SET "+stat+" = "+stat+" + 1 WHERE NAME = \""+playerName+"\"");
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addPlayerStatsDeath(String playerName){
|
||||
Connection dbcon;
|
||||
PreparedStatement ps;
|
||||
@@ -144,6 +153,125 @@ public class MiscChanges {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float getFoodOpulenceBonus(Item food){
|
||||
float mult = 1.0f;
|
||||
if(food.getSpellEffectPower(Enchants.BUFF_OPULENCE) > 0f){
|
||||
mult *= 1.0f + (food.getSpellEffectPower(Enchants.BUFF_OPULENCE)*0.0025f);
|
||||
}
|
||||
return food.getFoodComplexity()*mult;
|
||||
}
|
||||
|
||||
public static long getBedBonus(long secs, long bed){
|
||||
Optional<Item> beds = Items.getItemOptional(bed);
|
||||
if(beds.isPresent()) {
|
||||
Item bedItem = beds.get();
|
||||
if(bedItem.isBed()){
|
||||
secs *= 1+(bedItem.getCurrentQualityLevel()*0.005f);
|
||||
}
|
||||
}
|
||||
secs *= 2;
|
||||
return secs;
|
||||
}
|
||||
|
||||
public static boolean royalSmithImprove(Creature performer, Skill improve){
|
||||
if(performer.isRoyalSmith()){
|
||||
if(improve.getNumber() == SkillList.SMITHING_ARMOUR_CHAIN
|
||||
|| improve.getNumber() == SkillList.SMITHING_ARMOUR_PLATE
|
||||
|| improve.getNumber() == SkillList.SMITHING_BLACKSMITHING
|
||||
|| improve.getNumber() == SkillList.SMITHING_GOLDSMITHING
|
||||
|| improve.getNumber() == SkillList.SMITHING_LOCKSMITHING
|
||||
|| improve.getNumber() == SkillList.SMITHING_METALLURGY
|
||||
|| improve.getNumber() == SkillList.SMITHING_SHIELDS
|
||||
|| improve.getNumber() == SkillList.SMITHING_WEAPON_BLADES
|
||||
|| improve.getNumber() == SkillList.SMITHING_WEAPON_HEADS){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getNewFoodFill(float qlevel){
|
||||
float startPercent = 0.004f;
|
||||
float endPercent = 0.015f;
|
||||
return (int) ((startPercent*(1f-qlevel/100f)+endPercent*(qlevel/100f))*65535);
|
||||
}
|
||||
|
||||
public static boolean rollRarityImprove(Item source, int usedWeight){
|
||||
int templateWeight = source.getTemplate().getWeightGrams();
|
||||
float percentUsage = (float) usedWeight / (float) templateWeight;
|
||||
float chance = percentUsage * 0.05f;
|
||||
if(Server.rand.nextFloat() < chance){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static final int rarityChance = 3600;
|
||||
protected static HashMap<Long,Integer> pseudoMap = new HashMap<>();
|
||||
public static boolean getRarityWindowChance(long wurmid){ //nextInt checks against 0. False is true, true is false.
|
||||
if(pseudoMap.containsKey(wurmid)){
|
||||
int currentChance = pseudoMap.get(wurmid);
|
||||
boolean success = Server.rand.nextInt(currentChance) == 0;
|
||||
if(success){
|
||||
pseudoMap.put(wurmid, currentChance+rarityChance-1);
|
||||
}else{
|
||||
pseudoMap.put(wurmid, currentChance-1);
|
||||
}
|
||||
return !success;
|
||||
}else{
|
||||
pseudoMap.put(wurmid, rarityChance-1);
|
||||
return !(Server.rand.nextInt(rarityChance) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte getNewCreationRarity(SimpleCreationEntry entry, Item source, Item target, ItemTemplate template){
|
||||
if(source.getRarity() > 0 || target.getRarity() > 0) {
|
||||
byte sRarity = source.getRarity();
|
||||
byte tRarity = target.getRarity();
|
||||
int sourceid = entry.getObjectSource();
|
||||
int targetid = entry.getObjectTarget();
|
||||
Item realSource = null;
|
||||
if(source.getTemplateId() == sourceid){
|
||||
realSource = source;
|
||||
}else if(target.getTemplateId() == sourceid){
|
||||
realSource = target;
|
||||
}
|
||||
Item realTarget = null;
|
||||
if(source.getTemplateId() == targetid){
|
||||
realTarget = source;
|
||||
}else if(target.getTemplateId() == targetid){
|
||||
realTarget = target;
|
||||
}
|
||||
if (entry.depleteSource && entry.depleteTarget) {
|
||||
int min = Math.min(sRarity, tRarity);
|
||||
int max = Math.max(sRarity, tRarity);
|
||||
return (byte) (min+Server.rand.nextInt(1+(max-min)));
|
||||
}
|
||||
if(realSource == null || realTarget == null){
|
||||
logger.info("Null source or target.");
|
||||
return 0;
|
||||
}
|
||||
if(entry.depleteSource && realSource.getRarity() > 0){
|
||||
int templateWeight = realSource.getTemplate().getWeightGrams();
|
||||
int usedWeight = entry.getSourceWeightToRemove(realSource, realTarget, template, false);
|
||||
float percentUsage = (float) usedWeight / (float) templateWeight;
|
||||
float chance = percentUsage * 0.05f;
|
||||
if(Server.rand.nextFloat() < chance){
|
||||
return realSource.getRarity();
|
||||
}
|
||||
}else if(entry.depleteTarget && realTarget.getRarity() > 0){
|
||||
int templateWeight = realTarget.getTemplate().getWeightGrams();
|
||||
int usedWeight = entry.getTargetWeightToRemove(realSource, realTarget, template, false);
|
||||
float percentUsage = (float) usedWeight / (float) templateWeight;
|
||||
float chance = percentUsage * 0.05f;
|
||||
if(Server.rand.nextFloat() < chance){
|
||||
return target.getRarity();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void preInit(){
|
||||
try{
|
||||
@@ -157,8 +285,8 @@ public class MiscChanges {
|
||||
String infoTabTitle = "Server";
|
||||
// Initial messages:
|
||||
String[] infoTabLine = {"Server Thread: https://forum.wurmonline.com/index.php?/topic/162067-revenant-modded-pvepvp-3x-action-new-skillgain/",
|
||||
"Server Discord: https://discord.gg/r8QNXAC",
|
||||
"Server Maps: https://www.sarcasuals.com/revenant/"};
|
||||
"Website/Maps: https://www.sarcasuals.com/",
|
||||
"Server Discord: https://discord.gg/r8QNXAC"};
|
||||
StringBuilder str = new StringBuilder("{"
|
||||
+ " com.wurmonline.server.Message mess;");
|
||||
for (String anInfoTabLine : infoTabLine) {
|
||||
@@ -186,7 +314,8 @@ public class MiscChanges {
|
||||
|
||||
// - Enable creature custom colors - (Used for creating custom color creatures eg. Lilith) - //
|
||||
CtClass ctCreature = classPool.get("com.wurmonline.server.creatures.Creature");
|
||||
Util.setBodyDeclared(thisClass, ctCreature, "hasCustomColor", "{ return true; }");
|
||||
replace = "{ return true; }";
|
||||
Util.setBodyDeclared(thisClass, ctCreature, "hasCustomColor", replace);
|
||||
|
||||
// - Increase the amount of checks for new unique spawns by 5x - //
|
||||
CtClass ctServer = classPool.get("com.wurmonline.server.Server");
|
||||
@@ -229,8 +358,8 @@ public class MiscChanges {
|
||||
// - Remove fatiguing actions requiring you to be on the ground - //
|
||||
CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action");
|
||||
CtConstructor[] ctActionConstructors = ctAction.getConstructors();
|
||||
for(CtConstructor constructor : ctActionConstructors){
|
||||
constructor.instrument(new ExprEditor(){
|
||||
for(CtConstructor constructor : ctActionConstructors) {
|
||||
constructor.instrument(new ExprEditor() {
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("isFatigue")) {
|
||||
m.replace("" +
|
||||
@@ -249,17 +378,6 @@ public class MiscChanges {
|
||||
});
|
||||
}
|
||||
|
||||
// - Allow all creatures to be displayed in the Mission Ruler - //
|
||||
CtClass ctMissionManager = classPool.get("com.wurmonline.server.questions.MissionManager");
|
||||
ctMissionManager.getDeclaredMethod("dropdownCreatureTemplates").instrument(new ExprEditor() {
|
||||
@Override
|
||||
public void edit(FieldAccess fieldAccess) throws CannotCompileException {
|
||||
if (Objects.equals("baseCombatRating", fieldAccess.getFieldName()))
|
||||
fieldAccess.replace("$_ = 1.0f;");
|
||||
logger.info("Instrumented Mission Ruler to display all creatures.");
|
||||
}
|
||||
});
|
||||
|
||||
Util.setReason("Fix Portal Issues.");
|
||||
CtClass ctPortal = classPool.get("com.wurmonline.server.questions.PortalQuestion");
|
||||
Util.instrumentDeclared(thisClass, ctPortal, "sendQuestion", "willLeaveServer", "$_ = true;");
|
||||
@@ -298,14 +416,6 @@ public class MiscChanges {
|
||||
Util.insertBeforeDeclared(thisClass, ctPlayers, "broadCastDeathInfo", MiscChanges.class.getName()+".broadCastDeaths($1, $2);");
|
||||
//ctPlayers.getDeclaredMethod("broadCastDeathInfo").insertBefore("mod.sin.wyvern.MiscChanges.broadCastDeaths($1, $2);");
|
||||
|
||||
Util.setReason("Adjust weapon damage type based on the potion/salve applied.");
|
||||
replace = "int wt = mod.sin.wyvern.MiscChanges.getWeaponType($1);"
|
||||
+ "if(wt != -1){"
|
||||
+ " type = wt;"
|
||||
+ " return wt;"
|
||||
+ "}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCombatHandler, "getType", replace);
|
||||
|
||||
Util.setReason("Attempt to prevent libila from losing faith when crossing servers.");
|
||||
CtClass ctIntraServerConnection = classPool.get("com.wurmonline.server.intra.IntraServerConnection");
|
||||
ctIntraServerConnection.getDeclaredMethod("savePlayerToDisk").instrument(new ExprEditor() {
|
||||
@@ -372,14 +482,6 @@ public class MiscChanges {
|
||||
+ " logger.info(\"Potential player macro: \"+this.player.getName()+\" [\"+this.commandsThisSecond+\" commands]\");"
|
||||
+ "}";
|
||||
Util.instrumentDeclared(thisClass, ctCommunicator, "reallyHandle_CMD_ITEM_CREATION_LIST", "log", replace);
|
||||
|
||||
Util.setReason("Fix permissions in structures so players cannot cast spells unless they have enter permission.");
|
||||
CtClass ctStructure = classPool.get("com.wurmonline.server.structures.Structure");
|
||||
replace = "if(com.wurmonline.server.behaviours.Actions.isActionDietySpell(action)){"
|
||||
+ " return this.mayPass(performer);"
|
||||
+ "}"
|
||||
+ "$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctStructure, "isActionAllowed", "isActionImproveOrRepair", replace);
|
||||
|
||||
//1f+0.5f*(1f-Math.pow(2, -Math.pow((eff-1f), pow1)/pow2))
|
||||
Util.setReason("Fix 100+ quality or power making certain interaction broken.");
|
||||
@@ -411,15 +513,6 @@ public class MiscChanges {
|
||||
"$1 = $1*(minRate+(maxRate-minRate)*Math.pow((100-this.knowledge)*0.01, newPower));";
|
||||
Util.insertBeforeDescribed(thisClass, ctSkill,"alterSkill", desc, replace);
|
||||
|
||||
Util.setReason("Adjust the amount of scale/hide to distribute after a slaying (1/5).");
|
||||
replace = "{ return (1.0f + (float)$1.getWeightGrams() * $2)*0.2f; }";
|
||||
Util.setBodyDeclared(thisClass, ctCreature, "calculateDragonLootTotalWeight", replace);
|
||||
|
||||
CtClass ctCargoTransportationMethods = classPool.get("com.wurmonline.server.behaviours.CargoTransportationMethods");
|
||||
Util.setReason("Disable strength requirement checks for load/unload.");
|
||||
replace = "{ return true; }";
|
||||
Util.setBodyDeclared(thisClass, ctCargoTransportationMethods, "strengthCheck", replace);
|
||||
|
||||
Util.setReason("Reduce chance of lockpicks breaking.");
|
||||
replace = "$_ = 40f + $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "checkLockpickBreakage", "getCurrentQualityLevel", replace);
|
||||
@@ -436,21 +529,6 @@ public class MiscChanges {
|
||||
});
|
||||
}
|
||||
|
||||
Util.setReason("Enable Mycelium to be absorbed from Freedom Isles.");
|
||||
replace = "$_ = 3;";
|
||||
CtClass[] params7 = {
|
||||
ctAction,
|
||||
ctCreature,
|
||||
CtClass.intType,
|
||||
CtClass.intType,
|
||||
CtClass.booleanType,
|
||||
CtClass.intType,
|
||||
CtClass.shortType,
|
||||
CtClass.floatType
|
||||
};
|
||||
String desc7 = Descriptor.ofMethod(CtClass.booleanType, params7);
|
||||
Util.instrumentDescribed(thisClass, ctTileBehaviour, "action", desc7, "getKingdomTemplateId", replace);
|
||||
|
||||
CtClass ctMethodsStructure = classPool.get("com.wurmonline.server.behaviours.MethodsStructure");
|
||||
Util.setReason("Allow players to construct larger houses.");
|
||||
float carpentryMultiplier = 2f;
|
||||
@@ -463,39 +541,6 @@ public class MiscChanges {
|
||||
Util.setReason("Allow players to construct larger houses.");
|
||||
Util.instrumentDeclared(thisClass, ctMethodsStructure, "hasEnoughSkillToContractStructure", "getKnowledge", replace);
|
||||
|
||||
CtClass ctPlayerInfo = classPool.get("com.wurmonline.server.players.PlayerInfo");
|
||||
Util.setReason("Remove waiting time between converting deity.");
|
||||
replace = "{ return true; }";
|
||||
Util.setBodyDeclared(thisClass, ctPlayerInfo, "mayChangeDeity", replace);
|
||||
|
||||
CtClass ctBless = classPool.get("com.wurmonline.server.spells.Bless");
|
||||
Util.setReason("Fix Bless infidel error.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctBless, "precondition", "accepts", replace);
|
||||
|
||||
CtClass ctRefresh = classPool.get("com.wurmonline.server.spells.Refresh");
|
||||
Util.setReason("Fix Refresh infidel error.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctRefresh, "precondition", "accepts", replace);
|
||||
|
||||
CtClass ctArmourTypes = classPool.get("com.wurmonline.server.combat.ArmourTypes");
|
||||
Util.setReason("Use epic armor DR values.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctArmourTypes, "getArmourBaseDR", "isChallengeOrEpicServer", replace);
|
||||
|
||||
Util.setReason("Use epic armor effectiveness values.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctArmourTypes, "getArmourEffModifier", "isChallengeOrEpicServer", replace);
|
||||
|
||||
Util.setReason("Use epic armor material values.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctArmourTypes, "getArmourMatBonus", "isChallengeOrEpicServer", replace);
|
||||
|
||||
CtClass ctArmour = classPool.get("com.wurmonline.server.combat.Armour");
|
||||
Util.setReason("Use epic armor initialization values.");
|
||||
replace = "$_ = true;";
|
||||
Util.instrumentDeclared(thisClass, ctArmour, "initialize", "isChallengeOrEpicServer", replace);
|
||||
|
||||
Util.setReason("Reduce power of imbues.");
|
||||
replace = "$_ = Math.max(-80d, -80d+$2);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "smear", "max", replace);
|
||||
@@ -513,18 +558,6 @@ public class MiscChanges {
|
||||
replace = "$_ = $_ / 10;";
|
||||
Util.insertAfterDeclared(thisClass, ctMailSendConfirmQuestion, "getCostForItem", replace);
|
||||
|
||||
Util.setReason("Remove spam from creature enchantments on zombies.");
|
||||
CtClass ctCreatureEnchantment = classPool.get("com.wurmonline.server.spells.CreatureEnchantment");
|
||||
replace = "$_ = false;";
|
||||
Util.instrumentDeclared(thisClass, ctCreatureEnchantment, "precondition", "isReborn", replace);
|
||||
|
||||
Util.setReason("Fix epic mission naming.");
|
||||
CtClass ctEpicServerStatus = classPool.get("com.wurmonline.server.epic.EpicServerStatus");
|
||||
replace = "if($2.equals(\"\")){" +
|
||||
" $2 = com.wurmonline.server.deities.Deities.getDeityName($1);" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctEpicServerStatus, "generateNewMissionForEpicEntity", replace);
|
||||
|
||||
Util.setReason("Remove guard tower guards helping against certain types of enemies.");
|
||||
CtClass ctGuardTower = classPool.get("com.wurmonline.server.kingdom.GuardTower");
|
||||
replace = "if($0.isUnique() || "+Titans.class.getName()+".isTitan($0) || "+RareSpawns.class.getName()+".isRareCreature($0)){" +
|
||||
@@ -534,13 +567,6 @@ public class MiscChanges {
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctGuardTower, "alertGuards", "isWithinTileDistanceTo", replace);
|
||||
|
||||
Util.setReason("Ensure unique creatures cannot be hitched to vehicles.");
|
||||
CtClass ctVehicle = classPool.get("com.wurmonline.server.behaviours.Vehicle");
|
||||
replace = "if($1.isUnique()){" +
|
||||
" return false;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctVehicle, "addDragger", replace);
|
||||
|
||||
// Enable Strongwall for Libila and other spells on PvE
|
||||
CtClass ctSpellGenerator = classPool.get("com.wurmonline.server.spells.SpellGenerator");
|
||||
ctSpellGenerator.getDeclaredMethod("createSpells").instrument(new ExprEditor() {
|
||||
@@ -586,8 +612,142 @@ public class MiscChanges {
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctItem, "mayCommand", replace);
|
||||
|
||||
Util.setReason("Modify timed affinity timer.");
|
||||
CtClass ctAffinitiesTimed = classPool.get("com.wurmonline.server.skills.AffinitiesTimed");
|
||||
replace = "$_ = "+MiscChanges.class.getName()+".getFoodOpulenceBonus($0);";
|
||||
Util.instrumentDeclared(thisClass, ctAffinitiesTimed, "addTimedAffinityFromBonus", "getFoodComplexity", replace);
|
||||
|
||||
Util.setReason("Food affinity timer normalization.");
|
||||
replace = "long time = "+WurmCalendar.class.getName()+".getCurrentTime();" +
|
||||
"if($0.getExpires($1) == null){" +
|
||||
" $_ = Long.valueOf(time);" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctAffinitiesTimed, "add", "getExpires", replace);
|
||||
|
||||
Util.setReason("Make bed QL affect sleep bonus timer.");
|
||||
CtClass ctPlayerInfo = classPool.get("com.wurmonline.server.players.PlayerInfo");
|
||||
replace = "secs = "+MiscChanges.class.getName()+".getBedBonus(secs, this.bed);" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctPlayerInfo, "calculateSleep", "setSleep", replace);
|
||||
|
||||
Util.setReason("Fix intrateleport block bug.");
|
||||
replace = "if($6.contains(\"blocked\")){" +
|
||||
" logger.info(\"Detected a blocked movement, resetting position back to old.\");" +
|
||||
" $1 = $0.getMovementScheme().xOld;" +
|
||||
" $2 = $0.getMovementScheme().yOld;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreature, "intraTeleport", replace);
|
||||
|
||||
Util.setReason("Allow royal smith to improve smithing items faster.");
|
||||
replace = "if("+MiscChanges.class.getName()+".royalSmithImprove($1, improve)){" +
|
||||
" $_ = $proceed($$) * 0.9f;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "getImproveActionTime", replace);
|
||||
Util.setReason("Allow royal smith to improve smithing items faster.");
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "polishItem", "getImproveActionTime", replace);
|
||||
Util.setReason("Allow royal smith to improve smithing items faster. Also make tempering use water enchants.");
|
||||
replace = "if("+MiscChanges.class.getName()+".royalSmithImprove($1, improve)){" +
|
||||
" $_ = $proceed($1, target) * 0.9f;" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($1, target);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "temper", "getImproveActionTime", replace);
|
||||
|
||||
// Fix for body strength not working properly when mounted. (Bdew)
|
||||
ctCreature.getMethod("getTraitMovePercent", "(Z)F").instrument(new ExprEditor() {
|
||||
private boolean first = true;
|
||||
|
||||
@Override
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("getStrengthSkill")) {
|
||||
if (first)
|
||||
m.replace("wmod = wmod * 3D; $_ = $proceed() * (this.isUnicorn()?3D:2D);");
|
||||
else
|
||||
m.replace("$_ = $proceed() * (this.isUnicorn()?3D:2D);");
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Util.setReason("Modify food fill percent.");
|
||||
CtClass[] params12 = {
|
||||
ctAction,
|
||||
ctCreature,
|
||||
ctItem,
|
||||
CtClass.floatType
|
||||
};
|
||||
String desc12 = Descriptor.ofMethod(CtClass.booleanType, params12);
|
||||
replace = "$_ = $proceed($1, $2, $3, $4, "+MiscChanges.class.getName()+".getNewFoodFill(qlevel));";
|
||||
Util.instrumentDescribed(thisClass, ctMethodsItems, "eat", desc12, "modifyHunger", replace);
|
||||
|
||||
// Fix for butchering not giving skill gain when butchering too many items
|
||||
ctMethodsItems.getDeclaredMethod("filet").instrument(new ExprEditor() {
|
||||
private boolean first = true;
|
||||
|
||||
@Override
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("skillCheck")) {
|
||||
if (first) {
|
||||
first = false;
|
||||
}else {
|
||||
m.replace("$_ = $proceed($1, $2, $3, false, $5);");
|
||||
logger.info("Replaced filet skill check to ensure butchering skill is always gained.");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// How to add a skill!
|
||||
/*CtClass ctSkillSystem = classPool.get("com.wurmonline.server.skills.SkillSystem");
|
||||
CtConstructor ctSkillSystemConstructor = ctSkillSystem.getClassInitializer();
|
||||
logathing("Test first");
|
||||
ctSkillSystemConstructor.insertAfter("com.wurmonline.server.skills.SkillSystem.addSkillTemplate(new "+SkillTemplate.class.getName()+"(10096,
|
||||
\"Battle Yoyos\", 4000.0f, new int[]{1022}, 1209600000l, (short) 4, true, true));");*/
|
||||
|
||||
Util.setReason("Hook for rare material usage in improvement.");
|
||||
replace = "if("+MiscChanges.class.getName()+".rollRarityImprove($0, usedWeight)){" +
|
||||
" rarity = source.getRarity();" +
|
||||
"}" +
|
||||
"$_ = $proceed($$);";
|
||||
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "setWeight", replace);
|
||||
|
||||
Util.setReason("Bad luck protection on rarity windows.");
|
||||
replace = "if($1 == 3600){" +
|
||||
" $_ = "+MiscChanges.class.getName()+".getRarityWindowChance(this.getWurmId());" +
|
||||
"}else{" +
|
||||
" $_ = $proceed($$);" +
|
||||
"}";
|
||||
Util.instrumentDeclared(thisClass, ctPlayer, "poll", "nextInt", replace);
|
||||
|
||||
CtClass ctSimpleCreationEntry = classPool.get("com.wurmonline.server.items.SimpleCreationEntry");
|
||||
ctSimpleCreationEntry.getDeclaredMethod("run").instrument(new ExprEditor() {
|
||||
private boolean first = true;
|
||||
|
||||
@Override
|
||||
public void edit(MethodCall m) throws CannotCompileException {
|
||||
if (m.getMethodName().equals("getRarity")) {
|
||||
if (first) {
|
||||
m.replace("byte newRarity = "+MiscChanges.class.getName()+".getNewCreationRarity(this, source, target, template);" +
|
||||
"if(newRarity > 0){" +
|
||||
" act.setRarity(newRarity);" +
|
||||
"}" +
|
||||
"$_ = $proceed($$);");
|
||||
logger.info("Replaced getRarity in SimpleCreationEntry to allow functional rare creations.");
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
}
|
||||
public static void logMessage(String message){
|
||||
logger.info(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package mod.sin.wyvern;
|
||||
|
||||
import com.wurmonline.server.Server;
|
||||
import com.wurmonline.server.creatures.CreatureTemplate;
|
||||
import com.wurmonline.server.deities.Deities;
|
||||
import com.wurmonline.server.epic.EpicMission;
|
||||
import com.wurmonline.server.epic.EpicServerStatus;
|
||||
import com.wurmonline.server.players.PlayerInfo;
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
@@ -81,18 +81,73 @@ public class MissionCreator {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isMissionOkaySlayable(CreatureTemplate template){
|
||||
if(template.isSubmerged()){
|
||||
return false;
|
||||
}
|
||||
if(template.isUnique()){
|
||||
return false;
|
||||
}
|
||||
if(RareSpawns.isRareCreature(template.getTemplateId())){
|
||||
return false;
|
||||
}
|
||||
if(Titans.isTitan(template.getTemplateId()) || Titans.isTitanMinion(template.getTemplateId())){
|
||||
return false;
|
||||
}
|
||||
return template.isEpicMissionSlayable();
|
||||
}
|
||||
public static boolean isMissionOkayHerbivore(CreatureTemplate template){
|
||||
if(template.isSubmerged()){
|
||||
return false;
|
||||
}
|
||||
if(template.isUnique()){
|
||||
return false;
|
||||
}
|
||||
if(RareSpawns.isRareCreature(template.getTemplateId())){
|
||||
return false;
|
||||
}
|
||||
if(Titans.isTitan(template.getTemplateId()) || Titans.isTitanMinion(template.getTemplateId())){
|
||||
return false;
|
||||
}
|
||||
return template.isHerbivore();
|
||||
}
|
||||
|
||||
public static void preInit(){
|
||||
try{
|
||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||
final Class<MissionCreator> thisClass = MissionCreator.class;
|
||||
String replace;
|
||||
|
||||
CtClass ctTriggerEffect = classPool.get("com.wurmonline.server.tutorial.TriggerEffect");
|
||||
Util.setReason("Give players currency for completing a mission.");
|
||||
CtClass ctTriggerEffect = classPool.get("com.wurmonline.server.tutorial.TriggerEffect");
|
||||
replace = "$_ = $proceed($$);" +
|
||||
MissionCreator.class.getName()+".awardMissionBonus($0);";
|
||||
Util.instrumentDeclared(thisClass, ctTriggerEffect, "effect", "addToSleep", replace);
|
||||
|
||||
Util.setReason("Prevent mission creatures from spawning in water.");
|
||||
CtClass ctEpicServerStatus = classPool.get("com.wurmonline.server.epic.EpicServerStatus");
|
||||
replace = "$_ = false;";
|
||||
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "spawnSingleCreature", "isSwimming", replace);
|
||||
|
||||
Util.setReason("Modify which templates are allowed to spawn on herbivore-only epic missions.");
|
||||
replace = "$_ = "+MissionCreator.class.getName()+".isMissionOkayHerbivore($0);";
|
||||
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayCreatureMission", "isHerbivore", replace);
|
||||
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayTraitorMission", "isHerbivore", replace);
|
||||
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSacrificeCreatureMission", "isHerbivore", replace);
|
||||
|
||||
Util.setReason("Modify which templates are allowed to spawn on slay missions.");
|
||||
replace = "$_ = "+MissionCreator.class.getName()+".isMissionOkaySlayable($0);";
|
||||
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSlayCreatureMission", "isEpicMissionSlayable", replace);
|
||||
Util.instrumentDeclared(thisClass, ctEpicServerStatus, "createSacrificeCreatureMission", "isEpicMissionSlayable", replace);
|
||||
|
||||
Util.setReason("Adjust which epic missions are available..");
|
||||
CtClass ctEpicMissionEnum = classPool.get("com.wurmonline.server.epic.EpicMissionEnum");
|
||||
replace = "{ if($0.getMissionType() == 108 || $0.getMissionType() == 120 || $0.getMissionType() == 124){" +
|
||||
" return 0;" +
|
||||
"}" +
|
||||
"return $0.missionChance; }";
|
||||
Util.setBodyDeclared(thisClass, ctEpicMissionEnum, "getMissionChance", replace);
|
||||
|
||||
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.wurmonline.server.items.ItemList;
|
||||
import com.wurmonline.server.items.NoSpaceException;
|
||||
import com.wurmonline.shared.constants.BodyPartConstants;
|
||||
import com.wurmonline.shared.constants.Enchants;
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
@@ -26,26 +25,25 @@ public class MountedChanges {
|
||||
ArrayList<Item> gear = new ArrayList<>();
|
||||
try {
|
||||
Item leftFoot = creature.getEquippedItem(BodyPartConstants.LEFT_FOOT);
|
||||
leftFoot.setDamage(leftFoot.getDamage()+(leftFoot.getDamageModifier()*0.002f));
|
||||
gear.add(leftFoot);
|
||||
} catch (NoSuchItemException | NoSpaceException ignored) {
|
||||
}
|
||||
try {
|
||||
Item rightFoot = creature.getEquippedItem(BodyPartConstants.RIGHT_FOOT);
|
||||
rightFoot.setDamage(rightFoot.getDamage()+(rightFoot.getDamageModifier()*0.002f));
|
||||
gear.add(rightFoot);
|
||||
} catch (NoSuchItemException | NoSpaceException ignored) {
|
||||
}
|
||||
try {
|
||||
Item leftHand = creature.getEquippedItem(BodyPartConstants.LEFT_HAND);
|
||||
leftHand.setDamage(leftHand.getDamage()+(leftHand.getDamageModifier()*0.002f));
|
||||
gear.add(leftHand);
|
||||
} catch (NoSuchItemException | NoSpaceException ignored) {
|
||||
}
|
||||
try {
|
||||
Item rightHand = creature.getEquippedItem(BodyPartConstants.RIGHT_HAND);
|
||||
gear.add(rightHand);
|
||||
} catch (NoSuchItemException | NoSpaceException ignored) {
|
||||
}
|
||||
try {
|
||||
Item rightHand = creature.getEquippedItem(BodyPartConstants.RIGHT_HAND);
|
||||
rightHand.setDamage(rightHand.getDamage()+(rightHand.getDamageModifier()*0.002f));
|
||||
gear.add(rightHand);
|
||||
} catch (NoSuchItemException | NoSpaceException ignored) {
|
||||
}
|
||||
@@ -76,12 +74,12 @@ public class MountedChanges {
|
||||
if(barding.getTemplateId() == ItemList.clothBarding){
|
||||
factor *= 0.9f;
|
||||
}else if(barding.getTemplateId() == ItemList.leatherBarding){
|
||||
factor *= 0.75f;
|
||||
factor *= 0.82f;
|
||||
}else if(barding.getTemplateId() == ItemList.chainBarding){
|
||||
factor *= 0.6f;
|
||||
factor *= 0.75f;
|
||||
}
|
||||
}
|
||||
} catch (NoArmourException | NoSpaceException e) {
|
||||
} catch (NoArmourException | NoSpaceException ignored) {
|
||||
}
|
||||
}
|
||||
if (creature.getBonusForSpellEffect(Enchants.CRET_OAKSHELL) > 0.0f) {
|
||||
@@ -92,6 +90,7 @@ public class MountedChanges {
|
||||
float saddleFactor = 1.0f;
|
||||
Item saddle = creature.getEquippedItem(BodyPartConstants.TORSO);
|
||||
if(saddle != null) {
|
||||
saddle.setDamage(saddle.getDamage()+(saddle.getDamageModifier()*0.001f));
|
||||
saddleFactor += Math.max(10f, saddle.getCurrentQualityLevel()) / 2000f;
|
||||
saddleFactor += saddle.getSpellSpeedBonus() / 2000f;
|
||||
saddleFactor += saddle.getRarity() * 0.03f;
|
||||
@@ -99,6 +98,7 @@ public class MountedChanges {
|
||||
}
|
||||
} catch (NoSuchItemException | NoSpaceException ignored) {
|
||||
}
|
||||
factor *= creature.getMovementScheme().getSpeedModifier();
|
||||
}
|
||||
return factor;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,11 @@ import com.wurmonline.server.players.Titles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class PlayerTitles {
|
||||
public static Logger logger = Logger.getLogger(PlayerTitles.class.getName());
|
||||
|
||||
protected static ArrayList<String> donatorTitles = new ArrayList<>();
|
||||
protected static HashMap<String,Integer> customTitles = new HashMap<>();
|
||||
protected static HashMap<String,String> playerTitles = new HashMap<>();
|
||||
@@ -45,14 +48,27 @@ public class PlayerTitles {
|
||||
|
||||
donatorTitles.add("Pazza");
|
||||
customTitles.put("Pazza", 801); // Sindusks Favorite GM
|
||||
|
||||
donatorTitles.add("Warriorgen");
|
||||
customTitles.put("Warriorgen", 802);
|
||||
customTitles.put("Warriorgen", 802); // That Guy
|
||||
|
||||
donatorTitles.add("Eternallove");
|
||||
customTitles.put("Eternallove", 803);
|
||||
customTitles.put("Eternallove", 803); // Warriorgens Wife
|
||||
|
||||
donatorTitles.add("Bambam");
|
||||
customTitles.put("Bambam", 804);
|
||||
customTitles.put("Bambam", 804); // Thorn One
|
||||
|
||||
donatorTitles.add("Svenja");
|
||||
customTitles.put("Svenja", 805);
|
||||
customTitles.put("Svenja", 805); // The care-dependent
|
||||
playerTitles.put("Svenja", "Akuma");
|
||||
|
||||
donatorTitles.add("Alexiaselena");
|
||||
customTitles.put("Alexiaselena", 806); // The Treasuring
|
||||
playerTitles.put("Alexiaselena", "Kami");
|
||||
|
||||
donatorTitles.add("Reevi");
|
||||
customTitles.put("Reevi", 807); // Science Guy
|
||||
|
||||
customTitles.put("Genocide", 808); // Grand Designer
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,22 @@ 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);
|
||||
|
||||
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.logging.Logger;
|
||||
|
||||
public class RareSpawns {
|
||||
public static Logger logger = Logger.getLogger(RareSpawns.class.getName());
|
||||
public static boolean isRareCreature(Creature creature){
|
||||
int templateId = creature.getTemplate().getTemplateId();
|
||||
|
||||
public static boolean isRareCreature(int templateId){
|
||||
if(templateId == SpectralDrake.templateId){
|
||||
return true;
|
||||
}else if(templateId == Reaper.templateId){
|
||||
@@ -31,6 +31,9 @@ public class RareSpawns {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isRareCreature(Creature creature){
|
||||
return isRareCreature(creature.getTemplate().getTemplateId());
|
||||
}
|
||||
|
||||
public static void spawnRandomLocationCreature(int templateId){
|
||||
boolean found = false;
|
||||
@@ -61,7 +64,7 @@ public class RareSpawns {
|
||||
}
|
||||
try {
|
||||
logger.info("Spawning new rare creature at "+(spawnX*0.25f)+", "+(spawnY*0.25f));
|
||||
Creature.doNew(templateId, spawnX, spawnY, 360f*Server.rand.nextFloat(), 0, "", (byte)0);
|
||||
Creature.doNew(templateId, spawnX, spawnY, 360f*Server.rand.nextFloat(), 0, "", Server.rand.nextBoolean() ? (byte) 0 : (byte) 1);
|
||||
} catch (Exception e) {
|
||||
logger.severe("Failed to create Rare Spawn.");
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -19,14 +19,14 @@ import mod.sin.items.EternalReservoir;
|
||||
|
||||
public class Soulstealing {
|
||||
public static final Logger logger = Logger.getLogger(Soulstealing.class.getName());
|
||||
public static ArrayList<Item> soulForges = new ArrayList<Item>();
|
||||
public static ArrayList<Item> soulForges = new ArrayList<>();
|
||||
public static void pollSoulForge(Item soulForge){
|
||||
int tilex = soulForge.getTileX();
|
||||
int tiley = soulForge.getTileY();
|
||||
int range = (int) (soulForge.getCurrentQualityLevel()/10f);
|
||||
int fuel = soulForge.getData1();
|
||||
logger.info("Polling eternal reservoir at ("+tilex+", "+tiley+") [range "+range+"] <fuel "+fuel+">");
|
||||
if(fuel > 15){
|
||||
if(fuel >= 1){
|
||||
int sx = Zones.safeTileX(tilex - range);
|
||||
int sy = Zones.safeTileY(tiley - range);
|
||||
int ex = Zones.safeTileX(tilex + range);
|
||||
|
||||
@@ -116,12 +116,6 @@ public class SupplyDepots {
|
||||
return item.getTemplateId() == ArenaSupplyDepot.templateId;
|
||||
}
|
||||
public static void pollDepotSpawn(){
|
||||
if(!Servers.localServer.PVPSERVER && !WyvernMods.enableDepots){
|
||||
return;
|
||||
}
|
||||
if(!initalizedSupplyDepot){
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < depots.size(); i++){
|
||||
Item depot = depots.get(i);
|
||||
if(!Items.exists(depot)){
|
||||
@@ -137,6 +131,12 @@ public class SupplyDepots {
|
||||
sendDepotEffectsToPlayers(item);
|
||||
}
|
||||
}
|
||||
if(!Servers.localServer.PVPSERVER && !WyvernMods.enableDepots){
|
||||
return;
|
||||
}
|
||||
if(!initalizedSupplyDepot){
|
||||
return;
|
||||
}
|
||||
if(depots.isEmpty()){
|
||||
if(host == null){
|
||||
ArrayList<Creature> uniques = new ArrayList<>();
|
||||
@@ -227,9 +227,6 @@ public class SupplyDepots {
|
||||
inv.insertItem(enchantOrb);
|
||||
}
|
||||
try {
|
||||
// Sorcery fragment.
|
||||
Item sorceryFragment = ItemFactory.createItem(SorceryFragment.templateId, 90f, "Depot");
|
||||
inv.insertItem(sorceryFragment, true);
|
||||
// Add a special caches as a reward.
|
||||
int[] cacheIds = {
|
||||
ArmourCache.templateId,
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.wurmonline.server.players.PlayerInfo;
|
||||
import com.wurmonline.server.players.PlayerInfoFactory;
|
||||
import com.wurmonline.server.villages.Village;
|
||||
import com.wurmonline.server.villages.Villages;
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
|
||||
@@ -130,8 +130,7 @@ public class Titans {
|
||||
return isTitan(creature.getTemplate().getTemplateId());
|
||||
}
|
||||
|
||||
public static boolean isTitanMinion(Creature creature){
|
||||
int templateId = creature.getTemplate().getTemplateId();
|
||||
public static boolean isTitanMinion(int templateId){
|
||||
if(templateId == LilithWraith.templateId){
|
||||
return true;
|
||||
}else if(templateId == LilithZombie.templateId){
|
||||
@@ -144,6 +143,10 @@ public class Titans {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isTitanMinion(Creature creature){
|
||||
return isTitanMinion(creature.getTemplate().getTemplateId());
|
||||
}
|
||||
|
||||
// --- Advanced Abilities --- //
|
||||
public static void lilithMyceliumVoidAttack(Creature titan, Creature lCret, int tilex, int tiley){
|
||||
if (lCret.isUnique() || lCret.isInvulnerable() || lCret == titan || isTitanMinion(lCret)){
|
||||
|
||||
@@ -15,10 +15,11 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
|
||||
import com.wurmonline.server.Servers;
|
||||
import com.wurmonline.server.items.CreationEntry;
|
||||
import com.wurmonline.server.items.CreationMatrix;
|
||||
import com.wurmonline.server.items.ItemList;
|
||||
import com.wurmonline.server.Items;
|
||||
import com.wurmonline.server.creatures.Communicator;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.items.*;
|
||||
import mod.sin.lib.Util;
|
||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
@@ -29,9 +30,6 @@ import org.gotti.wurmunlimited.modsupport.creatures.ModCreatures;
|
||||
import org.gotti.wurmunlimited.modsupport.vehicles.ModVehicleBehaviours;
|
||||
|
||||
import com.wurmonline.server.TimeConstants;
|
||||
import com.wurmonline.server.deities.Deities;
|
||||
import com.wurmonline.server.deities.Deity;
|
||||
import com.wurmonline.server.items.NoSuchTemplateException;
|
||||
import com.wurmonline.server.players.Player;
|
||||
import com.wurmonline.server.skills.SkillList;
|
||||
import com.wurmonline.server.skills.SkillSystem;
|
||||
@@ -112,6 +110,23 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
}
|
||||
}
|
||||
|
||||
/*public static void handleExamine(Creature performer, Item target) {
|
||||
// Im just not a smart man.
|
||||
if(target.isContainerLiquid()){
|
||||
boolean found = false;
|
||||
for(Item i : Items.getAllItems()){
|
||||
if(i == target){
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if(found){
|
||||
logger.info("Item exists!");
|
||||
}else{
|
||||
logger.info("Item not found.");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void preInit() {
|
||||
logger.info("Pre-Initializing.");
|
||||
try {
|
||||
@@ -131,13 +146,20 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
MountedChanges.preInit();
|
||||
EconomicChanges.preInit();
|
||||
QualityOfLife.preInit();
|
||||
Bloodlust.preInit();
|
||||
AntiCheat.preInit();
|
||||
Mastercraft.preInit();
|
||||
Mastercraft.addNewTitles();
|
||||
SupplyDepots.preInit();
|
||||
|
||||
|
||||
Class<WyvernMods> thisClass = WyvernMods.class;
|
||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||
|
||||
/*Util.setReason("Insert examine method.");
|
||||
CtClass ctItemBehaviour = classPool.get("com.wurmonline.server.behaviours.ItemBehaviour");
|
||||
String replace = WyvernMods.class.getName() + ".handleExamine($2, $3);";
|
||||
Util.insertAfterDeclared(thisClass, ctItemBehaviour, "examine", replace);*/
|
||||
|
||||
// - Enable custom command handler - //
|
||||
CtClass ctCommunicator = classPool.get("com.wurmonline.server.creatures.Communicator");
|
||||
ctCommunicator.getDeclaredMethod("reallyHandle").instrument(new ExprEditor(){
|
||||
@@ -315,13 +337,15 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
ModActions.registerAction(new UnequipAllAction());
|
||||
ModActions.registerAction(new ReceiveMailAction());
|
||||
ModActions.registerAction(new LeaderboardAction());
|
||||
ModActions.registerAction(new AddSubGroupAction());
|
||||
logger.info("Registering Arena actions.");
|
||||
ModActions.registerAction(new SorceryCombineAction());
|
||||
//ModActions.registerAction(new VillageTeleportAction()); // [3/28/18] Disabled - Highway Portals added instead.
|
||||
ModActions.registerAction(new ArenaTeleportAction());
|
||||
ModActions.registerAction(new ArenaEscapeAction());
|
||||
logger.info("Registering Dev actions.");
|
||||
ModActions.registerAction(new MissionAction());
|
||||
ModActions.registerAction(new MissionAddAction());
|
||||
ModActions.registerAction(new MissionRemoveAction());
|
||||
logger.info("Setting custom creature corpse models.");
|
||||
MethodsBestiary.setTemplateVariables();
|
||||
/*if(Deities.getDeity(101) != null){ // Edit Breyk player god
|
||||
@@ -349,7 +373,43 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
|
||||
//espCounter = Servers.localServer.PVPSERVER; // Enables on PvP server by default.
|
||||
//espCounter = false;
|
||||
|
||||
|
||||
SkillTemplate exorcism = SkillSystem.templates.get(SkillList.EXORCISM);
|
||||
int[] deps = {SkillList.GROUP_ALCHEMY};
|
||||
try {
|
||||
String newName = "Crystal handling";
|
||||
ReflectionUtil.setPrivateField(exorcism, ReflectionUtil.getField(exorcism.getClass(), "name"), newName);
|
||||
SkillSystem.skillNames.put(exorcism.getNumber(), newName);
|
||||
SkillSystem.namesToSkill.put(newName, exorcism.getNumber());
|
||||
ReflectionUtil.setPrivateField(exorcism, ReflectionUtil.getField(exorcism.getClass(), "dependencies"), deps);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
logger.info("Failed to rename exorcism!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
SkillTemplate ballistae = SkillSystem.templates.get(SkillList.BALLISTA);
|
||||
int[] deps2 = {SkillList.GROUP_ALCHEMY};
|
||||
try {
|
||||
String newName = "Mystic components";
|
||||
ReflectionUtil.setPrivateField(ballistae, ReflectionUtil.getField(ballistae.getClass(), "name"), newName);
|
||||
SkillSystem.skillNames.put(ballistae.getNumber(), newName);
|
||||
SkillSystem.namesToSkill.put(newName, ballistae.getNumber());
|
||||
ReflectionUtil.setPrivateField(ballistae, ReflectionUtil.getField(ballistae.getClass(), "dependencies"), deps2);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
logger.info("Failed to rename ballistae!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
SkillTemplate preaching = SkillSystem.templates.get(SkillList.PREACHING);
|
||||
int[] deps3 = {SkillList.MASONRY};
|
||||
try {
|
||||
String newName = "Gem augmentation";
|
||||
ReflectionUtil.setPrivateField(preaching, ReflectionUtil.getField(preaching.getClass(), "name"), newName);
|
||||
SkillSystem.skillNames.put(preaching.getNumber(), newName);
|
||||
SkillSystem.namesToSkill.put(newName, preaching.getNumber());
|
||||
ReflectionUtil.setPrivateField(preaching, ReflectionUtil.getField(preaching.getClass(), "dependencies"), deps3);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
logger.info("Failed to rename preaching!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
SkillTemplate stealing = SkillSystem.templates.get(SkillList.STEALING);
|
||||
try {
|
||||
ReflectionUtil.setPrivateField(stealing, ReflectionUtil.getField(stealing.getClass(), "tickTime"), 0);
|
||||
@@ -387,26 +447,46 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
try {
|
||||
Connection con = ModSupportDb.getModSupportDb();
|
||||
String sql;
|
||||
if (!ModSupportDb.hasTable(con, "LeaderboardOpt")) {
|
||||
sql = "CREATE TABLE LeaderboardOpt (\t\tname\t\t\t\tVARCHAR(30)\t\t\tNOT NULL DEFAULT 'Unknown',\t\tOPTIN\t\t\t\t\tINT\t\tNOT NULL DEFAULT 0)";
|
||||
String tableName = "LeaderboardOpt";
|
||||
if (!ModSupportDb.hasTable(con, tableName)) {
|
||||
logger.info(tableName+" table not found in ModSupport. Creating table now.");
|
||||
sql = "CREATE TABLE "+tableName+" (\t\tname\t\t\t\tVARCHAR(30)\t\t\tNOT NULL DEFAULT 'Unknown',\t\tOPTIN\t\t\t\t\tINT\t\tNOT NULL DEFAULT 0)";
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ps.execute();
|
||||
ps.close();
|
||||
}
|
||||
if (!ModSupportDb.hasTable(con, "SteamIdMap")) {
|
||||
sql = "CREATE TABLE SteamIdMap (\t\tNAME\t\t\t\tVARCHAR(30)\t\t\tNOT NULL DEFAULT 'Unknown',\t\tSTEAMID\t\t\t\t\tLONG\t\tNOT NULL DEFAULT 0)";
|
||||
tableName = "SteamIdMap";
|
||||
if (!ModSupportDb.hasTable(con, tableName)) {
|
||||
logger.info(tableName+" table not found in ModSupport. Creating table now.");
|
||||
sql = "CREATE TABLE "+tableName+" (\t\tNAME\t\t\t\tVARCHAR(30)\t\t\tNOT NULL DEFAULT 'Unknown',\t\tSTEAMID\t\t\t\t\tLONG\t\tNOT NULL DEFAULT 0)";
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ps.execute();
|
||||
ps.close();
|
||||
}
|
||||
if (!ModSupportDb.hasTable(con, "PlayerStats")) {
|
||||
sql = "CREATE TABLE PlayerStats (NAME VARCHAR(30) NOT NULL DEFAULT 'Unknown', KILLS INT NOT NULL DEFAULT 0, DEATHS INT NOT NULL DEFAULT 0, DEPOTS INT NOT NULL DEFAULT 0, HOTAS INT NOT NULL DEFAULT 0, TITANS INT NOT NULL DEFAULT 0)";
|
||||
tableName = "PlayerStats";
|
||||
if (!ModSupportDb.hasTable(con, tableName)) {
|
||||
logger.info(tableName+" table not found in ModSupport. Creating table now.");
|
||||
sql = "CREATE TABLE "+tableName+" (NAME VARCHAR(30) NOT NULL DEFAULT 'Unknown', KILLS INT NOT NULL DEFAULT 0, DEATHS INT NOT NULL DEFAULT 0, DEPOTS INT NOT NULL DEFAULT 0, HOTAS INT NOT NULL DEFAULT 0, TITANS INT NOT NULL DEFAULT 0, UNIQUES INT NOT NULL DEFAULT 0)";
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ps.execute();
|
||||
ps.close();
|
||||
}else{
|
||||
logger.info("Found "+tableName+". Checking if it has a unique column.");
|
||||
ResultSet rs = con.getMetaData().getColumns(null, null, tableName, "UNIQUES");
|
||||
if(rs.next()){
|
||||
logger.info(tableName+" already has a uniques column.");
|
||||
}else{
|
||||
logger.info("Detected no uniques column in "+tableName);
|
||||
sql = "ALTER TABLE "+tableName+" ADD COLUMN UNIQUES INT NOT NULL DEFAULT 0";
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ps.execute();
|
||||
ps.close();
|
||||
}
|
||||
}
|
||||
if (!ModSupportDb.hasTable(con, "ObjectiveTimers")) {
|
||||
sql = "CREATE TABLE ObjectiveTimers (\t\tID\t\t\t\tVARCHAR(30)\t\t\tNOT NULL DEFAULT 'Unknown',\t\tTIMER\t\t\t\t\tLONG\t\tNOT NULL DEFAULT 0)";
|
||||
tableName = "ObjectiveTimers";
|
||||
if (!ModSupportDb.hasTable(con, tableName)) {
|
||||
logger.info(tableName+" table not found in ModSupport. Creating table now.");
|
||||
sql = "CREATE TABLE "+tableName+" (ID VARCHAR(30) NOT NULL DEFAULT 'Unknown', TIMER LONG NOT NULL DEFAULT 0)";
|
||||
PreparedStatement ps = con.prepareStatement(sql);
|
||||
ps.execute();
|
||||
ps.close();
|
||||
@@ -430,10 +510,9 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}else{
|
||||
SupplyDepots.initializeDepotTimer();
|
||||
Titans.initializeTitanTimer();
|
||||
}
|
||||
}
|
||||
SupplyDepots.initializeDepotTimer();
|
||||
Titans.initializeTitanTimer();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -453,6 +532,12 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
public static final long pollEternalReservoirTime = TimeConstants.MINUTE_MILLIS*10;
|
||||
public static long lastPolledMissionCreator = 0;
|
||||
public static final long pollMissionCreatorTime = TimeConstants.HOUR_MILLIS*4;
|
||||
public static long lastPolledBloodlust = 0;
|
||||
public static final long pollBloodlustTime = TimeConstants.MINUTE_MILLIS;
|
||||
public static long lastPolledUniqueRegeneration = 0;
|
||||
public static final long pollUniqueRegenerationTime = TimeConstants.SECOND_MILLIS;
|
||||
public static long lastPolledUniqueCollection = 0;
|
||||
public static final long pollUniqueCollectionTime = TimeConstants.MINUTE_MILLIS*5;
|
||||
@Override
|
||||
public void onServerPoll() {
|
||||
if((lastSecondPolled + TimeConstants.SECOND_MILLIS) < System.currentTimeMillis()){
|
||||
@@ -480,6 +565,18 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
MissionCreator.pollMissions();
|
||||
lastPolledMissionCreator += pollMissionCreatorTime;
|
||||
}
|
||||
if(lastPolledBloodlust + pollBloodlustTime < System.currentTimeMillis()){
|
||||
Bloodlust.pollLusts();
|
||||
lastPolledBloodlust += pollBloodlustTime;
|
||||
}
|
||||
if(lastPolledUniqueRegeneration + pollUniqueRegenerationTime < System.currentTimeMillis()){
|
||||
CombatChanges.pollUniqueRegeneration();
|
||||
lastPolledUniqueRegeneration += pollUniqueRegenerationTime;
|
||||
}
|
||||
if(lastPolledUniqueCollection + pollUniqueCollectionTime < System.currentTimeMillis()){
|
||||
CombatChanges.pollUniqueCollection();
|
||||
lastPolledUniqueCollection += pollUniqueCollectionTime;
|
||||
}
|
||||
|
||||
// Update counter
|
||||
if(lastSecondPolled + TimeConstants.SECOND_MILLIS*10 > System.currentTimeMillis()){
|
||||
@@ -493,6 +590,9 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
lastPolledRareSpawns = System.currentTimeMillis();
|
||||
lastPolledEternalReservoirs = System.currentTimeMillis();
|
||||
lastPolledMissionCreator = System.currentTimeMillis();
|
||||
lastPolledBloodlust = System.currentTimeMillis();
|
||||
lastPolledUniqueRegeneration = System.currentTimeMillis();
|
||||
lastPolledUniqueCollection = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,15 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.wurmonline.mesh.Tiles;
|
||||
import com.wurmonline.server.combat.Weapon;
|
||||
import com.wurmonline.server.creatures.*;
|
||||
import com.wurmonline.server.items.*;
|
||||
import com.wurmonline.server.skills.NoSuchSkillException;
|
||||
import com.wurmonline.server.zones.NoSuchZoneException;
|
||||
import com.wurmonline.server.zones.Zone;
|
||||
import com.wurmonline.server.zones.Zones;
|
||||
import com.wurmonline.shared.constants.BodyPartConstants;
|
||||
import com.wurmonline.shared.constants.CreatureTypes;
|
||||
import javassist.*;
|
||||
import javassist.bytecode.Descriptor;
|
||||
import javassist.expr.ExprEditor;
|
||||
@@ -34,7 +37,6 @@ import mod.sin.creatures.titans.*;
|
||||
import mod.sin.weapons.Club;
|
||||
import mod.sin.weapons.titan.*;
|
||||
import mod.sin.wyvern.MiscChanges;
|
||||
import mod.sin.wyvern.Arena;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
|
||||
@@ -110,51 +112,91 @@ public class MethodsBestiary {
|
||||
}
|
||||
return (byte)127;
|
||||
}
|
||||
|
||||
protected static boolean isUsuallyHitched(int templateId){
|
||||
if(templateId == Charger.templateId){
|
||||
return true;
|
||||
}else if(templateId == CreatureTemplateIds.HORSE_CID || templateId == CreatureTemplateIds.HELL_HORSE_CID){
|
||||
return true;
|
||||
}else if(templateId == WyvernBlue.templateId){
|
||||
return true;
|
||||
}else if(templateId == WyvernBlack.templateId){
|
||||
return true;
|
||||
}else if(templateId == WyvernGreen.templateId){
|
||||
return true;
|
||||
}else if(templateId == WyvernRed.templateId){
|
||||
return true;
|
||||
}else if(templateId == WyvernWhite.templateId){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float getAdjustedSizeMod(CreatureStatus status){
|
||||
try {
|
||||
float floatToRet = 1.0f;
|
||||
Creature statusHolder = ReflectionUtil.getPrivateField(status, ReflectionUtil.getField(status.getClass(), "statusHolder"));
|
||||
float aiDataModifier = 1.0f;
|
||||
if(statusHolder.getCreatureAIData() != null){
|
||||
aiDataModifier = statusHolder.getCreatureAIData().getSizeModifier();
|
||||
}
|
||||
byte modtype = ReflectionUtil.getPrivateField(status, ReflectionUtil.getField(status.getClass(), "modtype"));
|
||||
float ageSizeModifier = ReflectionUtil.callPrivateMethod(status, ReflectionUtil.getMethod(status.getClass(), "getAgeSizeModifier"));
|
||||
if ((!statusHolder.isVehicle() || statusHolder.isDragon()) && modtype > 0) {
|
||||
float floatToRet = 1.0f;
|
||||
if (/*(!statusHolder.isVehicle() || statusHolder.isDragon()) &&*/ modtype != 0) {
|
||||
float change = 0.0f;
|
||||
switch (modtype) {
|
||||
case 3: {
|
||||
floatToRet = 1.4f;
|
||||
case CreatureTypes.C_MOD_RAGING: {
|
||||
change = 0.4f;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
floatToRet = 2.0f;
|
||||
case CreatureTypes.C_MOD_SLOW: {
|
||||
change = 0.7f;
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
floatToRet = 2.0f;
|
||||
case CreatureTypes.C_MOD_GREENISH: {
|
||||
change = 1.0f;
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
floatToRet = 0.8f;
|
||||
case CreatureTypes.C_MOD_LURKING: {
|
||||
change = -0.2f;
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
floatToRet = 0.9f;
|
||||
case CreatureTypes.C_MOD_SLY: {
|
||||
change = -0.1f;
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
floatToRet = 1.5f;
|
||||
case CreatureTypes.C_MOD_HARDENED: {
|
||||
change = 0.5f;
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
floatToRet = 1.3f;
|
||||
case CreatureTypes.C_MOD_SCARED: {
|
||||
change = 0.3f;
|
||||
break;
|
||||
}
|
||||
case 99: {
|
||||
floatToRet = 3.0f;
|
||||
case CreatureTypes.C_MOD_CHAMPION: {
|
||||
change = 2.0f;
|
||||
break;
|
||||
}
|
||||
case CreatureTypes.C_MOD_SIZESMALL: {
|
||||
change = -0.5f;
|
||||
break;
|
||||
}
|
||||
case CreatureTypes.C_MOD_SIZEMINI: {
|
||||
change = -0.75f;
|
||||
break;
|
||||
}
|
||||
case CreatureTypes.C_MOD_SIZETINY: {
|
||||
change = -0.875f;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
//return floatToRet * ageSizeModifier;
|
||||
}
|
||||
}
|
||||
if(isUsuallyHitched(statusHolder.getTemplate().getTemplateId())){
|
||||
change *= 0.2f;
|
||||
}
|
||||
floatToRet += change;
|
||||
}
|
||||
int templateId = statusHolder.getTemplate().getTemplateId();
|
||||
if(templateId == Lilith.templateId){
|
||||
@@ -189,9 +231,18 @@ public class MethodsBestiary {
|
||||
floatToRet *= 1.15f;
|
||||
}else if(templateId == Terror.templateId){
|
||||
floatToRet *= 3.0f;
|
||||
}else if(templateId == IceCat.templateId){
|
||||
floatToRet *= 1.7f;
|
||||
}
|
||||
|
||||
if (statusHolder.getHitched() == null && statusHolder.getTemplate().getTemplateId() == 82 && !statusHolder.getNameWithoutPrefixes().equalsIgnoreCase(statusHolder.getTemplate().getName())) {
|
||||
floatToRet *= 2.0f;
|
||||
}
|
||||
if (!statusHolder.isVehicle() && statusHolder.hasTrait(28)) {
|
||||
floatToRet *= 1.5f;
|
||||
}
|
||||
|
||||
return floatToRet * ageSizeModifier;
|
||||
return floatToRet * ageSizeModifier * aiDataModifier;
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
|
||||
| NoSuchMethodException | ClassCastException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
@@ -221,10 +272,8 @@ public class MethodsBestiary {
|
||||
effs.addSpellEffect(new SpellEffect(titanWeapon.getWurmId(), Enchants.BUFF_ROTTING_TOUCH, 300, 20000000));
|
||||
effs.addSpellEffect(new SpellEffect(titanWeapon.getWurmId(), Enchants.BUFF_BLOODTHIRST, 100, 20000000));
|
||||
}
|
||||
if(titanWeapon != null){
|
||||
return titanWeapon;
|
||||
}
|
||||
} catch (FailedException | NoSuchTemplateException e) {
|
||||
return titanWeapon;
|
||||
} catch (FailedException | NoSuchTemplateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
@@ -295,6 +344,25 @@ public class MethodsBestiary {
|
||||
return -1f;
|
||||
}
|
||||
|
||||
public static boolean isNotHitchable(Creature creature){
|
||||
if(creature.isUnique()){
|
||||
return true;
|
||||
}
|
||||
int templateId = creature.getTemplate().getTemplateId();
|
||||
if(templateId == Avenger.templateId){
|
||||
return true;
|
||||
}else if(templateId == Giant.templateId){
|
||||
return true;
|
||||
}else if(templateId == SpiritTroll.templateId){
|
||||
return true;
|
||||
}else if(templateId == Creatures.TROLL_CID){
|
||||
return true;
|
||||
}else if(templateId == Creatures.GOBLIN_CID){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSacrificeImmune(Creature creature){
|
||||
if(Titans.isTitan(creature) || Titans.isTitanMinion(creature)){
|
||||
return true;
|
||||
@@ -340,12 +408,32 @@ public class MethodsBestiary {
|
||||
if(defender.isPlayer() && defender.getTarget() != attacker){
|
||||
return true;
|
||||
}
|
||||
if(defender.isPlayer()){
|
||||
Item weap = defender.getPrimWeapon();
|
||||
if(weap != null && weap.isWeapon()){
|
||||
try {
|
||||
double dam = Weapon.getModifiedDamageForWeapon(weap, defender.getSkills().getSkill(SkillList.BODY_STRENGTH), true) * 1000.0;
|
||||
dam += Server.getBuffedQualityEffect(weap.getCurrentQualityLevel() / 100.0f) * (double)Weapon.getBaseDamageForWeapon(weap) * 2400.0;
|
||||
if(attacker.getArmourMod() < 0.1f){
|
||||
return false;
|
||||
}
|
||||
if(dam * attacker.getArmourMod() < 3000){
|
||||
return true;
|
||||
}
|
||||
} catch (NoSuchSkillException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
if(defender.getBonusForSpellEffect(Enchants.CRET_BEARPAW) < 50f){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
if(defender.isPlayer() && attacker.getArmour(BodyPartConstants.TORSO) != null){
|
||||
return true;
|
||||
}
|
||||
} catch (NoArmourException | NoSpaceException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoArmourException | NoSpaceException ignored) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -456,6 +544,18 @@ public class MethodsBestiary {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setUniqueTypes(int templateId){
|
||||
try{
|
||||
CreatureTemplate template = CreatureTemplateFactory.getInstance().getTemplate(templateId);
|
||||
if(template != null){
|
||||
ReflectionUtil.setPrivateField(template, ReflectionUtil.getField(template.getClass(), "isNotRebirthable"), true);
|
||||
ReflectionUtil.setPrivateField(template, ReflectionUtil.getField(template.getClass(), "regenerating"), false);
|
||||
}
|
||||
} catch (NoSuchCreatureTemplateException | IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setGhost(int templateId){
|
||||
try{
|
||||
CreatureTemplate template = CreatureTemplateFactory.getInstance().getTemplate(templateId);
|
||||
@@ -528,6 +628,7 @@ public class MethodsBestiary {
|
||||
setCorpseModel(WyvernWhite.templateId, "whitedragonhatchling.");
|
||||
setCorpseModel(WyvernBlue.templateId, "bluedragonhatchling.");
|
||||
setCorpseModel(Facebreyker.templateId, "riftogre.");
|
||||
setCorpseModel(FireCrab.templateId, "crab.");
|
||||
setCorpseModel(ForestSpider.templateId, "fogspider.");
|
||||
setCorpseModel(Giant.templateId, "forestgiant.");
|
||||
setCorpseModel(LargeBoar.templateId, "wildboar.");
|
||||
@@ -539,7 +640,23 @@ public class MethodsBestiary {
|
||||
setGhost(Avenger.templateId);
|
||||
setGhost(LilithWraith.templateId);
|
||||
setGhost(Charger.templateId);
|
||||
|
||||
|
||||
// Make uniques no rebirth and non-regenerative.
|
||||
setUniqueTypes(CreatureTemplate.DRAGON_BLACK_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAGON_BLUE_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAGON_GREEN_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAGON_RED_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAGON_WHITE_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAKE_BLACK_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAKE_BLUE_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAKE_GREEN_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAKE_RED_CID);
|
||||
setUniqueTypes(CreatureTemplate.DRAKE_WHITE_CID);
|
||||
setUniqueTypes(CreatureTemplate.GOBLIN_LEADER_CID);
|
||||
setUniqueTypes(CreatureTemplate.FOREST_GIANT_CID);
|
||||
setUniqueTypes(CreatureTemplate.TROLL_KING_CID);
|
||||
setUniqueTypes(CreatureTemplate.CYCLOPS_CID);
|
||||
|
||||
// Dragon natural armour increases:
|
||||
setNaturalArmour(CreatureTemplate.DRAGON_BLUE_CID, 0.035f);
|
||||
setNaturalArmour(CreatureTemplate.DRAGON_WHITE_CID, 0.035f);
|
||||
@@ -561,7 +678,6 @@ public class MethodsBestiary {
|
||||
setNoCorpse(LilithZombie.templateId);
|
||||
|
||||
setNoCorpse(IceCat.templateId);
|
||||
setNoCorpse(FireCrab.templateId);
|
||||
setNoCorpse(FireGiant.templateId);
|
||||
setNoCorpse(Terror.templateId);
|
||||
|
||||
@@ -777,7 +893,14 @@ public class MethodsBestiary {
|
||||
MethodsBestiary.class.getName()+".addCreatureSpecialEffect(copyId != -10 ? copyId : creatureId, $0, creature);";
|
||||
Util.instrumentDescribed(thisClass, ctVirtualZone, "addCreature", desc4, "sendNewCreature", replace);
|
||||
|
||||
} catch ( CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
Util.setReason("Ensure unique creatures cannot be hitched to vehicles.");
|
||||
CtClass ctVehicle = classPool.get("com.wurmonline.server.behaviours.Vehicle");
|
||||
replace = "if("+MethodsBestiary.class.getName()+".isNotHitchable($1)){" +
|
||||
" return false;" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctVehicle, "addDragger", replace);
|
||||
|
||||
} catch ( CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
|
||||
throw new HookException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.wurmonline.server.FailedException;
|
||||
import com.wurmonline.server.Server;
|
||||
import com.wurmonline.server.Servers;
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.economy.Economy;
|
||||
@@ -23,10 +24,9 @@ import mod.sin.armour.SpectralHide;
|
||||
import mod.sin.creatures.Reaper;
|
||||
import mod.sin.creatures.SpectralDrake;
|
||||
import mod.sin.items.AffinityOrb;
|
||||
import mod.sin.items.caches.RiftCache;
|
||||
import mod.sin.items.caches.TitanCache;
|
||||
import mod.sin.wyvern.Bounty;
|
||||
import mod.sin.wyvern.Arena;
|
||||
import mod.sin.wyvern.Titans;
|
||||
import mod.sin.wyvern.*;
|
||||
import mod.sin.wyvern.util.ItemUtil;
|
||||
|
||||
public class PlayerBounty {
|
||||
@@ -139,12 +139,20 @@ public class PlayerBounty {
|
||||
logger.warning("Error: Treasure box was not created properly!");
|
||||
}
|
||||
}*/
|
||||
if(mob.isUnique()){
|
||||
MiscChanges.addPlayerStat(player.getName(), "UNIQUES");
|
||||
}
|
||||
if(RareSpawns.isRareCreature(mob)){
|
||||
Item riftCache = ItemFactory.createItem(RiftCache.templateId, 50f+(30f*Server.rand.nextFloat()), mob.getName());
|
||||
player.getInventory().insertItem(riftCache, true);
|
||||
}
|
||||
if(Titans.isTitan(mob)){
|
||||
player.addTitle(Title.getTitle(700));
|
||||
Item affinityOrb = ItemFactory.createItem(AffinityOrb.templateId, 99f, mob.getName());
|
||||
player.getInventory().insertItem(affinityOrb, true);
|
||||
Item titanCache = ItemFactory.createItem(TitanCache.templateId, 99f, mob.getName());
|
||||
player.getInventory().insertItem(titanCache, true);
|
||||
MiscChanges.addPlayerStat(player.getName(), "TITANS");
|
||||
return;
|
||||
}
|
||||
//double fightskill = player.getFightingSkill().getKnowledge();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.wurmonline.server.Server;
|
||||
import com.wurmonline.server.items.Item;
|
||||
import com.wurmonline.server.players.Titles;
|
||||
import com.wurmonline.server.skills.Skill;
|
||||
import com.wurmonline.server.skills.SkillList;
|
||||
import javassist.*;
|
||||
import javassist.bytecode.BadBytecode;
|
||||
import javassist.expr.ExprEditor;
|
||||
@@ -99,7 +100,10 @@ public class Mastercraft {
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Warriorgen_ThatGuy", 802, "That Guy", "That Guy", -1, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Eternallove_WarriorgensWife", 803, "Warriorgens Wife", "Warriorgens Wife", -1, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Bambam_ThornOne", 804, "Thorn One", "Thorn One", -1, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Svenja_CareDependant", 805, "The care-dependant", "The care-dependant", -1, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Svenja_CareDependant", 805, "The care-dependent", "The care-dependent", -1, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Alexia_TheTreasuring", 806, "The Treasuring", "The Treasuring", -1, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Reevi_ScienceGuy", 807, "Science Guy", "Science Guy", -1, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Genocide_GrandDesigner", 808, "Grand Designer", "Grand Designer", -1, "NORMAL");
|
||||
|
||||
// Characteristic Titles
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("MindLogic_Normal", 1000, "Logical", "Logical", 100, "NORMAL");
|
||||
@@ -156,6 +160,14 @@ public class Mastercraft {
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Weaponless_Minor", 1121, "Brawler", "Brawler", 10052, "MINOR");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Weaponless_Master", 1122, "Boxer", "Boxer", 10052, "MASTER");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Weaponless_Legendary", 1123, "Martial Artist", "Martial Artist", 10052, "LEGENDARY");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("BladesSmithing_Normal", 1124, "Bladesmith", "Bladesmith", SkillList.SMITHING_WEAPON_BLADES, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("BladesSmithing_Minor", 1125, "Renowned Bladesmith", "Renowned Bladesmith", SkillList.SMITHING_WEAPON_BLADES, "MINOR");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("BladesSmithing_Master", 1126, "Master Bladesmith", "Master Bladesmith", SkillList.SMITHING_WEAPON_BLADES, "MASTER");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("BladesSmithing_Legendary", 1127, "Legendary Bladesmith", "Legendary Bladesmith", SkillList.SMITHING_WEAPON_BLADES, "LEGENDARY");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("HeadSmithing_Normal", 1128, "Headsmither", "Headsmither", SkillList.SMITHING_WEAPON_HEADS, "NORMAL");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("HeadSmithing_Minor", 1129, "Renowned Headsmither", "Renowned Headsmither", SkillList.SMITHING_WEAPON_HEADS, "MINOR");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("HeadSmithing_Master", 1130, "Master Headsmither", "Master Headsmither", SkillList.SMITHING_WEAPON_HEADS, "MASTER");
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("HeadSmithing_Legendary", 1131, "Legendary Headsmither", "Legendary Headsmither", SkillList.SMITHING_WEAPON_HEADS, "LEGENDARY");
|
||||
|
||||
// Skill Titles (100)
|
||||
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Archery_Legendary", 1500, "Legendary Marksman", "Legendary Marksman", 1030, "LEGENDARY");
|
||||
|
||||
@@ -137,11 +137,19 @@ public class ItemUtil {
|
||||
Enchants.BUFF_ROTTING_TOUCH,
|
||||
Enchants.BUFF_LIFETRANSFER, Enchants.BUFF_LIFETRANSFER, // 2 rolls for LT
|
||||
Enchants.BUFF_NIMBLENESS,
|
||||
Enchants.BUFF_MINDSTEALER,
|
||||
Enchants.BUFF_FROSTBRAND,
|
||||
Enchants.BUFF_WEBARMOUR,
|
||||
Enchants.BUFF_BLESSINGDARK, Enchants.BUFF_BLESSINGDARK, // 2 rolls for BotD
|
||||
Enchants.BUFF_VENOM,
|
||||
Enchants.BUFF_WIND_OF_AGES
|
||||
Enchants.BUFF_WIND_OF_AGES,
|
||||
110, 110, //Harden
|
||||
114, //Efficiency
|
||||
115, //Quarry
|
||||
116, //Prowess
|
||||
117, //Industry
|
||||
118, //Endurance
|
||||
119, //Acuity
|
||||
};
|
||||
try {
|
||||
Item enchantOrb = ItemFactory.createItem(EnchantOrb.templateId, 99+(1*Server.rand.nextFloat()), "");
|
||||
|
||||
Reference in New Issue
Block a user