Jump to content

Recommended Posts

Posted (edited)

Creditos: Bluur

### Eclipse Workspace Patch 1.0
Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java    (revision 1)
+++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java    (working copy)
@@ -62,6 +62,7 @@
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSiege;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSkill;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSpawn;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminStriderRace;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
@@ -127,6 +128,8 @@
         registerAdminCommandHandler(new AdminTeleport());
         registerAdminCommandHandler(new AdminUnblockIp());
         registerAdminCommandHandler(new AdminZone());
+        //custom
+        registerAdminCommandHandler(new AdminStriderRace());
     }
     
     public void registerAdminCommandHandler(IAdminCommandHandler handler)
Index: java/net/sf/l2j/gameserver/custom/striderrace/StriderRace.java
===================================================================
--- java/net/sf/l2j/gameserver/custom/striderrace/StriderRace.java    (revision 0)
+++ java/net/sf/l2j/gameserver/custom/striderrace/StriderRace.java    (working copy)
@@ -0,0 +1,236 @@
+/*
+ * 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.custom.striderrace;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.datatables.MapRegionTable;
+import net.sf.l2j.gameserver.datatables.NpcTable;
+import net.sf.l2j.gameserver.datatables.SpawnTable;
+import net.sf.l2j.gameserver.model.L2Spawn;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.skills.AbnormalEffect;
+import net.sf.l2j.gameserver.util.Broadcast;
+
+/**
+ * @author Bluur
+ * @version 1.1
+ */
+public class StriderRace
+{
+    private static StriderRace INSTANCE;
+    private StriderRaceState srState = StriderRaceState.DESACTIVED;
+    private List<L2PcInstance> players = new ArrayList<>();
+    
+    private StriderRace(){}
+    
+    public void startEvent()
+    {
+        srState = StriderRaceState.REGISTER;
+        announceEvent("The event started! Commands .joinsr or .leavesr");
+        announceEvent("Registration time: 5 minutes!");
+        sleep(60);
+        announceEvent("[4] minutes to the end of the record!");
+        sleep(60);
+        announceEvent("[3] minutes to the end of the record!");
+        sleep(60);
+        announceEvent("[2] minutes to the end of the record!");
+        sleep(60);
+        announceEvent("[1] minutes to the end of the record!");
+        sleep(60);
+        if (!minPlayers())
+        {
+            abortEvent();
+            return;
+        }    
+        srState = StriderRaceState.WAIT;
+        announceEvent("closed registration! Total number of registered players: "+ players.size());
+        announceEvent("The players will be teleported in 10 seconds!");
+        sleep(10);
+        teleportPlayers();
+        mountPlayer(true);
+        paralizedPlayer(true);
+        announceEvent("The event will start in 15 seconds!");
+        sleep(15);
+        srState = StriderRaceState.ATIVED;
+        announceEvent("The race is on! Go Go Go!");
+        spawnNpc();
+        paralizedPlayer(false);
+        sleep(300); // duração do evento em segundos
+        if (srState == StriderRaceState.ATIVED)
+            finishEvent();
+    }
+    
+    private void paralizedPlayer(boolean value)
+    {
+        if (value)
+        {
+            for (L2PcInstance player : players)
+            {
+                player.setIsParalyzed(true);
+                player.startAbnormalEffect(AbnormalEffect.HOLD_2);
+            }
+        }
+        else
+        {
+            for (L2PcInstance player : players)
+            {
+                player.setIsParalyzed(false);
+                player.stopAbnormalEffect(AbnormalEffect.HOLD_2);
+            }
+        }
+    }
+    
+    private void mountPlayer(boolean value)
+    {
+        if (value)
+        {
+            for (L2PcInstance player : players)
+            {
+                if (player != null)
+                {                
+                    player.getRadar().addMarker(Config.EVENT_SR_LOC_ARRIVAL_X, Config.EVENT_SR_LOC_ARRIVAL_Y, Config.EVENT_SR_LOC_ARRIVAL_Z);
+                    player.mount(12526, 0, false);
+                }
+            }
+        }
+        else
+        {
+            for (L2PcInstance player : players)
+            {
+                if (player != null)
+                {
+                    player.getRadar().removeMarker(Config.EVENT_SR_LOC_ARRIVAL_X, Config.EVENT_SR_LOC_ARRIVAL_Y, Config.EVENT_SR_LOC_ARRIVAL_Z);
+                    player.dismount();                    
+                }
+            }
+        }
+    }
+        
+    private void abortEvent()
+    {
+        srState = StriderRaceState.DESACTIVED;
+        announceEvent("The event was terminated for lack of participants!");
+        players.clear();
+    }
+    
+    public void finishEvent()
+    {
+        srState = StriderRaceState.DESACTIVED;
+        announceEvent("The event duration time is up! Thank all...");
+        teleportPlayersToTown();
+        mountPlayer(false);
+        players.clear();
+    }
+    
+    private static void announceEvent(String sendMessage)
+    {
+        Broadcast.announceToOnlinePlayers("[Strider Race]: " + sendMessage, true);
+    }
+    
+    private void teleportPlayers()
+    {
+        for (L2PcInstance player : players)    
+            player.teleToLocation(Config.EVENT_SR_LOC_PLAYER_X, Config.EVENT_SR_LOC_PLAYER_Y, Config.EVENT_SR_LOC_PLAYER_Z, 60);    
+    }
+    
+    private void teleportPlayersToTown()
+    {
+        for (L2PcInstance player : players)
+            player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+    }
+        
+    private boolean minPlayers()
+    {
+        if (players.size() < Config.EVENT_SR_MINIMUM_PLAYERS)
+           return false;
+        
+        return true;
+    }
+    
+    public boolean maxPlayers()
+    {        
+        if (players.size() >= Config.EVENT_SR_MAXIMUM_PLAYERS)
+           return false;
+
+        return true;    
+    }
+    
+    public boolean containsPlayer(L2PcInstance player)
+    {
+        return players.contains(player);
+    }
+    
+    public void registerPlayer(L2PcInstance player)
+    {
+        players.add(player);
+    }
+    
+    public void removePlayer(L2PcInstance player)
+    {
+        players.remove(player);
+    }
+
+    private static void spawnNpc()
+    {    
+        NpcTemplate tp = NpcTable.getInstance().getTemplate(Config.EVENT_SR_LOC_ID_NPC);    
+        try
+        {
+            L2Spawn spawn = null;
+        
+            spawn = new L2Spawn(tp);
+            spawn.setLocx(Config.EVENT_SR_LOC_ARRIVAL_X);
+            spawn.setLocy(Config.EVENT_SR_LOC_ARRIVAL_Y);
+            spawn.setLocz(Config.EVENT_SR_LOC_ARRIVAL_Z);
+            spawn.setHeading(0);
+            
+            SpawnTable.getInstance().addNewSpawn(spawn, false);
+            spawn.init();
+            spawn.stopRespawn();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+        
+    public StriderRaceState getStriderRaceState()
+    {
+        return srState;
+    }
+    
+    private static void sleep(int value)
+    {
+        try
+        {
+            Thread.sleep(1000 * value);
+        }
+        catch (InterruptedException e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    public static StriderRace getInstance()
+    {
+        if (INSTANCE == null)
+            INSTANCE = new StriderRace();
+        
+        return INSTANCE;
+    }
+}
Index: java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/Logout.java    (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/Logout.java    (working copy)
@@ -15,6 +15,8 @@
 package net.sf.l2j.gameserver.network.clientpackets;
 
 import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRace;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRaceState;
 import net.sf.l2j.gameserver.instancemanager.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
@@ -44,6 +46,16 @@
             return;
         }
         
+        if (StriderRace.getInstance().getStriderRaceState() == StriderRaceState.ATIVED)
+        {
+            if (StriderRace.getInstance().containsPlayer(player))
+            {
+                player.sendMessage("[Strider Race]: You can't logout in strider race!");
+                player.sendPacket(ActionFailed.STATIC_PACKET);
+                return;
+            }
+        }
+        
         if (player.isLocked())
         {
             if (Config.DEBUG)
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -50,6 +50,8 @@
 import net.sf.l2j.gameserver.ai.NextAction.NextActionCallback;
 import net.sf.l2j.gameserver.communitybbs.BB.Forum;
 import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRace;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRaceState;
 import net.sf.l2j.gameserver.datatables.AccessLevels;
 import net.sf.l2j.gameserver.datatables.CharNameTable;
 import net.sf.l2j.gameserver.datatables.CharTemplateTable;
@@ -5012,6 +5014,16 @@
     {
         sendPacket(new SetupGauge(3, 0, 0));
         int petId = _mountNpcId;
+        
+        if (StriderRace.getInstance().getStriderRaceState() == StriderRaceState.ATIVED)
+        {
+            if (petId == 12526 && StriderRace.getInstance().containsPlayer(this))
+            {
+                sendMessage("[Strider Race]: You can't unmount in strider race!");
+                return false;
+            }
+        }
+        
         if (setMount(0, 0, 0))
         {
             stopFeed();
Index: java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java    (revision 1)
+++ java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java    (working copy)
@@ -15,6 +15,8 @@
 package net.sf.l2j.gameserver.model.actor.stat;
 
 import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRace;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRaceState;
 import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.datatables.PetDataTable;
 import net.sf.l2j.gameserver.model.actor.L2Character;
@@ -334,6 +336,9 @@
         if (penalty > 0)
             val *= Math.pow(0.84, penalty);
         
+        if (StriderRace.getInstance().getStriderRaceState() == StriderRaceState.ATIVED && StriderRace.getInstance().containsPlayer(getActiveChar()))        
+            val *= Config.EVENT_SR_SPEED;
+        
         return val;
     }
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java    (revision 1)
+++ java/net/sf/l2j/Config.java    (working copy)
@@ -226,6 +226,20 @@
     public static int ALT_FISH_CHAMPIONSHIP_REWARD_4;
     public static int ALT_FISH_CHAMPIONSHIP_REWARD_5;
     
+    /** Strider Race */
+    public static int EVENT_SR_MINIMUM_PLAYERS;
+    public static int EVENT_SR_MAXIMUM_PLAYERS;
+    public static int[][] EVENT_SR_REWARD_TOP1;
+    public static int[][] EVENT_SR_REWARD_TOP2;
+    public static int[][] EVENT_SR_REWARD_TOP3;
+    public static double EVENT_SR_SPEED;
+    public static int EVENT_SR_REWARD_COUNT;
+    public static int EVENT_SR_LOC_ARRIVAL_X;
+    public static int EVENT_SR_LOC_ARRIVAL_Y;
+    public static int EVENT_SR_LOC_ARRIVAL_Z;
+    public static int EVENT_SR_LOC_PLAYER_X;
+    public static int EVENT_SR_LOC_PLAYER_Y;
+    public static int EVENT_SR_LOC_PLAYER_Z;
+    public static int EVENT_SR_LOC_ID_NPC;
+    
     // --------------------------------------------------
     // HexID
     // --------------------------------------------------
@@ -879,6 +893,18 @@
             ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
             ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);
             
+            EVENT_SR_LOC_ID_NPC = events.getProperty("EventSRnpcID", 10);
+            EVENT_SR_MINIMUM_PLAYERS = events.getProperty("EventSRminimumPlayers", 2);
+            EVENT_SR_MAXIMUM_PLAYERS = events.getProperty("EventSRmaximumPlayers", 2);
+            EVENT_SR_REWARD_TOP1 = parseItemsList(events.getProperty("EventSRrewardsTop1", "57,300"));
+            EVENT_SR_REWARD_TOP2 = parseItemsList(events.getProperty("EventSRrewardsTop2", "57,200"));
+            EVENT_SR_REWARD_TOP3 = parseItemsList(events.getProperty("EventSRrewardsTop3", "57,100"));
+            EVENT_SR_SPEED = events.getProperty("EventSRspeedBoost", 1.0);
+            EVENT_SR_LOC_PLAYER_X = events.getProperty("EventSRlocPlayerX", 0);
+            EVENT_SR_LOC_PLAYER_Y = events.getProperty("EventSRlocPlayerY", 0);
+            EVENT_SR_LOC_PLAYER_Z = events.getProperty("EventSRlocPlayerZ", 0);
+            EVENT_SR_LOC_ARRIVAL_X = events.getProperty("EventSRlocArrivalX", 0);
+            EVENT_SR_LOC_ARRIVAL_Y = events.getProperty("EventSRlocArrivalY", 0);
+            EVENT_SR_LOC_ARRIVAL_Z = events.getProperty("EventSRlocArrivalZ", 0);
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminStriderRace.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminStriderRace.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminStriderRace.java    (working copy)
@@ -0,0 +1,60 @@
+/*
+ * 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.admincommandhandlers;
+
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRace;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRaceState;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author Bluur
+ *
+ */
+public class AdminStriderRace implements IAdminCommandHandler
+{
+    private static final String[] ADMIN_COMMANDS = {"admin_startsr"};
+
+    @Override
+    public boolean useAdminCommand(String command, L2PcInstance activeChar)
+    {
+        if (StriderRace.getInstance().getStriderRaceState() == StriderRaceState.DESACTIVED)        
+            initEvent();        
+        else
+            activeChar.sendMessage("[Strider Race]: The event this already in progress!");
+    
+        return true;
+    }
+
+    private static void initEvent()
+    {
+        ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()            
+        {               
+            @Override                    
+            public void run()                    
+            {                        
+                StriderRace.getInstance().startEvent();      
+            }
+         
+        }, 1);
+    }
+    
+    @Override
+    public String[] getAdminCommandList()
+    {
+        return ADMIN_COMMANDS;
+    }
+}
Index: java/net/sf/l2j/gameserver/custom/striderrace/StriderRaceState.java
===================================================================
--- java/net/sf/l2j/gameserver/custom/striderrace/StriderRaceState.java    (revision 0)
+++ java/net/sf/l2j/gameserver/custom/striderrace/StriderRaceState.java    (working copy)
@@ -0,0 +1,27 @@
+/*
+ * 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.custom.striderrace;
+
+/**
+ * @author Bluur
+ *
+ */
+public enum StriderRaceState
+{
+    DESACTIVED,
+    REGISTER,
+    WAIT,
+    ATIVED;
+}
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java    (revision 1)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java    (working copy)
@@ -15,6 +15,8 @@
 package net.sf.l2j.gameserver.network.clientpackets;
 
 import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRace;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRaceState;
 import net.sf.l2j.gameserver.instancemanager.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
@@ -47,6 +49,16 @@
             return;
         }
         
+        if (StriderRace.getInstance().getStriderRaceState() == StriderRaceState.ATIVED)
+        {
+            if (StriderRace.getInstance().containsPlayer(player))
+            {
+                player.sendMessage("[Strider Race]: You can't restart in strider race!");
+                sendPacket(RestartResponse.valueOf(false));
+                return;
+            }
+        }
+        
         if (player.isLocked())
         {
             sendPacket(RestartResponse.valueOf(false));
Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/RegStriderRace.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/RegStriderRace.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/RegStriderRace.java    (working copy)
@@ -0,0 +1,83 @@
+/*
+ * 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.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.custom.striderrace.StriderRace;
+import net.sf.l2j.gameserver.custom.striderrace.StriderRaceState;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ * @author Bluur
+ */
+public class RegStriderRace implements IVoicedCommandHandler
+{
+    private static final String[] voiced_commands =
+    {
+        "joinsr",
+        "leavesr"
+    };
+    
+    @Override
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
+    {
+        if (command.equals("joinsr"))
+        {
+            if (register(activeChar))
+            {
+                StriderRace.getInstance().registerPlayer(activeChar);
+                activeChar.sendMessage("[Strider Race]: You have been successfully registered!");
+            }
+        }
+        else if (command.equals("leavesr"))
+        {
+            remove(activeChar);
+        }
+        return true;
+    }
+    
+    private static boolean register(L2PcInstance p)
+    {
+        if (!StriderRace.getInstance().maxPlayers())
+        {
+            p.sendMessage("[Strider Race]: Limit of players was reached.");
+            return false;
+        }
+        else if (StriderRace.getInstance().getStriderRaceState() != StriderRaceState.REGISTER || p.getKarma() > 0 || p.isInCombat() || p.isInOlympiadMode() || p.inObserverMode() || StriderRace.getInstance().containsPlayer(p))
+        {
+            p.sendMessage("[Strider Race]: conditions for registration are inappropriate !!!");
+            return false;
+        }
+        
+        return true;
+    }
+    
+    private static boolean remove(L2PcInstance p)
+    {
+        if (StriderRace.getInstance().getStriderRaceState() == StriderRaceState.REGISTER && StriderRace.getInstance().containsPlayer(p))
+        {
+            StriderRace.getInstance().removePlayer(p);
+            p.sendMessage("[Strider Race]: you have been successfully removed!");
+        }
+        
+        return true;
+    }
+    
+    @Override
+    public String[] getVoicedCommandList()
+    {
+        return voiced_commands;
+    }
+}
Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (working copy)

import java.util.Map;

+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.RegStriderRace;

    protected VoicedCommandHandler()
    {
+        registerVoicedCommandHandler(new RegStriderRace());

\ No newline at end of file
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2StriderRaceEventInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2StriderRaceEventInstance.java    (revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2StriderRaceEventInstance.java    (working copy)
@@ -0,0 +1,102 @@
+/*
+ * 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.model.actor.instance;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ai.CtrlIntention;
+import net.sf.l2j.gameserver.datatables.MapRegionTable;
+import net.sf.l2j.gameserver.datatables.SpawnTable;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.L2Spawn;
+import net.sf.l2j.gameserver.model.actor.L2Npc;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.model.striderrace.StriderRace;
+import net.sf.l2j.gameserver.model.striderrace.StriderRaceState;
+import net.sf.l2j.gameserver.util.Broadcast;
+
+public class L2StriderRaceEventInstance extends L2NpcInstance
+{
+    public L2StriderRaceEventInstance(int objectId, NpcTemplate template)
+    {
+        super(objectId, template);
+    }
+    
+    private static int rankPlayer = 0;
+    
+    @Override
+    public void onAction(L2PcInstance player)
+    {
+        if (player.getTarget() != this)
+            player.setTarget(this);
+        else
+        {
+            if (!canInteract(player))
+                player.getAI().setIntention(CtrlIntention.INTERACT, this);
+            else
+            {
+                if (StriderRace.getInstance().getStriderRaceState() == StriderRaceState.ATIVED && StriderRace.getInstance().containsPlayer(player))
+                {
+                    if (rankPlayer < 2)
+                    {
+                        rankPlayer++;
+                        Broadcast.announceToOnlinePlayers("[Strider Race]: [" + rankPlayer + "] to arrive was -> " + player.getName(), true);
+                        rewardPlayer(player);
+                        StriderRace.getInstance().removePlayer(player);
+                        player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+                        player.dismount();                        
+                        return;
+                    }
+                    rankPlayer += 1;
+                    Broadcast.announceToOnlinePlayers("[Strider Race]: [3] to arrive was -> " + player.getName(), true);
+                    rewardPlayer(player);
+                    StriderRace.getInstance().finishEvent();
+                    rankPlayer = 0;
+                    
+                    L2Object obj = player.getTarget();
+                    if (obj != null && obj instanceof L2Npc)
+                    {
+                        L2Npc target = (L2Npc) obj;
+                        target.deleteMe();
+                        
+                        L2Spawn spawn = target.getSpawn();
+                        if (spawn != null)
+                        {
+                            spawn.stopRespawn();
+                            SpawnTable.getInstance().deleteSpawn(spawn, true);
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    private static void rewardPlayer(L2PcInstance player)
+    {
+        switch (rankPlayer)
+        {
+            case 1:
+                for (int[] item : Config.EVENT_SR_REWARD_TOP1)
+                    player.addItem("", item[0], item[1], player, true);
+                break;
+            case 2:
+                for (int[] item : Config.EVENT_SR_REWARD_TOP2)
+                    player.addItem("", item[0], item[1], player, true);
+                break;
+            default:
+                for (int[] item : Config.EVENT_SR_REWARD_TOP3)
+                    player.addItem("", item[0], item[1], player, true);
+        }
+    }
+}

Index: config/events.properties
===================================================================
--- config/events.properties    (revision 1)
+++ config/events.properties    (working copy)
gameserver/data/xml/admin_commands_rights.xml

+ <aCar name="admin_startsr" accessLevel="1" />
 
gameserver/data/xml/npcs
 
    <npc id="9106" idTemplate="35062" name="Strider Race Event" title="[ARRIVAL HERE]">
        <set name="level" val="75"/>
        <set name="radius" val="10"/>
        <set name="height" val="80"/>
        <set name="rHand" val="0"/>
        <set name="lHand" val="0"/>
        <set name="type" val="L2StriderRaceEvent"/>
        <set name="exp" val="0"/>
        <set name="sp" val="10"/>
        <set name="hp" val="2676.65854"/>
        <set name="mp" val="1507.8"/>
        <set name="hpRegen" val="8.5"/>
        <set name="mpRegen" val="3"/>
        <set name="pAtk" val="794.70901"/>
        <set name="pDef" val="319.24623"/>
        <set name="mAtk" val="542.68324"/>
        <set name="mDef" val="233.61053"/>
        <set name="crit" val="4"/>
        <set name="atkSpd" val="253"/>
        <set name="str" val="40"/>
        <set name="int" val="21"/>
        <set name="dex" val="30"/>
        <set name="wit" val="20"/>
        <set name="con" val="43"/>
        <set name="men" val="20"/>
        <set name="corpseTime" val="7"/>
        <set name="walkSpd" val="50"/>
        <set name="runSpd" val="120"/>
        <set name="dropHerbGroup" val="0"/>
        <set name="attackRange" val="40"/>
        <ai type="default" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" clan="door_clan;dion_siege_clan" clanRange="600" canMove="false" seedable="false"/>
        <skills>
            <skill id="4045" level="1"/>
            <skill id="4416" level="19"/>
        </skills>
    </npc>
Broadcast.announceToOnlinePlayers("[Strider Race]: The event ends with the winner -> " +player.getName(), true);
                                     Broadcast.announceToOnlinePlayers("[Strider Race]: " + sendMessage, true);
Edited by valentin
Posted

i didnt notice that he made like 10 topics  in row, i withdraw the stuff i said, shame on u dude. 

back on topic: does it work on acis 330-340? :D

Posted

i didnt notice that he made like 10 topics  in row, i withdraw the stuff i said, shame on u dude. 

back on topic: does it work on acis 330-340? :D

afcourse it does just need 1-2 adjustments.

PS SweetS its the best <3

Posted (edited)

sleep(60);  :happyforever:

Yeah, and

 

ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
{
  @Override
  public void run()
  {
    StriderRace.getInstance().startEvent();
  }
}, 1);

 

10/10

 

OP made my year

Edited by _dev_
Posted

admit it the sleep(60) is epic.. come on admit it 

nobody would ever think this

See what i would love is you sharing this code refactored by you. Then we're talking :)

Posted

See what i would love is you sharing this code refactored by you. Then we're talking :)

No my fear elfo, if you want see good codes pm me and we speak with images im not going to waste not even 1 minute of my life to sit and remake a code just to prove you.

What you think i am bot?

Posted

No my fear elfo, if you want see good codes pm me and we speak with images im not going to waste not even 1 minute of my life to sit and remake a code just to prove you.

What you think i am bot?

Go for it then, send some pictures. Cuz all your posts and insults and all your topics are stupid noob questions so something is wrong here.

Posted

Go for it then, send some pictures. Cuz all your posts and insults and all your topics are stupid noob questions so something is wrong here.

Yeap i learned and about my post was a question that is not that simple smart-ass

about my insults afcourse ill be mean to people who ask the same over and over or re-post 10 times in row copy paste topics..

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • so u need to create them and then use the icon name in the prefered ones
    • Please is anyone who can share the compiled version of the l2editor source for interlude? Because i run the !GenerateLibs.bat with the corrected code by CriticalError and then i try to build with the vs 2013 but i get errors again and again and when i try anyway to open or create something with the UnrealEd.exe then it closes automatically.
    • General Trackers :   IPTorrents invite IPTorrents account 1 tb TorrentLeech invite Torrentleech account 1 tb buffer  InTheShaDow ( ITS ) account Acid-lounge invite Torrentday invite Crnaberza account Abn.Lol account Limit-of-eden account Norbits account Xspeeds account Xspeeds invite Bemaniso invite Wigornot account Bithumen invite Filelist account Funfile invite AvistaZ invite Potuk.net invite ResurrectThe.Net invite GrabThe.Info invite Greek-Team invite LinkoManija invite Fano.in account tracker.czech-server.com Speed.cd invite Arab-torrents.net account Arabscene.me account Scenetime account 4thd.xyz invite Btarg.com.ar account Dedbit invite Estone.cc account Speedapp invite Finvip invite Fluxzone account GigaTorrents account Gimmepeers account Haidan.video invite Mojblink account Mycarpathians invite Newinsane.info account Oscarworld.xyz account Peers.FM invite Pt.msg.vg account Ransackedcrew account Redemption invite Scene-rush account Seedfile.io invite Teracod invite Torrent.ai account Torrentmasters invite Ttsweb invite X-files invite X-ite invite Ncore account TorrentHR account Rptorrents account BwTorrents account Superbits invite Krazyzone account Immortalseed account Tntracker invite Pt.eastgame.org account Bitturk account Rstorrent account Tracker.btnext invite Torrent-turk.de account BeiTai.PT account Pt.keepfrds account 52pt.site account Pthome account Torrentseeds account Aystorrent account Blues-brothers.biz invite Divteam account Thesceneplace invite CinemaMovies.pl account Brasiltracker account Patiodebutacas account Newheaven.nl account  Swarmazon.club invite Bc-reloaded account Crazyspirits account Silentground invite Omg.wtftrackr invite Milkie.cc invite Breathetheword invite Madsrevolution account Chilebt account Yubraca account Uniongang.tv account Frboard account Exvagos account Diablotorrent account Microbit account Carp-hunter.hu account Majomparade.eu account Theshinning.me account Youiv.info account Dragonworld-reloaded account Sharewood.tv account Partis.si account Digitalcore.club invite Fuzer.me account R3vuk.wtf invite Ztracker account 1 tb buffer 3changtrai account Best-core.info account Bitsite.us account Eliteunitedcrew invite Exitorrent.org account Tophos invite Torrent.lt account Sktorrent.eu account Oshen account Pirata.digital account Esharenet account Ohmenarikgi.la Pirate-share account Immortuos account Kiesbits account Cliente.amigos-share.club account Broadcity invite Ilovetorzz account Torrentbytes account Polishsource account Portugas invite Shareisland account ArabaFenice account Hudbt.hust.edu.cn account Audiences account Nanyangpt account Pt.sjtu.edu.cn account Pt.zhixing.bjtu.edu.cn account Byr.pt invite Ptfiles invite Red-bits account Pt.hdpost.top account Irrenhaus.dyndns.dk (NewPropaganda) account Mnvv2.info (MaxNewVision V2) account 1ptba.com account Spidertk.top account Film-paleis account Generation-free account Aftershock-tracker account Twilightsdreams account Back-ups.me invite Sor-next.tk ( Spirit Of Revolution ) account Tfa.tf ( The Falling Angels ) account Hdmayi account S-f-p.dyndns.dk ( Share Friends Projekt ) account Unlimitz.biz account Pttime account St-tracker.eu account New-retro.eu account Zbbit account Tigers-dl.net account Jptvts.us account Lat-team account Club.hares.top account Falkonvision-team account Concen account Drugari account T.ceskeforum account Peeratiko.org account Zamunda.se account Central-torrent.eu account h-o-d.org account Torrentleech.pl account Demonoid invite Lst.gg account Fakedoor.store account LaidBackManor account Vrbsharezone.co.uk invite Torrenteros account Arenaelite account Datascene account Tracker.0day.community Tapochek.net invite Ptchina invite Lesaloon account Exyusubs account Therebels.tv account Ubits.club invite Zmpt.cc account Turktorrent.us account Dasunerwarte account Hawke.uno account Monikadesign account Fearnopeer account Alpharatio account Wukongwendao.top account Chinapyg account Azusa.wiki account Yggtorrent.top account Torrentdd account Cyanbug.net invite Hhanclub.top account Wintersakura.net account Xthor account Tctg.pm account Finelite invite Agsvpt.com account Pt.0ff.cc invite Qingwapt.com account Xingtan.one account Ptcafe.club invite W-o-t.pro account Coastal-crew.bounceme.net account Darkpeers.org account Pianyuan.org account Seedpool.org  account Tempelbox account Pt.itzmx.com account Itatorrents.xyz  account Letseed.org account The-new-fun.com  account Malayabits.cc account Trellas.me account Yu-scene.net account Futuretorrent.org account Bitpt.cn account Tocashare.biz  account Videoteka.org  account White-angel.hu account Xbytesv2.li account Torr9  account Desitorrents account Okpt.net account Samaritano.cc account Polishtorrent.top  account C411.org account Bigcore.eu account BJ-Share.info account Infinitylibrary.net account Beload.org account Emuwarez.com account Yhpp.cc account Funsharing ( FSC ) account Rastastugan account Tlzdigital account account Upscalevault account Bluraytracker.cz account Torrenting.com account Infire.si account Dasunerwartete.biz invite The-torrent-trader account New-asgard.xyz account Pandapt account Deildu account Tmpt.top invite Pt.gtk.pw account Media.slo-bitcloud.eu account Pte.nu account P.t-baozi.cc account   Movies Trackers :   Secret-cinema account Anthelion account Pixelhd account Cinemageddon account Cinemaz account Retroflix account Classix-unlimited - invite Movie-Torrentz (m2g.link) invite Punck-tracker.net account Tmghub account Cathode-ray.tube account Greatposterwall account Arabicsource.net account Upload.cx account Crabpt.vip invite Onlyencodes.cc account Exyusubs account Hellashut.net invite Nordichd.sytes.net invite Locadora.cc account HD Trackers :   Blutopia buffered account Hd-olimpo buffered account Hdf.world account Torrentland.li account HdSky account Hdchina account Chdbits account Totheglory account Hdroute account Hdhome account TorrentCCF aka et8.org account 3DTorrents invite HD-Torrents account Bit-HDTV account HDME.eu invite Hdarea.co account Asiancinema.me account JoyHD invite HDSpace invite CrazyHD invite Bluebird-hd invite Htpt.cc account Hdtime invite Ourbits.club account Hd4fans account Siambit account Privatehd account Springsunday account Tjupt account Hdcity.leniter invite Ccfbits account Discfan account Pt.btschool.club account Ptsbao.club invite Hdzone.me invite Danishbytes account Zonaq.pw account Tracker.tekno3d account Arabp2p account Hd-united account Reelflix.xyz account Hdatmos.club account Anasch.cc invite Tigris-t account Nethd.org account Hd.ai invite Hitpt.com account Hdmonkey account Dragonhd.xyz account Hdclub.eu account Forum.bluraycd.com account Carpt account Hdfun.me invite Pt.hdupt invite Puntotorrent account Ultrahd account Rousi.zip account Bearbit account Hdturk.club account Asiandvdclub account Star-space.net account Nordicq.org account Hdkyl.in account Utp.to account Hdzero account Novahd account Hdtorrents.eu account   Music Trackers :   Dicmusic account Music-Vid account Open.cd account LzTr account ProAudioTorrents invite Jpopsuki invite TranceTraffic invite Audionews invite Kraytracker invite Libble.me invite Losslessclub invite Indietorrents.com invite Dimeadozen account Funkytorrents invite Karaokedl account zombtracker.the-zomb account Concertos account Sugoimusic account Satclubbing.club invite Metal.iplay invite Psyreactor invite Panda.cd account Adamsfile account Freehardmusic account Tracker.hqmusic.vn accouunt Twilightzoom account 3 tb buffer Hiresmusic account Metalguru account Musictorrents.org account Musebootlegs.com invite Zappateers.com account Jungleland.dnsalias.com account Naftamusic account Bemusic account   E-Learning Trackers :   Theplace account Thevault account Myanonamouse account Libranet account 420Project account Learnflakes account Pt.soulvoice.club account P2pelite account Aaaaarg.fail invite Ebooks-shares.org account Abtorrents account Pt.tu88.men invite Docspedia.world invite   TV-Trackers :   Skipthecommericals Cryptichaven account TV-Vault invite Shazbat.TV account Myspleen account Tasmanit.es invite Tvstore.me account Tvchaosuk account Jptv.club account   XXX - Porn Trackers :   FemdomCult account Pussytorrents account Adult-cinema-network account Bootytape account 1 Tb buffer Exoticaz account Bitporn account Kufirc account Gaytorrent.ru invite Nicept account Gay-torrents.org invite Ourgtn account Pt.hdbd.us account BitSexy account Happyfappy.org account Kamept.com account Lesbians4u.org account   Gaming Trackers :   Mteam.fr account BitGamer invite Retrowithin invite Gamegamept account   Cartoon/Anime/Comic Trackers :   Animeworld account Oldtoons.world account U2.dmhy account CartoonChaos invite Mononoke account Totallykids.tv account Bakabt.me invite Revanime account Ansktracker account Tracker.shakaw.com.br invite Bt.mdan.org account Skyey2.com account Animetracker.cc Adbt.it.cx invite Tracker.uniotaku.com account Mousebits.com account   Sports Trackers :   MMA-Tracker invite T3nnis.tv invite AcrossTheTasman account RacingForMe invite Sportscult invite Ultimatewrestlingtorrents account Worldboxingvideoarchive invite CyclingTorrents account Xtremewrestlingtorrents account Tc-boxing invite Mma-torrents account Aussierul invite Xwt-classics account Racing4everyone account Talk.tenyardtracker account Stalker.societyglitch invite Extremebits invite Rgfootball.net account F1carreras.xyz account   Software/Apps Trackers :   Brokenstones account Appzuniverse invite Teamos.xyz account Macbb.org account Phoenixproject.app account   Graphics Trackers:   Forum.Cgpersia account Cgfxw account   Others   Hduse.net account Fora.snahp.eu account Board4all.biz account Makingoff.org/forum account Xrel.to account Undergunz.su account Corebay account Endoftheinter.net ( EOTI ) account Thismight.be invite Skull.facefromouter.space account Avxhm.se (AvaxHome) account Ssdforum account Notfake.vip account Intotheinter.net account Tildes.net invite Thetoonz account Usinavirtual account Hdclasico invite HispaShare account Valentine.wtf account Adit-hd account Forum-andr.net account Warezforums account Justanothermusic.site account Forbiddenlibrary.moe account Senturion.to account Movieparadise account Dcdnet.ru account Sftdevils.net account Heavy-r.com account New-team.org account Ddl.tv account Filewarez.club account Hispamula.org account Hubwarez.tv account Ultim-zone.in account Leprosorium.ru account Planet-ultima.org account The-dark-warez.com account Koyi.pub account Tehparadox.net account Forumophilia account Torrentinvite.fr account Gmgard.com account   NZB :   Ninjacentral.co.za account Tabula-rasa.pw account Drunkenslug account Drunkenslug invite Usenet-4all account Dognzb.cr invite Kleverig account Nzb.cat account Nzbplanet.net invite Ng4you.com account NZB.to account Samuraiplace account Abhdtv.net account Abook.link account Comix.pw account House-of-usenet Secretbinaries.net account Vnext.to account Stockboxx.top account Sky-of-use.net account   Prices start from 3 $ to 100 $   Payment methods: Crypto, Neteller, Revolut   If you want to buy something send me a pm or contact me on:   Email: morrison2102@gmail.com   Discord: LFC4LIFE#4173   Telegram: https://t.me/LFC4LIFE4173   Skype: morrison2102@hotmail.com
    • I need two new one for the existing ones. 
    • Actioname dat Just change icons from there
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..