use of com.solinia.solinia.Interfaces.ISoliniaLootTableEntry in project solinia3-core by mixxit.
the class SoliniaLootFactory method CreateLootTableDrop.
public static void CreateLootTableDrop(int loottableid, int lootdropid, boolean operatorCreated) throws CoreStateInitException {
ISoliniaLootTable loottabletable = StateManager.getInstance().getConfigurationManager().getLootTable(loottableid);
SoliniaLootTableEntry loottable = new SoliniaLootTableEntry();
int id = 1;
for (ISoliniaLootTableEntry entry : loottabletable.getEntries()) {
if (entry.getId() > id)
id = entry.getId() + 1;
}
loottable.setId(id);
loottable.setLoottableid(loottableid);
loottable.setLootdropid(lootdropid);
loottable.setOperatorCreated(operatorCreated);
StateManager.getInstance().getConfigurationManager().getLootTable(loottableid).getEntries().add(loottable);
}
use of com.solinia.solinia.Interfaces.ISoliniaLootTableEntry in project solinia3-core by mixxit.
the class MythicMobsNPCEntityProvider method createNpcFile.
public String createNpcFile(ISoliniaNPC npc) {
String mob = "";
String uniquename = "NPCID_" + npc.getId();
if (npc.getMctype() == null)
return "";
mob = uniquename + ":\r\n";
mob = mob + " Type: " + npc.getMctype() + "\r\n";
if (npc.isUpsidedown() == true) {
mob = mob + " Display: Dinnerbone\r\n";
} else {
mob = mob + " Display: " + npc.getName() + "\r\n";
}
double hp = Utils.getStatMaxHP(npc.getClassObj(), npc.getLevel(), 75);
double damage = Utils.getMaxDamage(npc.getLevel(), 75);
if (npc.isHeroic()) {
hp += (Utils.getHeroicHPMultiplier() * npc.getLevel());
damage += (Utils.getHeroicDamageMultiplier() * npc.getLevel());
}
if (npc.isBoss()) {
hp += (Utils.getBossHPMultiplier() * npc.getLevel());
damage += (Utils.getBossDamageMultiplier() * npc.getLevel());
}
if (npc.isRaidheroic()) {
hp += (Utils.getRaidHeroicHPMultiplier() * npc.getLevel());
damage += (Utils.getRaidHeroicDamageMultiplier() * npc.getLevel());
}
if (npc.isRaidboss()) {
hp += (Utils.getRaidBossHPMultiplier() * npc.getLevel());
damage += (Utils.getRaidBossDamageMultiplier() * npc.getLevel());
}
float movementSpeed = 0.3f;
if (npc.isHeroic()) {
movementSpeed = Utils.getHeroicRunSpeed();
}
if (npc.isBoss()) {
movementSpeed = Utils.getBossRunSpeed();
}
if (npc.isRaidheroic()) {
movementSpeed = Utils.getRaidHeroicRunSpeed();
}
if (npc.isRaidboss()) {
movementSpeed = Utils.getRaidBossRunSpeed();
}
mob = mob + " Health: " + hp + "\r\n";
mob = mob + " Damage: " + damage + "\r\n";
mob = mob + " MaxCombatDistance: 25\r\n";
mob = mob + " PreventOtherDrops: true\r\n";
mob = mob + " PreventRandomEquipment: true\r\n";
mob = mob + " Options:\r\n";
mob = mob + " MovementSpeed: " + movementSpeed + "\r\n";
mob = mob + " KnockbackResistance: 0.75\r\n";
mob = mob + " PreventMobKillDrops: true\r\n";
mob = mob + " PreventOtherDrops: true\r\n";
mob = mob + " Silent: true\r\n";
mob = mob + " ShowHealth: true\r\n";
mob = mob + " PreventRenaming: true\r\n";
mob = mob + " PreventRandomEquipment: true\r\n";
mob = mob + " AlwaysShowName: true\r\n";
mob = mob + " Modules:\r\n";
mob = mob + " ThreatTable: false\r\n";
if (npc.isPet()) {
mob = mob + " Faction: FACTIONID_-1\r\n";
} else {
mob = mob + " Faction: FACTIONID_" + npc.getFactionid() + "\r\n";
}
// Act as normal mob if without faction
if (npc.getFactionid() > 0 || npc.isPet()) {
mob = mob + " AIGoalSelectors:\r\n";
mob = mob + " - 0 clear\r\n";
mob = mob + " - 1 skeletonbowattack\r\n";
mob = mob + " - 2 meleeattack\r\n";
mob = mob + " - 3 lookatplayers\r\n";
if (npc.isRoamer()) {
mob = mob + " - 4 randomstroll\r\n";
}
mob = mob + " AITargetSelectors:\r\n";
mob = mob + " - 0 clear\r\n";
mob = mob + " - 1 attacker\r\n";
// NPC attack players
if (!npc.isPet()) {
try {
ISoliniaFaction npcfaction = StateManager.getInstance().getConfigurationManager().getFaction(npc.getFactionid());
if (npcfaction.getBase() == -1500) {
mob = mob + " - 2 players\r\n";
}
} catch (CoreStateInitException e) {
// skip
}
}
// NPC attack NPCs
if (npc.isGuard() || npc.isPet()) {
// Always attack mobs with factionid 0
mob = mob + " - 3 SpecificFaction FACTIONID_0\r\n";
// Attack all mobs with -1500 faction
try {
int curnum = 4;
for (ISoliniaFaction faction : StateManager.getInstance().getConfigurationManager().getFactions()) {
if (faction.getBase() == -1500 && faction.getId() != npc.getFactionid()) {
mob = mob + " - " + curnum + " SpecificFaction FACTIONID_" + faction.getId() + "\r\n";
curnum++;
}
}
} catch (CoreStateInitException e) {
// skip
}
}
}
// then go ahead and use it! Better than that crap we have right?
if (npc.getLoottableid() > 0) {
try {
ISoliniaLootTable lootTable = StateManager.getInstance().getConfigurationManager().getLootTable(npc.getLoottableid());
if (lootTable != null) {
List<ISoliniaItem> potentialChestArmour = new ArrayList<ISoliniaItem>();
List<ISoliniaItem> potentialLegsArmour = new ArrayList<ISoliniaItem>();
List<ISoliniaItem> potentialFeetArmour = new ArrayList<ISoliniaItem>();
List<ISoliniaItem> potentialWeapons = new ArrayList<ISoliniaItem>();
List<ISoliniaItem> potentialBows = new ArrayList<ISoliniaItem>();
List<ISoliniaItem> potentialShields = new ArrayList<ISoliniaItem>();
for (ISoliniaLootTableEntry loottableentry : lootTable.getEntries()) {
ISoliniaLootDrop lootdrop = StateManager.getInstance().getConfigurationManager().getLootDrop(loottableentry.getLootdropid());
for (ISoliniaLootDropEntry lootdropentry : lootdrop.getEntries()) {
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(lootdropentry.getItemid());
if (ConfigurationManager.ArmourMaterials.contains(item.getBasename().toUpperCase())) {
if (item.getAllowedClassNames().size() == 0) {
if (item.getBasename().contains("CHESTPLATE"))
potentialChestArmour.add(item);
if (item.getBasename().contains("LEGGINGS"))
potentialLegsArmour.add(item);
if (item.getBasename().contains("BOOTS"))
potentialFeetArmour.add(item);
continue;
}
if (npc.getClassObj() != null) {
if (item.getAllowedClassNames().contains(npc.getClassObj().getName())) {
if (item.getBasename().contains("CHESTPLATE"))
potentialChestArmour.add(item);
if (item.getBasename().contains("LEGGINGS"))
potentialLegsArmour.add(item);
if (item.getBasename().contains("BOOTS"))
potentialFeetArmour.add(item);
continue;
}
}
}
if (ConfigurationManager.WeaponMaterials.contains(item.getBasename().toUpperCase())) {
if (item.getAllowedClassNames().size() == 0) {
if (item.getBasename().contains("SHIELD"))
potentialShields.add(item);
else if (item.getBasename().contains("BOW"))
potentialBows.add(item);
else
potentialWeapons.add(item);
continue;
}
if (npc.getClassObj() != null) {
if (item.getAllowedClassNames().contains(npc.getClassObj().getName())) {
if (item.getBasename().contains("SHIELD"))
potentialShields.add(item);
else
potentialWeapons.add(item);
continue;
}
}
}
if (ConfigurationManager.HandMaterials.contains(item.getBasename().toUpperCase())) {
if (item.getAllowedClassNames().size() == 0) {
if (item.getBasename().contains("SHIELD"))
potentialShields.add(item);
else if (item.getBasename().contains("BOW"))
potentialBows.add(item);
else
potentialWeapons.add(item);
continue;
}
if (npc.getClassObj() != null) {
if (item.getAllowedClassNames().contains(npc.getClassObj().getName())) {
if (item.getBasename().contains("SHIELD"))
potentialShields.add(item);
else
potentialWeapons.add(item);
continue;
}
}
}
}
mob = mob + " Equipment:\r\n";
if (potentialShields.size() > 0) {
Collections.sort(potentialShields, new Comparator<ISoliniaItem>() {
public int compare(ISoliniaItem o1, ISoliniaItem o2) {
if (o1.getMinLevel() == o2.getMinLevel())
return 0;
return o1.getMinLevel() > o2.getMinLevel() ? -1 : 1;
}
});
Collections.reverse(potentialShields);
System.out.println("Found better shield in lootdrop (" + potentialWeapons.get(0).getDisplayname() + "), using as shield");
writeCustomItem("plugins/MythicMobs/Items/CUSTOMITEMID" + potentialWeapons.get(0).getId() + ".yml", potentialWeapons.get(0));
mob = mob + " - " + "CUSTOMITEMID_" + potentialWeapons.get(0).getId() + ":5\r\n";
} else {
if (npc.getOffhanditem() != null)
mob = mob + " - " + npc.getOffhanditem() + ":5\r\n";
}
if (npc.isCustomhead() == true) {
if (npc.getCustomheaddata() != null) {
mob = mob + " - CUSTOMHEADNPCID_" + npc.getId() + ":4\r\n";
} else {
if (npc.getHeaditem() != null)
mob = mob + " - " + npc.getHeaditem() + ":4\r\n";
}
} else {
if (npc.getHeaditem() != null)
mob = mob + " - " + npc.getHeaditem() + ":4\r\n";
}
if (potentialChestArmour.size() > 0) {
Collections.sort(potentialChestArmour, new Comparator<ISoliniaItem>() {
public int compare(ISoliniaItem o1, ISoliniaItem o2) {
if (o1.getMinLevel() == o2.getMinLevel())
return 0;
return o1.getMinLevel() > o2.getMinLevel() ? -1 : 1;
}
});
Collections.reverse(potentialChestArmour);
System.out.println("Found better chest in lootdrop (" + potentialChestArmour.get(0).getDisplayname() + "), using as chest");
writeCustomItem("plugins/MythicMobs/Items/CUSTOMITEMID" + potentialChestArmour.get(0).getId() + ".yml", potentialChestArmour.get(0));
mob = mob + " - " + "CUSTOMITEMID_" + potentialChestArmour.get(0).getId() + ":3\r\n";
} else {
if (npc.getChestitem() != null)
mob = mob + " - " + npc.getChestitem() + ":3\r\n";
}
if (potentialLegsArmour.size() > 0) {
Collections.sort(potentialLegsArmour, new Comparator<ISoliniaItem>() {
public int compare(ISoliniaItem o1, ISoliniaItem o2) {
if (o1.getMinLevel() == o2.getMinLevel())
return 0;
return o1.getMinLevel() > o2.getMinLevel() ? -1 : 1;
}
});
Collections.reverse(potentialLegsArmour);
System.out.println("Found better legs in lootdrop (" + potentialLegsArmour.get(0).getDisplayname() + "), using as weapon");
writeCustomItem("plugins/MythicMobs/Items/CUSTOMITEMID" + potentialLegsArmour.get(0).getId() + ".yml", potentialLegsArmour.get(0));
mob = mob + " - " + "CUSTOMITEMID_" + potentialLegsArmour.get(0).getId() + ":2\r\n";
} else {
if (npc.getLegsitem() != null)
mob = mob + " - " + npc.getLegsitem() + ":2\r\n";
}
if (potentialFeetArmour.size() > 0) {
Collections.sort(potentialFeetArmour, new Comparator<ISoliniaItem>() {
public int compare(ISoliniaItem o1, ISoliniaItem o2) {
if (o1.getMinLevel() == o2.getMinLevel())
return 0;
return o1.getMinLevel() > o2.getMinLevel() ? -1 : 1;
}
});
Collections.reverse(potentialFeetArmour);
System.out.println("Found better feet in lootdrop (" + potentialFeetArmour.get(0).getDisplayname() + "), using as feet");
writeCustomItem("plugins/MythicMobs/Items/CUSTOMITEMID" + potentialFeetArmour.get(0).getId() + ".yml", potentialFeetArmour.get(0));
mob = mob + " - " + "CUSTOMITEMID_" + potentialFeetArmour.get(0).getId() + ":1\r\n";
} else {
if (npc.getFeetitem() != null)
mob = mob + " - " + npc.getFeetitem() + ":1\r\n";
}
if (npc.getClassObj() != null && npc.getClassObj().getName().toUpperCase().equals("RANGER") && potentialBows.size() > 0) {
Collections.sort(potentialBows, new Comparator<ISoliniaItem>() {
public int compare(ISoliniaItem o1, ISoliniaItem o2) {
if (o1.getMinLevel() == o2.getMinLevel())
return 0;
return o1.getMinLevel() > o2.getMinLevel() ? -1 : 1;
}
});
Collections.reverse(potentialBows);
System.out.println("Found better weapon (bow) in lootdrop (" + potentialBows.get(0).getDisplayname() + "), using as weapon");
writeCustomItem("plugins/MythicMobs/Items/CUSTOMITEMID" + potentialBows.get(0).getId() + ".yml", potentialBows.get(0));
mob = mob + " - " + "CUSTOMITEMID_" + potentialBows.get(0).getId() + ":0\r\n";
} else {
if (potentialWeapons.size() > 0) {
Collections.sort(potentialWeapons, new Comparator<ISoliniaItem>() {
public int compare(ISoliniaItem o1, ISoliniaItem o2) {
if (o1.getMinLevel() == o2.getMinLevel())
return 0;
return o1.getMinLevel() > o2.getMinLevel() ? -1 : 1;
}
});
Collections.reverse(potentialWeapons);
System.out.println("Found better weapon in lootdrop (" + potentialWeapons.get(0).getDisplayname() + "), using as weapon");
writeCustomItem("plugins/MythicMobs/Items/CUSTOMITEMID" + potentialWeapons.get(0).getId() + ".yml", potentialWeapons.get(0));
mob = mob + " - " + "CUSTOMITEMID_" + potentialWeapons.get(0).getId() + ":0\r\n";
} else {
if (npc.getHanditem() != null)
mob = mob + " - " + npc.getHanditem() + ":0\r\n";
}
}
}
}
} catch (CoreStateInitException e) {
// skip
}
} else {
if (npc.getHeaditem() != null || npc.getChestitem() != null || npc.getLegsitem() != null || npc.getFeetitem() != null || npc.getHanditem() != null || npc.getOffhanditem() != null) {
mob = mob + " Equipment:\r\n";
if (npc.getOffhanditem() != null)
mob = mob + " - " + npc.getOffhanditem() + ":5\r\n";
if (npc.isCustomhead() == true) {
if (npc.getCustomheaddata() != null) {
mob = mob + " - CUSTOMHEADNPCID_" + npc.getId() + ":4\r\n";
} else {
if (npc.getHeaditem() != null)
mob = mob + " - " + npc.getHeaditem() + ":4\r\n";
}
} else {
if (npc.getHeaditem() != null)
mob = mob + " - " + npc.getHeaditem() + ":4\r\n";
}
if (npc.getChestitem() != null)
mob = mob + " - " + npc.getChestitem() + ":3\r\n";
if (npc.getLegsitem() != null)
mob = mob + " - " + npc.getLegsitem() + ":2\r\n";
if (npc.getFeetitem() != null)
mob = mob + " - " + npc.getFeetitem() + ":1\r\n";
if (npc.getHanditem() != null)
mob = mob + " - " + npc.getHanditem() + ":0\r\n";
}
}
if (npc.isUsedisguise() == true) {
mob = mob + " Disguise:\r\n";
if (npc.getDisguisetype().toLowerCase().contains("player-")) {
mob = mob + " Type: player\r\n";
} else {
mob = mob + " Type: " + npc.getDisguisetype() + "\r\n";
}
if (npc.isBurning() == true) {
mob = mob + " Burning: true\r\n";
}
if (npc.getDisguisetype().toLowerCase().contains("player-")) {
String[] disguisedata = npc.getDisguisetype().split("-");
mob = mob + " Player: " + npc.getName() + "\r\n";
mob = mob + " Skin: '" + disguisedata[1] + "'\r\n";
}
}
if (npc.isBoss() == true || npc.isRaidboss()) {
/*
mob = mob + " BossBar:\r\n";
mob = mob + " Enabled: true\r\n";
mob = mob + " Title: " + npc.getName() + "\r\n";
mob = mob + " Range: 200\r\n";
mob = mob + " CreateFog: true\r\n";
mob = mob + " DarkenSky: true\r\n";
mob = mob + " PlayMusic: true\r\n";
*/
if (npc.getDisguisetype() != null)
if (npc.getDisguisetype().toLowerCase().contains("player-")) {
String[] disguisedata = npc.getDisguisetype().split("-");
mob = mob + " Player: " + npc.getName() + "\r\n";
mob = mob + " Skin: '" + disguisedata[1] + "'\r\n";
}
}
mob = mob + " Skills:\r\n";
if (npc.isInvisible() == true) {
mob = mob + " - potion{t=INVISIBILITY;d=2147483647;l=1} @self ~onSpawn\r\n";
}
return mob;
}
use of com.solinia.solinia.Interfaces.ISoliniaLootTableEntry in project solinia3-core by mixxit.
the class SoliniaLootTable method sendLootTableSettingsToSender.
@Override
public void sendLootTableSettingsToSender(CommandSender sender) {
try {
for (ISoliniaLootTableEntry le : getEntries()) {
ISoliniaLootDrop ld = StateManager.getInstance().getConfigurationManager().getLootDrop(le.getLootdropid());
sender.sendMessage("- " + ChatColor.GOLD + ld.getName().toUpperCase() + ChatColor.RESET + "[" + ld.getId() + "]:");
for (ISoliniaLootDropEntry lde : ld.getEntries()) {
ISoliniaItem i = StateManager.getInstance().getConfigurationManager().getItem(lde.getItemid());
sender.sendMessage(" - " + ChatColor.GOLD + i.getDisplayname() + ChatColor.RESET + "[" + i.getId() + "] - " + lde.getChance() + "% chance Count: " + lde.getCount() + " Always: " + lde.isAlways());
}
}
} catch (CoreStateInitException e) {
sender.sendMessage(e.getMessage());
}
}
use of com.solinia.solinia.Interfaces.ISoliniaLootTableEntry in project solinia3-core by mixxit.
the class SoliniaNPC method sendNpcSettingsToSender.
@Override
public void sendNpcSettingsToSender(CommandSender sender) throws CoreStateInitException {
sender.sendMessage(ChatColor.RED + "NPC Settings for " + ChatColor.GOLD + getName() + ChatColor.RESET);
sender.sendMessage("----------------------------");
sender.sendMessage("- id: " + ChatColor.GOLD + getId() + ChatColor.RESET);
sender.sendMessage("- name: " + ChatColor.GOLD + getName() + ChatColor.RESET);
sender.sendMessage("- raceid: " + ChatColor.GOLD + getRaceid() + ChatColor.RESET);
sender.sendMessage("- professionid: " + ChatColor.GOLD + getClassid() + ChatColor.RESET);
sender.sendMessage(ChatColor.RED + "STATS" + ChatColor.RESET);
sender.sendMessage("- level: " + ChatColor.GOLD + getLevel() + ChatColor.RESET);
sender.sendMessage("- avoidancerating: " + ChatColor.GOLD + getAvoidanceRating() + ChatColor.RESET);
sender.sendMessage("- accuracyrating: " + ChatColor.GOLD + getAccuracyRating() + ChatColor.RESET);
sender.sendMessage("- ac: " + ChatColor.GOLD + getAC() + ChatColor.RESET);
sender.sendMessage("- deathgrantstitle: " + ChatColor.GOLD + getDeathGrantsTitle() + ChatColor.RESET);
sender.sendMessage("----------------------------");
sender.sendMessage(ChatColor.RED + "SPAWNING" + ChatColor.RESET);
sender.sendMessage("- randomspawn: " + ChatColor.GOLD + isRandomSpawn() + ChatColor.RESET);
sender.sendMessage("----------------------------");
sender.sendMessage(ChatColor.RED + "AI" + ChatColor.RESET);
sender.sendMessage("- pet: " + ChatColor.GOLD + isPet() + ChatColor.RESET);
sender.sendMessage("- guard: " + ChatColor.GOLD + isGuard() + ChatColor.RESET);
sender.sendMessage("- roamer: " + ChatColor.GOLD + isRoamer() + ChatColor.RESET);
sender.sendMessage("- killtriggertext: " + ChatColor.GOLD + getKillTriggerText());
sender.sendMessage("- summoner: " + ChatColor.GOLD + isSummoner() + ChatColor.RESET);
sender.sendMessage("- randomchattriggertext: " + ChatColor.GOLD + getRandomchatTriggerText());
sender.sendMessage("----------------------------");
sender.sendMessage(ChatColor.RED + "APPEARANCE" + ChatColor.RESET);
sender.sendMessage("- mctype: " + ChatColor.GOLD + getMctype() + ChatColor.RESET);
sender.sendMessage("- usedisguise: " + ChatColor.GOLD + isUsedisguise() + ChatColor.RESET);
sender.sendMessage("- disguisetype: " + ChatColor.GOLD + getDisguisetype() + ChatColor.RESET);
sender.sendMessage("- customhead: " + ChatColor.GOLD + isCustomhead() + ChatColor.RESET);
sender.sendMessage("- customheaddata: " + ChatColor.GOLD + getCustomheaddata() + ChatColor.RESET);
sender.sendMessage("- upsidedown: " + ChatColor.GOLD + isUpsidedown() + ChatColor.RESET);
sender.sendMessage("- burning: " + ChatColor.GOLD + isBurning() + ChatColor.RESET);
sender.sendMessage("- invisible: " + ChatColor.GOLD + isInvisible() + ChatColor.RESET);
sender.sendMessage("- isundead: " + ChatColor.GOLD + isUndead() + ChatColor.RESET);
sender.sendMessage("- isanimal: " + ChatColor.GOLD + isAnimal() + ChatColor.RESET);
sender.sendMessage(ChatColor.RED + "EQUIPMENT" + ChatColor.RESET);
if (getLoottableid() != 0) {
sender.sendMessage("- loottableid: " + ChatColor.GOLD + getLoottableid() + " (" + StateManager.getInstance().getConfigurationManager().getLootTable(getLoottableid()).getName() + ")" + ChatColor.RESET);
} else {
sender.sendMessage("- loottableid: " + ChatColor.GOLD + getLoottableid() + " (No Loot Table)" + ChatColor.RESET);
}
sender.sendMessage("- handitem: " + ChatColor.GOLD + getHanditem() + ChatColor.RESET);
sender.sendMessage("- offhanditem: " + ChatColor.GOLD + getOffhanditem() + ChatColor.RESET);
sender.sendMessage("- headitem: " + ChatColor.GOLD + getHeaditem() + ChatColor.RESET);
sender.sendMessage("- chestitem: " + ChatColor.GOLD + getChestitem() + ChatColor.RESET);
sender.sendMessage("- legsitem: " + ChatColor.GOLD + getLegsitem() + ChatColor.RESET);
sender.sendMessage("- feetitem: " + ChatColor.GOLD + getFeetitem() + ChatColor.RESET);
sender.sendMessage(ChatColor.RED + "FACTION & MERCHANT" + ChatColor.RESET);
if (getFactionid() != 0) {
sender.sendMessage("- factionid: " + ChatColor.GOLD + getFactionid() + " (" + StateManager.getInstance().getConfigurationManager().getFaction(getFactionid()).getName() + ")" + ChatColor.RESET);
} else {
sender.sendMessage("- factionid: " + ChatColor.GOLD + getFactionid() + " (No Faction)" + ChatColor.RESET);
}
if (getMerchantid() != 0) {
sender.sendMessage("- merchantid: " + ChatColor.GOLD + getMerchantid() + " (" + StateManager.getInstance().getConfigurationManager().getNPCMerchant(getMerchantid()).getName() + ")" + ChatColor.RESET);
} else {
sender.sendMessage("- merchantid: " + ChatColor.GOLD + getMerchantid() + " (No Merchant Table)" + ChatColor.RESET);
}
sender.sendMessage(ChatColor.RED + "MISC" + ChatColor.RESET);
sender.sendMessage("- heroic: " + ChatColor.GOLD + isHeroic());
sender.sendMessage("- boss: " + ChatColor.GOLD + isBoss());
sender.sendMessage("- raidheroic: " + ChatColor.GOLD + isRaidheroic());
sender.sendMessage("- raidboss: " + ChatColor.GOLD + isRaidboss());
sender.sendMessage("- speaksalllangauges: " + ChatColor.GOLD + isSpeaksAllLanguages());
sender.sendMessage("----------------------------");
if (getLoottableid() != 0) {
sender.sendMessage(ChatColor.RED + "LOOT" + ChatColor.RESET + "[" + getLoottableid() + "] - " + "(" + StateManager.getInstance().getConfigurationManager().getLootTable(getLoottableid()).getName() + ")");
ISoliniaLootTable loottable = StateManager.getInstance().getConfigurationManager().getLootTable(getLoottableid());
for (ISoliniaLootTableEntry le : StateManager.getInstance().getConfigurationManager().getLootTable(loottable.getId()).getEntries()) {
ISoliniaLootDrop ld = StateManager.getInstance().getConfigurationManager().getLootDrop(le.getLootdropid());
sender.sendMessage("- " + ChatColor.GOLD + ld.getName().toUpperCase() + ChatColor.RESET + "[" + ld.getId() + "]:");
}
}
}
use of com.solinia.solinia.Interfaces.ISoliniaLootTableEntry in project solinia3-core by mixxit.
the class SoliniaLivingEntity method dropLoot.
@Override
public void dropLoot() {
if (isPlayer())
return;
try {
if (getNpcid() > 0) {
ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getNPC(getNpcid());
if (npc.getLoottableid() == 0)
return;
ISoliniaLootTable table = StateManager.getInstance().getConfigurationManager().getLootTable(npc.getLoottableid());
List<ISoliniaLootDropEntry> absoluteitems = new ArrayList<ISoliniaLootDropEntry>();
List<ISoliniaLootDropEntry> rollitems = new ArrayList<ISoliniaLootDropEntry>();
for (ISoliniaLootTableEntry entry : StateManager.getInstance().getConfigurationManager().getLootTable(table.getId()).getEntries()) {
ISoliniaLootDrop droptable = StateManager.getInstance().getConfigurationManager().getLootDrop(entry.getLootdropid());
for (ISoliniaLootDropEntry dropentry : StateManager.getInstance().getConfigurationManager().getLootDrop(droptable.getId()).getEntries()) {
if (dropentry.isAlways() == true) {
absoluteitems.add(dropentry);
continue;
}
rollitems.add(dropentry);
}
}
if (absoluteitems.size() == 0 && rollitems.size() == 0)
return;
int dropcount = StateManager.getInstance().getWorldPerkDropCountModifier();
Random r = new Random();
int randomInt = r.nextInt(100) + 1;
if (rollitems.size() > 0) {
// Based on the chance attempt to drop this item
for (int i = 0; i < dropcount; i++) {
ISoliniaLootDropEntry droptableentry = rollitems.get(new Random().nextInt(rollitems.size()));
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(droptableentry.getItemid());
randomInt = r.nextInt(100) + 1;
// Handle unique item checking also
if (item.isArtifact() == true && item.isArtifactFound() == true)
continue;
if (randomInt <= droptableentry.getChance()) {
// Handle unique item setting also
if (item.isArtifact() == true && item.isArtifactFound() == false)
item.setArtifactFound(true);
getBukkitLivingEntity().getLocation().getWorld().dropItem(getBukkitLivingEntity().getLocation(), item.asItemStack());
}
}
}
// Always drop these items
if (absoluteitems.size() > 0) {
for (int i = 0; i < absoluteitems.size(); i++) {
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(absoluteitems.get(i).getItemid());
for (int c = 0; c < absoluteitems.get(i).getCount(); c++) {
// Handle unique item checking also
if (item.isArtifact() == true && item.isArtifactFound() == true)
continue;
getBukkitLivingEntity().getLocation().getWorld().dropItem(getBukkitLivingEntity().getLocation(), item.asItemStack());
// Handle unique item setting also
if (item.isArtifact() == true && item.isArtifactFound() == false)
item.setArtifactFound(true);
}
}
}
} else {
/*
* This is no longer needed now we have loot drops int itemDropMinimum = 95; if
* (Utils.RandomChance(itemDropMinimum)) { if (getBukkitLivingEntity()
* instanceof Monster)
* getBukkitLivingEntity().getWorld().dropItem(this.getBukkitLivingEntity().
* getLocation(),SoliniaItemFactory.GenerateRandomLoot().asItemStack()); }
*/
}
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations