Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/org/l2jmobius/gameserver/model/actor/Npc.java
- IDEA additional info:
- Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
- <+>UTF-8
- ===================================================================
- diff --git a/java/org/l2jmobius/gameserver/model/actor/Npc.java b/java/org/l2jmobius/gameserver/model/actor/Npc.java
- --- a/java/org/l2jmobius/gameserver/model/actor/Npc.java
- +++ b/java/org/l2jmobius/gameserver/model/actor/Npc.java (date 1632068486809)
- @@ -689,7 +689,7 @@
- {
- pom = npcId + "-" + value;
- }
- -
- +
- final String temp = "data/html/default/" + pom + ".htm";
- if (!Config.LAZY_CACHE)
- {
- @@ -703,25 +703,31 @@
- {
- return temp;
- }
- -
- +
- // If the file is not found, the standard message "I have nothing to say to you" is returned
- return "data/html/npcdefault.htm";
- }
- -
- +
- public void showChatWindow(PlayerInstance player)
- {
- showChatWindow(player, 0);
- }
- -
- +
- /**
- * Returns true if html exists
- * @param player
- * @param type
- * @return boolean
- */
- - private boolean showPkDenyChatWindow(PlayerInstance player, String type)
- + private boolean showPkDenyChatWindow(int value, PlayerInstance player, String type)
- {
- - String html = HtmCache.getInstance().getHtm(player, "data/html/" + type + "/" + getId() + "-pk.htm");
- + String pom = "";
- + if (value == 0) {
- + pom = "";
- + } else {
- + pom = "-" + value;
- + }
- + String html = HtmCache.getInstance().getHtm(player, "data/html/" + type + "/" + getId() + "-pk" + pom + ".htm");
- if (html != null)
- {
- html = html.replace("%objectId%", String.valueOf(getObjectId()));
- @@ -731,7 +737,7 @@
- }
- return false;
- }
- -
- +
- /**
- * Open a chat window on client with the text of the NpcInstance.<br>
- * <br>
- @@ -746,51 +752,19 @@
- */
- public void showChatWindow(PlayerInstance player, int value)
- {
- + final int npcId = getTemplate().getId();
- if (!_isTalkable)
- {
- player.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- -
- - if (player.getReputation() < 0)
- - {
- - if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (this instanceof MerchantInstance))
- - {
- - if (showPkDenyChatWindow(player, "merchant"))
- - {
- - return;
- - }
- - }
- - else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && (this instanceof TeleporterInstance))
- - {
- - if (showPkDenyChatWindow(player, "teleporter"))
- - {
- - return;
- - }
- - }
- - else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && (this instanceof WarehouseInstance))
- - {
- - if (showPkDenyChatWindow(player, "warehouse"))
- - {
- - return;
- - }
- - }
- - else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (this instanceof FishermanInstance))
- - {
- - if (showPkDenyChatWindow(player, "fisherman"))
- - {
- - return;
- - }
- - }
- - }
- -
- +
- if (getTemplate().isType("Auctioneer") && (value == 0))
- {
- return;
- }
- -
- - final int npcId = getTemplate().getId();
- - String filename;
- +
- + String filename = "";
- switch (npcId)
- {
- case 31688:
- @@ -839,19 +813,51 @@
- {
- return;
- }
- - // Get the text of the selected HTML file in function of the npcId and of the page number
- - filename = (getHtmlPath(npcId, value, player));
- + else if (player.getReputation() < 0 && ((this instanceof MerchantInstance) ||
- + (this instanceof TeleporterInstance) ||
- + (this instanceof WarehouseInstance) ||
- + (this instanceof FishermanInstance)))
- + {
- + try {
- + if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (this instanceof MerchantInstance)) {
- + if (showPkDenyChatWindow(value, player, "merchant")) {
- + return;
- + }
- + } else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && (this instanceof TeleporterInstance)) {
- + if (showPkDenyChatWindow(value, player, "teleporter")) {
- + return;
- + }
- + } else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE && (this instanceof WarehouseInstance)) {
- + if (showPkDenyChatWindow(value, player, "warehouse")) {
- + return;
- + }
- + } else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && (this instanceof FishermanInstance)) {
- + if (showPkDenyChatWindow(value, player, "fisherman")) {
- + return;
- + }
- + }
- + } catch (Exception e) {
- + NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage (0);
- + npcHtmlMessage.setHtml("<html><body>My Text is missing:<br>" + getHtmlPath(npcId, value, player) + "</body></html>");
- + player.sendPacket(npcHtmlMessage);
- + }
- + }
- + else
- + {
- + // Get the text of the selected HTML file in function of the npcId and of the page number
- + filename = (getHtmlPath(npcId, value, player));
- + }
- break;
- }
- }
- -
- +
- // Send a Server->Client NpcHtmlMessage containing the text of the NpcInstance to the PlayerInstance
- final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- html.setFile(player, filename);
- html.replace("%npcname%", getName());
- html.replace("%objectId%", String.valueOf(getObjectId()));
- player.sendPacket(html);
- -
- +
- // Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
- player.sendPacket(ActionFailed.STATIC_PACKET);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement