Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/CustomMods/BossSettings.ini b/config/CustomMods/BossSettings.ini
- index 1190422..729b563 100644
- --- a/config/CustomMods/BossSettings.ini
- +++ b/config/CustomMods/BossSettings.ini
- @@ -1,4 +1,23 @@
- +#=============================================================
- +# Custom settings
- +#=============================================================
- +# Limit of displayed raid boss per page
- +# Default: 15
- +RaidBossInfoPageLimit = 15
- +
- +# Limit of displayed drop per page
- +# Default: 15, Max 18
- +RaidBossDropPageLimit = 18
- +
- +# Displayed date format for dead raid boss
- +# Default: (MMM dd, HH:mm)
- +RaidBossDateFormat = (MMM dd, HH:mm)
- +
- +# Displayed raid boss
- +# Syntax: bossId,bossId, ...
- +RaidBossIds = 25325,29001
- +
- #=============================================================
- # Bosses
- #=============================================================
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index 61cacdf..53f4314 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -85,6 +85,12 @@
- public static boolean ALLOW_DUALBOX;
- public static int ALLOWED_BOXES;
- public static boolean ALLOW_DUALBOX_OLY;
- + /** Raid info*/
- + public static int RAID_BOSS_INFO_PAGE_LIMIT;
- + public static int RAID_BOSS_DROP_PAGE_LIMIT;
- + public static String RAID_BOSS_DATE_FORMAT;
- + public static String RAID_BOSS_IDS;
- + public static List<Integer> LIST_RAID_BOSS_IDS;
- /** Clan Hall function */
- public static boolean PVP_SAME_IP;
- public static boolean PVP_SUMON;
- @@ -1084,6 +1090,16 @@
- private static final void loadBoss()
- {
- final ExProperties Boss = initProperties(BOSSESETTIGNS);
- + RAID_BOSS_INFO_PAGE_LIMIT = Integer.parseInt(Boss.getProperty("RaidBossInfoPageLimit", "15"));
- + RAID_BOSS_DROP_PAGE_LIMIT = Integer.parseInt(Boss.getProperty("RaidBossDropPageLimit", "15"));
- + RAID_BOSS_DATE_FORMAT = Boss.getProperty("RaidBossDateFormat", "MMM dd, HH:mm");
- + RAID_BOSS_IDS = Boss.getProperty("RaidBossIds", "0,0");
- + LIST_RAID_BOSS_IDS = new ArrayList<>();
- + for (String val : RAID_BOSS_IDS.split(","))
- + {
- + int npcId = Integer.parseInt(val);
- + LIST_RAID_BOSS_IDS.add(npcId);
- + }
- RAID_HP_REGEN_MULTIPLIER = Boss.getProperty("RaidHpRegenMultiplier", 1.);
- RAID_MP_REGEN_MULTIPLIER = Boss.getProperty("RaidMpRegenMultiplier", 1.);
- RAID_DEFENCE_MULTIPLIER = Boss.getProperty("RaidDefenceMultiplier", 1.);
- diff --git a/java/net/sf/l2j/gameserver/GameServer.java b/java/net/sf/l2j/gameserver/GameServer.java
- index 33aa989..fb95657 100644
- --- a/java/net/sf/l2j/gameserver/GameServer.java
- +++ b/java/net/sf/l2j/gameserver/GameServer.java
- @@ -39,6 +39,7 @@
- import net.sf.l2j.gameserver.data.manager.LotteryManager;
- import net.sf.l2j.gameserver.data.manager.PartyMatchRoomManager;
- import net.sf.l2j.gameserver.data.manager.PetitionManager;
- +import net.sf.l2j.gameserver.data.manager.RaidBossInfoManager;
- import net.sf.l2j.gameserver.data.manager.RaidBossManager;
- import net.sf.l2j.gameserver.data.manager.RaidPointManager;
- import net.sf.l2j.gameserver.data.manager.SevenSignsManager;
- @@ -57,6 +58,7 @@
- import net.sf.l2j.gameserver.data.xml.FishData;
- import net.sf.l2j.gameserver.data.xml.HennaData;
- import net.sf.l2j.gameserver.data.xml.HerbDropData;
- +import net.sf.l2j.gameserver.data.xml.IconTable;
- import net.sf.l2j.gameserver.data.xml.InstantTeleportData;
- import net.sf.l2j.gameserver.data.xml.ItemData;
- import net.sf.l2j.gameserver.data.xml.MapRegionData;
- @@ -218,6 +220,8 @@
- RandomAnimationTaskManager.getInstance();
- ShadowItemTaskManager.getInstance();
- WaterTaskManager.getInstance();
- + RaidBossInfoManager.getInstance();
- + IconTable.getInstance();
- StringUtil.printSection("Auto Spawns");
- AutoSpawnTable.getInstance();
- diff --git a/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java b/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java
- index 8055a66..64f5c5a 100644
- --- a/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java
- +++ b/java/net/sf/l2j/gameserver/data/manager/GrandBossManager.java
- @@ -10,6 +10,7 @@
- import net.sf.l2j.commons.logging.CLogger;
- import net.sf.l2j.commons.pool.ConnectionPool;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.xml.NpcData;
- import net.sf.l2j.gameserver.model.actor.instance.GrandBoss;
- @@ -106,6 +107,8 @@
- public void setStatSet(int bossId, StatSet info)
- {
- _sets.put(bossId, info);
- + if (Config.LIST_RAID_BOSS_IDS.contains(bossId))
- + RaidBossInfoManager.getInstance().updateRaidBossInfo(bossId, info.getLong("respawn_time"));
- updateDb(bossId, false);
- }
- diff --git a/java/net/sf/l2j/gameserver/data/manager/RaidBossInfoManager.java b/java/net/sf/l2j/gameserver/data/manager/RaidBossInfoManager.java
- new file mode 100644
- index 0000000..79f77ea
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/data/manager/RaidBossInfoManager.java
- @@ -0,0 +1,71 @@
- +package net.sf.l2j.gameserver.data.manager;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.util.Map;
- +import java.util.concurrent.ConcurrentHashMap;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.pool.ConnectionPool;
- +
- +import net.sf.l2j.Config;
- +
- +public class RaidBossInfoManager
- +{
- + private static final Logger _log = Logger.getLogger(RaidBossInfoManager.class.getName());
- + private final Map<Integer, Long> _raidBosses;
- +
- + protected RaidBossInfoManager()
- + {
- + _raidBosses = new ConcurrentHashMap<>();
- + load();
- + }
- +
- + public void load()
- + {
- + try (Connection con = ConnectionPool.getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT boss_id, respawn_time FROM grandboss_data UNION SELECT boss_id, respawn_time FROM raidboss_spawnlist ORDER BY boss_id"))
- + {
- + try (ResultSet rs = statement.executeQuery())
- + {
- + while (rs.next())
- + {
- + int bossId = rs.getInt("boss_id");
- + if (Config.LIST_RAID_BOSS_IDS.contains(bossId))
- + _raidBosses.put(bossId, rs.getLong("respawn_time"));
- +
- + /*if (Config.LIST_RAID_BOSS_IDS2.contains(bossId))
- + _raidBosses.put(bossId, rs.getLong("respawn_time"));
- + if (Config.LIST_RAID_BOSS_IDS3.contains(bossId))
- + _raidBosses.put(bossId, rs.getLong("respawn_time"));*/
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.warning("Exception: RaidBossInfoManager load: " + e);
- + }
- + _log.info("RaidBossInfoManager: Loaded " + _raidBosses.size() + " instances.");
- + }
- +
- + public void updateRaidBossInfo(int bossId, long respawnTime)
- + {
- + _raidBosses.put(bossId, respawnTime);
- + }
- +
- + public long getRaidBossRespawnTime(int bossId)
- + {
- + return _raidBosses.get(bossId);
- + }
- +
- + public static RaidBossInfoManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final RaidBossInfoManager _instance = new RaidBossInfoManager();
- + }
- +}
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/gameserver/data/xml/IconTable.java b/java/net/sf/l2j/gameserver/data/xml/IconTable.java
- new file mode 100644
- index 0000000..08bbfec
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/data/xml/IconTable.java
- @@ -0,0 +1,96 @@
- +/*
- + * This program is free software: you can redistribute it and/or modify it under
- + * the terms of the GNU General Public License as published by the Free Software
- + * Foundation, either version 3 of the License, or (at your option) any later
- + * version.
- + *
- + * This program is distributed in the hope that it will be useful, but WITHOUT
- + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- + * details.
- + *
- + * You should have received a copy of the GNU General Public License along with
- + * this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package net.sf.l2j.gameserver.data.xml;
- +
- +import java.io.File;
- +import java.util.Map;
- +import java.util.concurrent.ConcurrentHashMap;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
- +
- +import org.w3c.dom.Document;
- +import org.w3c.dom.NamedNodeMap;
- +import org.w3c.dom.Node;
- +/**
- + *
- + * @author Sarada
- + *
- + */
- +public class IconTable
- +{
- + private static final Logger _log = Logger.getLogger(IconTable.class.getName());
- +
- + private static Map<Integer, String> _icons = new ConcurrentHashMap<>();
- +
- + public static final IconTable getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + protected IconTable()
- + {
- +
- + load();
- + }
- +
- + private static void load()
- + {
- + try
- + {
- + File f = new File("./data/xml/icons.xml");
- + Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
- +
- + Node n = doc.getFirstChild();
- + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
- + {
- + if (d.getNodeName().equalsIgnoreCase("icon"))
- + {
- + NamedNodeMap attrs = d.getAttributes();
- +
- + int itemId = Integer.valueOf(attrs.getNamedItem("itemId").getNodeValue());
- + String iconName = attrs.getNamedItem("iconName").getNodeValue();
- +
- + if (itemId == 0 && itemId < 0)
- + {
- + _log.log(Level.WARNING, "Icon Table: itemId=\"" + itemId + "\" is not item ID, Ignoring it!");
- + continue;
- + }
- + _icons.put(itemId, iconName);
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Icon Table: Error loading from database: " + e.getMessage(), e);
- + }
- +
- + _log.info("Icon Table: Loaded " + _icons.size() + " icons.");
- + }
- +
- + public static String getIcon(int id)
- + {
- + if (_icons.get(id) == null)
- + return "icon.NOIMAGE";
- +
- + return _icons.get(id);
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final IconTable _instance = new IconTable();
- + }
- +}
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/gameserver/model/actor/Npc.java b/java/net/sf/l2j/gameserver/model/actor/Npc.java
- index 9b5c4fb..17a0088 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/Npc.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/Npc.java
- @@ -3,7 +3,9 @@
- import java.text.DateFormat;
- import java.util.ArrayList;
- import java.util.List;
- +import java.util.Map;
- import java.util.StringTokenizer;
- +import java.util.concurrent.ConcurrentHashMap;
- import net.sf.l2j.commons.lang.StringUtil;
- import net.sf.l2j.commons.pool.ThreadPool;
- @@ -94,7 +96,19 @@
- private final SiegableHall _siegableHall;
- private boolean _isCoreAiDisabled;
- -
- + protected static final int PAGE_LIMIT = Config.RAID_BOSS_DROP_PAGE_LIMIT;
- + protected static final Map<Integer, Integer> LAST_PAGE = new ConcurrentHashMap<>();
- + protected static final String[][] MESSAGE =
- + {
- + {
- + "<font color=\"LEVEL\">%player%</font>, are you not afraid?",
- + "Be careful <font color=\"LEVEL\">%player%</font>!"
- + },
- + {
- + "Here is the drop list of <font color=\"LEVEL\">%boss%</font>!",
- + "Seems that <font color=\"LEVEL\">%boss%</font> has good drops."
- + },
- + };
- public Npc(int objectId, NpcTemplate template)
- {
- super(objectId, template);
- diff --git a/java/net/sf/l2j/gameserver/model/actor/instance/RaidBossInfo.java b/java/net/sf/l2j/gameserver/model/actor/instance/RaidBossInfo.java
- new file mode 100644
- index 0000000..4a17556
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/model/actor/instance/RaidBossInfo.java
- @@ -0,0 +1,328 @@
- +/*
- +* This program is free software: you can redistribute it and/or modify it under
- +* the terms of the GNU General Public License as published by the Free Software
- +* Foundation, either version 3 of the License, or (at your option) any later
- +* version.
- +*
- +* This program is distributed in the hope that it will be useful, but WITHOUT
- +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- +* details.
- +*
- +* You should have received a copy of the GNU General Public License along with
- +* this program. If not, see <http://www.gnu.org/licenses/>.
- +*/
- +package net.sf.l2j.gameserver.model.actor.instance;
- +
- +import java.text.DecimalFormat;
- +import java.text.SimpleDateFormat;
- +import java.util.ArrayList;
- +import java.util.Collections;
- +import java.util.Date;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.StringTokenizer;
- +import java.util.concurrent.ConcurrentHashMap;
- +
- +import net.sf.l2j.commons.lang.StringUtil;
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.manager.RaidBossInfoManager;
- +import net.sf.l2j.gameserver.data.xml.IconTable;
- +import net.sf.l2j.gameserver.data.xml.ItemData;
- +import net.sf.l2j.gameserver.data.xml.NpcData;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.model.item.DropCategory;
- +import net.sf.l2j.gameserver.model.item.DropData;
- +import net.sf.l2j.gameserver.model.item.kind.Item;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- +public class RaidBossInfo extends Folk
- +{
- +private final Map<Integer, Integer> _lastPage = new ConcurrentHashMap<>();
- +
- +private final String[][] _messages =
- +{
- +{
- +"<font color=\"LEVEL\">%player%</font>, are you not afraid?",
- +"Be careful <font color=\"LEVEL\">%player%</font>!"
- +},
- +{
- +"Here is the drop list of <font color=\"LEVEL\">%boss%</font>!",
- +"Seems that <font color=\"LEVEL\">%boss%</font> has good drops."
- +},
- +};
- +
- +public RaidBossInfo(int objectId, NpcTemplate template)
- +{
- +super(objectId, template);
- +}
- +
- +@Override
- +public void showChatWindow(Player player, int val)
- +{
- +String name = "data/html/mods/raidbossinfo/" + getNpcId() + ".htm";
- +if (val != 0)
- +name = "data/html/mods/raidbossinfo/" + getNpcId() + "-" + val + ".htm";
- +
- +NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- +html.setFile(name);
- +html.replace("%objectId%", getObjectId());
- +player.sendPacket(html);
- +player.sendPacket(ActionFailed.STATIC_PACKET);
- +}
- +
- +@Override
- +public void onBypassFeedback(Player player, String command)
- +{
- +StringTokenizer st = new StringTokenizer(command, " ");
- +String currentCommand = st.nextToken();
- +
- +if (currentCommand.startsWith("RaidBossInfo"))
- +{
- +int pageId = Integer.parseInt(st.nextToken());
- +_lastPage.put(player.getObjectId(), pageId);
- +showRaidBossInfo(player, pageId);
- +}
- +else if (currentCommand.startsWith("RaidBossDrop"))
- +{
- +int bossId = Integer.parseInt(st.nextToken());
- +int pageId = st.hasMoreTokens() ? Integer.parseInt(st.nextToken()) : 1;
- +showRaidBossDrop(player, bossId, pageId);
- +}
- +
- +super.onBypassFeedback(player, command);
- +}
- +
- +private void showRaidBossInfo(Player player, int pageId)
- +{
- +List<Integer> infos = new ArrayList<>();
- +infos.addAll(Config.LIST_RAID_BOSS_IDS);
- +
- +final int limit = Config.RAID_BOSS_INFO_PAGE_LIMIT;
- +final int max = infos.size() / limit + (infos.size() % limit == 0 ? 0 : 1);
- +infos = infos.subList((pageId - 1) * limit, Math.min(pageId * limit, infos.size()));
- +
- +final StringBuilder sb = new StringBuilder();
- +sb.append("<html>");
- +sb.append("<center>");
- +sb.append("<body>");
- +sb.append("<table><tr>");
- +sb.append("<td width=32><img src=Icon.etc_alphabet_b_i00 height=32 width=32></td>");
- +sb.append("<td width=32><img src=Icon.etc_alphabet_i_i00 height=32 width=32></td>");
- +sb.append("<td width=32><img src=Icon.etc_alphabet_g_i00 height=32 width=32></td>");
- +sb.append("<td width=32><img src=Icon.etc_alphabet_b_i00 height=32 width=32></td>");
- +sb.append("<td width=32><img src=Icon.etc_alphabet_o_i00 height=32 width=32></td>");
- +sb.append("<td width=32><img src=Icon.etc_alphabet_s_i00 height=32 width=32></td>");
- +sb.append("<td width=32><img src=Icon.etc_alphabet_s_i00 height=32 width=32></td>");
- +sb.append("</tr></table><br>");
- +
- +sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
- +sb.append("<table bgcolor=\"000000\" width=\"318\">");
- +sb.append("<tr><td><center>" + _messages[0][Rnd.get(_messages.length)].replace("%player%", player.getName()) + "</center></td></tr>");
- +sb.append("<tr><td><center><font color=\"FF8C00\">Raid Boss Infos</font></center></td></tr>");
- +sb.append("</table>");
- +sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
- +
- +sb.append("<table bgcolor=\"000000\" width=\"318\">");
- +
- +for (int bossId : infos)
- +{
- +final NpcTemplate template = NpcData.getInstance().getTemplate(bossId);
- +if (template == null)
- +continue;
- +
- +String bossName = template.getName();
- +if (bossName.length() > 23)
- +bossName = bossName.substring(0, 23) + "...";
- +
- +final long respawnTime = RaidBossInfoManager.getInstance().getRaidBossRespawnTime(bossId);
- +if (respawnTime <= System.currentTimeMillis())
- +{
- +sb.append("<tr>");
- +sb.append("<td><a action=\"bypass -h npc_%objectId%_RaidBossDrop " + bossId + "\">" + bossName + "</a></td>");
- +sb.append("<td><font color=\"9CC300\">Alive</font></td>");
- +sb.append("</tr>");
- +}
- +else
- +{
- +sb.append("<tr>");
- +sb.append("<td width=\"159\" align=\"left\"><a action=\"bypass -h npc_%objectId%_RaidBossDrop " + bossId + "\">" + bossName + "</a></td>");
- +sb.append("<td width=\"159\" align=\"left\"><font color=\"FB5858\">Dead</font> " + new SimpleDateFormat(Config.RAID_BOSS_DATE_FORMAT).format(new Date(respawnTime)) + "</td>");
- +sb.append("</tr>");
- +}
- +}
- +sb.append("</table>");
- +
- +sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
- +
- +sb.append("<table width=\"300\" cellspacing=\"2\">");
- +sb.append("<tr>");
- +for (int x = 0; x < max; x++)
- +{
- + final int pageNr = x + 1;
- + if (pageId == pageNr)
- + sb.append("<td align=\"center\">" + pageNr + "</td>");
- + else
- + sb.append("<td align=\"center\"><a action=\"bypass -h npc_%objectId%_RaidBossInfo " + pageNr + "\">" + pageNr + "</a></td>");
- +}
- +sb.append("</tr>");
- +sb.append("</table>");
- +
- +sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
- +
- +sb.append("<table bgcolor=\"000000\" width=\"350\">");
- +sb.append("<tr><td><center><a action=\"bypass -h npc_%objectId%_Chat 0\">Return</a></center></td></tr>");
- +sb.append("</table>");
- +sb.append("<img src=\"L2UI.SquareGray\" width=300 height=1>");
- +
- +
- +sb.append("</center>");
- +sb.append("</body>");
- +sb.append("</html>");
- +
- +final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- +html.setHtml(sb.toString());
- +html.replace("%name%", getName());
- +html.replace("%objectId%", getObjectId());
- +player.sendPacket(html);
- +}
- +
- +private void showRaidBossDrop(Player player, int npcId, int page)
- +{
- + final NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
- + if (template == null)
- + return;
- +
- + if (template.getDropData().isEmpty())
- + {
- + player.sendMessage("This target have not drop info.");
- + return;
- + }
- +
- + final List<DropCategory> list = new ArrayList<>();
- + template.getDropData().forEach(c -> list.add(c));
- + Collections.reverse(list);
- +
- + int myPage = 1;
- + int i = 0;
- + int shown = 0;
- + boolean hasMore = false;
- +
- + final StringBuilder sb = new StringBuilder();
- + sb.append("<html>");
- + sb.append("<center>");
- + sb.append("<body>");
- + sb.append("<table width=\"256\">");
- + sb.append("<tr><td width=\"256\" align=\"center\">%name%</td></tr>");
- + sb.append("</table>");
- + sb.append("<br>");
- + sb.append("<table width=\"256\">");
- + sb.append("<tr><td width=\"256\" align=\"left\">" + MESSAGE[1][Rnd.get(MESSAGE.length)].replace("%boss%", template.getName()) + "</td></tr>");
- + sb.append("</table>");
- + sb.append("<br>");
- + sb.append("<table width=\"224\" bgcolor=\"000000\">");
- + sb.append("<tr><td width=\"224\" align=\"center\">Raid Boss Drops</td></tr>");
- + sb.append("</table>");
- + sb.append("<br>");
- +
- + for (DropCategory cat : list)
- + {
- + if (shown == PAGE_LIMIT)
- + {
- + hasMore = true;
- + break;
- + }
- +
- + for (DropData drop : cat.getAllDrops())
- + {
- + final double chance = Math.min(100, (((drop.getItemId() == 57) ? drop.getChance() * Config.RATE_DROP_ADENA : drop.getChance() * Config.RATE_DROP_ITEMS) / 10000));
- + final Item item = ItemData.getInstance().getTemplate(drop.getItemId());
- +
- + String name = item.getName();
- + if (name.startsWith("Recipe: "))
- + name = "R: " + name.substring(8);
- +
- + if (name.length() >= 45)
- + name = name.substring(0, 42) + "...";
- +
- + String percent = null;
- + if (chance <= 0.001)
- + {
- + DecimalFormat df = new DecimalFormat("#.####");
- + percent = df.format(chance);
- + }
- + else if (chance <= 0.01)
- + {
- + DecimalFormat df = new DecimalFormat("#.###");
- + percent = df.format(chance);
- + }
- + else
- + {
- + DecimalFormat df = new DecimalFormat("##.##");
- + percent = df.format(chance);
- + }
- +
- + if (myPage != page)
- + {
- + i++;
- + if (i == PAGE_LIMIT)
- + {
- + myPage++;
- + i = 0;
- + }
- + continue;
- + }
- +
- + if (shown == PAGE_LIMIT)
- + {
- + hasMore = true;
- + break;
- + }
- +
- + sb.append(((shown % 2) == 0 ? "<table width=\"280\" bgcolor=\"000000\"><tr>" : "<table width=\"280\"><tr>"));
- + sb.append("<td width=44 height=41 align=center><table bgcolor=" + (cat.isSweep() ? "FF00FF" : "FFFFFF") + " cellpadding=6 cellspacing=\"-5\"><tr><td><button width=32 height=32 back=" + IconTable.getIcon(item.getItemId()) + " fore=" + IconTable.getIcon(item.getItemId()) + "></td></tr></table></td>");
- + sb.append("<td width=240>" + (cat.isSweep() ? ("<font color=ff00ff>" + name + "</font>") : name) + "<br1><font color=B09878>" + (cat.isSweep() ? "Spoil" : "Drop") + " Chance : " + percent + "%</font></td>");
- + sb.append("</tr></table><img src=L2UI.SquareGray width=280 height=1>");
- + shown++;
- + }
- + }
- +
- + // Build page footer.
- + sb.append("<br><img src=\"L2UI.SquareGray\" width=277 height=1><table width=\"100%\" bgcolor=000000><tr>");
- +
- + if (page > 1)
- + StringUtil.append(sb, "<td align=left width=70><a action=\"bypass -h npc_%objectId%_RaidBossDrop "+ npcId + " ", (page - 1), "\">Previous</a></td>");
- + else
- + StringUtil.append(sb, "<td align=left width=70>Previous</td>");
- +
- + StringUtil.append(sb, "<td align=center width=100>Page ", page, "</td>");
- +
- + if (page < shown)
- + StringUtil.append(sb, "<td align=right width=70>" + (hasMore ? "<a action=\"bypass -h npc_%objectId%_RaidBossDrop " + npcId + " " + (page + 1) + "\">Next</a>" : "") + "</td>");
- + else
- + StringUtil.append(sb, "<td align=right width=70>Next</td>");
- +
- + sb.append("</tr></table><img src=\"L2UI.SquareGray\" width=277 height=1>");
- + sb.append("<br>");
- + sb.append("<center>");
- + sb.append("<table width=\"160\" cellspacing=\"2\">");
- + sb.append("<tr>");
- + sb.append("<td width=\"160\" align=\"center\"><a action=\"bypass -h npc_%objectId%_RaidBossInfo " + _lastPage.get(player.getObjectId()) + "\">Return</a></td>");
- + sb.append("</tr>");
- + sb.append("</table>");
- + sb.append("</center>");
- + sb.append("</body>");
- + sb.append("</html>");
- +
- + final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setHtml(sb.toString());
- + html.replace("%name%", getName());
- + html.replace("%objectId%", getObjectId());
- + player.sendPacket(html);
- +}
- +
- +}
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java b/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java
- index c7c5a19..0507249 100644
- --- a/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java
- +++ b/java/net/sf/l2j/gameserver/model/spawn/BossSpawn.java
- @@ -11,6 +11,7 @@
- import net.sf.l2j.commons.random.Rnd;
- import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.manager.RaidBossInfoManager;
- import net.sf.l2j.gameserver.enums.BossStatus;
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.actor.Npc;
- @@ -147,6 +148,8 @@
- // Refresh the database for this particular boss entry.
- updateOnDb();
- + if (Config.LIST_RAID_BOSS_IDS.contains(_spawn.getNpcId()))
- + RaidBossInfoManager.getInstance().updateRaidBossInfo(_spawn.getNpcId(), respawnTime);
- LOGGER.info("Raid boss: {} - {} ({}h).", _spawn.getNpc().getName(), new SimpleDateFormat("dd-MM-yyyy HH:mm").format(respawnTime), respawnDelay);
- }
- @@ -175,6 +178,10 @@
- // Refresh the database for this particular boss entry.
- updateOnDb();
- +
- + if (Config.LIST_RAID_BOSS_IDS.contains(npc.getNpcId()))
- + RaidBossInfoManager.getInstance().updateRaidBossInfo(npc.getNpcId(), 0);
- +
- if (Config.ANNOUNCE_BOSS_ALIVE)
- World.gameAnnounceToOnlinePlayers("Boss: " + npc.getName() + " has spawned in the world!");
- LOGGER.info("{} raid boss has spawned.", npc.getName());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement