pulled update

This commit is contained in:
mstoppelli
2018-05-30 15:53:53 -04:00
22 changed files with 515 additions and 185 deletions

View File

@@ -18,23 +18,22 @@ 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.sin.armour.SpectralHide;
import mod.sin.creatures.Reaper;
import mod.sin.creatures.SpectralDrake;
import mod.sin.items.AffinityOrb;
import mod.sin.items.ChaosCrystal;
import mod.sin.items.EnchantersCrystal;
import mod.sin.items.FriyanTablet;
import mod.sin.items.caches.GemCache;
import mod.sin.items.caches.RiftCache;
import mod.sin.items.caches.ToolCache;
import mod.sin.items.caches.TreasureMapCache;
import mod.sin.items.caches.*;
import mod.sin.wyvern.Bounty;
import mod.sin.wyvern.MiscChanges;
import mod.sin.wyvern.Arena;
import mod.sin.wyvern.Titans;
import mod.sin.wyvern.util.ItemUtil;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Random;
import java.util.logging.Logger;
public class LootBounty {
public static final Logger logger = Logger.getLogger(LootBounty.class.getName());
protected static final Random random = new Random();
@@ -107,7 +106,54 @@ public class LootBounty {
}
return 0;
}
public static void insertUniqueLoot(Creature mob, Item corpse){
try {
Item affinityOrb = ItemFactory.createItem(AffinityOrb.templateId, 90+(10*random.nextFloat()), "");
corpse.insertItem(affinityOrb);
int[] cacheIds = {
ArtifactCache.templateId,
CrystalCache.templateId, CrystalCache.templateId,
DragonCache.templateId, DragonCache.templateId,
MoonCache.templateId, MoonCache.templateId,
RiftCache.templateId,
TreasureMapCache.templateId
};
int i = 1+Server.rand.nextInt(3);
while(i > 0){
Item cache = ItemFactory.createItem(cacheIds[Server.rand.nextInt(cacheIds.length)], 50+(30*random.nextFloat()), "");
if(Server.rand.nextInt(5) == 0){
cache.setRarity((byte) 1);
}
corpse.insertItem(cache);
i--;
}
if(mob.isDragon()) {
int mTemplate = mob.getTemplate().getTemplateId();
int lootTemplate = ItemList.drakeHide;
if(mTemplate == CreatureTemplateFactory.DRAGON_BLACK_CID || mTemplate == CreatureTemplateFactory.DRAGON_BLUE_CID || mTemplate == CreatureTemplateFactory.DRAGON_GREEN_CID
|| mTemplate == CreatureTemplateFactory.DRAGON_RED_CID || mTemplate == CreatureTemplateFactory.DRAGON_WHITE_CID){
lootTemplate = ItemList.dragonScale;
}
logger.info("Generating extra hide & scale to insert on the corpse of " + mob.getName() + ".");
ItemTemplate itemTemplate = ItemTemplateFactory.getInstance().getTemplate(lootTemplate);
for (i = 0; i < 2; i++) {
Item loot = ItemFactory.createItem(lootTemplate, 80 + (15 * random.nextFloat()), "");
String creatureName = mob.getTemplate().getName().toLowerCase();
if (!loot.getName().contains(creatureName)) {
loot.setName(creatureName.toLowerCase() + " " + itemTemplate.getName());
}
loot.setData2(mTemplate);
int weightGrams = itemTemplate.getWeightGrams() * (lootTemplate == ItemList.drakeHide ? 3 : 1);
loot.setWeight((int) ((weightGrams * 0.02f) + (weightGrams * 0.02f * random.nextFloat())), true);
corpse.insertItem(loot);
}
}
} catch (FailedException | NoSuchTemplateException e) {
e.printStackTrace();
}
}
public static void blessWorldWithMoonVeins(Creature mob){
int i = 20;
while(i > 0){
@@ -290,8 +336,7 @@ public class LootBounty {
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;
}
else if(Titans.isTitan(mob)){
}else if(Titans.isTitan(mob)){
Server.getInstance().broadCastAlert("The Titan "+mob.getName()+" has been defeated!");
MiscChanges.sendGlobalFreedomChat(mob, "The Titan "+mob.getName()+" has been defeated!", 255, 105, 180);
MiscChanges.sendServerTabMessage("titan", "The Titan "+mob.getName()+" has been defeated!", 255, 105, 180);
@@ -331,21 +376,9 @@ public class LootBounty {
blessWorldWithMoonVeins(mob);
// Spawn 5-10 friyan tablets throughout the world.
spawnFriyanTablets();
// Add unique loot
insertUniqueLoot(mob, corpse);
try {
// guaranteed rare egg, 15% chance it's fantastic
Item item = ItemFactory.createItem(ItemUtil.getMysteryEggID(), 50, "");
item.setRarity((byte)1);
if(random.nextInt( 100) < 15) {
item.setRarity((byte)3);
}
corpse.insertItem(item);
//free affinity orb
item = ItemFactory.createItem(AffinityOrb.templateId, 50, "");
} catch (FailedException | NoSuchTemplateException e) {
e.printStackTrace();
}
// Spawn Spectral Drake
/*if (mob.isDragon()) { // Spawn the spectral drake and add extra hide/scale
handleDragonLoot(mob, corpse);