Index: java/net/sf/l2j/gameserver/network/clientpackets/Say2.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (working copy)
@@ -21,6 +21,7 @@
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.handler.ChatHandler;
import net.sf.l2j.gameserver.handler.IChatHandler;
+import net.sf.l2j.gameserver.model.RandomFight;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
@@ -171,6 +172,10 @@
return;
}
+ checkRandomFight(_text,activeChar);
+ if(_text.equalsIgnoreCase("?register") || _text.equalsIgnoreCase("?unregister"))
+ return;
+
if (_type == PETITION_PLAYER && activeChar.isGM())
_type = PETITION_GM;
@@ -214,6 +219,45 @@
return false;
}
+ void checkRandomFight(String text,L2PcInstance player)
+ {
+ if(text.equalsIgnoreCase("?register"))
+ {
+ if(RandomFight.players.contains(player))
+ {
+ player.sendMessage("You have already registed to the event.");
+ return;
+ }
+ if(RandomFight.state == RandomFight.State.INACTIVE)
+ return;
+ if(RandomFight.state != RandomFight.State.REGISTER)
+ {
+ player.sendMessage("Event has already started.");
+ return;
+ }
+ RandomFight.players.add(player);
+ player.sendMessage("You registed to the event!!");
+ return;
+ }
+ if(text.equalsIgnoreCase("?unregister"))
+ {
+ if(!RandomFight.players.contains(player))
+ {
+ player.sendMessage("You haven't registed to the event.");
+ return;
+ }
+ if(RandomFight.state == RandomFight.State.INACTIVE)
+ return;
+ if(RandomFight.state != RandomFight.State.REGISTER)
+ {
+ player.sendMessage("Event has already started.");
+ return;
+ }
+ RandomFight.players.remove(player);
+ player.sendMessage("You unregisted from the event!!");
+ }
+ }
+
@Override
protected boolean triggersOnActionRequest()
{
Как данный код перевести в байтпасы что бы у нпс просто было 2 кнопки рег и отменить