Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_datapack
- Index: data/html/droplist.htm
- ===================================================================
- --- data/html/droplist.htm (revision 0)
- +++ data/html/droplist.htm (working copy)
- @@ -0,0 +1,5 @@
- +<html><title>Droplist : %name%</title><body><img height=14>
- +<font color=B09878>* NOTE : Uncheck to ignore specific drop.</font>
- +<img src=L2UI.SquareGray width=280 height=1>
- +%list%
- +</body></html>
- \ No newline at end of file
- #P aCis_gameserver
- Index: java/net/sf/l2j/gameserver/model/actor/Npc.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/Npc.java (revision 7)
- +++ java/net/sf/l2j/gameserver/model/actor/Npc.java (working copy)
- @@ -1,7 +1,9 @@
- package net.sf.l2j.gameserver.model.actor;
- +import java.text.DecimalFormat;
- import java.util.ArrayList;
- import java.util.Arrays;
- +import java.util.Collections;
- import java.util.List;
- import net.sf.l2j.commons.concurrent.ThreadPool;
- @@ -14,6 +16,7 @@
- import net.sf.l2j.gameserver.data.cache.HtmCache;
- import net.sf.l2j.gameserver.data.sql.ClanTable;
- import net.sf.l2j.gameserver.data.xml.MultisellData;
- +import net.sf.l2j.gameserver.data.xml.NpcData;
- import net.sf.l2j.gameserver.data.xml.ScriptData;
- import net.sf.l2j.gameserver.enums.IntentionType;
- import net.sf.l2j.gameserver.enums.ScriptEventType;
- @@ -21,8 +24,11 @@
- import net.sf.l2j.gameserver.geoengine.GeoEngine;
- import net.sf.l2j.gameserver.model.L2Skill;
- import net.sf.l2j.gameserver.model.WorldObject;
- +import net.sf.l2j.gameserver.model.actor.instance.Chest;
- +import net.sf.l2j.gameserver.model.actor.instance.GrandBoss;
- import net.sf.l2j.gameserver.model.actor.instance.Merchant;
- import net.sf.l2j.gameserver.model.actor.instance.Monster;
- +import net.sf.l2j.gameserver.model.actor.instance.RaidBoss;
- import net.sf.l2j.gameserver.model.actor.stat.NpcStat;
- import net.sf.l2j.gameserver.model.actor.status.NpcStatus;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- @@ -30,6 +36,8 @@
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate.Race;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate.SkillType;
- import net.sf.l2j.gameserver.model.entity.Castle;
- +import net.sf.l2j.gameserver.model.item.DropCategory;
- +import net.sf.l2j.gameserver.model.item.DropData;
- import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- import net.sf.l2j.gameserver.model.item.kind.Item;
- import net.sf.l2j.gameserver.model.item.kind.Weapon;
- @@ -231,6 +239,8 @@
- // Check if the Player is a GM ; send him NPC infos if true.
- if (player.isGM())
- sendNpcInfos(player);
- + else if (this instanceof Monster || this instanceof RaidBoss || this instanceof GrandBoss || this instanceof Chest)
- + sendNpcDrop(player, getTemplate().getNpcId(), 1);
- if (player.getTarget() != this)
- player.setTarget(this);
- @@ -771,6 +781,109 @@
- player.sendPacket(html);
- }
- + public static void sendNpcDrop(Player player, int npcId, int page)
- + {
- + final int ITEMS_PER_LIST = 7;
- + final NpcTemplate npc = NpcData.getInstance().getTemplate(npcId);
- + if (npc == null)
- + return;
- +
- + if (npc.getDropData().isEmpty())
- + {
- + player.sendMessage("This target have not drop info.");
- + return;
- + }
- +
- + final List<DropCategory> list = new ArrayList<>();
- + npc.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();
- + for (DropCategory cat : list)
- + {
- + if (shown == ITEMS_PER_LIST)
- + {
- + hasMore = true;
- + break;
- + }
- +
- + for (DropData drop : cat.getAllDrops())
- + {
- + double chance = (drop.getItemId() == 57 ? drop.getChance() * Config.RATE_DROP_ADENA : drop.getChance() * Config.RATE_DROP_ITEMS) / 10000;
- + chance = chance > 100 ? 100 : chance;
- +
- + 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);
- + }
- +
- + Item item = ItemTable.getInstance().getTemplate(drop.getItemId());
- + String name = item.getName();
- +
- + if (name.startsWith("Recipe: "))
- + name = "R: " + name.substring(8);
- +
- + if (name.length() >= 40)
- + name = name.substring(0, 37) + "...";
- +
- + if (myPage != page)
- + {
- + i++;
- + if (i == ITEMS_PER_LIST)
- + {
- + myPage++;
- + i = 0;
- + }
- + continue;
- + }
- +
- + if (shown == ITEMS_PER_LIST)
- + {
- + hasMore = true;
- + break;
- + }
- +
- + String check = player.ignoredDropContain(item.getItemId()) ? "L2UI.CheckBox" : "L2UI.CheckBox_checked";
- + sb.append("<table width=280 bgcolor=000000><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=" + item.getIcon() + " fore=" + item.getIcon() + "></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("<td width=20><button action=\"bypass droplist " + npcId + " " + page + " " + item.getItemId() + "\" width=12 height=12 back=\"" + check + "\" fore=\"" + check + "\"/></td>");
- + sb.append("</tr></table><img src=L2UI.SquareGray width=280 height=1>");
- + shown++;
- + }
- + }
- + sb.append("<img height=" + (294 - (shown * 42)) + ">");
- + sb.append("<img height=8><img src=L2UI.SquareGray width=280 height=1>");
- + sb.append("<table width=280 bgcolor=000000><tr>");
- + sb.append("<td align=center width=70>" + (page > 1 ? "<button value=\"< PREV\" action=\"bypass droplist " + npcId + " " + (page - 1) + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
- + sb.append("<td align=center width=140>Page " + page + "</td>");
- + sb.append("<td align=center width=70>" + (hasMore ? "<button value=\"NEXT >\" action=\"bypass droplist " + npcId + " " + (page + 1) + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
- + sb.append("</tr></table><img src=L2UI.SquareGray width=280 height=1>");
- +
- + final NpcHtmlMessage html = new NpcHtmlMessage(200);
- + html.setFile("data/html/droplist.htm");
- + html.replace("%list%", sb.toString());
- + html.replace("%name%", npc.getName());
- + player.sendPacket(html);
- + }
- +
- /**
- * Open a quest or chat window on client with the text of this {@link Npc} in function of the command.
- * @param player :The player to test.
- Index: java/net/sf/l2j/gameserver/model/actor/Player.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/Player.java (revision 9)
- +++ java/net/sf/l2j/gameserver/model/actor/Player.java (working copy)
- @@ -474,6 +474,8 @@
- private Door _requestedGate;
- + private List<Integer> _ignored = new ArrayList<>();
- +
- /**
- * Constructor of Player (use Creature constructor).
- * <ul>
- @@ -8683,6 +8685,19 @@
- _requestedGate = door;
- }
- + public void ignored(Integer itemId)
- + {
- + if (_ignored.contains(itemId))
- + _ignored.remove(itemId);
- + else
- + _ignored.add(itemId);
- + }
- +
- + public boolean ignoredDropContain(int itemId)
- + {
- + return _ignored.contains(itemId);
- + }
- +
- @Override
- public boolean polymorph(PolyType type, int npcId)
- {
- Index: java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/Monster.java (revision 7)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/Monster.java (working copy)
- @@ -1108,7 +1108,7 @@
- for (DropData drop : cat.getAllDrops())
- {
- item = calculateRewardItem(drop, levelModifier, true);
- - if (item == null)
- + if (item == null || player.ignoredDropContain(item.getId()))
- continue;
- _sweepItems.add(item);
- @@ -1130,6 +1130,9 @@
- if (item != null)
- {
- + if (player.ignoredDropContain(item.getId()))
- + continue;
- +
- // Check if the autoLoot mode is active
- if ((isRaidBoss() && Config.AUTO_LOOT_RAID) || (!isRaidBoss() && Config.AUTO_LOOT))
- player.doAutoLoot(this, item);
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 9)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
- @@ -137,5 +137,18 @@
- final int arenaId = Integer.parseInt(_command.substring(12).trim());
- player.enterOlympiadObserverMode(arenaId);
- }
- + else if (_command.startsWith("droplist"))
- + {
- + StringTokenizer st = new StringTokenizer(_command, " ");
- + st.nextToken();
- +
- + int npcId = Integer.parseInt(st.nextToken());
- + int page = st.hasMoreTokens() ? Integer.parseInt(st.nextToken()) : 1;
- +
- + if (st.hasMoreTokens())
- + player.ignored(Integer.parseInt(st.nextToken()));
- +
- + Npc.sendNpcDrop(player, npcId, page);
- + }
- }
- }
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement