Advertisement
NoxiousL2j

Community Board Multisell aCis 409

Oct 28th, 2024 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.57 KB | None | 0 0
  1. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/communitybbs/CommunityBoard.java b/aCis_gameserver/java/net/sf/l2j/gameserver/communitybbs/CommunityBoard.java
  2. index d5b2c6b..dc49a3b 100644
  3. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/communitybbs/CommunityBoard.java
  4. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/communitybbs/CommunityBoard.java
  5. @@ -22,6 +22,7 @@
  6.  import net.sf.l2j.gameserver.communitybbs.model.Forum;
  7.  import net.sf.l2j.gameserver.communitybbs.model.Post;
  8.  import net.sf.l2j.gameserver.communitybbs.model.Topic;
  9. +import net.sf.l2j.gameserver.data.xml.MultisellData;
  10.  import net.sf.l2j.gameserver.enums.bbs.ForumAccess;
  11.  import net.sf.l2j.gameserver.enums.bbs.ForumType;
  12.  import net.sf.l2j.gameserver.model.actor.Player;
  13. @@ -119,6 +120,10 @@
  14.             TopicBBSManager.getInstance().parseCmd(command, player);
  15.         else if (command.startsWith("_bbsposts"))
  16.             PostBBSManager.getInstance().parseCmd(command, player);
  17. +       else if (command.startsWith("_bbsmultisell;"))
  18. +       {
  19. +           MultisellData.getInstance().separateAndSendCb(command.substring(14).trim(), player, false);
  20. +       }
  21.         else
  22.             BaseBBSManager.separateAndSend("<html><body><br><br><center>The command: " + command + " isn't implemented.</center></body></html>", player);
  23.     }
  24. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/MultisellData.java b/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/MultisellData.java
  25. index 23e4364..b20ccca 100644
  26. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/MultisellData.java
  27. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/MultisellData.java
  28. @@ -77,50 +77,85 @@
  29.     }
  30.    
  31.     /**
  32. -    * Send the correct multisell content to a {@link Player}.<br>
  33. -    * <br>
  34. -    * {@link ListContainer} template is first retrieved, based on its name, then {@link Npc} npcId check is done for security reason. Then the content is sent into {@link PreparedListContainer}, notably to check Player inventory. Finally a {@link MultiSellList} packet is sent to the Player. That
  35. -    * new, prepared list is kept in memory on Player instance, mostly for memory reason.
  36. -    * @param listName : The ListContainer list name.
  37. -    * @param player : The Player to check.
  38. -    * @param npc : The Npc to check (notably used for npcId check).
  39. -    * @param inventoryOnly : if true we check inventory content.
  40. -    */
  41. -   public void separateAndSend(String listName, Player player, Npc npc, boolean inventoryOnly)
  42. -   {
  43. -       final ListContainer template = _entries.get(listName.hashCode());
  44. -       if (template == null)
  45. -           return;
  46. -      
  47. -       if ((npc != null && !template.isNpcAllowed(npc.getNpcId())) || (npc == null && template.isNpcOnly()))
  48. -           return;
  49. -      
  50. -       final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc);
  51. -      
  52. -       int index = 0;
  53. -       do
  54. -       {
  55. -           // send list at least once even if size = 0
  56. -           player.sendPacket(new MultiSellList(list, index));
  57. -           index += PAGE_SIZE;
  58. -       }
  59. -       while (index < list.getEntries().size());
  60. -      
  61. -       player.setMultiSell(list);
  62. -   }
  63. -  
  64. -   public ListContainer getList(String listName)
  65. -   {
  66. -       return _entries.get(listName.hashCode());
  67. -   }
  68. -  
  69. -   public static MultisellData getInstance()
  70. -   {
  71. -       return SingletonHolder.INSTANCE;
  72. -   }
  73. -  
  74. -   private static class SingletonHolder
  75. -   {
  76. -       protected static final MultisellData INSTANCE = new MultisellData();
  77. -   }
  78. +     * Send the correct multisell content to a {@link Player}.<br>
  79. +     * <br>
  80. +     * {@link ListContainer} template is first retrieved, based on its name, then {@link Npc} npcId check is done for security reason. Then the content is sent into {@link PreparedListContainer}, notably to check Player inventory. Finally a {@link MultiSellList} packet is sent to the Player. That
  81. +     * new, prepared list is kept in memory on Player instance, mostly for memory reason.
  82. +     * @param listName : The ListContainer list name.
  83. +     * @param player : The Player to check.
  84. +     * @param npc : The Npc to check (notably used for npcId check).
  85. +     * @param inventoryOnly : if true we check inventory content.
  86. +     */
  87. +    public void separateAndSend(String listName, Player player, Npc npc, boolean inventoryOnly)
  88. +    {
  89. +        final ListContainer template = _entries.get(listName.hashCode());
  90. +        if (template == null)
  91. +        {
  92. +            return;
  93. +        }
  94. +
  95. +        if ((npc != null && !template.isNpcAllowed(npc.getNpcId())) || (npc == null && template.isNpcOnly()))
  96. +        {
  97. +            return;
  98. +        }
  99. +
  100. +        final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc);
  101. +
  102. +        int index = 0;
  103. +        do
  104. +        {
  105. +            // send list at least once even if size = 0
  106. +            player.sendPacket(new MultiSellList(list, index));
  107. +            index += PAGE_SIZE;
  108. +        }
  109. +        while (index < list.getEntries().size());
  110. +
  111. +        player.setMultiSell(list);
  112. +    }
  113. +
  114. +    /**
  115. +     * Send the correct multisell content to a {@link Player}.<br>
  116. +     * <br>
  117. +     * {@link ListContainer} template is first retrieved, based on its name, no {@link Npc} checks are done. Then the content is sent into {@link PreparedListContainer}, notably to check Player inventory. Finally a {@link MultiSellList} packet is sent to the Player. That new, prepared list is kept
  118. +     * in memory on Player instance, mostly for memory reason.
  119. +     * @param listName : The ListContainer list name.
  120. +     * @param player : The Player to check.
  121. +     * @param inventoryOnly : if true we check inventory content.
  122. +     */
  123. +    public void separateAndSendCb(String listName, Player player, boolean inventoryOnly)
  124. +    {
  125. +        final ListContainer template = _entries.get(listName.hashCode());
  126. +        if (template == null)
  127. +        {
  128. +            return;
  129. +        }
  130. +
  131. +        final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, null);
  132. +
  133. +        int index = 0;
  134. +        do
  135. +        {
  136. +            // send list at least once even if size = 0
  137. +            player.sendPacket(new MultiSellList(list, index));
  138. +            index += PAGE_SIZE;
  139. +        }
  140. +        while (index < list.getEntries().size());
  141. +
  142. +        player.setMultiSell(list);
  143. +    }
  144. +
  145. +    public ListContainer getList(String listName)
  146. +    {
  147. +        return _entries.get(listName.hashCode());
  148. +    }
  149. +
  150. +    public static MultisellData getInstance()
  151. +    {
  152. +        return SingletonHolder.INSTANCE;
  153. +    }
  154. +
  155. +    private static class SingletonHolder
  156. +    {
  157. +        protected static final MultisellData INSTANCE = new MultisellData();
  158. +    }
  159.  }
  160. \ No newline at end of file
  161.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement