Added Loot Logger.

This commit is contained in:
sigonasr2 2016-07-20 06:01:00 -05:00
parent 1db2164c3b
commit 7b6d647f93
5 changed files with 58 additions and 2 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.6.2-rangersop
version: 3.6.2r3
commands:
money:
description: Tells the player the amount of money they are holding.
@ -62,6 +62,11 @@ commands:
usage: /bow
permission: TwosideKeeper.report
permission-message: No permissions!
loot:
description: Generates a Loot report.
usage: /loot
permission: TwosideKeeper.report
permission-message: No permissions!
mega:
description: Generates a Mega Piece.
usage: /mega <MATERIAL> <false|true>

View File

@ -202,6 +202,7 @@ public enum MonsterDifficulty {
//amount of rolls increases. (A dropmult of 1.0 is required for
//an additional roll.)
for (int i=0;i<dropmult;i++) {
TwosideKeeper.Loot_Logger.AddLootRoll();
//First do a common roll.
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE*dropmult &&
this.loot_regular.length>0) {
@ -209,6 +210,7 @@ public enum MonsterDifficulty {
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot);
TwosideKeeper.Loot_Logger.AddCommonLoot();
}
//Rare Loot roll.
if (Math.random()<TwosideKeeper.RARE_DROP_RATE*dropmult &&
@ -233,6 +235,7 @@ public enum MonsterDifficulty {
break;
}
}
TwosideKeeper.Loot_Logger.AddRareLoot();
}
//Legendary Loot roll.
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE*dropmult &&
@ -264,18 +267,21 @@ public enum MonsterDifficulty {
break;
}
}
TwosideKeeper.Loot_Logger.AddLegendaryLoot();
}
if (isBoss) { //50% of the time, we drop something great.
if (Math.random()<=0.5 && this.loot_legendary.length>0) {
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot);
TwosideKeeper.Loot_Logger.AddLegendaryLoot();
}
else
if (this.loot_rare.length>0) { //Consolation Prize.
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
droplist.add(gen_loot);
TwosideKeeper.Loot_Logger.AddRareLoot();
}
}
}

View File

@ -0,0 +1,38 @@
package sig.plugin.TwosideKeeper.Logging;
import java.text.DecimalFormat;
import org.bukkit.ChatColor;
public class LootLogger {
int common_loot = 0;
int rare_loot = 0;
int legendary_loot = 0;
int total_rolls = 0;
public LootLogger() {
}
public void AddLootRoll() {
total_rolls++;
}
public void AddCommonLoot() {
common_loot++;
}
public void AddRareLoot() {
rare_loot++;
}
public void AddLegendaryLoot() {
legendary_loot++;
}
public String GenerateReport() {
DecimalFormat df = new DecimalFormat("0.0");
if (total_rolls>0) {
return "Total Rolls: "+ChatColor.AQUA+(total_rolls)+"\n"+ChatColor.WHITE
+ "Total Common Rolls: "+ChatColor.YELLOW+(common_loot)+ChatColor.GREEN+" ("+df.format(((double)common_loot/(total_rolls))*100)+"%)\n"+ChatColor.WHITE
+ "Total Rare Rolls: "+ChatColor.YELLOW+(rare_loot)+ChatColor.GREEN+" ("+df.format(((double)rare_loot/(total_rolls))*100)+"%)\n"+ChatColor.WHITE
+ "Total Legendary Rolls: "+ChatColor.YELLOW+(legendary_loot)+ChatColor.GREEN+" ("+df.format(((double)legendary_loot/(total_rolls))*100)+"%)";
} else {
return "Not enough data yet!";
}
}
}

View File

@ -181,6 +181,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.Logging.BowModeLogger;
import sig.plugin.TwosideKeeper.Logging.LootLogger;
import sig.plugin.TwosideKeeper.Logging.MysteriousEssenceLogger;
import net.minecraft.server.v1_9_R1.MinecraftServer;
@ -226,6 +227,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static WorldShopManager TwosideShops;
public static MysteriousEssenceLogger EssenceLogger; //The logger for Essences.
public static BowModeLogger BowLogger; //The logger for Bow Modes.
public static LootLogger Loot_Logger; //The logger for Loot.
public static AutoUpdatePlugin pluginupdater;
public static Lag tpstracker;
public static boolean restarting_server=false;
@ -289,6 +291,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
EssenceLogger = new MysteriousEssenceLogger();
BowLogger = new BowModeLogger();
Loot_Logger = new LootLogger();
chargezombies = new ArrayList<ChargeZombie>();
@ -799,6 +802,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
sender.sendMessage(BowLogger.GenerateReport());
return true;
} else
if (cmd.getName().equalsIgnoreCase("loot")) {
sender.sendMessage(Loot_Logger.GenerateReport());
return true;
} else
if (sender instanceof Player) {
DecimalFormat df = new DecimalFormat("0.00");
if (cmd.getName().equalsIgnoreCase("fix")) {