Search in sources :

Example 1 with ISoliniaLootTable

use of com.solinia.solinia.Interfaces.ISoliniaLootTable in project solinia3-core by mixxit.

the class CommandEditLootTable method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (!(sender instanceof Player) && !(sender instanceof CommandSender))
        return false;
    if (sender instanceof Player) {
        Player player = (Player) sender;
        if (!player.isOp() && !player.hasPermission("solinia.editloottable")) {
            player.sendMessage("You do not have permission to access this command");
            return false;
        }
    }
    if (args.length < 1) {
        sender.sendMessage("Insufficient arguments: LootTableid");
        return false;
    }
    if (args.length == 0) {
        return false;
    }
    int LootTableid = Integer.parseInt(args[0]);
    if (args.length == 1) {
        try {
            ISoliniaLootTable LootTable = StateManager.getInstance().getConfigurationManager().getLootTable(LootTableid);
            if (LootTable != null) {
                LootTable.sendLootTableSettingsToSender(sender);
            } else {
                sender.sendMessage("LootTable ID doesnt exist");
            }
            return true;
        } catch (CoreStateInitException e) {
            sender.sendMessage(e.getMessage());
        }
    }
    if (args.length < 3) {
        sender.sendMessage("Insufficient arguments: LootTableid setting value");
        return false;
    }
    String setting = args[1];
    String value = args[2];
    if (LootTableid < 1) {
        sender.sendMessage("Invalid LootTable id");
        return false;
    }
    try {
        if (StateManager.getInstance().getConfigurationManager().getLootTable(LootTableid) == null) {
            sender.sendMessage("Cannot locate LootTable id: " + LootTableid);
            return false;
        }
        if (StateManager.getInstance().getConfigurationManager().getLootTable(LootTableid).isOperatorCreated() && !sender.isOp()) {
            sender.sendMessage("This loottable was op created and you are not an op. Only ops can edit op loottable items");
            return false;
        }
        StateManager.getInstance().getConfigurationManager().editLootTable(LootTableid, setting, value);
        sender.sendMessage("Updating setting on LootTable");
    } catch (InvalidLootTableSettingException ne) {
        sender.sendMessage("Invalid LootTable setting: " + ne.getMessage());
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        sender.sendMessage(e.getMessage());
    }
    return true;
}
Also used : Player(org.bukkit.entity.Player) InvalidLootTableSettingException(com.solinia.solinia.Exceptions.InvalidLootTableSettingException) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) CommandSender(org.bukkit.command.CommandSender) ConsoleCommandSender(org.bukkit.command.ConsoleCommandSender) ISoliniaLootTable(com.solinia.solinia.Interfaces.ISoliniaLootTable)

Example 2 with ISoliniaLootTable

use of com.solinia.solinia.Interfaces.ISoliniaLootTable 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);
}
Also used : ISoliniaLootTableEntry(com.solinia.solinia.Interfaces.ISoliniaLootTableEntry) SoliniaLootTableEntry(com.solinia.solinia.Models.SoliniaLootTableEntry) ISoliniaLootTableEntry(com.solinia.solinia.Interfaces.ISoliniaLootTableEntry) ISoliniaLootTable(com.solinia.solinia.Interfaces.ISoliniaLootTable)

Example 3 with ISoliniaLootTable

use of com.solinia.solinia.Interfaces.ISoliniaLootTable in project solinia3-core by mixxit.

the class JsonLootTableRepository method reload.

@Override
public void reload() {
    List<ISoliniaLootTable> file = new ArrayList<ISoliniaLootTable>();
    try {
        GsonBuilder gsonbuilder = new GsonBuilder();
        gsonbuilder.registerTypeAdapterFactory(new ISoliniaLootTableEntryTypeAdapterFactory(SoliniaLootTableEntry.class));
        Gson gson = gsonbuilder.create();
        BufferedReader br = new BufferedReader(new FileReader(filePath));
        file = gson.fromJson(br, new TypeToken<List<SoliniaLootTable>>() {
        }.getType());
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    loottables.clear();
    for (ISoliniaLootTable i : file) {
        loottables.put(i.getId(), i);
    }
    System.out.println("Reloaded " + loottables.size() + " loottables");
}
Also used : ISoliniaLootTableEntryTypeAdapterFactory(com.solinia.solinia.Factories.ISoliniaLootTableEntryTypeAdapterFactory) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) BufferedReader(java.io.BufferedReader) FileNotFoundException(java.io.FileNotFoundException) Gson(com.google.gson.Gson) SoliniaLootTableEntry(com.solinia.solinia.Models.SoliniaLootTableEntry) FileReader(java.io.FileReader) ArrayList(java.util.ArrayList) List(java.util.List) ISoliniaLootTable(com.solinia.solinia.Interfaces.ISoliniaLootTable)

Example 4 with ISoliniaLootTable

use of com.solinia.solinia.Interfaces.ISoliniaLootTable 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;
}
Also used : ISoliniaItem(com.solinia.solinia.Interfaces.ISoliniaItem) ISoliniaLootTableEntry(com.solinia.solinia.Interfaces.ISoliniaLootTableEntry) ISoliniaFaction(com.solinia.solinia.Interfaces.ISoliniaFaction) ArrayList(java.util.ArrayList) ISoliniaLootTable(com.solinia.solinia.Interfaces.ISoliniaLootTable) ISoliniaLootDrop(com.solinia.solinia.Interfaces.ISoliniaLootDrop) ISoliniaLootDropEntry(com.solinia.solinia.Interfaces.ISoliniaLootDropEntry) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException)

Example 5 with ISoliniaLootTable

use of com.solinia.solinia.Interfaces.ISoliniaLootTable 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() + "]:");
        }
    }
}
Also used : ISoliniaLootTableEntry(com.solinia.solinia.Interfaces.ISoliniaLootTableEntry) ISoliniaLootTable(com.solinia.solinia.Interfaces.ISoliniaLootTable) ISoliniaLootDrop(com.solinia.solinia.Interfaces.ISoliniaLootDrop)

Aggregations

ISoliniaLootTable (com.solinia.solinia.Interfaces.ISoliniaLootTable)7 ISoliniaLootTableEntry (com.solinia.solinia.Interfaces.ISoliniaLootTableEntry)4 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)3 ISoliniaLootDrop (com.solinia.solinia.Interfaces.ISoliniaLootDrop)3 ArrayList (java.util.ArrayList)3 ISoliniaFaction (com.solinia.solinia.Interfaces.ISoliniaFaction)2 ISoliniaItem (com.solinia.solinia.Interfaces.ISoliniaItem)2 ISoliniaLootDropEntry (com.solinia.solinia.Interfaces.ISoliniaLootDropEntry)2 ISoliniaNPC (com.solinia.solinia.Interfaces.ISoliniaNPC)2 SoliniaLootTableEntry (com.solinia.solinia.Models.SoliniaLootTableEntry)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 InvalidLootTableSettingException (com.solinia.solinia.Exceptions.InvalidLootTableSettingException)1 InvalidNpcSettingException (com.solinia.solinia.Exceptions.InvalidNpcSettingException)1 ISoliniaLootTableEntryTypeAdapterFactory (com.solinia.solinia.Factories.ISoliniaLootTableEntryTypeAdapterFactory)1 BufferedReader (java.io.BufferedReader)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 List (java.util.List)1 Random (java.util.Random)1