Skip to content

Commit

Permalink
Update to latest version 1.2 for Wurm Unlimited 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Sindusk committed Feb 2, 2019
1 parent ba8dde1 commit 23fac18
Show file tree
Hide file tree
Showing 17 changed files with 153 additions and 183 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'java'

group "mod.sin"
version "1.1"
version "1.2"

repositories {
mavenCentral()
Expand All @@ -11,7 +11,7 @@ repositories {
}

dependencies {
compile 'org.gotti.wurmunlimited:server-modlauncher:0.37'
compile 'org.gotti.wurmunlimited:server-modlauncher:0.39-beta1'
compile 'com.github.Sindusk:sindusklibrary:v1.7'
compile 'com.github.Sindusk:DiscordRelay:v1.2'
compile 'com.github.Sindusk:DUSKombat:v1.0'
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/mod/sin/creatures/Reaper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.wurmonline.server.bodys.BodyTemplate;
import com.wurmonline.server.bodys.Wound;
import com.wurmonline.server.combat.ArmourTemplate;
import com.wurmonline.server.combat.ArmourTypes;
import com.wurmonline.server.items.Materials;
import com.wurmonline.server.skills.SkillList;
Expand Down Expand Up @@ -30,25 +31,25 @@ public CreatureTemplateBuilder createCreateTemplateBuilder() {
"The reaper, here to claim the souls of the living.", "model.creature.gmdark",
types, BodyTemplate.TYPE_HUMAN, (short) 20, (byte) 0, (short) 350, (short) 100, (short) 60, "sound.death.dragon",
"sound.death.dragon", "sound.combat.hit.dragon", "sound.combat.hit.dragon",
0.10f, 35.0f, 45.0f, 22.0f, 40.0f, 0.0f, 1.0f, 500,
0.09f, 37.0f, 48.0f, 25.0f, 45.0f, 0.0f, 1.0f, 500,
new int[]{}, 20, 70, Materials.MATERIAL_MEAT_HUMANOID);

builder.skill(SkillList.BODY_STRENGTH, 60.0f);
builder.skill(SkillList.BODY_STRENGTH, 70.0f);
builder.skill(SkillList.BODY_STAMINA, 70.0f);
builder.skill(SkillList.BODY_CONTROL, 60.0f);
builder.skill(SkillList.MIND_LOGICAL, 35.0f);
builder.skill(SkillList.MIND_SPEED, 45.0f);
builder.skill(SkillList.SOUL_STRENGTH, 80.0f);
builder.skill(SkillList.SOUL_DEPTH, 80.0f);
builder.skill(SkillList.WEAPONLESS_FIGHTING, 80.0f);
builder.skill(SkillList.GROUP_FIGHTING, 80.0f);
builder.skill(SkillList.WEAPONLESS_FIGHTING, 85.0f);
builder.skill(SkillList.GROUP_FIGHTING, 85.0f);

builder.boundsValues(-0.5f, -1.0f, 0.5f, 1.42f);
builder.handDamString("slice");
builder.kickDamString("reap");
builder.maxAge(200);
builder.armourType(ArmourTypes.ARMOUR_SCALE_DRAGON);
builder.baseCombatRating(55.0f);
builder.armourType(ArmourTemplate.ARMOUR_TYPE_LEATHER_DRAGON);
builder.baseCombatRating(58.0f);
builder.combatDamageType(Wound.TYPE_PIERCE);
builder.maxGroupAttackSize(100);

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/mod/sin/items/AffinityOrb.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ public void createTemplate() throws IOException{
itemBuilder.name(name, "affinity orbs", "A valuable orb that infuses the user with hidden knowledge.");
itemBuilder.descriptions("brilliantly glowing", "strongly glowing", "faintly glowing", "barely glowing");
itemBuilder.itemTypes(new short[]{
ItemTypes.ITEM_TYPE_MAGIC,
ItemTypes.ITEM_TYPE_NODROP,
ItemTypes.ITEM_TYPE_FULLPRICE,
ItemTypes.ITEM_TYPE_NOSELLBACK,
ItemTypes.ITEM_TYPE_ALWAYS_BANKABLE
ItemTypes.ITEM_TYPE_NOSELLBACK
});
itemBuilder.imageNumber((short) 919);
itemBuilder.behaviourType((short) 1);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mod/sin/items/EternalOrb.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void createTemplate() throws IOException{
itemBuilder.difficulty(5.0f);
itemBuilder.weightGrams(500);
itemBuilder.material(Materials.MATERIAL_CRYSTAL);
itemBuilder.value(200000);
itemBuilder.value(100000);
itemBuilder.isTraded(true);

ItemTemplate template = itemBuilder.build();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mod/sin/items/EternalReservoir.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void createTemplate() throws IOException{
ItemTypes.ITEM_TYPE_NOTAKE,
ItemTypes.ITEM_TYPE_DECORATION,
ItemTypes.ITEM_TYPE_USE_GROUND_ONLY,
ItemTypes.ITEM_TYPE_HASDATA,
ItemTypes.ITEM_TYPE_NEVER_SHOW_CREATION_WINDOW_OPTION,
ItemTypes.ITEM_TYPE_NOT_MISSION
});
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mod/sin/weapons/BattleYoyo.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void createTemplate() throws IOException{
itemBuilder.behaviourType((short) 35);
itemBuilder.combatDamage(35);
itemBuilder.decayTime(Long.MAX_VALUE);
itemBuilder.dimensions(5, 10, 80);
itemBuilder.dimensions(5, 10, 20);
itemBuilder.primarySkill(SkillList.YOYO);
itemBuilder.bodySpaces(MiscConstants.EMPTY_BYTE_PRIMITIVE_ARRAY);
itemBuilder.modelName("model.toy.yoyo.");
Expand Down
34 changes: 11 additions & 23 deletions src/main/java/mod/sin/wyvern/Arena.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public static void sendNewSpawnQuestion(SpawnQuestion sq){
}

public static void sendHotaMessage(String message){
if (SupplyDepots.host != null) {
MiscChanges.sendGlobalFreedomChat(SupplyDepots.host, message, 200, 200, 200);
}
DiscordRelay.sendToDiscord("arena", message, true);
}

Expand Down Expand Up @@ -114,18 +117,9 @@ public static void createNewHotaPrize(Village v, int winStreak){
}
statue.setAuxData((byte)winStreak);
}
int r = winStreak * 50 & 255;
int g = 0;
int b = 0;
if (winStreak > 5 && winStreak < 16) {
r = 0;
}
if (winStreak > 5 && winStreak < 20) {
g = winStreak * 50 & 255;
}
if (winStreak > 5 && winStreak < 30) {
b = winStreak * 50 & 255;
}
int r = (winStreak + Server.rand.nextInt(5)) * 50 & 255;
int g = (winStreak + Server.rand.nextInt(5)) * 80 & 255;
int b = (winStreak + Server.rand.nextInt(5)) * 120 & 255;
statue.setColor(WurmColor.createColor(r, g, b));
statue.getColor();
Zone z = Zones.getZone(statue.getTileX(), statue.getTileY(), true);
Expand Down Expand Up @@ -180,16 +174,16 @@ public static void createNewHotaPrize(Village v, int winStreak){
statue.insertItem(token, true);
i--;
}
// Add 3-5 seryll lumps of medium ql
i = 3+Server.rand.nextInt(3); // 3-5 lumps
// Add 4-6 seryll lumps of medium ql
i = 4+Server.rand.nextInt(3); // 4-6 lumps
while(i > 0){
Item seryll = ItemFactory.createItem(ItemList.seryllBar, 40f+(60f*Server.rand.nextFloat()), null);
statue.insertItem(seryll, true);
i--;
}
// Add 2-4 silver
long iron = 20000; // 2 silver
iron += Server.rand.nextInt(20000); // add up to 2 more silver
// Add 3-6 silver
long iron = 30000; // 3 silver
iron += Server.rand.nextInt(30000); // add up to 3 more silver
Item[] coins = Economy.getEconomy().getCoinsFor(iron);
for(Item coin : coins){
statue.insertItem(coin, true);
Expand Down Expand Up @@ -481,12 +475,6 @@ public void edit(MethodCall m) throws CannotCompileException {
String desc3 = Descriptor.ofMethod(CtClass.voidType, params3);
replace = "$_ = com.wurmonline.server.Servers.localServer.PVPSERVER && !lVehicle.isLocked();";
Util.instrumentDescribed(thisClass, ctCreature, "setVehicle", desc3, "isThisAChaosServer", replace);

// - Allow managing animals on Arena - //
CtClass ctManageMenu = classPool.get("com.wurmonline.server.behaviours.ManageMenu");
replace = "$_ = false;";
Util.instrumentDeclared(thisClass, ctManageMenu, "getBehavioursFor", "isThisAPvpServer", replace);
Util.instrumentDeclared(thisClass, ctManageMenu, "action", "isThisAPvpServer", replace);

// - Multiply mine door bash damage by 3 on Arena - //
CtClass ctTerraforming = classPool.get("com.wurmonline.server.behaviours.Terraforming");
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/mod/sin/wyvern/Crystals.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.wurmonline.server.items.NotOwnedException;
import com.wurmonline.server.skills.NoSuchSkillException;
import com.wurmonline.server.skills.SkillList;
import com.wurmonline.server.spells.SpellEffect;
import com.wurmonline.shared.constants.Enchants;
import mod.sin.items.ChaosCrystal;
import mod.sin.items.EnchantersCrystal;
Expand Down Expand Up @@ -63,7 +64,18 @@ public static double getEnchantersInfusionDifficulty(Creature performer, Item so
e.printStackTrace();
}
if(target.getSpellEffects() != null){
diff += target.getSpellEffects().getEffects().length*10;
for (SpellEffect eff : target.getSpellEffects().getEffects()){
// Double power-based penalty for BotD
if (eff.type == Enchants.BUFF_BLESSINGDARK){
diff += eff.getPower() * 0.1f;
}
if (eff.type != Enchants.BUFF_BLOODTHIRST) {
diff += eff.getPower() * 0.1f;
}else{
// Bloodthirst penalty (1 per 1000 power)
diff += eff.getPower() * 0.001f;
}
}
}
return diff;
}
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/mod/sin/wyvern/EconomicChanges.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ public static void preInit(){
replace = "$_ = "+EconomicChanges.class.getName()+".getNewVillageTiles(vill.getNumTiles());";
Util.instrumentDeclared(thisClass, ctGuardPlan, "getMonthlyCost", "getNumTiles", replace);

Util.setReason("Disable upkeep on arena for now until a fix can be found.");
replace = "if(com.wurmonline.server.Servers.localServer.PVPSERVER){"
+ " $_ = false;"
+ "}else{" +
" $_ = $proceed($$);" +
"}";
//replace = "$_ = false;";
Util.instrumentDeclared(thisClass, ctGuardPlan, "getMonthlyCost", "isUpkeep", replace);

/*Util.setReason("Allow players to get a full deed refund.");
replace = "{ return "+EconomicChanges.class.getName()+".getNewDisbandMoney(this, this.getVillage()); }";
Util.setBodyDeclared(thisClass, ctGuardPlan, "getDisbandMoneyLeft", replace);*/
Expand All @@ -114,8 +123,8 @@ public static void preInit(){
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);
}
} catch ( NotFoundException | IllegalArgumentException | ClassCastException e) {
throw new HookException(e);
}
}
}
60 changes: 21 additions & 39 deletions src/main/java/mod/sin/wyvern/ItemMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import com.wurmonline.server.Servers;
import com.wurmonline.server.combat.ArmourTemplate;
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;
import org.gotti.wurmunlimited.modsupport.actions.ModActions;

import com.wurmonline.server.behaviours.ActionEntry;
import com.wurmonline.server.combat.Armour;
import com.wurmonline.server.combat.Weapon;
import com.wurmonline.server.creatures.Creature;
import com.wurmonline.server.items.Item;
Expand Down Expand Up @@ -116,7 +115,6 @@ public static void createItems(){
CORPSE_DECORATION.createTemplate();
DEPTH_DRILL.createTemplate();
DISINTEGRATION_ROD.createTemplate();
//ELECTRUM_LUMP.createTemplate();
ENCHANT_ORB.createTemplate();
ETERNAL_ORB.createTemplate();
EVISCERATOR.createTemplate();
Expand Down Expand Up @@ -200,7 +198,6 @@ public static void initCreationEntries(){
//COIN_DECORATION.initCreationEntry();
//CORPSE_DECORATION.initCreationEntry();
DEPTH_DRILL.initCreationEntry();
//ELECTRUM_LUMP.initCreationEntry();
EVISCERATOR.initCreationEntry();
KNUCKLES.initCreationEntry();
MASS_STORAGE_UNIT.initCreationEntry();
Expand All @@ -227,47 +224,28 @@ public static void initCreationEntries(){
GLIMMERSCALE_HOSE.initCreationEntry();
GLIMMERSCALE_SLEEVE.initCreationEntry();
GLIMMERSCALE_VEST.initCreationEntry();*/

// Allow sickle heads from steel & moon metals:
// [3/28/18] Disabled: Implemented in WU 1.6.
/*CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_WEAPON_BLADES, ItemList.anvilLarge, ItemList.steelBar,
ItemList.sickleBlade, false, true, 0.0f, false, false, CreationCategories.BLADES);
CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_WEAPON_BLADES, ItemList.anvilLarge, ItemList.adamantineBar,
ItemList.sickleBlade, false, true, 0.0f, false, false, CreationCategories.BLADES);
CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_WEAPON_BLADES, ItemList.anvilLarge, ItemList.glimmerSteelBar,
ItemList.sickleBlade, false, true, 0.0f, false, false, CreationCategories.BLADES);
CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_WEAPON_BLADES, ItemList.anvilLarge, ItemList.seryllBar,
ItemList.sickleBlade, false, true, 0.0f, false, false, CreationCategories.BLADES);
// Allow steel staff to be created from moon metals:
CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_WEAPON_BLADES, ItemList.anvilLarge, ItemList.adamantineBar,
ItemList.staffSteel, false, true, 0.0f, false, false, CreationCategories.BLADES);
CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_WEAPON_BLADES, ItemList.anvilLarge, ItemList.glimmerSteelBar,
ItemList.staffSteel, false, true, 0.0f, false, false, CreationCategories.BLADES);
CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_WEAPON_BLADES, ItemList.anvilLarge, ItemList.seryllBar,
ItemList.staffSteel, false, true, 0.0f, false, false, CreationCategories.BLADES);*/
}

public static void createCustomArmours(){
try {
logger.info("Beginning custom armour creation.");
Map<Integer, Armour> armours = ReflectionUtil.getPrivateField(null, ReflectionUtil.getField(Armour.class, "armours"));

armours.put(SpectralBoot.templateId, new Armour(SpectralBoot.templateId, 0.002f, 0.3f));
armours.put(SpectralCap.templateId, new Armour(SpectralCap.templateId, 0.003f, 0.3f));
armours.put(SpectralGlove.templateId, new Armour(SpectralGlove.templateId, 0.002f, 0.3f));
armours.put(SpectralHose.templateId, new Armour(SpectralHose.templateId, 0.0075f, 0.3f));
armours.put(SpectralJacket.templateId, new Armour(SpectralJacket.templateId, 0.01f, 0.3f));
armours.put(SpectralSleeve.templateId, new Armour(SpectralSleeve.templateId, 0.004f, 0.3f));

armours.put(GlimmerscaleBoot.templateId, new Armour(GlimmerscaleBoot.templateId, 0.002f, 0.15f));
armours.put(GlimmerscaleGlove.templateId, new Armour(GlimmerscaleGlove.templateId, 0.001f, 0.15f));
armours.put(GlimmerscaleHelmet.templateId, new Armour(GlimmerscaleHelmet.templateId, 0.008f, 0.15f));
armours.put(GlimmerscaleHose.templateId, new Armour(GlimmerscaleHose.templateId, 0.05f, 0.15f));
armours.put(GlimmerscaleSleeve.templateId, new Armour(GlimmerscaleSleeve.templateId, 0.008f, 0.15f));
armours.put(GlimmerscaleVest.templateId, new Armour(GlimmerscaleVest.templateId, 0.05f, 0.15f));

new ArmourTemplate(SpectralBoot.templateId, ArmourTemplate.ARMOUR_TYPE_LEATHER_DRAGON, 0.002f);
new ArmourTemplate(SpectralCap.templateId, ArmourTemplate.ARMOUR_TYPE_LEATHER_DRAGON, 0.003f);
new ArmourTemplate(SpectralGlove.templateId, ArmourTemplate.ARMOUR_TYPE_LEATHER_DRAGON, 0.002f);
new ArmourTemplate(SpectralHose.templateId, ArmourTemplate.ARMOUR_TYPE_LEATHER_DRAGON, 0.0075f);
new ArmourTemplate(SpectralJacket.templateId, ArmourTemplate.ARMOUR_TYPE_LEATHER_DRAGON, 0.01f);
new ArmourTemplate(SpectralSleeve.templateId, ArmourTemplate.ARMOUR_TYPE_LEATHER_DRAGON, 0.004f);

new ArmourTemplate(GlimmerscaleBoot.templateId, ArmourTemplate.ARMOUR_TYPE_SCALE_DRAGON, 0.002f);
new ArmourTemplate(GlimmerscaleGlove.templateId, ArmourTemplate.ARMOUR_TYPE_SCALE_DRAGON, 0.001f);
new ArmourTemplate(GlimmerscaleHelmet.templateId, ArmourTemplate.ARMOUR_TYPE_SCALE_DRAGON, 0.008f);
new ArmourTemplate(GlimmerscaleHose.templateId, ArmourTemplate.ARMOUR_TYPE_SCALE_DRAGON, 0.05f);
new ArmourTemplate(GlimmerscaleSleeve.templateId, ArmourTemplate.ARMOUR_TYPE_SCALE_DRAGON, 0.008f);
new ArmourTemplate(GlimmerscaleVest.templateId, ArmourTemplate.ARMOUR_TYPE_SCALE_DRAGON, 0.05f);

//ReflectionUtil.setPrivateField(null, ReflectionUtil.getField(Armour.class, "armours"), armours);
} catch (IllegalArgumentException | IllegalAccessException | ClassCastException | NoSuchFieldException e) {
} catch (IllegalArgumentException | ClassCastException e) {
e.printStackTrace();
}
}
Expand All @@ -277,7 +255,7 @@ public static void createCustomWeapons(){
logger.info("Beginning custom weapon creation.");
new Weapon(BattleYoyo.templateId, 6.85f, 3.85f, 0.008f, 2, 2, 0.0f, 0d);
new Weapon(Club.templateId, 8.1f, 4.5f, 0.002f, 3, 3, 0.4f, 0.5d);
new Weapon(Knuckles.templateId, 3.6f, 2.2f, 0.002f, 1, 1, 0.2f, 0.5d);
new Weapon(Knuckles.templateId, 3.7f, 2.2f, 0.002f, 1, 1, 0.2f, 0.5d);
new Weapon(Warhammer.templateId, 9.40f, 5.6f, 0.008f, 4, 3, 1f, 0d);
//new Weapon(ItemList.stoneChisel, 50f, 1f, 0.5f, 8, 1, 3f, -5f);
// Titan weaponry
Expand Down Expand Up @@ -360,6 +338,10 @@ public static void modifyItems() throws NoSuchTemplateException, IllegalArgument
ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "value"), 100000);
ReflectionUtil.setPrivateField(creatureCage, ReflectionUtil.getField(creatureCage.getClass(), "fullprice"), true);

// Resurrection Stones to 2 silver instead of 5 silver.
ItemTemplate resurrectionStone = ItemTemplateFactory.getInstance().getTemplate(ItemList.resurrectionStone);
ReflectionUtil.setPrivateField(resurrectionStone, ReflectionUtil.getField(resurrectionStone.getClass(), "value"), 20000);

// 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);
Expand Down
Loading

0 comments on commit 23fac18

Please sign in to comment.