Overhauled itemBonuses to actually work. Have yet to test timed bonuses, I think they use auxdata for number of hours left. Wood essence also introduced.

This commit is contained in:
mstoppelli
2018-06-06 08:08:30 -04:00
parent 361432ec1e
commit 5b9fa72644
11 changed files with 359 additions and 20 deletions

View File

@@ -22,6 +22,8 @@ import mod.sin.armour.SpectralHide;
import mod.sin.creatures.Reaper;
import mod.sin.creatures.SpectralDrake;
import mod.sin.items.AffinityOrb;
import mod.sin.items.EnchantersCrystal;
import mod.sin.items.TreasureBox;
import mod.sin.items.caches.RiftCache;
import mod.sin.items.caches.TitanCache;
import mod.sin.kingdomoffices.ItemCreator;
@@ -112,7 +114,19 @@ public class PlayerBounty {
e.printStackTrace();
}
}
public static void rewardRareLoot(Player player, Creature mob) {
try {
double fightskill = player.getFightingSkill().getKnowledge();
int quality = random.nextInt((int)fightskill);
Item crystal = ItemFactory.createItem(TreasureBox.templateId, quality, (random.nextInt((int)fightskill) < 20 ? (byte)0:(byte)1), "");
player.getInventory().insertItem(crystal);
player.getCommunicator().sendNormalServerMessage("You find something in your inventory!");
} catch (FailedException | NoSuchTemplateException e) {
e.printStackTrace();
}
}
;
public static void checkPlayerReward(Player player, Creature mob){
try{
if(mob.isReborn() || mob.isBred()){
@@ -145,6 +159,7 @@ public class PlayerBounty {
if(RareSpawns.isRareCreature(mob)){
Item riftCache = ItemFactory.createItem(RiftCache.templateId, 50f+(30f*Server.rand.nextFloat()), mob.getName());
player.getInventory().insertItem(riftCache, true);
rewardRareLoot(player, mob);
}
if(Titans.isTitan(mob)){
player.addTitle(Title.getTitle(700));