Schematics, gremlins, holiday items added. Untested
This commit is contained in:
75
src/main/java/mod/sin/creatures/Gremlin.java
Normal file
75
src/main/java/mod/sin/creatures/Gremlin.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package mod.sin.creatures;
|
||||
|
||||
import com.wurmonline.mesh.Tiles;
|
||||
import com.wurmonline.server.bodys.BodyTemplate;
|
||||
import com.wurmonline.server.bodys.Wound;
|
||||
import com.wurmonline.server.creatures.CreatureTemplate;
|
||||
import com.wurmonline.server.creatures.CreatureTemplateFactory;
|
||||
import com.wurmonline.server.creatures.Creatures;
|
||||
import com.wurmonline.server.creatures.NoSuchCreatureTemplateException;
|
||||
import com.wurmonline.server.items.ItemList;
|
||||
import com.wurmonline.server.skills.SkillList;
|
||||
import com.wurmonline.shared.constants.CreatureTypes;
|
||||
import org.gotti.wurmunlimited.modsupport.CreatureTemplateBuilder;
|
||||
import org.gotti.wurmunlimited.modsupport.creatures.EncounterBuilder;
|
||||
import org.gotti.wurmunlimited.modsupport.creatures.ModCreature;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Gremlin implements ModCreature, CreatureTypes {
|
||||
public static int templateId;
|
||||
@Override
|
||||
public CreatureTemplateBuilder createCreateTemplateBuilder() {
|
||||
int[] types = new int[] {
|
||||
CreatureTypes.C_TYPE_MOVE_LOCAL,
|
||||
CreatureTypes.C_TYPE_AGG_HUMAN,
|
||||
CreatureTypes.C_TYPE_HUNTING,
|
||||
CreatureTypes.C_TYPE_MONSTER,
|
||||
CreatureTypes.C_TYPE_CARNIVORE
|
||||
};
|
||||
|
||||
CreatureTemplateBuilder builder = new CreatureTemplateBuilder("mod.creature.gremlin", "gremlin",
|
||||
"Small creature that enjoys ruining christmas.", "model.creature.humanoid.goblin.standard",
|
||||
types,
|
||||
BodyTemplate.TYPE_HUMAN, (short)5, (byte)0, (short)130,
|
||||
(short)30, (short)20, "sound.death.goblin", "sound.death.goblin",
|
||||
"sound.combat.hit.goblin", "sound.combat.hit.goblin",
|
||||
0.7f, 3.0f, 5.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.7f, 1500, new int[] {ItemList.heart}, 10, 94);
|
||||
|
||||
builder.skill(SkillList.BODY_STRENGTH, 20.0f);
|
||||
builder.skill(SkillList.BODY_STAMINA, 15.0f);
|
||||
builder.skill(SkillList.BODY_CONTROL, 20.0f);
|
||||
builder.skill(SkillList.MIND_LOGICAL, 10.0f);
|
||||
builder.skill(SkillList.MIND_SPEED, 12.0f);
|
||||
builder.skill(SkillList.SOUL_STRENGTH, 15.0f);
|
||||
builder.skill(SkillList.SOUL_DEPTH, 26.0f);
|
||||
builder.skill(SkillList.WEAPONLESS_FIGHTING, 7.0f);
|
||||
builder.skill(SkillList.GROUP_FIGHTING, 40.0f);
|
||||
|
||||
builder.handDamString("claws");
|
||||
builder.alignment(-40.0f);
|
||||
builder.maxAge(100);
|
||||
builder.baseCombatRating(7.0f);
|
||||
builder.combatDamageType(Wound.TYPE_PIERCE);
|
||||
builder.denName("gremlin hole");
|
||||
builder.hasHands(true);
|
||||
builder.maxPercentOfCreatures(.06f);
|
||||
|
||||
templateId = builder.getTemplateId();
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEncounters() {
|
||||
|
||||
if (templateId == 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
new EncounterBuilder(Tiles.Tile.TILE_TREE.id)
|
||||
.addCreatures(templateId, 5)
|
||||
.build(1);
|
||||
|
||||
}
|
||||
}
|
||||
58
src/main/java/mod/sin/items/CrystalPermaFrost.java
Normal file
58
src/main/java/mod/sin/items/CrystalPermaFrost.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package mod.sin.items;
|
||||
|
||||
import com.wurmonline.server.MiscConstants;
|
||||
import com.wurmonline.server.items.*;
|
||||
import com.wurmonline.server.skills.SkillList;
|
||||
import org.gotti.wurmunlimited.modsupport.ItemTemplateBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class CrystalPermaFrost implements MiscConstants, ItemTypes {
|
||||
public static Logger logger = Logger.getLogger(CrystalPermaFrost.class.getName());
|
||||
public static int templateId;
|
||||
String name = "crystal of permafrost";
|
||||
|
||||
public void createTemplate() throws IOException {
|
||||
ItemTemplateBuilder itemBuilder = new ItemTemplateBuilder("mod.item.crystal.permafrost");
|
||||
itemBuilder.name(name, "crystals of permafrost", "It's freezing to the touch, like it's absorbing all the heat.");
|
||||
itemBuilder.descriptions("brilliantly glowing", "strongly glowing", "faintly glowing", "barely glowing");
|
||||
itemBuilder.itemTypes(new short[]{
|
||||
ItemTypes.ITEM_TYPE_MAGIC,
|
||||
ItemTypes.ITEM_TYPE_FULLPRICE,
|
||||
ItemTypes.ITEM_TYPE_NOSELLBACK,
|
||||
ItemTypes.ITEM_TYPE_ALWAYS_BANKABLE
|
||||
});
|
||||
itemBuilder.imageNumber((short) 859);
|
||||
itemBuilder.behaviourType((short) 1);
|
||||
itemBuilder.combatDamage(0);
|
||||
itemBuilder.decayTime(Long.MAX_VALUE);
|
||||
itemBuilder.dimensions(1, 1, 1);
|
||||
itemBuilder.primarySkill((int) NOID);
|
||||
itemBuilder.bodySpaces(EMPTY_BYTE_PRIMITIVE_ARRAY);
|
||||
itemBuilder.modelName("model.valrei.");
|
||||
itemBuilder.difficulty(5.0f);
|
||||
itemBuilder.weightGrams(2000);
|
||||
itemBuilder.material(Materials.MATERIAL_CRYSTAL);
|
||||
itemBuilder.value(0);
|
||||
|
||||
ItemTemplate template = itemBuilder.build();
|
||||
templateId = template.getTemplateId();
|
||||
logger.info(name + " TemplateID: " + templateId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void initCreationEntry() {
|
||||
logger.info("initCreationEntry()");
|
||||
if(templateId > 0){
|
||||
logger.info("Creating "+name+" creation entry, ID = "+templateId);
|
||||
AdvancedCreationEntry ce = CreationEntryCreator.createAdvancedEntry(SkillList.GROUP_ALCHEMY, HolidaySpirit.templateId, HolidaySpirit.templateId,
|
||||
CrystalPermaFrost.templateId, false, false, 0f, true, false,
|
||||
CreationCategories.ALCHEMY);
|
||||
ce.addRequirement(new CreationRequirement(1, HolidaySpirit.templateId, 18, true));
|
||||
}else{
|
||||
logger.info(name+" does not have a template ID on creation entry.");
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/main/java/mod/sin/items/HolidaySpirit.java
Normal file
44
src/main/java/mod/sin/items/HolidaySpirit.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package mod.sin.items;
|
||||
|
||||
import com.wurmonline.server.MiscConstants;
|
||||
import com.wurmonline.server.items.ItemTemplate;
|
||||
import com.wurmonline.server.items.ItemTypes;
|
||||
import com.wurmonline.server.items.Materials;
|
||||
import org.gotti.wurmunlimited.modsupport.ItemTemplateBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class HolidaySpirit implements ItemTypes, MiscConstants {
|
||||
public static Logger logger = Logger.getLogger(HolidaySpirit.class.getName());
|
||||
public static int templateId;
|
||||
|
||||
public void createTemplate() throws IOException {
|
||||
String name = "holiday spirit";
|
||||
ItemTemplateBuilder itemBuilder = new ItemTemplateBuilder("mod.item.holiday.spirit");
|
||||
itemBuilder.name(name, "holiday spirit", "Stolen christmas joy.");
|
||||
itemBuilder.descriptions("brilliantly glowing", "strongly glowing", "faintly glowing", "barely glowing");
|
||||
itemBuilder.itemTypes(new short[]{
|
||||
ItemTypes.ITEM_TYPE_MAGIC,
|
||||
ItemTypes.ITEM_TYPE_FULLPRICE,
|
||||
ItemTypes.ITEM_TYPE_NOSELLBACK,
|
||||
ItemTypes.ITEM_TYPE_ALWAYS_BANKABLE
|
||||
});
|
||||
itemBuilder.imageNumber((short) 859);
|
||||
itemBuilder.behaviourType((short) 1);
|
||||
itemBuilder.combatDamage(0);
|
||||
itemBuilder.decayTime(Long.MAX_VALUE);
|
||||
itemBuilder.dimensions(1, 1, 1);
|
||||
itemBuilder.primarySkill((int) NOID);
|
||||
itemBuilder.bodySpaces(EMPTY_BYTE_PRIMITIVE_ARRAY);
|
||||
itemBuilder.modelName("model.valrei.");
|
||||
itemBuilder.difficulty(5.0f);
|
||||
itemBuilder.weightGrams(100);
|
||||
itemBuilder.material(Materials.MATERIAL_CRYSTAL);
|
||||
itemBuilder.value(0);
|
||||
|
||||
ItemTemplate template = itemBuilder.build();
|
||||
templateId = template.getTemplateId();
|
||||
logger.info(name + " TemplateID: " + templateId);
|
||||
}
|
||||
}
|
||||
54
src/main/java/mod/sin/items/WandPermaFrost.java
Normal file
54
src/main/java/mod/sin/items/WandPermaFrost.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package mod.sin.items;
|
||||
|
||||
import com.wurmonline.server.MiscConstants;
|
||||
import com.wurmonline.server.items.*;
|
||||
import com.wurmonline.server.skills.SkillList;
|
||||
import org.gotti.wurmunlimited.modsupport.ItemTemplateBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class WandPermaFrost implements MiscConstants {
|
||||
public static Logger logger = Logger.getLogger(WandPermaFrost.class.getName());
|
||||
public static int templateId;
|
||||
String name = "wand of permafrost";
|
||||
|
||||
public void createTemplate() throws IOException {
|
||||
ItemTemplateBuilder itemBuilder = new ItemTemplateBuilder("mod.item.wand.permafrost");
|
||||
itemBuilder.name(name, "wands of permafrost", "A powerful wand containing a permafrost crystal.");
|
||||
itemBuilder.descriptions("brilliantly glowing", "strongly glowing", "faintly glowing", "barely glowing");
|
||||
itemBuilder.itemTypes(new short[]{
|
||||
ItemTypes.ITEM_TYPE_MAGIC,
|
||||
ItemTypes.ITEM_TYPE_FULLPRICE,
|
||||
ItemTypes.ITEM_TYPE_NOSELLBACK,
|
||||
ItemTypes.ITEM_TYPE_ALWAYS_BANKABLE
|
||||
});
|
||||
itemBuilder.imageNumber((short) 859);
|
||||
itemBuilder.behaviourType((short) 1);
|
||||
itemBuilder.combatDamage(0);
|
||||
itemBuilder.decayTime(Long.MAX_VALUE);
|
||||
itemBuilder.dimensions(1, 1, 1);
|
||||
itemBuilder.primarySkill((int) NOID);
|
||||
itemBuilder.bodySpaces(EMPTY_BYTE_PRIMITIVE_ARRAY);
|
||||
itemBuilder.modelName("model.valrei.");
|
||||
itemBuilder.difficulty(5.0f);
|
||||
itemBuilder.weightGrams(3000);
|
||||
itemBuilder.material(Materials.MATERIAL_CRYSTAL);
|
||||
itemBuilder.value(0);
|
||||
|
||||
ItemTemplate template = itemBuilder.build();
|
||||
templateId = template.getTemplateId();
|
||||
logger.info(name + " TemplateID: " + templateId);
|
||||
}
|
||||
|
||||
public void initCreationEntry() {
|
||||
logger.info("initCreationEntry()");
|
||||
if(templateId > 0){
|
||||
logger.info("Creating "+name+" creation entry, ID = "+templateId);
|
||||
CreationEntryCreator.createSimpleEntry(SkillList.SMITHING_GOLDSMITHING, CrystalPermaFrost.templateId, ItemList.shaft, templateId,
|
||||
true,true, 0, false, false, CreationCategories.JEWELRY);
|
||||
}else{
|
||||
logger.info(name+" does not have a template ID on creation entry.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,14 @@ public class DatabaseHelper {
|
||||
ps.execute();
|
||||
ps.close();
|
||||
}
|
||||
tableName = "SchematicMap";
|
||||
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', templateid INT 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.");
|
||||
|
||||
@@ -108,6 +108,9 @@ public class ItemMod {
|
||||
public static WoodEssence WOOD_ESSENCE = new WoodEssence();
|
||||
public static ArcaniteNecklace ARCANITE_NECKLACE = new ArcaniteNecklace();
|
||||
public static ArcaniteNecklaceFocus ARCANITE_NECKLACE_FOCUS = new ArcaniteNecklaceFocus();
|
||||
public static HolidaySpirit HOLIDAY_SPIRIT = new HolidaySpirit();
|
||||
public static WandPermaFrost WAND_PERMA_FROST = new WandPermaFrost();
|
||||
public static CrystalPermaFrost CRYSTAL_PERMA_FROST = new CrystalPermaFrost();
|
||||
|
||||
public static void createItems(){
|
||||
logger.info("createItems()");
|
||||
@@ -147,6 +150,9 @@ public class ItemMod {
|
||||
WOOD_ESSENCE.createTemplate();
|
||||
ARCANITE_NECKLACE.createTemplate();
|
||||
ARCANITE_NECKLACE_FOCUS.createTemplate();
|
||||
HOLIDAY_SPIRIT.createTemplate();
|
||||
CRYSTAL_PERMA_FROST.createTemplate();
|
||||
WAND_PERMA_FROST.createTemplate();
|
||||
|
||||
|
||||
// Arena Fragments
|
||||
@@ -234,6 +240,8 @@ public class ItemMod {
|
||||
WOOD_ESSENCE.initCreationEntry();
|
||||
ARCANITE_NECKLACE.initCreationEntry();
|
||||
ARCANITE_NECKLACE_FOCUS.initCreationEntry();
|
||||
CRYSTAL_PERMA_FROST.initCreationEntry();
|
||||
WAND_PERMA_FROST.initCreationEntry();
|
||||
|
||||
|
||||
// Spectral set
|
||||
|
||||
@@ -26,6 +26,7 @@ import mod.sin.items.*;
|
||||
import mod.sin.kingdomoffices.ItemCreator;
|
||||
import mod.sin.lib.Util;
|
||||
import mod.sin.wyvern.bonusoverhaul.ItemBonusOverhaul;
|
||||
import mod.sin.wyvern.schematics.Schematics;
|
||||
import org.gotti.wurmunlimited.modloader.ReflectionUtil;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookException;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
@@ -158,6 +159,7 @@ implements WurmServerMod, Configurable, PreInitable, Initable, ItemTemplatesCrea
|
||||
KeyEvent.preInit();
|
||||
//GemAugmentation.preInit();
|
||||
ItemBonusOverhaul.preInit();
|
||||
Schematics.preInit();
|
||||
|
||||
Class<WyvernMods> thisClass = WyvernMods.class;
|
||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||
|
||||
@@ -40,7 +40,10 @@ public class ItemBonusOverhaul {
|
||||
|
||||
batteries = new Battery[] {
|
||||
new Battery(Soul.templateId, 30),
|
||||
new Battery(ItemList.rubyStar, 10)
|
||||
new Battery(ItemList.rubyStar, 10),
|
||||
new Battery(ItemList.diamondStar, 10),
|
||||
new Battery(ItemList.emeraldStar, 10),
|
||||
new Battery(ItemList.sapphireStar, 10)
|
||||
};
|
||||
|
||||
for(ItemBonusWrapper wrapper: itemBonuses) {
|
||||
|
||||
@@ -15,10 +15,12 @@ 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.Gremlin;
|
||||
import mod.sin.creatures.Reaper;
|
||||
import mod.sin.creatures.SpectralDrake;
|
||||
import mod.sin.items.AffinityOrb;
|
||||
import mod.sin.items.FriyanTablet;
|
||||
import mod.sin.items.HolidaySpirit;
|
||||
import mod.sin.items.caches.*;
|
||||
import mod.sin.wyvern.Bounty;
|
||||
import mod.sin.wyvern.MiscChanges;
|
||||
@@ -388,6 +390,16 @@ public class LootBounty {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(mob.getTemplateId() == Gremlin.templateId) {
|
||||
if(random.nextInt(100) < 20) {
|
||||
try {
|
||||
Item holidaySpirit = ItemFactory.createItem(HolidaySpirit.templateId, 20+(60*random.nextFloat()), "");
|
||||
corpse.insertItem(holidaySpirit);
|
||||
} catch (FailedException | NoSuchTemplateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mob.isUnique()){
|
||||
// Spawn random addy/glimmer veins throughout the world
|
||||
blessWorldWithMoonVeins(mob);
|
||||
|
||||
73
src/main/java/mod/sin/wyvern/schematics/Schematics.java
Normal file
73
src/main/java/mod/sin/wyvern/schematics/Schematics.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package mod.sin.wyvern.schematics;
|
||||
|
||||
import com.wurmonline.server.creatures.Creature;
|
||||
import com.wurmonline.server.items.CreationEntry;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import mod.sin.items.WandPermaFrost;
|
||||
import mod.sin.lib.Util;
|
||||
import org.gotti.wurmunlimited.modloader.classhooks.HookManager;
|
||||
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.ArrayList;
|
||||
|
||||
public class Schematics {
|
||||
private static ArrayList<Integer> schematics = new ArrayList<>();
|
||||
|
||||
public static void preInit() {
|
||||
initSchematicList();
|
||||
|
||||
try {
|
||||
Util.setReason("Overriding difficulty check to check for creationentry requirements");
|
||||
ClassPool classPool = HookManager.getInstance().getClassPool();
|
||||
final Class<Schematics> thisClass = Schematics.class;
|
||||
String replace;
|
||||
|
||||
CtClass ctCreationEntry = classPool.get("com.wurmonline.server.items.CreationEntry");
|
||||
replace = "boolean hasSchematic = " + Schematics.class.getName() + "checkSchematic($3, $0);" +
|
||||
"if(!hasSchematic) {" +
|
||||
"return 0.0f" +
|
||||
"}";
|
||||
Util.insertBeforeDeclared(thisClass, ctCreationEntry, "getDifficultyFor", replace);
|
||||
} catch (NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void initSchematicList() {
|
||||
// Add items to schematic list here. These items will require the player to have read a schematic before
|
||||
schematics.add(WandPermaFrost.templateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a creationentry requires a schematic to be learned first. If it requires one that isnt learned, return false. Else, return true.
|
||||
* @param performer performer of the craft
|
||||
* @param ce creation entry being tested
|
||||
* @return schematic needed
|
||||
*/
|
||||
public static boolean checkSchematic(Creature performer, CreationEntry ce) {
|
||||
int product = ce.getObjectCreated();
|
||||
if(schematics.contains(product)) {
|
||||
try {
|
||||
Connection dbcon = ModSupportDb.getModSupportDb();
|
||||
PreparedStatement ps = dbcon.prepareStatement("SELECT * FROM SchematicMap");
|
||||
ResultSet rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
if (rs.getString("name").equals(performer.getName()) && rs.getInt("templateid") == product) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user