Advertisement
Guest User

Pvp Chat Mode - Core

a guest
Feb 4th, 2013
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.20 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P l2jelios_gameserver
  3. Index: java/net/sf/l2j/gameserver/network/clientpackets/Say2.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/network/clientpackets/Say2.java  (revision 4)
  6. +++ java/net/sf/l2j/gameserver/network/clientpackets/Say2.java  (working copy)
  7. @@ -24,6 +24,8 @@
  8.  import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  9.  import net.sf.l2j.gameserver.network.SystemMessageId;
  10.  import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  11. +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
  12. +import net.sf.l2j.gameserver.util.Broadcast;
  13.  import net.sf.l2j.gameserver.util.IllegalPlayerAction;
  14.  import net.sf.l2j.gameserver.util.Util;
  15.  
  16. @@ -165,6 +167,9 @@
  17.             return;
  18.         }
  19.        
  20. +       if(checkPvpChatFunction(activeChar , _text , _type))
  21. +           return;
  22. +      
  23.         if (activeChar.isChatBanned() || (activeChar.isInJail() && !activeChar.isGM()))
  24.         {
  25.             activeChar.sendPacket(SystemMessageId.CHATTING_PROHIBITED);
  26. @@ -204,6 +209,25 @@
  27.             _log.warning(activeChar.getName() + " tried to use unregistred chathandler type: " + _type + ".");
  28.     }
  29.    
  30. +   private static boolean checkPvpChatFunction(L2PcInstance player , String text , int type)
  31. +    {
  32. +        if(Config.ALLOW_PVP_CHAT)
  33. +        {
  34. +          if(type == 0)
  35. +          {
  36. +            if(text.startsWith(Config.PVP_CHAT_PREFIX))
  37. +            {
  38. +                if(player.getPvpKills() >= Config.PVP_AMOUNT_FOR_CHAT)
  39. +                {
  40. +                    Broadcast.toAllOnlinePlayers(new CreatureSay(0,15,player.getName(),text.substring(1)));
  41. +                    return true;
  42. +                }
  43. +            }
  44. +          }
  45. +        }
  46. +        return false;
  47. +    }
  48. +  
  49.     private static boolean checkBot(String text)
  50.     {
  51.         for (String botCommand : WALKER_COMMAND_LIST)
  52. Index: config/l2jelios.properties
  53. ===================================================================
  54. --- config/l2jelios.properties  (revision 5)
  55. +++ config/l2jelios.properties  (working copy)
  56. @@ -0,0 +1,7 @@
  57. +# Unique Chat Mode based on PvP
  58. +# On X PvP you are allowed to talk from a special chat.
  59. +AllowPvpChat = False
  60. +# How many PvP are needed to use this chat.
  61. +PvpAmountForChat = 100
  62. +# Chat's prefix. Default : -
  63. +PvpChatPrefix = -
  64. \ No newline at end of file
  65. Index: java/net/sf/l2j/Config.java
  66. ===================================================================
  67. --- java/net/sf/l2j/Config.java (revision 5)
  68. +++ java/net/sf/l2j/Config.java (working copy)
  69. @@ -485,6 +485,10 @@
  70.    
  71.     // l2jelios configurable file  
  72.    
  73. +   public static boolean ALLOW_PVP_CHAT;
  74. +   public static String PVP_CHAT_PREFIX;
  75. +   public static int PVP_AMOUNT_FOR_CHAT;
  76. +  
  77.     // --------------------------------------------------
  78.     // Server
  79.     // --------------------------------------------------
  80. @@ -1256,6 +1260,10 @@
  81.                 l2jelios.load(is);
  82.                 is.close();
  83.                
  84. +        ALLOW_PVP_CHAT = Boolean.parseBoolean(l2jelios.getProperty("AllowPvpChat", "False"));
  85. +                PVP_AMOUNT_FOR_CHAT = Integer.parseInt(l2jelios.getProperty("PvpAmountForChat", "100"));
  86. +                PVP_CHAT_PREFIX = l2jelios.getProperty("PvpChatPrefix", "-");
  87. +              
  88.             }
  89.             catch (Exception e)
  90.             {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement