Перейти к содержанию
Авторизация  
brounlimited

[Share] Aio & Vip Premium Chat

Рекомендуемые сообщения

So , i was kinda bored and i've decided to make a new "premium" chat for AiO & VIP players.

It has been tested on aCis rev332 & it's working without any bug.

 

Note that, in the patch AiO & VIP system does't exist in the patch.

 

Usage key for chat: >

Credits for the code: `iAndre (me)

 

Have fun,

`iAndre.

 

Index: aCis_gameserver/net/sf/l2j/gameserver/util/FloodProtectors.java
===================================================================
--- aCis_gameserver/net/sf/l2j/gameserver/util/FloodProtectors.java (revision 0)
+++ aCis_gameserver/net/sf/l2j/gameserver/util/FloodProtectors.java (working copy)

private final FloodProtectorAction _characterSelect;
+ private final FloodProtectorAction _AioVipVoice;
_characterSelect = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_CHARACTER_SELECT);
+ _AioVipVoice = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_AIO_VIP_VOICE);
public FloodProtectorAction getCharacterSelect()
{
return _characterSelect;
}

+ public FloodProtectorAction getAioVipVoice()
+ {
+ return _AioVipVoice;
+ }

Index: aCis_gameserver/config/sf/l2j/config.java
===================================================================
--- aCis_gameserver/net/sf/l2j/config.java (revision 0)
+++ aCis_gameserver/net/sf/l2j/config.java (working copy)

public static FloodProtectorConfig FLOOD_PROTECTOR_CHARACTER_SELECT;
+ public static FloodProtectorConfig FLOOD_PROTECTOR_AIO_VIP_VOICE;

+ public static boolean ALLOW_AIO_AND_VIP_CHAT;
// --------------------------------------------------
GLOBAL_LEVEL_RESTRICTION = CustomMods.getProperty("GlobalLevelRestriction", 62);
TRADE_LEVEL_RESTRICTION = CustomMods.getProperty("TradeLevelRestriction", 41);

+ ALLOW_AIO_AND_VIP_CHAT = CustomMods.getProperty("AllowAioAndVipChat", true);

NUMBER_OF_ACTIVE_AUGMENT_SKILLS = CustomMods.getProperty("NumberOfActiveAugmentSkills", 3);
Index: aCis_gameserver/config/floodprotector.properties
===================================================================
--- aCis_gameserver/config/floodprotector.properties (revision 0)
+++ aCis_gameserver/config/floodprotector.properties (working copy)
FloodProtectorCharacterSelectPunishmentTime = 0
+# AioVipVoice - AiO & Vip voice flooding, 10s on retail
+FloodProtectorAioVipVoiceInterval = 100
+FloodProtectorAioVipVoiceLogFlooding = False
+FloodProtectorAioVipVoicePunishmentLimit = 0
+FloodProtectorAioVipVoicePunishmentType = none
+FloodProtectorAioVipVoicePunishmentTime = 0

Index: aCis_gameserver/config/CustomMods.properties
===================================================================
--- aCis_gameserver/config/CustomMods.properties (revision 0)
+++ aCis_gameserver/config/CustomMods.properties (working copy)
+#=======================================
+#	 Aio & Vip Chat
+#=======================================
+# Allow Aio and Vip Chat.
+# Usage key: >
+AllowAioAndVipChat = True
+
#=======================================
# Number Of active augment skills

Index: aCis_gameserver/net/sf/l2j/gameserver/network/clientpackets/Say2.java
===================================================================
--- aCis_gameserver/net/sf/l2j/gameserver/network/clientpackets/Say2.java (revision 0)
+++ aCis_gameserver/net/sf/l2j/gameserver/network/clientpackets/Say2.java (working copy)
public final static int HERO_VOICE = 17;
+ public final static int AIO_VIP_VOICE = 18;
"HERO_VOICE",
+ "AIO_VIP_VOICE"
};

if (_text.length() >= 100)
return;
+ if (Config.ALLOW_AIO_AND_VIP_CHAT && (activeChar.isAio() || VIPEngine.getInstance().isVip(activeChar)))
+ {
+ if(_text.startsWith(">"))
+ for(L2PcInstance p : L2World.getInstance().getAllPlayers().values())
+ {
+	 p.sendPacket(new CreatureSay(0,Say2.AIO_VIP_VOICE,activeChar.getName(),_text));
+	 return;
+ }
+ else
+ {
+	 activeChar.sendMessage("This chat can be used only by VIP & AiO characters of the server.");
+ }
+ }
Index: aCis_gameserver/net/sf/l2j/gameserver/handler/ChatHandler.java
===================================================================
--- aCis_gameserver/net/sf/l2j/gameserver/handler/ChatHandler.java (revision 0)
+++ aCis_gameserver/net/sf/l2j/gameserver/handler/ChatHandler.java (working copy)
registerChatHandler(new ChatTrade());
+ registerChatHandler(new ChatAioVipVoice());
Index: aCis_gameserver/net/sf/l2j/gameserver/handler/chathandlers/ChatAioVipVoice.java
===================================================================
--- aCis_gameserver/net/sf/l2j/gameserver/handler/chathandlers/ChatAioVipVoice.java (revision 0)
+++ aCis_gameserver/net/sf/l2j/gameserver/handler/chathandlers/ChatAioVipVoice.java (working copy)
/*
* 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.handler.chathandlers;
import java.util.Collection;
import net.sf.l2j.gameserver.handler.IChatHandler;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
/**
* A chat handler
* @author iAndre
*/
public class ChatAioVipVoice implements IChatHandler
{
private static final int[] COMMAND_IDS =
{
18
};

private static boolean _chatDisabled = false;

/**
* Handle chat type 'AiOVip voice'
* @see net.sf.l2j.gameserver.handler.IChatHandler#handleChat(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String, java.lang.String)
*/
@Override
public void handleChat(int type, L2PcInstance activeChar, String target, String text)
{
if (isChatDisabled() && !activeChar.isGM())
{
activeChar.sendPacket(SystemMessageId.GM_NOTICE_CHAT_DISABLED);
return;
}

if (activeChar.isAio() || VIPEngine.getInstance().isVip(activeChar))
{
if (!activeChar.getFloodProtectors().getAioVipVoice().tryPerformAction("AioVipVoice"))
return;

CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);

Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
for (L2PcInstance player : pls)
player.sendPacket(cs);
}
}

/**
* @return Returns the chatDisabled.
*/
public static boolean isChatDisabled()
{
return _chatDisabled;
}

/**
* @param chatDisabled The chatDisabled to set.
*/
public static void setIsChatDisabled(boolean chatDisabled)
{
_chatDisabled = chatDisabled;
}

/**
* Returns the chat types registered to this handler
* @see net.sf.l2j.gameserver.handler.IChatHandler#getChatTypeList()
*/
@Override
public int[] getChatTypeList()
{
return COMMAND_IDS;
}
}
Index: aCis_gameserver/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChatManager.java
===================================================================
--- aCis_gameserver/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChatManager.java (revision 0)
+++ aCis_gameserver/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChatManager.java (working copy)
+ else if (type.startsWith("AioVip"))
+ {
+	 if (!ChatAioVipVoice.isChatDisabled())
+	 {
+	 ChatAioVipVoice .setIsChatDisabled(true);
+	 activeChar.sendMessage("Premium Voice has been disabled!");
+	 }
+	 else
+	 {
+	 ChatAioVipVoice .setIsChatDisabled(false);
+	 activeChar.sendMessage("Premium Voice has been enabled!");
+	 }
+ }
}
catch (Exception e)

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...