merge latest version, fix up gradle depends

This commit is contained in:
mstoppelli
2018-12-07 01:38:09 -05:00
56 changed files with 3892 additions and 386 deletions

View File

@@ -0,0 +1,325 @@
package mod.sin.wyvern;
import com.wurmonline.server.players.Achievement;
import com.wurmonline.server.players.AchievementTemplate;
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
public class AchievementChanges {
private static Logger logger = Logger.getLogger(AchievementChanges.class.getName());
public static HashMap<Integer, AchievementTemplate> goodAchievements = new HashMap<>();
public static ArrayList<Integer> blacklist = new ArrayList<>();
protected static int getNumber(String name){
AchievementTemplate temp = Achievement.getTemplate(name);
if(temp != null){
return temp.getNumber();
}
return -1;
}
protected static void blacklist(String name){
blacklist.add(getNumber(name));
}
protected static void blacklist(int number){
blacklist.add(number);
}
private static AchievementTemplate addAchievement(int id, String name, String description, String requirement, boolean isInvisible, int triggerOn, byte achievementType, boolean playUpdateSound, boolean isOneTimer) {
AchievementTemplate ach = new AchievementTemplate(id, name, isInvisible, triggerOn, achievementType, playUpdateSound, isOneTimer, requirement);
ach.setDescription(description);
try {
ReflectionUtil.callPrivateMethod(null, ReflectionUtil.getMethod(Achievement.class, "addTemplate", new Class<?>[]{AchievementTemplate.class}), ach);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
}
return ach;
}
protected static void generateBlacklist(){
blacklist("Adulterator");
blacklist("All Hell");
blacklist("Ambitious");
blacklist("Angry Sailor");
blacklist("Arachnophile");
blacklist("Arch Mage");
blacklist("Ascended");
blacklist("Backstabber");
blacklist("Barbarian");
blacklist("Braaains");
blacklist(299); // Brilliant!
blacklist(364); // Brilliant!
blacklist("Bumble Bee");
blacklist("Burglar");
blacklist("Cap'n");
blacklist("Caravel sailor");
blacklist("Chief Mate");
blacklist("Cog sailor");
blacklist("Corbita sailor");
blacklist("Cowboy");
blacklist("Deforestation");
blacklist("Demolition");
blacklist("Diabolist");
blacklist("Die by the Rift");
blacklist("Die by the Rift a gazillion times");
blacklist("Drake Spirits");
blacklist("Eagle Spirits");
blacklist("Environmental Hero");
blacklist("Epic finalizer");
blacklist(298); // Exquisite Gem
blacklist(363); // Exquisite Gem
blacklist("Fast Learner");
blacklist("Fine titles");
blacklist("Fo's Favourite");
blacklist("Ghost of the Rift Warmasters");
blacklist("Hedgehog");
blacklist("High Spirits");
blacklist("Hippie");
blacklist("Humanss!");
blacklist("Hunter Apprentice");
blacklist("Incarnated To Hell");
blacklist("Investigating the Rift");
blacklist("Jackal Hunter");
blacklist("Janitor");
blacklist("Johnny Appleseed");
blacklist("Joyrider");
blacklist("Juggernaut's demise");
blacklist("Kingdom Assault");
blacklist("Knarr sailor");
blacklist("Last Rope");
blacklist("Lord of War");
blacklist("Mage");
blacklist("Magician");
blacklist("Magus");
blacklist("Manifested No More");
blacklist("Master Bridgebuilder");
blacklist("Master Shipbuilder");
blacklist("Master Winemaker");
blacklist("Miner on Strike");
blacklist("Moby Dick");
blacklist("Mountain Goat");
blacklist("Moved a Mountain");
blacklist("Muffin Maker");
blacklist("Mussst kill");
blacklist("No Fuel for the Flame Of Udun");
blacklist("On the Way to the Moon");
blacklist("Out At Sea");
blacklist("Out, out, brief candle!");
blacklist("Own The Rift");
blacklist("Pasta maker");
blacklist("Pasta master");
blacklist("Peace of Mind");
blacklist("Pirate");
blacklist("Pizza maker");
blacklist("Pizza master");
blacklist("Planeswalker");
blacklist("Rider of the Apocalypse");
blacklist("Rift Beast Nemesis");
blacklist("Rift Ogre Hero");
blacklist("Rift Opener");
blacklist("Rift Specialist");
blacklist("Rift Surfer");
blacklist("Rowboat sailor");
blacklist("Ruler");
blacklist("Sailboat sailor");
blacklist("Settlement Assault");
blacklist("Sisyphos Says Hello");
blacklist("Shadow");
blacklist("Shadowmage");
blacklist("Shutting Down");
blacklist("Singing While Eating");
blacklist("Sneaky");
blacklist("Tastes like Chicken");
blacklist("Tears of the Unicorn");
blacklist("The Path of Vynora");
blacklist("The Smell of Freshly Baked Bread");
blacklist("The Smell of Freshly Made Muffins");
blacklist("Thin Air");
blacklist("Tree Hugger");
blacklist("Trucker");
blacklist("Truffle Pig");
blacklist("Vynora commands you");
blacklist("Waller");
blacklist("Wanderer");
blacklist("Went up a Hill");
blacklist("Wet Feet");
blacklist("You Beauty");
blacklist("You Cannot Pass");
blacklist("Zombie Hunter");
blacklist("around the world");
blacklist("brewed 1000 liters");
blacklist("brewed liters");
blacklist("distilled 1000 liters");
blacklist("distilled liters");
}
protected static void setRequirement(AchievementTemplate temp, String req){
try {
ReflectionUtil.setPrivateField(temp, ReflectionUtil.getField(temp.getClass(), "requirement"), req);
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
}
protected static void addRequirements(AchievementTemplate temp){
if(temp.getName().equals("Meoww!")){
setRequirement(temp, "Kill a Wild Cat");
}
if(temp.getName().equals("Treasure Hunter")){
setRequirement(temp, "Open a treasure chest");
}
if(temp.getName().equals("Mercykiller")){
setRequirement(temp, "Slay a Diseased creature");
}
if(temp.getName().equals("Slayer of the Meek")){
setRequirement(temp, "Slay a Scared creature");
}
if(temp.getName().equals("Willbreaker")){
setRequirement(temp, "Slay a Hardened creature");
}
if(temp.getName().equals("Crocodiles Killed")){
setRequirement(temp, "Kill a Crocodile");
}
if(temp.getName().equals("Tower Builder")){
setRequirement(temp, "Build a Guard Tower");
}
if(temp.getName().equals("Invisible:UseResStone")){
setRequirement(temp, "Use a Resurrection Stone");
}
if(temp.getName().equals("Invisible:ShakerOrbing")){
setRequirement(temp, "Use a Shaker Orb");
}
if(temp.getName().equals("Invisible:CutTree")){
setRequirement(temp, "Cut down a tree");
}
if(temp.getName().equals("Invisible:CatchFish")){
setRequirement(temp, "Catch a fish");
}
if(temp.getName().equals("Invisible:PlantFlower")){
setRequirement(temp, "Plant a flower");
}
if(temp.getName().equals("Invisible:Planting")){
setRequirement(temp, "Plant a tree");
}
if(temp.getName().equals("Invisible:PickLock")){
setRequirement(temp, "Pick a lock");
}
if(temp.getName().equals("Invisible:Stealth")){
setRequirement(temp, "Successfully hide");
}
if(temp.getName().equals("Invisible:ItemInTrash")){
setRequirement(temp, "Trash an item");
}
if(temp.getName().equals("Invisible:BulkBinDeposit")){
setRequirement(temp, "Deposit a bulk item");
}
if(temp.getName().equals("Invisible:Distancemoved")){
setRequirement(temp, "Walk one tile");
}
if(temp.getName().equals("Invisible:Hedges")){
setRequirement(temp, "Plant a hedge or flower bed");
}
if(temp.getName().equals("Invisible:MeditatingAction")){
setRequirement(temp, "Meditate");
}
if(temp.getName().equals("Invisible:PickMushroom")){
setRequirement(temp, "Pick a mushroom");
}
if(temp.getName().equals("Maintenance")){
setRequirement(temp, "Repair a fence, floor, or wall");
}
if(temp.getName().equals("Be Gentle Please")){
setRequirement(temp, "Win a spar");
}
if(temp.getName().equals("Rarity")){
setRequirement(temp, "Make the best quality of an item");
}
}
protected static void fixName(AchievementTemplate temp){
if(temp.getName().contains("Invisible:")){
temp.setName(temp.getName().replaceAll("Invisible:", ""));
}
if(temp.getName().equals("PlayerkillBow")){
temp.setName("Arrow To The Knee");
}
if(temp.getName().equals("PlayerkillSword")){
temp.setName("Pointing The Right Direction");
}
if(temp.getName().equals("PlayerkillMaul")){
temp.setName("Trip To The Maul");
}
if(temp.getName().equals("PlayerkillAxe")){
temp.setName("Can I Axe You A Question?");
}
if(temp.getName().equals("OuchThatHurt")){
temp.setName("Ouch That Hurt");
}
if(temp.getName().equals("UseResStone")){
temp.setName("No Risk No Reward");
}
if(temp.getName().equals("ShakerOrbing")){
temp.setName("This Mine Is Busted");
}
if(temp.getName().equals("CutTree")){
temp.setName("Getting Wood");
}
if(temp.getName().equals("CatchFish")){
temp.setName("Delicious Fish");
}
if(temp.getName().equals("PlantFlower")){
temp.setName("Gardening");
}
if(temp.getName().equals("Planting")){
temp.setName("Forester");
}
if(temp.getName().equals("PickLock")){
temp.setName("Vault Hunter");
}
if(temp.getName().equals("ItemInTrash")){
temp.setName("Another Mans Trash");
}
if(temp.getName().equals("Stealth")){
temp.setName("The Invisible Man");
}
if(temp.getName().equals("BulkBinDeposit")){
temp.setName("Bulk Hoarder");
}
if(temp.getName().equals("Distancemoved")){
temp.setName("Explorer");
}
if(temp.getName().equals("Hedges")){
temp.setName("Hedging Your Bets");
}
if(temp.getName().equals("MeditatingAction")){
temp.setName("One With The World");
}
if(temp.getName().equals("PickMushroom")){
temp.setName("Mushroom Collector");
}
}
public static void onServerStarted(){
try {
ConcurrentHashMap<Integer, AchievementTemplate> templates = ReflectionUtil.getPrivateField(Achievement.class, ReflectionUtil.getField(Achievement.class, "templates"));
generateBlacklist();
for(int i : templates.keySet()){
AchievementTemplate temp = templates.get(i);
addRequirements(temp);
if(!temp.getRequirement().equals("") && !temp.isForCooking() && !blacklist.contains(i)){
fixName(temp);
goodAchievements.put(i, temp);
logger.info(temp.getNumber()+": "+temp.getName()+" - "+temp.getDescription()+" ("+temp.getRequirement()+")");
}
}
logger.info("Total achievements loaded into system: "+goodAchievements.size());
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
}
}

View File

@@ -44,11 +44,16 @@ public class AntiCheat {
boolean foundSteamIdMap = false;
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("SELECT * FROM SteamIdMap");
ps = dbcon.prepareStatement("SELECT * FROM SteamIdMap WHERE NAME=? AND STEAMID=?");
ps.setString(1, name);
ps.setString(2, steamId);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
if (!rs.getString("NAME").equals(name)) continue;
foundSteamIdMap = true;
if(!foundSteamIdMap) {
foundSteamIdMap = true;
}else{
logger.warning(String.format("Player %s has accessed their account from multiple Steam ID's!", name));
}
}
rs.close();
ps.close();
@@ -59,7 +64,9 @@ public class AntiCheat {
logger.info("No steam id entry for " + name + ". Creating one.");
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO SteamIdMap (NAME, STEAMID) VALUES(\"" + name + "\", " + steamId + ")");
ps = dbcon.prepareStatement("INSERT INTO SteamIdMap (NAME, STEAMID) VALUES(?, ?)");
ps.setString(1, name);
ps.setString(2, steamId);
ps.executeUpdate();
ps.close();
} catch (SQLException e) {

View File

@@ -9,6 +9,7 @@ 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.skills.Affinity;
import com.wurmonline.server.villages.Citizen;
import com.wurmonline.server.villages.Village;
import com.wurmonline.server.zones.Zone;
@@ -135,14 +136,14 @@ public class Arena {
statue.insertItem(sleepPowder, true);
}
for (x = 0; x < 5; ++x) {
lump = ItemFactory.createItem(ItemList.adamantineBar, Math.min(99, 50 + winStreak), null);
lump = ItemFactory.createItem(ItemList.adamantineBar, Math.min(99f, 60 + (winStreak*Server.rand.nextFloat()*1.5f)), null);
float baseWeight = lump.getWeightGrams();
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);
lump = ItemFactory.createItem(ItemList.glimmerSteelBar, Math.min(99f, 60 + (winStreak*Server.rand.nextFloat()*1.5f)), null);
float baseWeight = lump.getWeightGrams();
float multiplier = 1f;//+(winStreak*0.2f*Server.rand.nextFloat());
lump.setWeight((int) (baseWeight*multiplier), true);
@@ -159,8 +160,8 @@ public class Arena {
ArtifactCache.templateId,
CrystalCache.templateId, CrystalCache.templateId,
DragonCache.templateId, DragonCache.templateId, DragonCache.templateId,
GemCache.templateId,
RiftCache.templateId, RiftCache.templateId, RiftCache.templateId,
ToolCache.templateId,
TreasureMapCache.templateId
};
int i = 5+Server.rand.nextInt(4); // 5-8 caches.
@@ -176,9 +177,9 @@ public class Arena {
i--;
}
// Add 3-5 seryll lumps of medium ql
i = 3+Server.rand.nextInt(3); // 3-5 caches
i = 3+Server.rand.nextInt(3); // 3-5 lumps
while(i > 0){
Item seryll = ItemFactory.createItem(ItemList.seryllBar, 30f+(40f*Server.rand.nextFloat()), null);
Item seryll = ItemFactory.createItem(ItemList.seryllBar, 40f+(60f*Server.rand.nextFloat()), null);
statue.insertItem(seryll, true);
i--;
}
@@ -205,6 +206,10 @@ public class Arena {
}
}
public static Affinity[] getNullAffinities(){
return new Affinity[0];
}
public static void preInit(){
try {
ClassPool classPool = HookManager.getInstance().getClassPool();
@@ -221,6 +226,7 @@ public class Arena {
+ " $_ = $proceed($$);"
+ "}";
Util.instrumentDeclared(thisClass, ctCommunicator, "reallyHandle_CMD_MOVE_INVENTORY", "getDominator", replace);
Util.instrumentDeclared(thisClass, ctCommunicator, "equipCreatureCheck", "getDominator", replace);
/*ctCommunicator.getDeclaredMethod("reallyHandle_CMD_MOVE_INVENTORY").instrument(new ExprEditor(){
public void edit(MethodCall m) throws CannotCompileException {
if (m.getMethodName().equals("getDominator")) {
@@ -684,13 +690,13 @@ public class Arena {
"}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "getFavor", replace);
Util.setReason("Nerf resurrection stones.");
/*Util.setReason("Nerf resurrection stones.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
" $_ = com.wurmonline.server.Server.rand.nextInt(40) > 35;" +
"}else{" +
" $_ = $proceed($$);" +
"}";
Util.instrumentDeclared(thisClass, ctCreature, "die", "isDeathProtected", replace);
Util.instrumentDeclared(thisClass, ctCreature, "die", "isDeathProtected", replace);*/
Util.setReason("Adjust spawn question mechanics.");
CtClass ctSpawnQuestion = classPool.get("com.wurmonline.server.questions.SpawnQuestion");
@@ -766,6 +772,48 @@ public class Arena {
replace = "$_ = $0.getAttitude(this) == 1;";
Util.instrumentDeclared(thisClass, ctPlayer, "spreadCrownInfluence", "isFriendlyKingdom", replace);
Util.setReason("Disable item drops from players on Arena.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && this.isPlayer()){" +
" this.getCommunicator().sendSafeServerMessage(\"You have died on the Arena server and your items are kept safe.\");" +
" keepItems = true;" +
"}" +
"$_ = $proceed($$);";
Util.instrumentDeclaredCount(thisClass, ctCreature, "die", "isOnCurrentServer", 1, replace);
Util.setReason("Disable player skill loss on Arena.");
replace = "if(this.isPlayer() && this.isDeathProtected()){" +
" this.getCommunicator().sendSafeServerMessage(\"You have died with a Resurrection Stone and your knowledge is kept safe.\");" +
" return;" +
"}else{" +
" this.getCommunicator().sendAlertServerMessage(\"You have died without a Resurrection Stone, resulting in some of your knowledge being lost.\");" +
"}";
Util.insertBeforeDeclared(thisClass, ctCreature, "punishSkills", replace);
Util.setReason("Disable player fight skill loss on Arena.");
replace = "if(this.isPlayer() && this.isDeathProtected()){" +
" $_ = null;" +
"}else{" +
" $_ = $proceed($$);" +
"}";
Util.instrumentDeclaredCount(thisClass, ctCreature, "modifyFightSkill", "setKnowledge", 1, replace);
Util.setReason("Disable player affinity loss on Arena.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER && this.isPlayer() && this.isDeathProtected()){" +
" this.getCommunicator().sendSafeServerMessage(\"Your resurrection stone keeps your affinities safe from your slayers.\");" +
" $_ = "+Arena.class.getName()+".getNullAffinities();" +
"}else{" +
" $_ = $proceed($$);" +
"}";
Util.instrumentDeclared(thisClass, ctPlayer, "modifyRanking", "getAffinities", replace);
/*Util.setReason("Enable stealing from deeds.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){" +
" $_ = true;" +
"}else{" +
" $_ = $proceed($$);" +
"}";
Util.instrumentDeclared(thisClass, ctMethodsItems, "checkIfStealing", "mayPass", replace);*/
}catch (NotFoundException e) {
throw new HookException(e);

View File

@@ -26,25 +26,6 @@ public class Bounty {
//protected static WyvernMods mod;
public static HashMap<String, Integer> reward = new HashMap<>();
// Using a hook in CombatEngine.addWound, we call this function to create a list of creatures that actually inflicted damage.
public static HashMap<Long, Map<Long, Double>> dealtDamage = new HashMap<>();
public static void addDealtDamage(long defender, long attacker, double damage){
if(dealtDamage.containsKey(defender)){
Map<Long, Double> dealers = dealtDamage.get(defender);
if(!dealers.containsKey(attacker)){
dealers.put(attacker, damage);
}else{
double newDam = dealers.get(attacker);
newDam += damage;
dealers.put(attacker, newDam);
}
}else{
Map<Long, Double> dealers = new HashMap<>();
dealers.put(attacker, damage);
dealtDamage.put(defender, dealers);
}
}
public static long lastAttacked(Map<Long, Long> attackers, long playerId){
return System.currentTimeMillis()-attackers.get(playerId);
}
@@ -219,7 +200,7 @@ public class Bounty {
+ "}");*/
// -- When a creature takes damage, track the damage taken -- //
CtClass[] params2 = {
/*CtClass[] params2 = {
ctCreature,
ctCreature,
CtClass.byteType,
@@ -235,11 +216,10 @@ public class Bounty {
};
String desc2 = Descriptor.ofMethod(CtClass.booleanType, params2);
CtClass ctCombatEngine = classPool.get("com.wurmonline.server.combat.CombatEngine");
replace = ""
+ "if($1 != null && $2 != null){"
replace = "if($1 != null && $2 != null){"
+ " "+Bounty.class.getName()+".addDealtDamage($2.getWurmId(), $1.getWurmId(), $5);"
+ "}";
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc2, replace);
Util.insertBeforeDescribed(thisClass, ctCombatEngine, "addWound", desc2, replace);*/
//ctCombatEngine.getMethod("addWound", desc2).insertBefore("if($1 != null && $2 != null){mod.sin.wyvern.bounty.MethodsBounty.addDealtDamage($2.getWurmId(), $1.getWurmId(), $5);}");
}

View File

@@ -55,10 +55,10 @@ public class Caches {
}
public static float getBaseQuality(float quality){
return quality*0.2f;
return quality*0.25f;
}
public static float getRandomQuality(float quality){
return quality*0.5f;
return quality*0.6f;
}
public static float getWeightMultiplier(int templateId, float quality){
if(templateId == DragonCache.templateId){
@@ -120,6 +120,7 @@ public class Caches {
ItemList.axeSmall, ItemList.axeMedium, ItemList.axeHuge,
ItemList.maulSmall, ItemList.maulMedium, ItemList.maulLarge,
ItemList.spearLong, ItemList.staffSteel, ItemList.halberd,
Club.templateId, BattleYoyo.templateId,
Knuckles.templateId, Warhammer.templateId
};
}else if(templateId == CrystalCache.templateId){
@@ -174,11 +175,52 @@ public class Caches {
ItemList.riftWood,
ItemList.riftStone
};
}else if(templateId == ToolCache.templateId){
return new int[]{
ItemList.hatchet,
ItemList.knifeCarving,
ItemList.pickAxe,
ItemList.saw,
ItemList.shovel,
ItemList.rake,
ItemList.hammerMetal,
ItemList.hammerWood,
ItemList.anvilSmall,
ItemList.cheeseDrill,
ItemList.knifeButchering,
ItemList.fishingRodIronHook,
ItemList.stoneChisel,
ItemList.spindle,
ItemList.anvilLarge,
ItemList.grindstone,
ItemList.needleIron,
ItemList.knifeFood,
ItemList.sickle,
ItemList.scythe,
ItemList.file,
ItemList.awl,
ItemList.leatherKnife,
ItemList.scissors,
ItemList.clayShaper,
ItemList.spatula,
ItemList.fruitpress,
ItemList.trowel,
ItemList.groomingBrush
};
}
return null;
}
public static void adjustBasicItem(int templateId, float quality, Item item){
if(templateId == ArmourCache.templateId){
if(Server.rand.nextInt(800) < quality){
if(item.getRarity() == 0){
if(Server.rand.nextInt(1800) < quality){
item.setRarity(MiscConstants.SUPREME);
}else{
item.setRarity(MiscConstants.RARE);
}
}
}
if(quality > 50){
if(quality > 95 && Server.rand.nextBoolean()){
ItemUtil.applyEnchant(item, Enchants.BUFF_SHARED_PAIN, quality*Server.rand.nextFloat()*0.7f);
@@ -218,7 +260,6 @@ public class Caches {
Materials.MATERIAL_STEEL
};
item.setMaterial(materials[Server.rand.nextInt(materials.length)]);
item.setQualityLevel(item.getQualityLevel());
if(Server.rand.nextInt(400) < quality){
if(item.getRarity() == 0){
if(Server.rand.nextInt(900) < quality){
@@ -233,8 +274,8 @@ public class Caches {
Enchants.BUFF_WIND_OF_AGES,
Enchants.BUFF_BLESSINGDARK
};
ItemUtil.applyEnchant(item, enchants[Server.rand.nextInt(enchants.length)], quality*Server.rand.nextFloat()*0.6f);
ItemUtil.applyEnchant(item, Enchants.BUFF_NIMBLENESS, quality*Server.rand.nextFloat()*0.7f);
ItemUtil.applyEnchant(item, enchants[Server.rand.nextInt(enchants.length)], quality*0.5f+(quality*0.5f*Server.rand.nextFloat()));
ItemUtil.applyEnchant(item, Enchants.BUFF_NIMBLENESS, quality*0.3f+(quality*0.7f*Server.rand.nextFloat()));
}else if(quality > 30){
ItemUtil.applyEnchant(item, Enchants.BUFF_LIFETRANSFER, quality*0.6f+(quality*0.6f*Server.rand.nextFloat()));
}
@@ -242,7 +283,54 @@ public class Caches {
if(Server.rand.nextInt(500) < quality){
item.setRarity(MiscConstants.RARE);
}
}
}else if(templateId == ToolCache.templateId){
byte[] materials = {
Materials.MATERIAL_SERYLL,
Materials.MATERIAL_GLIMMERSTEEL,
Materials.MATERIAL_ADAMANTINE,
Materials.MATERIAL_STEEL,
Materials.MATERIAL_TIN,
Materials.MATERIAL_BRONZE,
Materials.MATERIAL_BRASS,
Materials.MATERIAL_ZINC,
Materials.MATERIAL_IRON,
Materials.MATERIAL_COPPER,
Materials.MATERIAL_GOLD,
Materials.MATERIAL_LEAD,
Materials.MATERIAL_SILVER
};
item.setMaterial(materials[Server.rand.nextInt(materials.length)]);
if(Server.rand.nextInt(1200) < quality){
if(item.getRarity() == 0){
if(Server.rand.nextInt(2700) < quality){
item.setRarity(MiscConstants.SUPREME);
}else{
item.setRarity(MiscConstants.RARE);
}
}
}
if(Server.rand.nextInt(200) < quality){
byte rune = (byte) (Server.rand.nextInt(78)-128);
if(!ItemUtil.isSingleUseRune(rune)){
ItemUtil.applyEnchant(item, rune, 50);
}
}
if(quality > 30 && Server.rand.nextInt(250) < quality){
ItemUtil.applyEnchant(item, Enchants.BUFF_WIND_OF_AGES, quality*0.6f+(quality*0.6f*Server.rand.nextFloat()));
}
if(quality > 30 && Server.rand.nextInt(250) < quality){
ItemUtil.applyEnchant(item, Enchants.BUFF_CIRCLE_CUNNING, quality*0.6f+(quality*0.6f*Server.rand.nextFloat()));
}
if(quality > 50 && Server.rand.nextInt(250) < quality){ // Efficiency
ItemUtil.applyEnchant(item, (byte) 114, quality*0.6f+(quality*0.6f*Server.rand.nextFloat()));
}
if(quality > 70 && Server.rand.nextInt(350) < quality){
ItemUtil.applyEnchant(item, Enchants.BUFF_BLESSINGDARK, quality*0.6f+(quality*0.6f*Server.rand.nextFloat()));
}
if(quality > 90 && Server.rand.nextInt(5000) < quality){ // Titanforged
ItemUtil.applyEnchant(item, (byte) 120, quality*0.2f+(quality*0.2f*Server.rand.nextFloat()));
}
}
}
public static int getBasicNums(int templateId){
if(templateId == CrystalCache.templateId){
@@ -439,7 +527,7 @@ public class Caches {
TITAN_CACHE.createTemplate();
CACHE_IDS.add(TitanCache.templateId);
TOOL_CACHE.createTemplate();
//CACHE_IDS.add(ToolCache.templateId);
CACHE_IDS.add(ToolCache.templateId);
TREASUREMAP_CACHE.createTemplate();
CACHE_IDS.add(TreasureMapCache.templateId);
WEAPON_CACHE.createTemplate();

View File

@@ -9,21 +9,22 @@ import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.items.Item;
import com.wurmonline.server.players.Player;
import com.wurmonline.shared.constants.Enchants;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;
import javassist.*;
import javassist.bytecode.*;
import javassist.expr.ExprEditor;
import javassist.expr.FieldAccess;
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.Objects;
import java.util.logging.Logger;
public class CombatChanges {
public static Logger logger = Logger.getLogger(CombatChanges.class.getName());
// Added to CombatHandled
public static int getWeaponType(Item weapon){
if(weapon.enchantment == Enchants.ACID_DAM){
return Wound.TYPE_ACID;
@@ -67,6 +68,7 @@ public class CombatChanges {
return mult;
}
// Added to CombatHandled
public static int getLifeTransferAmountModifier(Wound wound, int initial){
byte type = wound.getType();
if(type == Wound.TYPE_ACID || type == Wound.TYPE_BURN || type == Wound.TYPE_COLD){
@@ -77,6 +79,7 @@ public class CombatChanges {
return initial;
}
// Added to CombatHandled
public static float getLifeTransferModifier(Creature creature, Creature defender){
if(Servers.localServer.PVPSERVER && (defender.isDominated() || defender.isPlayer()) && creature.isPlayer()){
return 0.5f;
@@ -84,6 +87,7 @@ public class CombatChanges {
return 1.0f;
}
// Added to CombatHandled
public static void doLifeTransfer(Creature creature, Creature defender, Item attWeapon, double defdamage, float armourMod){
float lifeTransfer = attWeapon.getSpellLifeTransferModifier()*getLifeTransferModifier(creature, defender);
Wound[] w;
@@ -94,6 +98,7 @@ public class CombatChanges {
}
}
// Added (kind of) to CombatHandled
public static float getAdjustedOakshell(Creature defender, Item armour, float armourMod){
if(defender != null && armour == null){
float oakshellPower = defender.getBonusForSpellEffect(Enchants.CRET_OAKSHELL);
@@ -139,6 +144,8 @@ public class CombatChanges {
}
}
}
// Added to CombatHandled
public static boolean canDoDamage(double damage, Creature attacker, Creature defender) {
//logger.info(String.format("canDoDamage from %s to %s - %.1f", attacker.getName(), defender.getName(), damage));
return damage > 1D;
@@ -250,6 +257,18 @@ public class CombatChanges {
}
}
// Added to CombatHandled
public static void pollCreatureActionStacks(){
for(Creature c : Creatures.getInstance().getCreatures()){
if(c.isFighting()) {
c.getActions().poll(c);
}
}
}
public static void goodLog(String str){
logger.info(str);
}
public static void preInit(){
try{
@@ -383,6 +402,55 @@ public class CombatChanges {
"}";
Util.instrumentDeclared(thisClass, ctCombatHandler, "setDamage", "getSpellPainShare", replace);
/*Util.setReason("Debug attack method");
CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action");
CtClass[] params4 = {
ctCreature,
CtClass.intType,
CtClass.booleanType,
CtClass.floatType,
ctAction
};
String desc4 = Descriptor.ofMethod(CtClass.booleanType, params4);
replace = "logger.info(\"opponent = \"+$1.getName()+\", combatCounter = \"+$2+\", opportunity = \"+$3+\", actionCounter = \"+$4);";
Util.insertBeforeDescribed(thisClass, ctCombatHandler, "attack", desc4, replace);*/
/*Util.setReason("Debug CreatureAI Poll");
CtClass ctCreatureAI = classPool.get("com.wurmonline.server.creatures.ai.CreatureAI");
replace = "if($1.getTemplate().getTemplateId() == 2147483619){" +
CombatChanges.class.getName()+".goodLog(\"CreatureAI.pollCreature(\"+$1.getName()+\", \"+$2+\")\");" +
"}";
Util.insertBeforeDeclared(thisClass, ctCreatureAI, "pollCreature", replace);*/
/*Util.setReason("Debug VolaTile Poll");
CtClass ctVolaTile = classPool.get("com.wurmonline.server.zones.VolaTile");
replace = "if($2.getTemplate().getTemplateId() == 2147483619){" +
CombatChanges.class.getName()+".goodLog(\"VolaTile.pollOneCreatureOnThisTile(\"+$2.getName()+\")\");" +
"}";
Util.insertBeforeDeclared(thisClass, ctVolaTile, "pollOneCreatureOnThisTile", replace);*/
/*Util.setReason("Debug Creature Poll");
replace = "if($0.getTemplate().getTemplateId() == 2147483619){" +
CombatChanges.class.getName()+".goodLog(\"Creature.poll(\"+$0.getName()+\")\");" +
"}";
Util.insertBeforeDeclared(thisClass, ctCreature, "poll", replace);*/
/*Util.setReason("Debug Creatures Poll");
CtClass ctCreatures = classPool.get("com.wurmonline.server.creatures.Creatures");
replace = CombatChanges.class.getName()+".goodLog(\"Creatures.pollAllCreatures()\");";
Util.insertBeforeDeclared(thisClass, ctCreatures, "pollAllCreatures", replace);*/
// TODO: Enable with new combat rework.
/*Util.setReason("Poll creature action stacks on every update.");
CtClass ctZones = classPool.get("com.wurmonline.server.zones.Zones");
replace = //CombatChanges.class.getName()+".goodLog(\"Zones.pollNextZones(\"+$1+\") [time \"+java.lang.System.currentTimeMillis()+\"]\");" +
CombatChanges.class.getName()+".pollCreatureActionStacks();";
Util.insertBeforeDeclared(thisClass, ctZones, "pollNextZones", replace);*/
/*replace = "$_ = $proceed($$);" +
CombatChanges.class.getName()+".goodLog(\"Zones.pollNextZones(\"+sleepTime+\") call to Creatures.getInstance().pollAllCreatures(\"+$1+\") [time \"+java.lang.System.currentTimeMillis()+\"]\");";
Util.instrumentDeclared(thisClass, ctZones, "pollNextZones", "pollAllCreatures", replace);*/
patchCombatDamageCheckCombatEngine(classPool);
patchCombatDamageCheckCombatHandler(classPool);

View File

@@ -28,7 +28,8 @@ public class Crystals {
Enchants.BUFF_VENOM,
Enchants.BUFF_WEBARMOUR,
Enchants.BUFF_WIND_OF_AGES,
110 // Harden
110, // Harden
114 // Efficiency
//110, 111 // Harden and Phasing
};
public static byte getNewRandomEnchant(Item target){

View File

@@ -0,0 +1,150 @@
package mod.sin.wyvern;
import com.wurmonline.server.players.Player;
import org.gotti.wurmunlimited.modsupport.ModSupportDb;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Logger;
public class DatabaseHelper {
private static Logger logger = Logger.getLogger(DatabaseHelper.class.getName());
public static void onPlayerLogin(Player p){
Connection dbcon;
PreparedStatement ps;
boolean foundLeaderboardOpt = false;
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("SELECT * FROM LeaderboardOpt");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
if (!rs.getString("name").equals(p.getName())) continue;
foundLeaderboardOpt = true;
}
rs.close();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
if (!foundLeaderboardOpt) {
logger.info("No leaderboard entry for "+p.getName()+". Creating one.");
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO LeaderboardOpt (name) VALUES(?)");
ps.setString(1, p.getName());
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
}
boolean foundPlayerStats = false;
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("SELECT * FROM PlayerStats");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
if (!rs.getString("NAME").equals(p.getName())) continue;
foundPlayerStats = true;
}
rs.close();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
if (!foundPlayerStats) {
logger.info("No player stats entry for "+p.getName()+". Creating one.");
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO PlayerStats (NAME) VALUES(\"" + p.getName() + "\")");
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
public static void onServerStarted(){
try {
Connection con = ModSupportDb.getModSupportDb();
String sql;
String tableName = "LeaderboardOpt";
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', OPTIN INT NOT NULL DEFAULT 0)";
PreparedStatement ps = con.prepareStatement(sql);
ps.execute();
ps.close();
}
tableName = "SteamIdMap";
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', STEAMID LONG NOT NULL DEFAULT 0)";
PreparedStatement ps = con.prepareStatement(sql);
ps.execute();
ps.close();
}
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();
}
}
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();
try {
Connection dbcon;
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO ObjectiveTimers (ID, TIMER) VALUES(\"DEPOT\", 0)");
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
try {
Connection dbcon;
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO ObjectiveTimers (ID, TIMER) VALUES(\"TITAN\", 0)");
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
}
SupplyDepots.initializeDepotTimer();
Titans.initializeTitanTimer();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
}
}

View File

@@ -0,0 +1,38 @@
package mod.sin.wyvern;
import com.wurmonline.server.deities.Deities;
import com.wurmonline.server.deities.Deity;
import java.util.logging.Logger;
public class DeityChanges {
public static Logger logger = Logger.getLogger(DeityChanges.class.getName());
public static void onServerStarted(){
if(Deities.getDeity(101) != null){ // Edit Thelastdab Player God
Deity thelastdab = Deities.getDeity(101);
// Add some defining affinities
thelastdab.metalAffinity = true;
thelastdab.deathProtector = true;
thelastdab.mountainGod = true;
thelastdab.warrior = true;
// Remove some affinities
thelastdab.learner = false;
thelastdab.repairer = false;
thelastdab.befriendCreature = false;
thelastdab.healer = false;
thelastdab.clayAffinity = false;
thelastdab.waterGod = false;
}
/*if(Deities.getDeity(102) != null){ // Edit Cyberhusky player god
Deity cyberhusky = Deities.getDeity(102);
// Add some defining affinities
cyberhusky.hateGod = true;
cyberhusky.allowsButchering = true;
cyberhusky.warrior = true;
// Remove some affinities
cyberhusky.woodAffinity = false;
cyberhusky.befriendCreature = false;
}*/
}
}

View File

@@ -1,6 +1,9 @@
package mod.sin.wyvern;
import com.wurmonline.server.economy.Economy;
import com.wurmonline.server.economy.Shop;
import com.wurmonline.server.items.Item;
import com.wurmonline.server.items.Trade;
import com.wurmonline.server.items.ItemTemplateFactory;
import com.wurmonline.server.villages.GuardPlan;
import com.wurmonline.server.villages.Village;
@@ -49,6 +52,36 @@ public class EconomicChanges {
return -10;
}
public static long getNewShopDiff(Trade trade, long money, long shopDiff){
Shop shop = null;
Village citizenVillage = null;
if (trade.creatureOne.isNpcTrader()) {
shop = Economy.getEconomy().getShop(trade.creatureOne);
}
if (trade.creatureTwo.isNpcTrader()) {
shop = Economy.getEconomy().getShop(trade.creatureTwo);
}
if(shop == null){
logger.info("Something went horribly wrong and the shop is null.");
return 0;
}
logger.info("Money = "+money+", shopDiff = "+shopDiff);
if(!shop.isPersonal() && money > 0){
logger.info("We're adding money. Testing to see how much difference there is.");
if(money + shopDiff > 0){
logger.info("Player actually purchased something. Reducing the income.");
long newDiff = money + shopDiff;
logger.info("Actual difference in currency: "+Economy.getEconomy().getChangeFor(newDiff).getChangeString());
newDiff *= 0.2;
logger.info("After 80% void: "+Economy.getEconomy().getChangeFor(newDiff).getChangeString());
logger.info("Returning the following amount of money to incur the change: "+(-shopDiff+newDiff));
return -shopDiff+newDiff;
}
//return (long) (money*0.2);
}
return money;
}
public static void preInit(){
try{
ClassPool classPool = HookManager.getInstance().getClassPool();
@@ -77,6 +110,11 @@ public class EconomicChanges {
replace = "$_ = 1;";
Util.instrumentDeclared(thisClass, ctCreature, "removeRandomItems", "nextInt", replace);
Util.setReason("Void 80% of all currency put into traders.");
CtClass ctTrade = classPool.get("com.wurmonline.server.items.Trade");
replace = "$1 = "+EconomicChanges.class.getName()+".getNewShopDiff($0, $1, $0.shopDiff);";
Util.insertBeforeDeclared(thisClass, ctTrade, "addShopDiff", replace);
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);
}

View File

@@ -0,0 +1,50 @@
package mod.sin.wyvern;
import com.wurmonline.server.items.Item;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
import mod.sin.lib.Util;
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import java.util.logging.Logger;
public class GemAugmentation {
public static Logger logger = Logger.getLogger(GemAugmentation.class.getName());
public static boolean setGemmedQuality(Item target, double power, float maxGain, float modifier){
logger.info(String.format("Item %s [QL %.2f] improved with power %.1f, max gain %.1f, modifier %.1f",
target.getName(), target.getQualityLevel(), power, maxGain, modifier));
return target.setQualityLevel(Math.min(999.9f, (float)((double)target.getQualityLevel() + power * (double)maxGain * (double) (modifier * target.getMaterialImpBonus()))));
}
public static void preInit(){
try {
ClassPool classPool = HookManager.getInstance().getClassPool();
Class<GemAugmentation> thisClass = GemAugmentation.class;
String replace;
Util.setReason("Primary Gem Augmentation Hook.");
CtClass ctMethodsItems = classPool.get("com.wurmonline.server.behaviours.MethodsItems");
replace = "$_ = "+GemAugmentation.class.getName()+".setGemmedQuality($0, power, maxGain, modifier);";
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "setQualityLevel", replace);
Util.instrumentDeclared(thisClass, ctMethodsItems, "polishItem", "setQualityLevel", replace);
Util.instrumentDeclared(thisClass, ctMethodsItems, "temper", "setQualityLevel", replace);
Util.setReason("Prevent action power from being diluted.");
replace = "$_ = $proceed((float)power);";
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "setPower", replace);
Util.instrumentDeclared(thisClass, ctMethodsItems, "polishItem", "setPower", replace);
Util.instrumentDeclared(thisClass, ctMethodsItems, "temper", "setPower", replace);
CtClass ctDbItem = classPool.get("com.wurmonline.server.items.DbItem");
replace = //"logger.info(\"qlevel = \"+qlevel);" +
"$_ = $proceed(9999.9f, $2);";
Util.instrumentDeclared(thisClass, ctDbItem, "setQualityLevel", "min", replace);
}catch (NotFoundException e) {
throw new HookException(e);
}
}
}

View File

@@ -12,6 +12,7 @@ import java.util.logging.Logger;
import com.wurmonline.server.Servers;
import com.wurmonline.server.behaviours.Action;
import mod.sin.lib.Util;
import mod.sin.items.caches.*;
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modloader.classhooks.InvocationHandlerFactory;
@@ -37,7 +38,8 @@ import mod.sin.weapons.titan.*;
public class ItemMod {
public static Logger logger = Logger.getLogger(ItemMod.class.getName());
public static AffinityCatcher AFFINITY_CATCHER = new AffinityCatcher();
public static AffinityOrb AFFINITY_ORB = new AffinityOrb();
public static ArenaCache ARENA_CACHE = new ArenaCache();
public static ArenaSupplyDepot ARENA_SUPPLY_DEPOT = new ArenaSupplyDepot();
@@ -50,6 +52,7 @@ public class ItemMod {
public static CorpseDecoration CORPSE_DECORATION = new CorpseDecoration();
public static DepthDrill DEPTH_DRILL = new DepthDrill();
public static DisintegrationRod DISINTEGRATION_ROD = new DisintegrationRod();
//public static TitaniumLump ELECTRUM_LUMP = new TitaniumLump();
public static EnchantOrb ENCHANT_ORB = new EnchantOrb();
public static EternalOrb ETERNAL_ORB = new EternalOrb();
public static Eviscerator EVISCERATOR = new Eviscerator();
@@ -104,10 +107,11 @@ public class ItemMod {
public static StableContract STABLE_CONTRACT = new StableContract();
public static MoreAnchors MORE_ANCHORS = new MoreAnchors();
public static WoodEssence WOOD_ESSENCE = new WoodEssence();
public static void createItems(){
logger.info("createItems()");
try{
AFFINITY_CATCHER.createTemplate();
AFFINITY_ORB.createTemplate();
ARENA_CACHE.createTemplate();
ARENA_SUPPLY_DEPOT.createTemplate();
@@ -120,6 +124,7 @@ public class ItemMod {
CORPSE_DECORATION.createTemplate();
DEPTH_DRILL.createTemplate();
DISINTEGRATION_ROD.createTemplate();
//ELECTRUM_LUMP.createTemplate();
ENCHANT_ORB.createTemplate();
ETERNAL_ORB.createTemplate();
EVISCERATOR.createTemplate();
@@ -178,6 +183,8 @@ public class ItemMod {
}
public static void registerActions(){
ModActions.registerAction(new AffinityCatcherCaptureAction());
ModActions.registerAction(new AffinityCatcherConsumeAction());
ModActions.registerAction(new AffinityOrbAction());
ModActions.registerAction(new ArenaCacheOpenAction());
ModActions.registerAction(new ArrowPackUnpackAction());
@@ -190,6 +197,7 @@ public class ItemMod {
ModActions.registerAction(new EnchantOrbAction());
ModActions.registerAction(new EternalOrbAction());
ModActions.registerAction(new FriyanTabletAction());
ModActions.registerAction(new KeyCombinationAction());
ModActions.registerAction(new SealedMapAction());
ModActions.registerAction(new SupplyDepotAction());
ModActions.registerAction(new TreasureBoxAction());
@@ -207,6 +215,7 @@ public class ItemMod {
//COIN_DECORATION.initCreationEntry();
//CORPSE_DECORATION.initCreationEntry();
DEPTH_DRILL.initCreationEntry();
//ELECTRUM_LUMP.initCreationEntry();
EVISCERATOR.initCreationEntry();
KNUCKLES.initCreationEntry();
MASS_STORAGE_UNIT.initCreationEntry();
@@ -288,6 +297,7 @@ public class ItemMod {
new Weapon(Club.templateId, 8.1f, 4.5f, 0.002f, 3, 3, 0.4f, 0.5d);
new Weapon(Knuckles.templateId, 3.6f, 2.1f, 0.002f, 1, 1, 0.2f, 0.5d);
new Weapon(Warhammer.templateId, 9.40f, 5.6f, 0.008f, 4, 3, 1f, 0d);
//new Weapon(ItemList.stoneChisel, 50f, 1f, 0.5f, 8, 1, 3f, -5f);
// 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);
@@ -328,19 +338,35 @@ public class ItemMod {
}
return -10;
}
private static void setFragments(int templateId, int fragmentCount){
try {
ItemTemplate item = ItemTemplateFactory.getInstance().getTemplate(templateId);
ReflectionUtil.setPrivateField(item, ReflectionUtil.getField(item.getClass(), "fragmentAmount"), fragmentCount);
} catch (IllegalAccessException | NoSuchFieldException | NoSuchTemplateException e) {
e.printStackTrace();
}
}
public static void modifyItems() throws NoSuchTemplateException, IllegalArgumentException, IllegalAccessException, ClassCastException, NoSuchFieldException{
// Make leather able to be combined.
ItemTemplate leather = ItemTemplateFactory.getInstance().getTemplate(ItemList.leather);
ReflectionUtil.setPrivateField(leather, ReflectionUtil.getField(leather.getClass(), "combine"), true);
// Make logs able to be combined.
// Make logs able to be combined. Also reduce their volume.
ItemTemplate log = ItemTemplateFactory.getInstance().getTemplate(ItemList.log);
ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "combine"), true);
ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "centimetersZ"), 50);
int newVolume = log.getSizeX()*log.getSizeY()*log.getSizeZ();
ReflectionUtil.setPrivateField(log, ReflectionUtil.getField(log.getClass(), "volume"), newVolume);
// Reduce kindling volume as well to make sure they're not larger than logs.
ItemTemplate kindling = ItemTemplateFactory.getInstance().getTemplate(ItemList.kindling);
ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "centimetersY"), 10);
ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "centimetersZ"), 10);
int newKindlingVolume = kindling.getSizeX()*kindling.getSizeY()*kindling.getSizeZ();
ReflectionUtil.setPrivateField(kindling, ReflectionUtil.getField(kindling.getClass(), "volume"), newKindlingVolume);
// Set silver mirror price to 10 silver instead of 1 iron.
ItemTemplate handMirror = ItemTemplateFactory.getInstance().getTemplate(ItemList.handMirror);
ReflectionUtil.setPrivateField(handMirror, ReflectionUtil.getField(handMirror.getClass(), "value"), 200000);
@@ -362,6 +388,14 @@ public class ItemMod {
ItemTemplate transmutationRod = ItemTemplateFactory.getInstance().getTemplate(ItemList.rodTransmutation);
ReflectionUtil.setPrivateField(transmutationRod, ReflectionUtil.getField(transmutationRod.getClass(), "value"), 2000000);
// Creature crates to 10 silver.
ItemTemplate creatureCage = ItemTemplateFactory.getInstance().getTemplate(ItemList.creatureCrate);
ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "value"), 100000);
ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "fullprice"), true);
// Set transmutation rod to 2 gold instead of 50 silver.
//ItemTemplate transmutationRod = ItemTemplateFactory.getInstance().getTemplate(668);
//ReflectionUtil.setPrivateField(transmutationRod, ReflectionUtil.getField(transmutationRod.getClass(), "value"), 2000000);
// " return this.isTransportable || (this.getTemplateId() >= 510 && this.getTemplateId() <= 513) || this.getTemplateId() == 722 || this.getTemplateId() == 670;"
// Make mailboxes loadable (PvE Only)
@@ -413,8 +447,37 @@ public class ItemMod {
ReflectionUtil.setPrivateField(marbleKeystone, ReflectionUtil.getField(marbleKeystone.getClass(), "decoration"), true);
ItemTemplate skull = ItemTemplateFactory.getInstance().getTemplate(ItemList.skull);
ReflectionUtil.setPrivateField(skull, ReflectionUtil.getField(skull.getClass(), "decoration"), true);
// Modify fragment counts
setFragments(ArmourCache.templateId, 18);
setFragments(ArtifactCache.templateId, 33);
setFragments(CrystalCache.templateId, 11);
setFragments(DragonCache.templateId, 19);
setFragments(GemCache.templateId, 7);
setFragments(MoonCache.templateId, 14);
setFragments(PotionCache.templateId, 18);
setFragments(RiftCache.templateId, 24);
setFragments(TitanCache.templateId, 100);
setFragments(ToolCache.templateId, 27);
setFragments(TreasureMapCache.templateId, 38);
setFragments(AffinityOrb.templateId, 20);
// Tier 4
setFragments(ItemList.statueWorg, 40);
setFragments(ItemList.statueEagle, 40);
// Tier 5
setFragments(ItemList.statueHellHorse, 45);
setFragments(ItemList.statueDrake, 45);
// Tier 6
setFragments(ItemList.statueFo, 50);
setFragments(ItemList.statueMagranon, 50);
setFragments(ItemList.statueLibila, 50);
setFragments(ItemList.statueVynora, 50);
// Still need to override the method for getting spaceLeft
createCustomWeapons();
createCustomArmours();

View File

@@ -0,0 +1,396 @@
package mod.sin.wyvern;
import com.wurmonline.server.Message;
import com.wurmonline.server.Server;
import com.wurmonline.server.TimeConstants;
import com.wurmonline.server.creatures.Creature;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.logging.Logger;
public class KeyEvent {
public static Logger logger = Logger.getLogger(KeyEvent.class.getName());
protected static class Response{
protected int index;
protected long startTime;
protected long endTime;
protected String response = "";
public Response(int index, int startSecond, int endSecond){
this.index = index;
this.startTime = startSecond * TimeConstants.SECOND_MILLIS;
this.endTime = endSecond * TimeConstants.SECOND_MILLIS;
}
public void setResponse(String response){
this.response = response;
}
public String getResponse(){
return response;
}
}
protected static ArrayList<Response> responses = new ArrayList<>();
protected static void resetResponses(){
responses.clear();
responses.add(new Response(0, 40, 60)); // Desire
responses.add(new Response(1, 120, 150)); // Fo's Power
responses.add(new Response(2, 170, 200)); // Magranon's Power
responses.add(new Response(3, 220, 250)); // Vynora's Power
responses.add(new Response(4, 270, 300)); // Liblia's Power
responses.add(new Response(5, 340, 370)); // Ascend Template
// Reset booleans
hasWeaponEnchant = false;
hasCreatureEnchant = false;
hasIndustryEnchant = false;
hasHeal = false;
hasTame = false;
}
public static String getResponse(int index){
for(Response r : responses){
if(r.index == index){
return r.getResponse();
}
}
return "";
}
public static boolean hasWeaponEnchant = false;
public static boolean hasCreatureEnchant = false;
public static boolean hasIndustryEnchant = false;
public static boolean hasHeal = false;
public static boolean hasTame = false;
public static String foPower = "";
public static String magranonPower = "";
public static String vynoraPower = "";
public static String libilaPower = "";
public static String ascendTemplate = "";
public static String getFoPowers(){
return "I offer the following: Life Transfer, Oakshell, Light of Fo, Charm";
}
public static boolean isValidFo(){
return isValidFo(getResponse(1).toLowerCase());
}
public static boolean isValidFo(String response){
if(response.contains("life transfer") || response.contains("lifetransfer") || response.equals("lt")){
foPower = "Life Transfer";
hasWeaponEnchant = true;
return true;
}else if(response.contains("oakshell") || response.contains("oak shell")){
foPower = "Oakshell";
hasCreatureEnchant = true;
return true;
}else if(response.contains("light of fo") || response.contains("lof") || response.contains("light fo")){
foPower = "Light of Fo";
hasHeal = true;
return true;
}else if(response.contains("charm") || response.contains("tame")){
foPower = "Charm";
hasTame = true;
return true;
}
return false;
}
public static String getMagranonPowers(){
String builder = "I offer the following: ";
boolean started = false;
if(!hasWeaponEnchant){
builder += "Flaming Aura";
started = true;
}
if(!hasCreatureEnchant){
if(started){
builder += ", Frantic Charge";
}else{
builder += "Frantic Charge";
started = true;
}
}
if(!hasIndustryEnchant){
if(started){
builder += ", Efficiency";
}else{
builder += "Efficiency";
started = true;
}
}
if(!hasHeal){
if(started){
builder += ", Mass Stamina";
}else{
builder += "Mass Stamina";
started = true;
}
}
if(!hasTame){
if(started){
builder += ", Dominate";
}else{
builder += "Dominate";
}
}
builder += ", Strongwall";
return builder;
}
public static void setRandomMagranonPower(){
if(!hasWeaponEnchant){
magranonPower = "Flaming Aura";
hasWeaponEnchant = true;
}else if(!hasCreatureEnchant){
magranonPower = "Frantic Charge";
hasCreatureEnchant = true;
}else if(!hasIndustryEnchant){
magranonPower = "Efficiency";
hasIndustryEnchant = true;
}else{
magranonPower = "Strongwall";
}
}
public static boolean isValidMagranon(){
return isValidMagranon(getResponse(2).toLowerCase());
}
public static boolean isValidMagranon(String response){
if((response.contains("flaming aura") || response.contains("flamingaura") || response.contains("flame aura") || response.equals("fa"))){
magranonPower = "Flaming Aura";
hasWeaponEnchant = true;
return true;
}else if((response.contains("frantic") || response.contains("charge"))){
magranonPower = "Frantic Charge";
hasCreatureEnchant = true;
return true;
}else if((response.contains("mass stam") || response.contains("stamina"))){
magranonPower = "Mass Stamina";
hasHeal = true;
return true;
}else if((response.contains("effic") || response.contains("effec"))){
magranonPower = "Efficiency";
hasIndustryEnchant = true;
return true;
}else if((response.contains("dominate") || response.contains("dom"))){
magranonPower = "Dominate";
hasTame = true;
return true;
}else if(response.contains("wall") || response.contains("strong")){
magranonPower = "Strongwall";
return true;
}
return false;
}
public static String getVynoraPowers(){
String builder = "I offer the following: ";
builder += "Wind of Ages, Circle of Cunning, Aura of Shared Pain";
if(!hasWeaponEnchant){
builder += ", Frostbrand, Nimbleness, Mind Stealer";
}
if(!hasCreatureEnchant){
builder += ", Excel";
}
builder += ", Opulence";
return builder;
}
public static void setRandomVynoraPower(){
if(!hasWeaponEnchant){
vynoraPower = "Nimbleness";
hasWeaponEnchant = true;
}else if(!hasCreatureEnchant){
vynoraPower = "Excel";
hasCreatureEnchant = true;
}else{
vynoraPower = "Wind of Ages";
hasIndustryEnchant = true;
}
}
public static boolean isValidVynora(){
return isValidVynora(getResponse(3).toLowerCase());
}
public static boolean isValidVynora(String response){
if((response.contains("frost"))){
vynoraPower = "Frostbrand";
hasWeaponEnchant = true;
return true;
}else if((response.contains("nimb"))){
vynoraPower = "Nimbleness";
hasWeaponEnchant = true;
return true;
}else if((response.contains("mind stealer") || response.contains("mindstealer"))){
vynoraPower = "Mind Stealer";
hasWeaponEnchant = true;
return true;
}else if((response.contains("excel"))){
vynoraPower = "Excel";
hasCreatureEnchant = true;
return true;
}else if(response.contains("wind") || response.equals("woa")){
vynoraPower = "Wind of Ages";
hasIndustryEnchant = true;
return true;
}else if(response.contains("circle") || response.contains("cunning") || response.equals("coc")){
vynoraPower = "Circle of Cunning";
hasIndustryEnchant = true;
return true;
}else if(response.contains("aura") || response.contains("shared") || response.equals("aosp")){
vynoraPower = "Aura of Shared Pain";
return true;
}else if(response.contains("opulence")){
vynoraPower = "Opulence";
return true;
}
return false;
}
public static String getLibilaPowers(){
String builder = "I offer the following: ";
builder += "Web Armour";
if(!hasWeaponEnchant){
builder += ", Bloodthirst, Rotting Touch";
}
if(!hasCreatureEnchant){
builder += ", Truehit";
}
if(!hasHeal){
builder += ", Scorn of Libila";
}
if(!hasIndustryEnchant){
builder += ", Blessings of the Dark";
}
if(!hasTame){
builder += ", Rebirth";
}
builder += ", Drain Health, Drain Stamina";
return builder;
}
public static void setRandomLibilaPower(){
if(!hasWeaponEnchant){
libilaPower = "Rotting Touch";
hasWeaponEnchant = true;
}else if(!hasCreatureEnchant){
libilaPower = "Truehit";
hasCreatureEnchant = true;
}else if(!hasTame){
libilaPower = "Rebirth";
hasTame = true;
}else{
libilaPower = "Drain Health";
}
}
public static boolean isValidLibila(){
return isValidLibila(getResponse(4).toLowerCase());
}
public static boolean isValidLibila(String response){
if((response.contains("bloodthirst") || response.contains("blood thirst"))){
libilaPower = "Bloodthirst";
hasWeaponEnchant = true;
return true;
}else if((response.contains("rotting") || response.contains("touch"))){
libilaPower = "Rotting Touch";
hasWeaponEnchant = true;
return true;
}else if((response.contains("truehit") || response.contains("truhit"))){
libilaPower = "Truehit";
hasCreatureEnchant = true;
return true;
}else if((response.contains("scorn"))){
libilaPower = "Scorn of Libila";
hasHeal = true;
return true;
}else if((response.contains("blessing") || response.contains("dark") || response.equals("botd"))){
libilaPower = "Blessings of the Dark";
hasIndustryEnchant = true;
return true;
}else if((response.contains("rebirth"))){
libilaPower = "Rebirth";
hasTame = true;
return true;
}else if(response.contains("health")){
libilaPower = "Drain Health";
return true;
}else if(response.contains("stam")){
libilaPower = "Drain Stamina";
return true;
}else if(response.contains("web") || response.contains("armour")){
libilaPower = "Web Armour";
return true;
}
return false;
}
public static void setRandomAscendTemplate(){
if(Server.rand.nextBoolean()) {
ascendTemplate = "Fo";
}else{
ascendTemplate = "Vynora";
}
}
public static boolean isValidAscendTemplate(){
return isValidAscendTemplate(getResponse(5).toLowerCase());
}
public static boolean isValidAscendTemplate(String response){
if(response.equals("fo")){
ascendTemplate = "Fo";
return true;
}else if(response.contains("mag")){
ascendTemplate = "Magranon";
return true;
}else if(response.contains("vyn")){
ascendTemplate = "Vynora";
return true;
}else if(response.contains("lib")){
ascendTemplate = "Libila";
return true;
}
return false;
}
protected static boolean isValidResponse(int index, String message){
if (index == 0){ // Desire
return true;
}else if(index == 1){ // Fo Power
return isValidFo(message);
}else if(index == 2){ // Magranon Power
return isValidMagranon(message);
}else if(index == 3) { // Vynora Power
return isValidVynora(message);
}else if(index == 4){ // Libila Power
return isValidLibila(message);
}else if(index == 5){ // Ascend Template
return isValidAscendTemplate(message);
}
return true;
}
protected static boolean active = false;
protected static long startTime = 0;
protected static Creature performer = null;
public static boolean isActive(){
return active;
}
public static void setActive(long time, Creature performer){
KeyEvent.active = true;
KeyEvent.startTime = time;
KeyEvent.performer = performer;
resetResponses();
}
public static void handlePlayerMessage(Message message){
if(performer == message.getSender()){
long currentTime = System.currentTimeMillis() - startTime;
//logger.info(String.format("Current timer: %s", currentTime));
for(Response r : responses){
//logger.info(String.format("Checking if index %s is valid at time %s (%s to %s)", r.index, currentTime, r.startTime, r.endTime));
if(r.startTime < currentTime && r.endTime > currentTime){
String response = message.getMessage().substring(message.getSender().getName().length()+3).toLowerCase();
//logger.info(String.format("Response at index %s is valid (%s to %s)", r.index, r.startTime, r.endTime));
if (isValidResponse(r.index, response)) {
r.setResponse(response);
}
}
}
}
}
public static void preInit(){
resetResponses();
}
}

View File

@@ -10,6 +10,11 @@ import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.deities.Deities;
import com.wurmonline.server.economy.Economy;
import com.wurmonline.server.items.*;
import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.creatures.NoSuchCreatureException;
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;
@@ -20,6 +25,7 @@ import com.wurmonline.server.webinterface.WcKingdomChat;
import com.wurmonline.server.zones.VolaTile;
import com.wurmonline.server.zones.Zones;
import com.wurmonline.shared.constants.Enchants;
import com.wurmonline.shared.util.StringUtilities;
import javassist.*;
import javassist.bytecode.Descriptor;
import javassist.expr.ExprEditor;
@@ -41,6 +47,10 @@ import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;
@@ -61,16 +71,19 @@ public class MiscChanges {
};
r.run();
}
public static void sendGlobalFreedomChat(final Creature sender, final String message, final int red, final int green, final int blue){
public static void sendGlobalFreedomChat(final Creature sender, final String message, final int red, final int green, final int blue){
sendGlobalFreedomChat(sender, sender.getNameWithoutPrefixes(), message, red, green, blue);
}
public static void sendGlobalFreedomChat(final Creature sender, final String name, final String message, final int red, final int green, final int blue){
Runnable r = () -> {
Message mess;
for(Player rec : Players.getInstance().getPlayers()){
mess = new Message(sender, (byte)10, "GL-Freedom", "<"+sender.getNameWithoutPrefixes()+"> "+message, red, green, blue);
mess = new Message(sender, (byte)10, "GL-Freedom", "<"+name+"> "+message, red, green, blue);
rec.getCommunicator().sendMessage(mess);
}
if (message.trim().length() > 1) {
WcKingdomChat wc = new WcKingdomChat(WurmId.getNextWCCommandId(), sender.getWurmId(), sender.getNameWithoutPrefixes(), message, false, (byte) 4, red, green, blue);
WcKingdomChat wc = new WcKingdomChat(WurmId.getNextWCCommandId(), sender.getWurmId(), name, message, false, (byte) 4, red, green, blue);
if (!Servers.isThisLoginServer()) {
wc.sendToLoginServer();
} else {
@@ -81,6 +94,29 @@ public class MiscChanges {
r.run();
}
public static void broadCastDeathsPvE(Player player, Map<Long, Long> attackers){
StringBuilder attackerString = new StringBuilder();
final long now = System.currentTimeMillis();
for (final Long attackerId : attackers.keySet()) {
final Long time = attackers.get(attackerId);
try {
final Creature creature = Creatures.getInstance().getCreature(attackerId);
if (now - time >= 600000L) {
continue;
}
if(attackerString.length() > 0){
attackerString.append(" ");
}
attackerString.append(StringUtilities.raiseFirstLetter(creature.getName()));
if (creature.isPlayer()) {
return;
}
}
catch (NoSuchCreatureException ignored) {}
}
Players.getInstance().broadCastDeathInfo(player, attackerString.toString());
}
public static void broadCastDeaths(Creature player, String slayers){
String slayMessage = "slain by ";
sendGlobalFreedomChat(player, slayMessage+slayers, 200, 25, 25);
@@ -374,8 +410,10 @@ 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/",
"Website/Maps: https://www.sarcasuals.com/",
"Server Discord: https://discord.gg/r8QNXAC"};
"Website/Maps: https://www.sarcasuals.com/",
"Server Discord: https://discord.gg/r8QNXAC",
"Server Data: https://docs.google.com/spreadsheets/d/1yjqTHoxUan4LIldI3jgrXZgXj1M2ENQ4MXniPUz0rE4",
"Server Wiki/Documentation: https://docs.google.com/document/d/1GeaygilS-Z-d1TuGB7awOe9sJNV4o5BTZw_a2ATJy98"};
StringBuilder str = new StringBuilder("{"
+ " com.wurmonline.server.Message mess;");
for (String anInfoTabLine : infoTabLine) {
@@ -437,12 +475,11 @@ public class MiscChanges {
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "isCombine", replace);
// - Check new improve materials - //
// TODO: Re-enable when custom items are created that require it.
/*replace = "int temp = "+ItemMod.class.getName()+".getModdedImproveTemplateId($1);"
replace = "int temp = "+ItemMod.class.getName()+".getModdedImproveTemplateId($1);"
+ "if(temp != -10){"
+ " return temp;"
+ "}";
Util.insertBeforeDeclared(thisClass, ctMethodsItems, "getImproveTemplateId", replace);*/
Util.insertBeforeDeclared(thisClass, ctMethodsItems, "getImproveTemplateId", replace);
// - Remove fatiguing actions requiring you to be on the ground - //
CtClass ctAction = classPool.get("com.wurmonline.server.behaviours.Action");
@@ -497,8 +534,16 @@ public class MiscChanges {
Util.instrumentDeclared(thisClass, ctArrows, "addToHitCreature", "addAttacker", replace);
Util.setReason("Broadcast death tabs to GL-Freedom.");
Util.insertBeforeDeclared(thisClass, ctPlayers, "broadCastDeathInfo", MiscChanges.class.getName()+".broadCastDeaths($1, $2);");
//ctPlayers.getDeclaredMethod("broadCastDeathInfo").insertBefore("mod.sin.wyvern.MiscChanges.broadCastDeaths($1, $2);");
replace = MiscChanges.class.getName()+".broadCastDeaths($1, $2);";
Util.insertBeforeDeclared(thisClass, ctPlayers, "broadCastDeathInfo", replace);
Util.setReason("Broadcast player death tabs always.");
replace = MiscChanges.class.getName()+".broadCastDeathsPvE($0, $0.attackers);";
Util.insertBeforeDeclared(thisClass, ctPlayer, "modifyRanking", replace);
Util.setReason("Disable PvP only death tabs.");
replace = "$_ = true;";
Util.instrumentDeclared(thisClass, ctPlayers, "broadCastDeathInfo", "isThisAPvpServer", replace);
Util.setReason("Attempt to prevent libila from losing faith when crossing servers.");
CtClass ctIntraServerConnection = classPool.get("com.wurmonline.server.intra.IntraServerConnection");
@@ -804,7 +849,6 @@ public class MiscChanges {
// 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));");*/
@@ -868,6 +912,92 @@ public class MiscChanges {
}
});
Util.setReason("Make armour title benefits always occur.");
replace = "$_ = improve.getNumber();";
Util.instrumentDeclared(thisClass, ctMethodsItems, "improveItem", "getSkillId", replace);
Util.instrumentDeclared(thisClass, ctMethodsItems, "polishItem", "getSkillId", replace);
Util.setReason("Make it so sorceries can be used anywhere with a flat 3x3 altar.");
CtClass ctAbilities = classPool.get("com.wurmonline.server.players.Abilities");
replace = "$_ = 1;";
Util.instrumentDeclared(thisClass, ctAbilities, "isInProperLocation", "getTemplateId", replace);
Util.setReason("Make the key of the heavens only usable on PvE");
replace = "if($1.getTemplateId() == 794 && com.wurmonline.server.Servers.localServer.PVPSERVER){" +
" $2.getCommunicator().sendNormalServerMessage(\"The \"+$1.getName()+\" may not be used on Arena.\");" +
" return false;" +
"}";
Util.insertBeforeDeclared(thisClass, ctAbilities, "isInProperLocation", replace);
Util.setReason("Make drinks less filling.");
CtClass[] params14 = {
ctAction,
ctCreature,
ctItem,
CtClass.floatType
};
String desc14 = Descriptor.ofMethod(CtClass.booleanType, params14);
replace = "if(template != 128){" +
" $_ = $proceed($1, $2, $3*5);" +
"}else{" +
" $_ = $proceed($$);" +
"}";
Util.instrumentDescribed(thisClass, ctMethodsItems, "drink", desc14, "sendActionControl", replace);
replace = "if(template != 128){" +
" $_ = $proceed($1/5, $2, $3, $4, $5);" +
"}else{" +
" $_ = $proceed($$);" +
"}";
Util.instrumentDescribed(thisClass, ctMethodsItems, "drink", desc14, "modifyThirst", replace);
Util.setReason("Disable Gem Augmentation skill from converting.");
CtClass ctMethodsReligion = classPool.get("com.wurmonline.server.behaviours.MethodsReligion");
replace = "$_ = $proceed($1, $2, true, $4);";
Util.instrumentDeclared(thisClass, ctMethodsReligion, "listen", "skillCheck", replace);
Util.setReason("Disable GM commands from displaying in /help unless the player is a GM.");
CtClass ctServerTweaksHandler = classPool.get("com.wurmonline.server.ServerTweaksHandler");
replace = "if($1.getPower() < 1){" +
" return;" +
"}";
Util.insertBeforeDeclared(thisClass, ctServerTweaksHandler, "sendHelp", replace);
Util.setReason("Make damage less likely to interrupt actions during combat.");
replace = "$1 = $1/2;";
Util.insertBeforeDeclared(thisClass, ctCreature, "maybeInterruptAction", replace);
Util.setReason("Fix mission null pointer exception.");
CtClass ctEpicServerStatus = classPool.get("com.wurmonline.server.epic.EpicServerStatus");
replace = "if(itemplates.size() < 1){" +
" com.wurmonline.server.epic.EpicServerStatus.setupMissionItemTemplates();" +
"}";
Util.insertBeforeDeclared(thisClass, ctEpicServerStatus, "getRandomItemTemplateUsed", replace);
Util.setReason("Fix bug causing high cast spells to reduce power.");
CtClass ctSpellEffect = classPool.get("com.wurmonline.server.spells.SpellEffect");
replace = "{" +
" final float mod = 5.0f * (1.0f - java.lang.Math.min($0.getPower(), 100f) / 100.0f);" +
" $0.setPower(mod + $1);" +
"}";
Util.setBodyDeclared(thisClass, ctSpellEffect, "improvePower", replace);
Util.setReason("Disable smelting pots from being used.");
CtClass ctItemBehaviour = classPool.get("com.wurmonline.server.behaviours.ItemBehaviour");
CtClass[] params15 = {
ctAction,
ctCreature,
ctItem,
ctItem,
CtClass.shortType,
CtClass.floatType
};
String desc15 = Descriptor.ofMethod(CtClass.booleanType, params15);
replace = "if($5 == 519){" +
" $2.getCommunicator().sendNormalServerMessage(\"Smelting is disabled.\");" +
" return true;" +
"}";
Util.insertBeforeDescribed(thisClass, ctItemBehaviour, "action", desc15, replace);
} catch (CannotCompileException | NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);
}

View File

@@ -67,7 +67,7 @@ public class MountedChanges {
if(creature.isHorse() || creature.isUnicorn()) {
factor *= newCalcHorseShoeBonus(creature);
}
if(creature.isHorse()){
/*if(creature.isHorse()){
try {
Item barding = creature.getArmour(BodyPartConstants.TORSO);
if(barding != null){
@@ -81,7 +81,7 @@ public class MountedChanges {
}
} catch (NoArmourException | NoSpaceException ignored) {
}
}
}*/
if (creature.getBonusForSpellEffect(Enchants.CRET_OAKSHELL) > 0.0f) {
factor *= 1f - (0.3f * (creature.getBonusForSpellEffect(Enchants.CRET_OAKSHELL) / 100.0f));
}

View File

@@ -80,6 +80,9 @@ public class PlayerTitles {
customTitles.put("Piratemax", 810); // Slave
playerTitles.put("Piratemax", "Boy Next Door");
donatorTitles.add("Eltacolad");
customTitles.put("Eltacolad", 811); // The One True Taco
// Other rewards
customTitles.put("Critias", 602);
}

View File

@@ -0,0 +1,147 @@
package mod.sin.wyvern;
import com.wurmonline.server.Server;
import com.wurmonline.server.TimeConstants;
import com.wurmonline.server.skills.*;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
import mod.sin.lib.Util;
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import java.util.logging.Logger;
public class SkillChanges {
public static Logger logger = Logger.getLogger(SkillChanges.class.getName());
public static double newDoSkillGainNew(Skill skill, double check, double power, double learnMod, float times, double skillDivider) {
double bonus = 1.0;
double diff = Math.abs(check - skill.getKnowledge());
short sType = SkillSystem.getTypeFor(skill.getNumber());
boolean awardBonus = true;
if (sType == 1 || sType == 0) {
awardBonus = false;
}
if (diff <= 15.0 && awardBonus) {
bonus = 1.0 + (0.1 * (diff / 15.0));
}
/*if (power < 0.0) {
if (this.knowledge < 20.0) {
this.alterSkill((100.0 - this.knowledge) / (this.getDifficulty(this.parent.priest) * this.knowledge * this.knowledge) * learnMod * bonus, false, times, true, skillDivider);
}
} else {
this.alterSkill((100.0 - this.knowledge) / (this.getDifficulty(this.parent.priest) * this.knowledge * this.knowledge) * learnMod * bonus, false, times, true, skillDivider);
}*/
try {
Skills parent = ReflectionUtil.getPrivateField(skill, ReflectionUtil.getField(skill.getClass(), "parent"));
double advanceMultiplicator = (100.0 - skill.getKnowledge()) / (skill.getDifficulty(parent.priest) * skill.getKnowledge() * skill.getKnowledge()) * learnMod * bonus;
double negativeDecayRate = 5;
double positiveDecayRate = 3;
double valueAtZero = 3.74d;
double valueAtOneHundred = 0.9d;
//advanceMultiplicator *= Math.pow(2, ((2-Math.pow((100/(100+power)), p))*(100-power)/100));
//double mult = Math.pow(2, (2-Math.pow(100/(100+power), negativeDecayRate))*Math.pow((100-power)*0.01, positiveDecayRate));
double mult = valueAtOneHundred*Math.pow(valueAtZero/valueAtOneHundred, (2-Math.pow(100/(100+Math.max(-99,power)), negativeDecayRate))*Math.pow((100-power)*0.01, positiveDecayRate));
if(mult < 0.5 && skill.getKnowledge() < 20){
advanceMultiplicator *= 0.5+(Server.rand.nextDouble()*0.5);
}else if(skill.getNumber() == SkillList.MEDITATING || skill.getNumber() == SkillList.LOCKPICKING){
advanceMultiplicator *= Math.max(mult, 0.8d);
}else if(mult > 0.0001) {
advanceMultiplicator *= mult;
}else{
advanceMultiplicator = 0;
}
/*if(skill.getType() > 3) {
logger.info(String.format("Power of %.2f on skill %s gives multiplier of %.2f.", power, skill.getName(), mult));
}*/
return advanceMultiplicator;
//ReflectionUtil.callPrivateMethod(skill, ReflectionUtil.getMethod(skill.getClass(), "alterSkill"), advanceMultiplicator, false, times, true, skillDivider);
} catch (IllegalAccessException | NoSuchFieldException e) {
logger.info(e.getMessage());
e.printStackTrace();
}
return 0;
}
public static void onServerStarted(){
/*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);
} catch (IllegalAccessException | NoSuchFieldException e) {
logger.info("Failed to set tickTime for stealing!");
e.printStackTrace();
}
SkillTemplate meditating = SkillSystem.templates.get(SkillList.MEDITATING);
try {
ReflectionUtil.setPrivateField(meditating, ReflectionUtil.getField(meditating.getClass(), "tickTime"), TimeConstants.HOUR_MILLIS);
} catch (IllegalAccessException | NoSuchFieldException e) {
logger.info("Failed to set tickTime for meditating!");
e.printStackTrace();
}
meditating.setDifficulty(300f);
// Set mining difficulty down to be equivalent to digging.
SkillTemplate mining = SkillSystem.templates.get(SkillList.MINING);
mining.setDifficulty(3000f);
// Triple lockpicking skill
SkillTemplate lockpicking = SkillSystem.templates.get(SkillList.LOCKPICKING);
lockpicking.setDifficulty(700f);
}
public static void preInit(){
try{
ClassPool classPool = HookManager.getInstance().getClassPool();
final Class<SkillChanges> thisClass = SkillChanges.class;
String replace;
Util.setReason("Allow skill check failures to add skill gain.");
CtClass ctSkill = classPool.get("com.wurmonline.server.skills.Skill");
replace = "{" +
" double advanceMultiplicator = "+SkillChanges.class.getName()+".newDoSkillGainNew($0, $1, $2, $3, $4, $5);" +
" $0.alterSkill(advanceMultiplicator, false, $4, true, $5);" +
"}";
Util.setBodyDeclared(thisClass, ctSkill, "doSkillGainNew", replace);
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);
}
}
}

View File

@@ -198,6 +198,7 @@ public class SupplyDepots {
MiscChanges.sendServerTabMessage("arena", "The next Arena depot will appear in 5 minutes!", 255, 128, 0);
}else if(minutesLeft == 19){
MiscChanges.sendServerTabMessage("arena", "The next Arena depot will appear in 20 minutes!", 255, 128, 0);
MiscChanges.sendGlobalFreedomChat(host, "The next Arena depot will appear in 20 minutes!", 255, 128, 0);
}else if(minutesLeft == 59){
MiscChanges.sendServerTabMessage("arena", "The next Arena depot will appear in 60 minutes!", 255, 128, 0);
MiscChanges.sendGlobalFreedomChat(host, "The next Arena depot will appear in 60 minutes!", 255, 128, 0);
@@ -251,14 +252,12 @@ public class SupplyDepots {
inv.insertItem(token, true);
i--;
}
// Seryll or sleep powder
if(Server.rand.nextBoolean()){
Item seryll = ItemFactory.createItem(ItemList.seryllBar, 70+(30*Server.rand.nextFloat()), null);
inv.insertItem(seryll, true);
}else{
Item sleepPowder = ItemFactory.createItem(ItemList.sleepPowder, 99f, null);
inv.insertItem(sleepPowder, true);
}
// High quality seryll
Item seryll = ItemFactory.createItem(ItemList.seryllBar, 80+(20*Server.rand.nextFloat()), null);
inv.insertItem(seryll, true);
// Sleep powder
Item sleepPowder = ItemFactory.createItem(ItemList.sleepPowder, 99f, null);
inv.insertItem(sleepPowder, true);
// Very low chance for a HotA statue.
if(Server.rand.nextFloat()*100f <= 1f){
Item hotaStatue = ItemFactory.createItem(ItemList.statueHota, 80f+(20f*Server.rand.nextFloat()), "");

View File

@@ -3,6 +3,7 @@ package mod.sin.wyvern;
import com.wurmonline.mesh.Tiles;
import com.wurmonline.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.creatures.MineDoorPermission;
@@ -152,7 +153,8 @@ public class Titans {
if (lCret.isUnique() || lCret.isInvulnerable() || lCret == titan || isTitanMinion(lCret)){
return;
}
if (!lCret.addWoundOfType(lCret, Wound.TYPE_INFECTION, 1, true, 1.0f, true, 50000f)) {
lCret.addWoundOfType(lCret, Wound.TYPE_INFECTION, 1, true, 1.0f, true, 50000f);
/*if (!lCret.addWoundOfType(lCret, Wound.TYPE_INFECTION, 1, true, 1.0f, true, 50000f)) {
Creatures.getInstance().setCreatureDead(lCret);
Players.getInstance().setCreatureDead(lCret);
lCret.setTeleportPoints((short)tilex, (short)tiley, titan.getLayer(), 0);
@@ -162,7 +164,7 @@ public class Titans {
if (!lCret.isPlayer()) {
lCret.getMovementScheme().resumeSpeedModifier();
}
}
}*/
}
public static void ifritMassIncinerateAttack(Creature titan, Creature lCret){
if (lCret.isUnique() || lCret.isInvulnerable() || lCret == titan || isTitanMinion(lCret)){
@@ -675,6 +677,23 @@ public class Titans {
}
titanDamage.put(titan, currentDamage);
}
public static void pollTitanRegeneration(){
if(!titans.isEmpty()) {
for (Creature cret : titans) {
if (cret.getBody().isWounded()) {
Wounds tWounds = cret.getBody().getWounds();
int toHeal = 5;
Wound w = tWounds.getWounds()[Server.rand.nextInt(tWounds.getWounds().length)];
if (w.getSeverity() > toHeal) {
w.modifySeverity(-toHeal);
break;
} else {
w.heal();
}
}
}
}
}
public static void pollTitan(Creature titan){
if(titanDamage.containsKey(titan)){
int prevDamage = titanDamage.get(titan);
@@ -687,6 +706,14 @@ public class Titans {
titanDamage.put(titan, titan.getStatus().damage);
}
}
public static void pollTitans(){
for(Creature c : titans){
if(isTitan(c)){
pollTitan(c);
}
}
pollTitanRegeneration();
}
public static ArrayList<Creature> titans = new ArrayList<>();
public static long lastPolledTitanSpawn = 0;
@@ -764,7 +791,7 @@ public class Titans {
int tiley = (int) (minY+(minY*2*Server.rand.nextFloat()))*4;*/
int[] titanTemplates = {Lilith.templateId, Ifrit.templateId};
try {
Creature.doNew(titanTemplates[Server.rand.nextInt(titanTemplates.length)], spawnX, spawnY, 360f*Server.rand.nextFloat(), 1, "", (byte)0);
Creature.doNew(titanTemplates[Server.rand.nextInt(titanTemplates.length)], spawnX, spawnY, 360f*Server.rand.nextFloat(), 0, "", (byte)0);
lastSpawnedTitan = System.currentTimeMillis();
updateLastSpawnedTitan();
} catch (Exception e) {
@@ -779,13 +806,6 @@ public class Titans {
lastPolledTitanSpawn = System.currentTimeMillis();
}
}
public static void pollTitans(){
for(Creature c : titans){
if(isTitan(c)){
pollTitan(c);
}
}
}
public static void preInit(){
try {

View File

@@ -7,23 +7,20 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import com.wurmonline.server.Message;
import com.wurmonline.server.Items;
import com.wurmonline.server.Server;
import com.wurmonline.server.creatures.Communicator;
import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.creatures.CreatureTemplate;
import com.wurmonline.server.creatures.CreatureTemplateFactory;
import com.wurmonline.server.items.*;
import com.wurmonline.server.kingdom.Kingdoms;
import mod.sin.actions.items.SorcerySplitAction;
import javassist.bytecode.Descriptor;
import mod.sin.items.*;
import mod.sin.kingdomoffices.ItemCreator;
@@ -34,16 +31,12 @@ import org.gotti.wurmunlimited.modloader.classhooks.HookException;
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
import org.gotti.wurmunlimited.modloader.classhooks.InvocationHandlerFactory;
import org.gotti.wurmunlimited.modloader.interfaces.*;
import org.gotti.wurmunlimited.modsupport.ModSupportDb;
import org.gotti.wurmunlimited.modsupport.actions.ModActions;
import org.gotti.wurmunlimited.modsupport.creatures.ModCreatures;
import org.gotti.wurmunlimited.modsupport.vehicles.ModVehicleBehaviours;
import com.wurmonline.server.TimeConstants;
import com.wurmonline.server.players.Player;
import com.wurmonline.server.skills.SkillList;
import com.wurmonline.server.skills.SkillSystem;
import com.wurmonline.server.skills.SkillTemplate;
import javassist.CannotCompileException;
import javassist.ClassPool;
@@ -58,7 +51,7 @@ import mod.sin.wyvern.bestiary.MethodsBestiary;
import mod.sin.wyvern.mastercraft.Mastercraft;
public class WyvernMods
implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCreatedListener, ServerStartedListener, ServerPollListener, PlayerLoginListener {
implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCreatedListener, ServerStartedListener, ServerPollListener, PlayerLoginListener, ChannelMessageListener {
private static Logger logger = Logger.getLogger(WyvernMods.class.getName());
public static boolean espCounter = false;
public static boolean enableDepots = false;
@@ -120,9 +113,9 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
}
}
/*public static void handleExamine(Creature performer, Item target) {
public static void handleExamine(Creature performer, Item target) {
// Im just not a smart man.
if(target.isContainerLiquid()){
/*if(target.isContainerLiquid()){
boolean found = false;
for(Item i : Items.getAllItems()){
if(i == target){
@@ -134,8 +127,8 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
}else{
logger.info("Item not found.");
}
}
}*/
}*/
}
public void preInit() {
logger.info("Pre-Initializing.");
@@ -152,6 +145,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
MethodsBestiary.preInit();
MissionCreator.preInit();
CombatChanges.preInit();
SkillChanges.preInit();
MeditationPerks.preInit();
MountedChanges.preInit();
EconomicChanges.preInit();
@@ -161,15 +155,17 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
Mastercraft.preInit();
Mastercraft.addNewTitles();
SupplyDepots.preInit();
KeyEvent.preInit();
//GemAugmentation.preInit();
ItemBonusOverhaul.preInit();
Class<WyvernMods> thisClass = WyvernMods.class;
ClassPool classPool = HookManager.getInstance().getClassPool();
/*Util.setReason("Insert examine method.");
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);*/
Util.insertAfterDeclared(thisClass, ctItemBehaviour, "examine", replace);
// - Enable custom command handler - //
CtClass ctCommunicator = classPool.get("com.wurmonline.server.creatures.Communicator");
@@ -180,7 +176,6 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
+ "if(!mod.sin.wyvern.WyvernMods.customCommandHandler($1, this.player)){"
+ " $_ = $proceed(tempBuffer);"
+ "}");
return;
}
}
});
@@ -216,6 +211,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
// Flavor Mobs:
logger.info("Registering Flavor creatures.");
ModCreatures.addCreature(new Avenger());
ModCreatures.addCreature(new FireCrab());
ModCreatures.addCreature(new ForestSpider());
ModCreatures.addCreature(new Giant());
ModCreatures.addCreature(new Charger());
@@ -226,9 +222,9 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
// Event Mobs:
logger.info("Registering Event creatures.");
ModCreatures.addCreature(new IceCat());
ModCreatures.addCreature(new FireCrab());
ModCreatures.addCreature(new FireGiant());
ModCreatures.addCreature(new GuardianMagranon());
// Bosses:
logger.info("Registering Custom Boss creatures.");
ModCreatures.addCreature(new Reaper());
@@ -254,7 +250,6 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
Bounty.init();
Mastercraft.changeExistingTitles();
}
@Override
@@ -340,62 +335,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
@Override
public void onPlayerLogin(Player p) {
Connection dbcon;
PreparedStatement ps;
boolean foundLeaderboardOpt = false;
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("SELECT * FROM LeaderboardOpt");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
if (!rs.getString("name").equals(p.getName())) continue;
foundLeaderboardOpt = true;
}
rs.close();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
if (!foundLeaderboardOpt) {
logger.info("No leaderboard entry for "+p.getName()+". Creating one.");
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO LeaderboardOpt (name) VALUES(\"" + p.getName() + "\")");
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
}
boolean foundPlayerStats = false;
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("SELECT * FROM PlayerStats");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
if (!rs.getString("NAME").equals(p.getName())) continue;
foundPlayerStats = true;
}
rs.close();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
if (!foundPlayerStats) {
logger.info("No player stats entry for "+p.getName()+". Creating one.");
try {
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO PlayerStats (NAME) VALUES(\"" + p.getName() + "\")");
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
}
DatabaseHelper.onPlayerLogin(p);
PlayerTitles.awardCustomTitles(p);
}
@@ -415,6 +355,8 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
ModActions.registerAction(new ReceiveMailAction());
ModActions.registerAction(new LeaderboardAction());
ModActions.registerAction(new AddSubGroupAction());
ModActions.registerAction(new SorcerySplitAction());
ModActions.registerAction(new LeaderboardSkillAction());
logger.info("Registering Arena actions.");
ModActions.registerAction(new SorceryCombineAction());
//ModActions.registerAction(new VillageTeleportAction()); // [3/28/18] Disabled - Highway Portals added instead.
@@ -423,85 +365,19 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
logger.info("Registering Dev actions.");
ModActions.registerAction(new MissionAddAction());
ModActions.registerAction(new MissionRemoveAction());
ModActions.registerAction(new CreatureReportAction());
ModActions.registerAction(new SmoothTerrainAction());
logger.info("Setting custom creature corpse models.");
MethodsBestiary.setTemplateVariables();
/*if(Deities.getDeity(101) != null){ // Edit Breyk player god
Deity breyk = Deities.getDeity(101);
// Add some defining affinities
breyk.repairer = true;
breyk.learner = true;
breyk.deathProtector = true;
breyk.befriendCreature = true;
// Remove some affinities
breyk.warrior = false;
breyk.healer = false;
breyk.clayAffinity = false;
}*/
/*if(Deities.getDeity(102) != null){ // Edit Cyberhusky player god
Deity cyberhusky = Deities.getDeity(102);
// Add some defining affinities
cyberhusky.hateGod = true;
cyberhusky.allowsButchering = true;
cyberhusky.warrior = true;
// Remove some affinities
cyberhusky.woodAffinity = false;
cyberhusky.befriendCreature = false;
}*/
logger.info("Setting up Achievement templates.");
AchievementChanges.onServerStarted();
DeityChanges.onServerStarted();
//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);
} catch (IllegalAccessException | NoSuchFieldException e) {
logger.info("Failed to set tickTime for stealing!");
e.printStackTrace();
}
SkillTemplate meditating = SkillSystem.templates.get(SkillList.MEDITATING);
try {
ReflectionUtil.setPrivateField(meditating, ReflectionUtil.getField(meditating.getClass(), "tickTime"), TimeConstants.HOUR_MILLIS);
} catch (IllegalAccessException | NoSuchFieldException e) {
logger.info("Failed to set tickTime for meditating!");
e.printStackTrace();
}
meditating.setDifficulty(300f);
SkillChanges.onServerStarted();
CreationEntry lockpicks = CreationMatrix.getInstance().getCreationEntry(ItemList.lockpick);
try {
@@ -512,88 +388,10 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
e.printStackTrace();
}
// Set mining difficulty down to be equivalent to digging.
SkillTemplate mining = SkillSystem.templates.get(SkillList.MINING);
mining.setDifficulty(3000f);
// Triple lockpicking skill
SkillTemplate lockpicking = SkillSystem.templates.get(SkillList.LOCKPICKING);
lockpicking.setDifficulty(700f);
} catch (IllegalArgumentException | ClassCastException e) {
e.printStackTrace();
}
try {
Connection con = ModSupportDb.getModSupportDb();
String sql;
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();
}
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();
}
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();
}
}
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();
try {
Connection dbcon;
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO ObjectiveTimers (ID, TIMER) VALUES(\"DEPOT\", 0)");
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
try {
Connection dbcon;
dbcon = ModSupportDb.getModSupportDb();
ps = dbcon.prepareStatement("INSERT INTO ObjectiveTimers (ID, TIMER) VALUES(\"TITAN\", 0)");
ps.executeUpdate();
ps.close();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
}
SupplyDepots.initializeDepotTimer();
Titans.initializeTitanTimer();
}
catch (SQLException e) {
throw new RuntimeException(e);
}
DatabaseHelper.onServerStarted();
}
public static long lastSecondPolled = 0;
@@ -615,6 +413,8 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
public static final long pollUniqueRegenerationTime = TimeConstants.SECOND_MILLIS;
public static long lastPolledUniqueCollection = 0;
public static final long pollUniqueCollectionTime = TimeConstants.MINUTE_MILLIS*5;
public static long lastPolledTerrainSmooth = 0;
public static final long pollTerrainSmoothTime = TimeConstants.SECOND_MILLIS*5;
@Override
public void onServerPoll() {
if((lastSecondPolled + TimeConstants.SECOND_MILLIS) < System.currentTimeMillis()){
@@ -654,7 +454,11 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
CombatChanges.pollUniqueCollection();
lastPolledUniqueCollection += pollUniqueCollectionTime;
}
if(lastPolledTerrainSmooth + pollTerrainSmoothTime < System.currentTimeMillis()){
SmoothTerrainAction.onServerPoll();
lastPolledTerrainSmooth += pollTerrainSmoothTime;
}
// Update counter
if(lastSecondPolled + TimeConstants.SECOND_MILLIS*10 > System.currentTimeMillis()){
lastSecondPolled += TimeConstants.SECOND_MILLIS;
@@ -670,8 +474,19 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
lastPolledBloodlust = System.currentTimeMillis();
lastPolledUniqueRegeneration = System.currentTimeMillis();
lastPolledUniqueCollection = System.currentTimeMillis();
lastPolledTerrainSmooth = System.currentTimeMillis();
}
}
}
@Override
public MessagePolicy onKingdomMessage(Message message) {
String window = message.getWindow();
if(window.startsWith("GL-Freedom") && KeyEvent.isActive()){
KeyEvent.handlePlayerMessage(message);
}
return MessagePolicy.PASS;
}
}

View File

@@ -5,6 +5,8 @@ import java.util.Random;
import java.util.logging.Logger;
import com.wurmonline.mesh.Tiles;
import com.wurmonline.server.Servers;
import com.wurmonline.server.behaviours.AutoEquipMethods;
import com.wurmonline.server.combat.Weapon;
import com.wurmonline.server.creatures.*;
import com.wurmonline.server.items.*;
@@ -627,6 +629,11 @@ public class MethodsBestiary {
// Goblin leader natural armour increase:
setNaturalArmour(CreatureTemplate.GOBLIN_LEADER_CID, 0.055f);
// Worg armour reduction on Arena
if(Servers.localServer.PVPSERVER) {
setNaturalArmour(CreatureTemplate.WORG_CID, 0.3f);
}
// Make titan minions drop no corpse
setNoCorpse(IfritFiend.templateId);
setNoCorpse(IfritSpider.templateId);

View File

@@ -6,11 +6,7 @@ import java.util.Random;
import java.util.logging.Logger;
import com.wurmonline.mesh.Tiles;
import com.wurmonline.server.FailedException;
import com.wurmonline.server.HistoryManager;
import com.wurmonline.server.Players;
import com.wurmonline.server.Server;
import com.wurmonline.server.Servers;
import com.wurmonline.server.*;
import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.creatures.CreatureTemplate;
import com.wurmonline.server.creatures.CreatureTemplateFactory;
@@ -18,6 +14,7 @@ import com.wurmonline.server.creatures.Creatures;
import com.wurmonline.server.items.*;
import com.wurmonline.server.villages.Village;
import com.wurmonline.server.villages.Villages;
import mod.piddagoras.duskombat.DamageEngine;
import mod.sin.creatures.Reaper;
import mod.sin.creatures.SpectralDrake;
import mod.sin.items.AffinityOrb;
@@ -39,14 +36,14 @@ public class LootBounty {
protected static final Random random = new Random();
public static void displayLootAssistance(Creature mob){
if(Bounty.dealtDamage.containsKey(mob.getWurmId())){
if(DamageEngine.dealtDamage.containsKey(mob.getWurmId())){
logger.info("Found the damageDealt entry, parsing...");
ArrayList<String> names = new ArrayList<String>();
ArrayList<Double> damages = new ArrayList<Double>();
for(long creatureId : Bounty.dealtDamage.get(mob.getWurmId()).keySet()){
for(long creatureId : DamageEngine.dealtDamage.get(mob.getWurmId()).keySet()){
if(Players.getInstance().getPlayerOrNull(creatureId) != null){
names.add(Players.getInstance().getPlayerOrNull(creatureId).getName());
damages.add(Bounty.dealtDamage.get(mob.getWurmId()).get(creatureId));
damages.add(DamageEngine.dealtDamage.get(mob.getWurmId()).get(creatureId));
}else{
if(Creatures.getInstance().getCreatureOrNull(creatureId) != null){
logger.info("Skipping creature "+Creatures.getInstance().getCreatureOrNull(creatureId).getName()+" in loot assistance.");
@@ -158,14 +155,14 @@ public class LootBounty {
e.printStackTrace();
}
}
public static void blessWorldWithMoonVeins(Creature mob){
int i = 20;
int i = 8+Server.rand.nextInt(5);
while(i > 0){
int x = random.nextInt(Server.surfaceMesh.getSize());
int y = random.nextInt(Server.surfaceMesh.getSize());
short height = Tiles.decodeHeight(Server.surfaceMesh.getTile(x, y));
int type = Tiles.decodeType((int)Server.caveMesh.getTile(x, y));
int type = Tiles.decodeType(Server.caveMesh.getTile(x, y));
if(height >= 100 && (type == Tiles.Tile.TILE_CAVE_WALL.id || type == Tiles.Tile.TILE_CAVE.id)){
Tiles.Tile tileType = random.nextBoolean() ? Tiles.Tile.TILE_CAVE_WALL_ORE_ADAMANTINE : Tiles.Tile.TILE_CAVE_WALL_ORE_GLIMMERSTEEL;
Server.caveMesh.setTile(x, y, Tiles.encode(Tiles.decodeHeight(Server.caveMesh.getTile(x, y)), tileType.id, Tiles.decodeData(Server.caveMesh.getTile(x, y))));
@@ -173,8 +170,8 @@ public class LootBounty {
Server.setCaveResource(x, y, 400+random.nextInt(600));
Village v = Villages.getVillage(x, y, true);
if (v == null) {
for (int vx = -50; vx < 50; vx += 5) {
for (int vy = -50; vy < 50 && (v = Villages.getVillage(x + vx, y + vy, true)) == null; vy += 5) {
for (int vx = -20; vx < 20; vx += 5) {
for (int vy = -20; vy < 20 && (v = Villages.getVillage(x + vx, y + vy, true)) == null; vy += 5) {
}
if(v != null){
break;
@@ -183,6 +180,7 @@ public class LootBounty {
}
if(v != null){
HistoryManager.addHistory(mob.getTemplate().getName(), "blesses the world with a "+tileType.getName()+" near "+v.getName()+"!");
MiscChanges.sendServerTabMessage("rumors",mob.getTemplate().getName()+" blesses the world with a "+tileType.getName()+" near "+v.getName()+"!", 255, 255, 255);
}
logger.info("Placed a "+tileType.getName()+" at "+x+", "+y+" - "+height+" height");
i--;
@@ -338,6 +336,23 @@ public class LootBounty {
boolean sendLootHelp = false;
// Begin loot table drops
int templateId = mob.getTemplate().getTemplateId();
if(Servers.localServer.PVPSERVER && mob.isPlayer()){
if(mob.isDeathProtected()) {
logger.info("Death protection was active for " + mob.getName() + ". Inserting silver coin reward.");
try {
Item silver = ItemFactory.createItem(ItemList.coinSilver, 99f, null);
corpse.insertItem(silver, true);
} catch (FailedException | NoSuchTemplateException e) {
e.printStackTrace();
}
}
Item[] items = mob.getAllItems();
for(Item item : items){
if(item.isRepairable()){
item.setDamage(Math.min(99f, item.getDamage() + Math.max(10f+(Server.rand.nextFloat()*5f), 10f * item.getDamageModifier(false))));
}
}
}
if(templateId == Reaper.templateId || templateId == SpectralDrake.templateId){
Server.getInstance().broadCastAlert("The "+mob.getName()+" has been slain. A new creature shall enter the realm shortly.");
sendLootHelp = true;
@@ -383,7 +398,7 @@ public class LootBounty {
spawnFriyanTablets();
// Add unique loot
insertUniqueLoot(mob, corpse);
// Spawn Spectral Drake
/*if (mob.isDragon()) { // Spawn the spectral drake and add extra hide/scale
handleDragonLoot(mob, corpse);

View File

@@ -18,6 +18,9 @@ import com.wurmonline.server.items.ItemTemplate;
import com.wurmonline.server.items.NoSuchTemplateException;
import com.wurmonline.server.players.Player;
import com.wurmonline.server.players.Titles.Title;
import com.wurmonline.server.skills.NoSuchSkillException;
import com.wurmonline.server.skills.SkillList;
import mod.piddagoras.duskombat.DamageEngine;
import mod.sin.armour.SpectralHide;
import mod.sin.creatures.Reaper;
import mod.sin.creatures.SpectralDrake;
@@ -141,7 +144,7 @@ public class PlayerBounty {
return;
}
}
if(Bounty.dealtDamage.containsKey(mobWurmId) && Bounty.dealtDamage.get(mobWurmId).containsKey(player.getWurmId())){
if(DamageEngine.dealtDamage.containsKey(mobWurmId) && DamageEngine.dealtDamage.get(mobWurmId).containsKey(player.getWurmId())){
// -- Damage Dealt Rewards -- //
/*if(mob.isUnique()){
// Treasure boxes awarded to players who deal damage:
@@ -234,7 +237,7 @@ public class PlayerBounty {
try {
//Map<Long, Long> attackers = ReflectionUtil.getPrivateField(creature, ReflectionUtil.getField(creature.getClass(), "attackers"));
Map<Long, Long> attackers = Bounty.getAttackers(creature);
if(!Bounty.isCombatant(attackers, player.getWurmId()) || creature.isPlayer() || creature.isReborn()){
if((attackers != null && !Bounty.isCombatant(attackers, player.getWurmId())) || creature.isPlayer() || creature.isReborn()){
return;
}
logger.info(player.getName()+" killed "+creature.getName());

View File

@@ -92,6 +92,7 @@ public class Mastercraft {
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Home_Decorator", 600, "Home Decorator", "Home Decorator", -1, "NORMAL");
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Arena_Champion", 601, "Champion of the Arena", "Champion of the Arena", -1, "NORMAL");
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Pastamancer", 602, "Pastamancer", "Pastamancer", -1, "NORMAL");
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Pizzamancer", 603, "Pizzamancer", "Pizzamancer", -1, "NORMAL");
// Special Event Titles
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Titan_Slayer", 700, "Titanslayer", "Titanslayer", -1, "NORMAL");
@@ -111,6 +112,7 @@ public class Mastercraft {
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Genocide_GrandDesigner", 808, "Grand Designer", "Grand Designer", -1, "NORMAL");
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Seleas_CrazyCatLord", 809, "The Crazy Cat Lord", "The Crazy Cat Lord", -1, "NORMAL");
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Piratemax_Slave", 810, "Slave", "Slave", -1, "NORMAL");
ExtendTitleEnum.getSingletonInstance().addExtendEntry("Eltacolad_TrueTaco", 811, "The One True Taco", "The One True Taco", -1, "NORMAL");
// Characteristic Titles
ExtendTitleEnum.getSingletonInstance().addExtendEntry("MindLogic_Normal", 1000, "Logical", "Logical", 100, "NORMAL");

View File

@@ -33,6 +33,14 @@ public class ItemUtil {
ItemList.tomeMagicBlue,
ItemList.tomeMagicWhite
};
public static boolean isSorcery(Item item){
for(int id : sorceryIds){
if(item.getTemplateId() == id){
return true;
}
}
return false;
}
public static int[] plateChainTemplates = {
ItemList.plateBoot,
ItemList.plateGauntlet,
@@ -271,4 +279,24 @@ public class ItemUtil {
}
return null;
}
public static boolean isSingleUseRune(byte rune){
if(rune == -80){
return true;
}else if(rune == -81){
return true;
}else if(rune == -91){
return true;
}else if(rune == -97){
return true;
}else if(rune == -104){
return true;
}else if(rune == -107){
return true;
}else if(rune == -119){
return true;
}else if(rune == -126){
return true;
}
return false;
}
}