Noticias:

Menú Principal

Mensajes recientes

#11
L2 | Eventos / Evento Hidden Bastard
Último mensaje por Swarlog - Jun 29, 2025, 12:09 AM
/* 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 2, 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */

package com.l2jfrozen.gameserver.model.entity.event;



import java.util.Calendar;
import java.util.Collection;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.managers.TownManager;
import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.util.random.Rnd;

import javolution.util.FastList;

/**
 *
 * @author Elfocrash
 */
public class HiddenBastard
{
   public static FastList<L2PcInstance> _players = new FastList<L2PcInstance>();
       public static State state = State.INACTIVE;
       public static L2PcInstance bastard = null;
       public static L2PcInstance winner = null;
       public static enum State  { INACTIVE,PICKING,SEARCHING }
     protected static final Logger _log = Logger.getLogger(TriviaEventManager.class.getName());

     /** Task for event cycles<br> */
     private Task _task;
     
/**
* New instance only by getInstance()<br>
*/
public HiddenBastard()
{
if (Config.ENABLE_HIDDENBASTARD_EVENT)
{
this.scheduleEventStart();
_log.warning("HiddenBastard: Started.");
}
else
{
_log.warning("HiddenBastard: Engine is Disabled.");
}
}

       public class Task implements Runnable
       {
private long _startTime;
public ScheduledFuture<?> nextRun;

public Task(long startTime)
{
_startTime = startTime;
}

public void setStartTime(long startTime)
{
_startTime = startTime;
}         
          @Override
               public void run()
               {
        int delay = (int) Math.round((_startTime - System.currentTimeMillis()) / 1000.0);
  int nextMsg = 0;
  if (delay > 3600)
  {
  nextMsg = delay - 3600;
  }
  else if (delay > 1800)
  {
  nextMsg = delay - 1800;
  }
  else if (delay > 900)
  {
  nextMsg = delay - 900;
  }
  else if (delay > 600)
  {
  nextMsg = delay - 600;
  }
  else if (delay > 300)
  {
  nextMsg = delay - 300;
  }
  else if (delay > 60)
  {
  nextMsg = delay - 60;
  }
  else if (delay > 5)
  {
  nextMsg = delay - 5;
  }
  else if (delay > 0)
  {
  nextMsg = delay;
  }
  else
  {
                if (state != State.INACTIVE)
                  {
                         return;
                  }
               
                Runner();
  }
 
  if (delay > 0)
  {
  nextRun = ThreadPoolManager.getInstance().scheduleGeneral(this, nextMsg * 1000);
  }
 
       }
     
       public void Runner()
       {
   _task.setStartTime(System.currentTimeMillis() + 1000L *10);
   ThreadPoolManager.getInstance().executeTask(_task);
           Announce("Hidden Bastard Event Started. In 20 seconds a random player from Giran will be picked to become the hidden bastard.");
               state = State.PICKING;
               waitSecs(20);
               Announce("The event started! Someone in Giran is the Hidden Bastard. Use .bastard command while targeting a player to check if he is the bastard!");
               Announce("You have 5 minutes to search for him.");
               pickBastard();
               wait(4);
               while(state == State.SEARCHING)
               {
                       Announce("One minute left! Still searching for him!");
                       wait(1);
                       while(state == State.SEARCHING)
                       {
                       Announce("No one found the hidden bastard. And that's just sad. " + bastard + "was the bastard.");
                       bastard.setIsBastard(false);
                       bastard.setIsImobilised(false);
                       clear();
                       this.scheduleEventStart();
                       }
               }
       }
       
   /**
* Starts the event
*/
public void scheduleEventStart()
{
try
{
Calendar currentTime = Calendar.getInstance();
Calendar nextStartTime = null;
Calendar testStartTime = null;
for (String timeOfDay : Config.HIDDENBASTARD_INTERVAL)
{
// Creating a Calendar object from the specified interval value
testStartTime = Calendar.getInstance();
testStartTime.setLenient(true);
String[] splitTimeOfDay = timeOfDay.split(":");
testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
// If the date is in the past, make it the next day (Example: Checking for "1:00", when the time is 23:57.)
if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
{
testStartTime.add(Calendar.DAY_OF_MONTH, 1);
}
// Check for the test date to be the minimum (smallest in the specified list)
if (nextStartTime == null || testStartTime.getTimeInMillis() < nextStartTime.getTimeInMillis())
{
nextStartTime = testStartTime;
}
}
if(nextStartTime != null)
     _task = new Task(nextStartTime.getTimeInMillis());
ThreadPoolManager.getInstance().executeTask(_task);
}
catch (Exception e)
{
_log.warning("TriviaEventEngine[TriviaManager.scheduleEventStart()]: Error figuring out a start time. Check TriviaEventInterval in config file.");
}
}

       public static void Announce(String msg)
       {
               Collection<L2PcInstance> plrs = L2World.getInstance().getAllPlayers();
               CreatureSay cs = new CreatureSay(1, Say2.ANNOUNCEMENT, "", msg);
             
               for (L2PcInstance pls : plrs)
               {
                       pls.sendPacket(cs);
               }
       }
     
     
       public void pickBastard()
       {             
               state = State.SEARCHING;
             
               L2ZoneType zone = TownManager.getInstance().getTown(9);

               for (L2Character character : zone.getCharactersInside().values())
               if ((character instanceof L2PcInstance) && !((L2PcInstance) character).isInCombat() && !((L2PcInstance) character).isInParty() && !((L2PcInstance) character).isInOlympiadMode() && !((L2PcInstance) character).isCursedWeaponEquipped())
               _players.add((L2PcInstance) character);
                                                     
               if(_players.size() > 2)
               {
                bastard = _players.get(Rnd.get(1, _players.size() - 1));
                bastard.setIsBastard(true);
                bastard.sendMessage("You are the secret bastard. You are not allowed to move or talk.");
                bastard.setIsImobilised(true);
               }
               else
               {
                    Announce("Non enough players in giran for the event to start.");
                    state = State.INACTIVE;
                    this.scheduleEventStart();
                    clear();
               }               
        }
     
       public static void endAndReward(L2PcInstance player)
       {
       player.addItem("reward", Config.HIDDENBASTARD_EVENT_REWARD_ID, Config.HIDDENBASTARD_EVENT_REWARD_AMOUNT, player,true);
       }
     
       public static void clear()
       {
               _players.clear();
               bastard = null;
               winner = null;
               state = State.INACTIVE;
       }
       
       public void waitSecs(int i)
       {
               try
               {
                       Thread.sleep(i * 1000);
               }
               catch (InterruptedException ie)
               {
                       ie.printStackTrace();
               }
       }
     
       public void wait(int i)
       {
               try
               {
                       Thread.sleep(i * 60000);
               }
               catch (InterruptedException ie)
               {
                       ie.printStackTrace();
               }
       }
     
       public static HiddenBastard getInstance()
       {
               return SingletonHolder._instance;
       }
     
       private static class SingletonHolder
       {
             protected static final HiddenBastard _instance = new HiddenBastard();
       }
}

/*
 * 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 com.l2jfrozen.gameserver.handler.voicedcommandhandlers;

import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.event.HiddenBastard;

/**
 *
 * @author  Elfocrash
 */

public class HiddenBastardCmd implements IVoicedCommandHandler
{
private static String[] _voicedCommands =
{
"bastard"
};

@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if(command.equalsIgnoreCase(_voicedCommands[0]))
{
if(!(activeChar.getTarget() instanceof L2PcInstance))
{
activeChar.sendMessage("Only players can be bastards.");
return false;
}

if(activeChar.getTarget() == activeChar)
{
activeChar.sendMessage("You are too good to be the bastard.");
return false;
}

if(activeChar.getTarget() == null)
{
activeChar.sendMessage("You have to target someone.");
return false;
}

if(((L2PcInstance) activeChar.getTarget()) == HiddenBastard.bastard)
{
activeChar.sendMessage("You found him!" + activeChar.getTarget().getName() + " is the bastard.");
HiddenBastard.Announce(activeChar.getName() + " found the hidden bastard who was " + HiddenBastard.bastard);
HiddenBastard.endAndReward(activeChar);
HiddenBastard.bastard.setIsBastard(false);
HiddenBastard.bastard.setIsImobilised(false);
HiddenBastard.clear();
}
else
{
activeChar.sendMessage("No! " + activeChar.getTarget().getName() + " is not the bastard.");
return false;
}
}
return true;
}

@Override
public String[] getVoicedCommandList()
{
return _voicedCommands;
}
}
#12
L2 | Eventos / Evento Claim A Target System
Último mensaje por Swarlog - Jun 29, 2025, 12:09 AM
[img width=500 height=232]No puedes ver este adjunto.

Es muy parecido al evento "Hitman", en un npc indicas el personaje que quieres que maten y quien lo mate es recompensado. El jugador indicado es mostrado en el chat y la lista de pjs a matar es almacenada.

CitarCORE:

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: config/players.properties
===================================================================
--- config/players.properties    (revision 1)
+++ config/players.properties    (working copy)
@@ -288,4 +288,14 @@
 MaxBuffsAmount = 20
 
 # Store buffs/debuffs on user logout?
-StoreSkillCooltime = True
\ No newline at end of file
+StoreSkillCooltime = True
+
+#=============================================================
+#                        Public Target
+#=============================================================
+# player's who request someone else death (requestor) - settings
+RequiredItemId = 57
+RequiredItemAmount = 10000
+# player's who kill the requested player rewards - settings
+RewardKillerId = 57
+RewardKillerAmount = 2000000
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2KillTargetInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2KillTargetInstance.java    (revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2KillTargetInstance.java    (working copy)
@@ -0,0 +1,84 @@
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import java.util.StringTokenizer;
+
+
+
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.Announcements;
+
+
+
+public class L2KillTargetInstance extends L2NpcInstance{
+
+    int requestorItemId = Config.REQUESTOR_ITEM_ID;
+    int requestorItemAmount = Config.REQUESTOR_ITEM_AMOUNT;
+   
+    public L2KillTargetInstance(int objectId, NpcTemplate template) {
+        super(objectId, template);
+    }
+
+    public void onBypassFeedback(L2PcInstance player, String command)
+    {
+        if (command.startsWith("killpl"))
+                   {
+                        StringTokenizer st = new StringTokenizer(command);
+                        st.nextToken();
+                       
+                        if (st.countTokens() != 1)
+                        {
+                            player.sendMessage("Fill the box with a name,please");
+                            return;
+                        }
+                        if(player.getInventory().getItemByItemId(requestorItemId).getCount() <= requestorItemAmount)
+                        {
+                            player.sendMessage("You need more items to claim a target");
+                            return;
+                        }
+                                       
+                        String val = String.valueOf(st.nextToken());
+                        L2PcInstance target = L2World.getInstance().getPlayer(val);
+
+                        if (target == null)
+                        {
+                            player.sendMessage("Such player doesn't exist or it isn't online");
+                            return;
+                        }
+                        else if (target.equals(player))
+                        {
+                            player.sendMessage("You can't target yourself");
+                            return;
+                        }
+                        else if (target.isTargeted())
+                        {
+                            player.sendMessage("This player is already targeted by someone else,choose another");
+                            return;
+                        }
+                       
+                        target.setTargeted(true);
+                        player.destroyItemByItemId("Mark Target", requestorItemId, requestorItemAmount, player.getTarget(), true);
+                        Announcements.getInstance().announceToAll("Mission: Kill "+target.getName()+" for special reward");
+                        target.sendMessage("Player "+player.getName()+" targeted you and offers adena to whoever kill you");
+       
+                   }
+       
+    }
+   
+        public String getHtmlPath(int npcId, int val)
+        {
+            String pom = "";
+            if (val == 0)
+            {
+                pom = "" + npcId;
+            }
+            else
+            {
+                pom = npcId + "-" + val;
+            }
+   
+            return "data/html/killtarget/" + pom + ".htm";
+        }
+}
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)
@@ -37,6 +37,7 @@
 
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
 import net.sf.l2j.gameserver.GameTimeController;
 import net.sf.l2j.gameserver.GeoData;
 import net.sf.l2j.gameserver.LoginServerThread;
@@ -252,6 +253,10 @@
  */
 public final class L2PcInstance extends L2Playable
 {
+   
+    public int killerRewardItemId = Config.KILLER_REWARD_ITEM_ID;
+    public int killerRewardAmount = Config.KILLER_REWARD_AMOUNT;
+   
     private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
     private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
     private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?";
@@ -262,9 +267,9 @@
     private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay, systime, restore_type FROM character_skills_save WHERE char_obj_id=? AND class_index=? ORDER BY buff_index ASC";
     private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
     
-    private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade,last_recom_date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
-    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
-    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
+    private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade,last_recom_date,publictarget) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+    private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,publictarget=? WHERE obj_id=?";
+    private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,publictarget FROM characters WHERE obj_id=?";
     
     private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
     private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
@@ -485,6 +490,7 @@
     
     private boolean _noble = false;
     private boolean _hero = false;
+    public boolean _targeted = false;
     
     private L2Npc _currentFolkNpc = null;
     
@@ -4026,6 +4032,19 @@
         {
             L2PcInstance pk = killer.getActingPlayer();
             
+
+            if(killer instanceof L2PcInstance)
+            {
+                pk = (L2PcInstance) killer;
+                if(isTargeted())
+                {
+
+                    Announcements.getInstance().announceToAll("Targeted player "+getName()+" was killed by "+pk.getName()+",the player who killed targeted player rewarded with special item");
+                    setTargeted(false);
+                    sendMessage("Since you've been killed while you were public target,you are not public target anymore");
+                    pk.addItem("Public Target",killerRewardItemId,killerRewardAmount,pk,true);
+                }
+            }
             // Clear resurrect xp calculation
             setExpBeforeDeath(0);
             
@@ -5453,6 +5472,7 @@
             statement.setInt(32, isNoble() ? 1 : 0);
             statement.setLong(33, 0);
             statement.setLong(34, System.currentTimeMillis());
+            statement.setInt(35, isTargeted() ? 1 : 0);
             statement.executeUpdate();
             statement.close();
         }
@@ -5508,6 +5528,7 @@
                 player.setPkKills(rset.getInt("pkkills"));
                 player.setOnlineTime(rset.getLong("onlinetime"));
                 player.setNoble(rset.getInt("nobless") == 1, false);
+                player.setTargeted(rset.getInt("publictarget") == 1);
                 
                 player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
                 if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -5934,7 +5955,8 @@
             statement.setLong(47, getClanCreateExpiryTime());
             statement.setString(48, getName());
             statement.setLong(49, getDeathPenaltyBuffLevel());
-            statement.setInt(50, getObjectId());
+            statement.setInt(50, isTargeted() ? 1 : 0);
+            statement.setInt(51, getObjectId());
             
             statement.execute();
             statement.close();
@@ -8052,6 +8074,17 @@
         return _hero;
     }
     
+    public boolean isTargeted()
+    {
+        return _targeted;
+    }
+   
+    public void setTargeted(boolean val)
+    {
+        _targeted = val;
+    }
+
+   
     public boolean isInOlympiadMode()
     {
         return _inOlympiadMode;
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java    (revision 1)
+++ java/net/sf/l2j/Config.java    (working copy)
@@ -376,7 +376,11 @@
     // --------------------------------------------------
     // Players
     // --------------------------------------------------
-   
+    /** Target system */
+    public static int REQUESTOR_ITEM_ID;
+    public static int REQUESTOR_ITEM_AMOUNT;
+    public static int KILLER_REWARD_ITEM_ID;
+    public static int KILLER_REWARD_AMOUNT;
     /** Misc */
     public static int STARTING_ADENA;
     public static boolean EFFECT_CANCELING;
@@ -995,6 +999,11 @@
             
             // players
             ExProperties players = load(PLAYERS_FILE);
+            REQUESTOR_ITEM_ID = players.getProperty("RequiredItemId",57);
+            REQUESTOR_ITEM_AMOUNT = players.getProperty("RequiredItemAmount",10000);
+            KILLER_REWARD_ITEM_ID = players.getProperty("RewardKillerId",57);
+            KILLER_REWARD_AMOUNT = players.getProperty("RewardKillerAmount",100000);
+           
             STARTING_ADENA = players.getProperty("StartingAdena", 100);
             EFFECT_CANCELING = players.getProperty("CancelLesserEffect", true);
             HP_REGEN_MULTIPLIER = players.getProperty("HpRegenMultiplier", 1.);

CitarDATA:

### Eclipse Workspace Patch 1.0
#P aCis_datapack
Index: sql/characters.sql
===================================================================
--- sql/characters.sql    (revision 1)
+++ sql/characters.sql    (working copy)
@@ -54,6 +54,7 @@
   `clan_join_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
   `clan_create_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
   `death_penalty_level` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
+  `publictarget` TINYINT UNSIGNED NOT NULL DEFAULT 0,
   PRIMARY KEY (obj_Id),
   KEY `clanid` (`clanid`)
 );
\ No newline at end of file
Index: data/xml/npcs/50000-50999.xml
===================================================================
--- data/xml/npcs/50000-50999.xml    (revision 1)
+++ data/xml/npcs/50000-50999.xml    (working copy)
@@ -72,4 +72,40 @@
             <skill id="4416" level="18"/>
         </skills>
     </npc>
+    <npc id="50009" idTemplate="30519" name="Haras" title="Claim a target">
+        <set name="level" val="70"/>
+        <set name="radius" val="7"/>
+        <set name="height" val="18"/>
+        <set name="rHand" val="0"/>
+        <set name="lHand" val="0"/>
+        <set name="type" val="L2KillTarget"/>
+        <set name="exp" val="0"/>
+        <set name="sp" val="0"/>
+        <set name="hp" val="2444.46819"/>
+        <set name="mp" val="1345.8"/>
+        <set name="hpRegen" val="7.5"/>
+        <set name="mpRegen" val="2.7"/>
+        <set name="pAtk" val="688.86373"/>
+        <set name="pDef" val="295.91597"/>
+        <set name="mAtk" val="470.40463"/>
+        <set name="mDef" val="216.53847"/>
+        <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" canMove="true" seedable="false"/>
+        <skills>
+            <skill id="4045" level="1"/>
+            <skill id="4416" level="18"/>
+        </skills>
+    </npc>
 </list>
\ No newline at end of file
Index: data/html/killtarget/50009.htm
===================================================================
--- data/html/killtarget/50009.htm    (revision 0)
+++ data/html/killtarget/50009.htm    (working copy)
@@ -0,0 +1,23 @@
+<html>
+<body>
+       <center><font color="FF9900">Public Target Manager</font></center>
+       <table>
+               <tr>
+                       <td>Hello,I'm here to let the others players know the name of player that you want to <font color="FF9900">die</font>.<br1>
+                       <br></td>
+               </tr>
+               <tr>
+                       <td>If someone else has already targeted a specific player <font color="FF9900">you can't</font> target the same player.<br1>
+                       <br></td>
+               </tr>
+               <tr>
+                       <td>After your mark your <font color="FF9900">target</font>,there will be an <font color="FF9900">announcement</font> so every will know<br1>
+                       My services are <font color="FF9900">not</font> free of course.The <font color="FF9900">killer</font> of your targeted player will take the items you will spend.<br><br><br></td>
+               </tr>
+               <tr>
+                       <td>Player:<edit var="pname" width=80 height=20>
+                       <a action="bypass -h npc_%objectId%_killpl $pname">Claim a target</a></td>
+               </tr>
+       </table>
+</body>
+</html>
\ No newline at end of file
#13
L2 | Eventos / Evento Deathmatch Engine by In...
Último mensaje por Swarlog - Jun 29, 2025, 12:08 AM
/*
 * 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 com.azaria.events;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;

import javolution.util.FastMap;

import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.Announcements;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Broadcast;
import com.l2jserver.tools.random.Rnd;

/**
 * @author Intrepid
 *
 */
public class DeathMatch
{
// declare logger
private static final Logger _log = Logger.getLogger(DeathMatch.class.getName());

// event name
private static final String _eventName = "DeathMatch";

// event finished and not started yet
private static final int STATUS_NOT_IN_PROGRESS = 0;

// event registration allowed
private static final int STATUS_REGISTRATION = 1;

// event registration ended and combat not started yet
private static final int STATUS_PREPARATION = 2;

// event players teleported to the event and combat starter
private static final int STATUS_COMBAT = 3;

// event combat ended wait setup for next event
private static final int STATUS_NEXT_EVENT = 4;

private static final String REMOVE_DISCONNECTED = "UPDATE characters SET heading=?,x=?,y=?,z=? WHERE charId=?";

/**
* Initialize new/Returns the one and only instance<br><br>
*
* @return DeathMatch<br>
*/
public static DeathMatch getInstance()
{
return SingletonHolder._instance;
}

private static class SingletonHolder
{
protected static final DeathMatch _instance = new DeathMatch();
}

private final ThreadPoolManager tpm;

private final autoEventTask task;
private final reviveTask taskDuring;
private ScheduledFuture<?> reviver;
private ScheduledFuture<?> event;
private int announced;

private static FastMap<Integer,L2PcInstance> players;

private volatile int status;
private volatile boolean active;

/**
* private constructor
*/
private DeathMatch()
{
tpm = ThreadPoolManager.getInstance();
status = STATUS_NOT_IN_PROGRESS;
announced = 0;
players = new FastMap<Integer,L2PcInstance>(Config.DM_MAX_PARTICIPANT);
task = new autoEventTask();
taskDuring = new reviveTask();
reviver = null;
active = Config.DM_ALLOWED;
if (active)
{
tpm.scheduleGeneral(task, Config.DM_DELAY_INITIAL_REGISTRATION);
_log.info("DeathMatch: Initialized event enabled.");
}
else
_log.info("DeathMatch: Initialized but not enabled.");
}

private class autoEventTask implements Runnable
{
@Override
public void run()
{
switch (status)
{
case STATUS_NOT_IN_PROGRESS:
if (Config.DM_ALLOWED)
registrationStart();
else
active = false;
break;
case STATUS_REGISTRATION:
if (announced < (Config.DM_REGISTRATION_ANNOUNCEMENT_COUNT + 2))
registrationAnnounce();
else
registrationEnd();
break;
case STATUS_PREPARATION:
startEvent();
break;
case STATUS_COMBAT:
endEvent();
break;
case STATUS_NEXT_EVENT:
status = STATUS_NOT_IN_PROGRESS;
tpm.scheduleGeneral(task, Config.DM_DELAY_BETWEEN_EVENTS);
break;
default:
_log.severe("Incorrect status set in Automated " + _eventName + ", terminating the event!");
}
}
}

private class reviveTask implements Runnable
{
@Override
public void run()
{
L2PcInstance player;
for (L2PcInstance p : players.values())
{
player = p.getActingPlayer();
if (player != null && player.isDead())
revive(player);
}
}
}


public void registerPlayer(L2PcInstance player)
{
if (!active)
return;

if (status != STATUS_REGISTRATION || players.size() >= Config.DM_MAX_PARTICIPANT)
player.sendPacket(SystemMessageId.REGISTRATION_PERIOD_OVER);
else if(!players.containsValue(player))
{
if (!canJoin(player))
{
player.sendMessage("You can't join to the" + _eventName + " because you dont meet with the requirements!");
return;
}
players.put(player.getObjectId(), player);
player.sendMessage("You are successfully registered to: " + _eventName);
if (Config.DM_REG_CANCEL)
player.sendMessage("If you decide to cancel your registration use .leavedm!");
}
else
player.sendMessage("You are alredy registered");
}

public void cancelRegistration(L2PcInstance player)
{
if (!active)
return;

if (status != STATUS_REGISTRATION)
player.sendPacket(SystemMessageId.REGISTRATION_PERIOD_OVER);
else if (players.containsValue(player))
{
players.remove(player);
player.sendMessage("You successfully cancelled your registration in " + _eventName);
}
else
player.sendMessage("You are not a participant in" + _eventName);
}

public void registrationStart()
{
status = STATUS_REGISTRATION;
Announcements.getInstance().announceToAll(new SystemMessage(SystemMessageId.REGISTRATION_PERIOD));
SystemMessage time = new SystemMessage(SystemMessageId.REGISTRATION_TIME_S1_S2_S3);
long timeLeft = Config.DM_REGISTRATION_LENGHT/ 1000;
time.addNumber((int) (timeLeft / 3600));
time.addNumber((int) (timeLeft % 3600 / 60));
time.addNumber((int) (timeLeft % 3600 % 60));
Broadcast.toAllOnlinePlayers(time);
Announcements.getInstance().announceToAll("To join the " + _eventName + " you must type .joindm");
tpm.scheduleGeneral(task, Config.DM_REGISTRATION_LENGHT / (Config.DM_REGISTRATION_ANNOUNCEMENT_COUNT + 2));
}

public void registrationAnnounce()
{
SystemMessage time = new SystemMessage(SystemMessageId.REGISTRATION_TIME_S1_S2_S3);
long timeLeft = Config.DM_REGISTRATION_LENGHT;
long elapsed = timeLeft / (Config.DM_REGISTRATION_ANNOUNCEMENT_COUNT + 2) * announced;
timeLeft -= elapsed;
timeLeft /= 1000;
time.addNumber((int) (timeLeft / 3600));
time.addNumber((int) (timeLeft % 3600 / 60));
time.addNumber((int) (timeLeft % 3600 % 60));
Broadcast.toAllOnlinePlayers(time);
Announcements.getInstance().announceToAll("To join the " + _eventName + " you must type .joindm");
announced++;
tpm.scheduleGeneral(task, Config.DM_REGISTRATION_LENGHT / (Config.DM_REGISTRATION_ANNOUNCEMENT_COUNT + 2));
}

public void registrationEnd()
{
announced = 0;
status = STATUS_PREPARATION;

for (L2PcInstance p : players.values())
{
if (p == null)
continue;
if (!canJoin(p))
{
p.sendMessage("You can't join to the" + _eventName + " because you dont meet with the requirements!");
players.remove(p);
}
}

if (players.size() <= Config.DM_MIN_PLAYER)
{
Announcements.getInstance().announceToAll(_eventName + "aborted not enough players!");
players.clear();
status = STATUS_NOT_IN_PROGRESS;
tpm.scheduleGeneral(task, Config.DM_DELAY_BETWEEN_EVENTS);
return;
}

SystemMessage time = new SystemMessage(SystemMessageId.BATTLE_BEGINS_S1_S2_S3);
long timeLeft = Config.DM_PREPARATION_LENGHT / 1000;
time.addNumber((int) (timeLeft / 3600));
time.addNumber((int) (timeLeft % 3600 / 60));
time.addNumber((int) (timeLeft % 3600 % 60));

for (L2PcInstance p : players.values())
{
if (p == null)
continue;

p.setIsParalyzed(true);
p.sendPacket(time);
checkEquipment(p);
if (Config.DM_CANCEL_PARTY_ONSTART && p.getParty() != null)
p.getParty().removePartyMember(p);
if (Config.DM_CANCEL_BUFF_ONSTART)
p.stopAllEffects();
if (Config.DM_CANCEL_CUBIC_ONSTART && !p.getCubics().isEmpty())
{
for (L2CubicInstance cubic : p.getCubics().values())
{
cubic.stopAction();
cubic.cancelDisappear();
}
p.getCubics().clear();
}
if (Config.DM_UNSUMMON_PET_ONSTART && p.getPet() != null)
p.getPet().unSummon(p);
if (Config.DM_CANCEL_TRANSFORM_ONSTART && p.isTransformed())
p.untransform();
if (p.isDead())
p.setIsPendingRevive(true);

int spawn = Rnd.get(2);
if (spawn == 0)
p.teleToLocation(Config.DM_LOCX1,Config.DM_LOCY1,Config.DM_LOCZ1);
if (spawn == 1)
p.teleToLocation(Config.DM_LOCX2,Config.DM_LOCY2,Config.DM_LOCZ2);

if (Config.DM_RECOVER_ONSTART && p.getCurrentCp() != p.getMaxCp() || p.getCurrentHp() != p.getMaxHp() || p.getCurrentMp() != p.getMaxMp())
{
p.getStatus().setCurrentCp(p.getMaxCp());
p.getStatus().setCurrentHpMp(p.getMaxHp(), p.getMaxMp());
}
}
tpm.scheduleGeneral(task, Config.DM_PREPARATION_LENGHT);
}

public void startEvent()
{
status = STATUS_COMBAT;
SystemMessage time = new SystemMessage(SystemMessageId.BATTLE_ENDS_S1_S2_S3);
long timeLeft = Config.DM_EVENT_LENGHT / 1000;
time.addNumber((int) (timeLeft / 3600));
time.addNumber((int) (timeLeft % 3600 / 60));
time.addNumber((int) (timeLeft % 3600 % 60));
L2PcInstance player;
for (L2PcInstance p : players.values())
{
player = p.getActingPlayer();
if (player == null)
continue;
player.setIsParalyzed(false);
player.sendPacket(time);
}
reviver = tpm.scheduleGeneralAtFixedRate(taskDuring, Config.DM_REVIVE_DELAY, Config.DM_REVIVE_DELAY);
event = tpm.scheduleGeneral(task, Config.DM_EVENT_LENGHT);
}

public void endEvent()
{
if (status != STATUS_COMBAT)
return;
status = STATUS_NEXT_EVENT;
reviver.cancel(true);
if (!event.cancel(false))
return;

Announcements.getInstance().announceToAll(_eventName + " is finished!");

L2PcInstance player;
for (L2PcInstance p : players.values())
{
player = p.getActingPlayer();
if (player == null)
{
removeDisconnected(p.getObjectId(), p);
continue;
}
removeFromEvent(player);
}
players.clear();
tpm.scheduleGeneral(task, Config.DM_ENDING_LENGHT);
}

private void revive(L2PcInstance player)
{
player.setIsPendingRevive(true);
int teleTo = Rnd.get(1);
if (teleTo == 1)
player.teleToLocation(Config.DM_RANDOM_RESPAWN1_X, Config.DM_RANDOM_RESPAWN1_Y, Config.DM_RANDOM_RESPAWN1_Z);
if (teleTo == 2)
player.teleToLocation(Config.DM_RANDOM_RESPAWN2_X, Config.DM_RANDOM_RESPAWN2_Y, Config.DM_RANDOM_RESPAWN2_Z);
}

private boolean canJoin(L2PcInstance player)
{
// level restriction
boolean can = player.getLevel() <= Config.DM_MAX_LVL;
can &= player.getLevel() >= Config.DM_MIN_LVL;
// hero restriction
if (!Config.DM_HERO_JOIN)
can &= !player.isHero();
// cw owner restriction
if (Config.DM_CWOWNER_JOIN)
can &= !player.isCursedWeaponEquipped();
return can;
}

private final void checkEquipment(L2PcInstance player)
{
L2ItemInstance item;
for (int i = 0; i < 25; i++)
{
synchronized (player.getInventory())
{
item = player.getInventory().getPaperdollItem(i);
if (item != null && !canUse(item.getItemId()))
player.useEquippableItem(item, true);
}
}
}

public static final boolean canUse(int itemId)
{
for (int id : Config.DM_DISALLOWED_ITEMS)
if (itemId == id)
return false;
return true;
}

private void removeFromEvent(L2PcInstance player)
{
if (!player.isDead())
{
player.getStatus().setCurrentCp(player.getMaxCp());
player.getStatus().setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
}
else
player.setIsPendingRevive(true);
player.teleToLocation(Config.DM_TELE_BACK_X, Config.DM_TELE_BACK_Y, Config.DM_TELE_BACK_Z);
}

public final void removeDisconnected(int objID,L2PcInstance player)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_DISCONNECTED);
ps.setInt(1, player.getHeading());
ps.setInt(2, Config.DM_TELE_BACK_X);
ps.setInt(3, Config.DM_TELE_BACK_Y);
ps.setInt(4, Config.DM_TELE_BACK_Z);
ps.setInt(5, objID);
ps.executeUpdate();
ps.close();
}
catch (SQLException e)
{
_log.log(Level.WARNING,"Could not remove a disconnected DM player!", e);
}
finally
{
L2DatabaseFactory.close(con);
}
}

public final void addDisconnected(L2PcInstance participant)
{
switch (status)
{
case STATUS_REGISTRATION:
if (Config.DM_REGISTER_AFTER_RELOG && !players.containsValue(participant))
registerPlayer(participant);
break;
case STATUS_COMBAT:
L2PcInstance p = players.get(participant.getObjectId());
if (p == null)
break;
players.put(participant.getObjectId(), participant);
checkEquipment(participant);
int spawn = Rnd.get(2);
if (spawn == 0)
participant.teleToLocation(Config.DM_LOCX1,Config.DM_LOCY1,Config.DM_LOCZ1);
if (spawn == 1)
participant.teleToLocation(Config.DM_LOCX2,Config.DM_LOCY2,Config.DM_LOCZ2);
break;
}
}

public final void onKill(L2Character killer,L2PcInstance killed)
{
if (status != STATUS_COMBAT)
return;

((L2PcInstance) killer).addItem("DEATHMACH", Config.DM_REWARD_ID, Config.DM_REWARD_COUNT, killer, false);
killer.sendMessage(killer + "killed: " + killed);
killed.sendMessage(killed + "killed by: " + killer);
}


public static final boolean isInProgress()
{
switch (getInstance().status)
{
case STATUS_PREPARATION:
case STATUS_COMBAT:
return true;
default:
return false;
}
}

public static final boolean isPlaying(L2PcInstance player)
{
return isInProgress() && isMember(player);
}

public static final boolean isMember(L2PcInstance player)
{
if (player == null)
return false;

switch (getInstance().status)
{
case STATUS_NOT_IN_PROGRESS:
return false;
case STATUS_REGISTRATION:
return players.containsValue(player);
case STATUS_PREPARATION:
return players.containsValue(player) || isMember(player.getObjectId());
case STATUS_COMBAT:
case STATUS_NEXT_EVENT:
return isMember(player.getObjectId());
default:
return false;
}
}

private final static boolean isMember(int oID)
{
return players.get(oID) != null;
}
}
#14
L2 | Eventos / Evento Catch a Tiger
Último mensaje por Swarlog - Jun 29, 2025, 12:08 AM

### Eclipse Workspace Patch 1.0
#P L2J_DataPack_BETA
Index: dist/game/data/scripts.cfg
===================================================================
--- dist/game/data/scripts.cfg (revision 10487)
+++ dist/game/data/scripts.cfg (working copy)
@@ -313,3 +313,4 @@
 #events/FreyaCelebration/FreyaCelebration.java
 #events/MasterOfEnchanting/MasterOfEnchanting.java
 #events/LoveYourGatekeeper/LoveYourGatekeeper.java
+#events/CatchATiger/CatchATiger.java
Index: dist/game/data/scripts/events/CatchATiger/13292-02.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-02.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-02.htm (working copy)
@@ -0,0 +1,9 @@
+<html><head>
+<body>Employee of Magic Research Institute:<br>
+You're such a trouper, really!<br>
+To get a large enough sample for our study, we'll need at least 20 Apigas or Golden Apigas. The Institute rewards those who help.
+And, you'll be doing your part for magical science!<br><br><br>
+<a action="bypass -h Quest CatchATiger give_reward">Hand over 20 Apigas.</a><br>
+<a action="bypass -h Quest CatchATiger give_adv_reward">Hand over 20 Golden Apigas.</a>
+</body></html>
+
Index: dist/game/data/stats/skills/09000-09099.xml
===================================================================
--- dist/game/data/stats/skills/09000-09099.xml (revision 10487)
+++ dist/game/data/stats/skills/09000-09099.xml (working copy)
@@ -1477,26 +1477,46 @@
  </for>
  </skill>
  <skill id="9088" levels="1" name="Cupid's Arrow">
+ <set name="castRange" val="500" />
  <set name="effectPoint" val="-1000" />
+ <set name="effectRange" val="700" />
+ <set name="hitTime" val="1000" />
  <set name="icon" val="icon.skill3260" />
  <set name="isMagic" val="2" /> <!-- Static Skill -->
  <set name="itemConsumeCount" val="1" />
  <set name="itemConsumeId" val="17067" /> <!-- Event - Cupid's Fatigue Relief Potion -->
  <set name="magicLvl" val="1" />
+ <set name="mpConsume" val="1" />
  <set name="operateType" val="A1" />
+ <set name="power" val="100" />
  <set name="reuseDelay" val="1000" />
- <set name="targetType" val="NONE" />
+ <set name="skillType" val="PDAM" />
+ <set name="staticDamage" val="true" />
+ <set name="target" val="ONE" />
+ <cond msgId="109">
+ <target npcId="13196,13286,13287,13288,13289,13290,13291" />
+ </cond>
  </skill>
  <skill id="9089" levels="1" name="Cupid's Major Cure">
+ <set name="castRange" val="500" />
  <set name="effectPoint" val="-1000" />
+ <set name="effectRange" val="700" />
+ <set name="hitTime" val="1000" />
  <set name="icon" val="icon.skill3260" />
  <set name="isMagic" val="2" /> <!-- Static Skill -->
  <set name="itemConsumeCount" val="1" />
  <set name="itemConsumeId" val="17068" /> <!-- Event - Cupid's Powerful Fatigue Relief Potion -->
  <set name="magicLvl" val="1" />
+ <set name="mpConsume" val="1" />
  <set name="operateType" val="A1" />
+ <set name="power" val="200" />
  <set name="reuseDelay" val="4000" />
- <set name="targetType" val="NONE" />
+ <set name="skillType" val="PDAM" />
+ <set name="staticDamage" val="true" />
+ <set name="target" val="TARGET_ONE" />
+ <cond msgId="109">
+ <target npcId="13196,13286,13287,13288,13289,13290,13291" />
+ </cond>
  </skill>
  <skill id="9090" levels="1" name="Fighter's Will">
  <!-- Confirmed CT2.5 -->
Index: dist/game/data/scripts/events/CatchATiger/13292-06.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-06.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-06.htm (working copy)
@@ -0,0 +1,6 @@
+<html><head>
+<body>
+Employee of Magic Research Institute:<br>
+Oh, what a superstar! If I had my way, I'd get you a plaque put up in the Institute.<br>...<br>
+Sadly, you'll have to make do with this.
+</body></html>
Index: dist/game/data/scripts/events/CatchATiger/config.xml
===================================================================
--- dist/game/data/scripts/events/CatchATiger/config.xml (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/config.xml (working copy)
@@ -0,0 +1,46 @@
+<event name="Catch a Tiger" active="01 09 2011-15 09 2011" dropPeriod="01 09 2011-08 09 2011">
+ <droplist>
+ <!-- No drop here -->
+ </droplist>
+ <spawnlist>
+ <add npc="13292" x="16111" y="142850" z="-2707" heading="16000" />
+ <add npc="13292" x="17275" y="145000" z="-3037" heading="25000" />
+ <add npc="13292" x="83037" y="149324" z="-3470" heading="44000" />
+ <add npc="13292" x="82145" y="148609" z="-3468" heading="0" />
+ <add npc="13292" x="81755" y="146487" z="-3534" heading="32768" />
+ <add npc="13292" x="-81031" y="150038" z="-3045" heading="0" />
+ <add npc="13292" x="-83156" y="150994" z="-3130" heading="0" />
+ <add npc="13292" x="-13727" y="122117" z="-2990" heading="16384" />
+ <add npc="13292" x="-14129" y="123869" z="-3118" heading="40959" />
+ <add npc="13292" x="-84411" y="244813" z="-3730" heading="57343" />
+ <add npc="13292" x="-84023" y="243051" z="-3730" heading="4096" />
+ <add npc="13292" x="46908" y="50856" z="-2997" heading="8192" />
+ <add npc="13292" x="45538" y="48357" z="-3061" heading="18000" />
+ <add npc="13292" x="9929" y="16324" z="-4576" heading="62999" />
+ <add npc="13292" x="11546" y="17599" z="-4586" heading="46900" />
+ <add npc="13292" x="81987" y="53723" z="-1497" heading="0" />
+ <add npc="13292" x="81083" y="56118" z="-1562" heading="32768" />
+ <add npc="13292" x="147200" y="25614" z="-2014" heading="16384" />
+ <add npc="13292" x="148557" y="26806" z="-2206" heading="32768" />
+ <add npc="13292" x="117356" y="76708" z="-2695" heading="49151" />
+ <add npc="13292" x="115887" y="76382" z="-2714" heading="0" />
+ <add npc="13292" x="-117239" y="46842" z="367" heading="49151" />
+ <add npc="13292" x="-119494" y="44882" z="367" heading="24576" />
+ <add npc="13292" x="111004" y="218928" z="-3544" heading="16384" />
+ <add npc="13292" x="108426" y="221876" z="-3600" heading="49151" />
+ <add npc="13292" x="-45278" y="-112766" z="-241" heading="0" />
+ <add npc="13292" x="-45372" y="-114104" z="-241" heading="16384" />
+ <add npc="13292" x="115096" y="-178370" z="-891" heading="0" />
+ <add npc="13292" x="116199" y="-182694" z="-1506" heading="0" />
+ <add npc="13292" x="86865" y="-142915" z="-1341" heading="26000" />
+ <add npc="13292" x="85584" y="-142490" z="-1343" heading="0" />
+ <add npc="13292" x="147421" y="-55435" z="-2736" heading="49151" />
+ <add npc="13292" x="148206" y="-55786" z="-2782" heading="61439" />
+ <add npc="13292" x="43165" y="-48461" z="-797" heading="17000" />
+ <add npc="13292" x="43966" y="-47709" z="-798" heading="49999" />
+ </spawnlist>
+ <messages>
+ <add type="onEnd" text="Catch a Tiger event end!" />
+ <add type="onEnter" text="Catch a Tiger: Event ongoing!" />
+ </messages>
+</event>
\ No newline at end of file
Index: dist/game/data/scripts/events/CatchATiger/13292-11.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-11.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-11.htm (working copy)
@@ -0,0 +1,6 @@
+<html><head><body>Employee of Magic Research Institute:
+<br>Good to see you again!
+<br>You survived the tiger menace, eh? Now for the next part. Let's take a look at the contract.
+<br>Apigas and Golden Apigas are how you buy your rewards.
+<a action="bypass -h Quest CatchATiger give_potions">Purchase 200 Sedative Potions (2010 Adena)</a>
+<a action="bypass -h Quest CatchATiger 13292-02.htm">Receive a reward.</a></body></html>
Index: dist/game/data/scripts/events/CatchATiger/13292-03.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-03.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-03.htm (working copy)
@@ -0,0 +1,7 @@
+<html><head>
+<body>
+Employee of Magic Research Institute:<br>
+Not enough Adena.<br>
+You need at least <font color="LEVEL">2010 Adena</font>
+</body></html>
+
Index: dist/game/data/scripts/events/CatchATiger/13292-07.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-07.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-07.htm (working copy)
@@ -0,0 +1,9 @@
+<html><head>
+<body>
+Employee of Magic Research Institute:<br>
+We're not sure. All we know is that, when we use this new experimental summoning scroll, creatures appear, we think from another dimension.<br>
+The White Tigers are particularly interesting for our research, and we're rewarding anyone who can subdue them long enough for us to take a look.<br>
+It's not a difficult task, provided you've got the spine to stare down a White Tiger. Brrr... those eyes.<br><br><br>
+<a action="bypass -h Quest CatchATiger 13292-08.htm">How can I help?</a>
+</body></html>
+
Index: dist/game/data/stats/npcs/13200-13300.xml
===================================================================
--- dist/game/data/stats/npcs/13200-13300.xml (revision 10487)
+++ dist/game/data/stats/npcs/13200-13300.xml (working copy)
@@ -3421,7 +3421,7 @@
  <height normal="25" />
  </collision>
  </npc>
- <npc id="13286" level="85" type="L2Npc" name="Baby White Tiger">
+ <npc id="13286" level="85" type="L2Monster" name="Baby White Tiger">
  <!-- Confirmed CT2.5 -->
  <race>BEAST</race>
  <sex>MALE</sex>
@@ -3457,7 +3457,7 @@
  <height normal="15.7" />
  </collision>
  </npc>
- <npc id="13287" level="85" type="L2Npc" name="Baby White Tiger Captain">
+ <npc id="13287" level="85" type="L2Monster" name="Baby White Tiger Captain">
  <!-- Confirmed CT2.5 -->
  <race>BEAST</race>
  <sex>MALE</sex>
@@ -3493,7 +3493,7 @@
  <height normal="29.5" />
  </collision>
  </npc>
- <npc id="13288" level="85" type="L2Npc" name="Gloomy Baby White Tiger">
+ <npc id="13288" level="85" type="L2Monster" name="Gloomy Baby White Tiger">
  <!-- Confirmed CT2.5 -->
  <race>BEAST</race>
  <sex>MALE</sex>
@@ -3529,7 +3529,7 @@
  <height normal="15.7" />
  </collision>
  </npc>
- <npc id="13289" level="85" type="L2Npc" name="Gloomy Baby White Tiger Captain">
+ <npc id="13289" level="85" type="L2Monster" name="Gloomy Baby White Tiger Captain">
  <!-- Confirmed CT2.5 -->
  <race>BEAST</race>
  <sex>MALE</sex>
@@ -3565,7 +3565,7 @@
  <height normal="29.5" />
  </collision>
  </npc>
- <npc id="13290" level="85" type="L2Npc" name="White Tiger">
+ <npc id="13290" level="85" type="L2Monster" name="White Tiger">
  <!-- Confirmed CT2.5 -->
  <race>BEAST</race>
  <sex>MALE</sex>
@@ -3601,7 +3601,7 @@
  <height normal="17.2" />
  </collision>
  </npc>
- <npc id="13291" level="85" type="L2Npc" name="White Tiger Captain">
+ <npc id="13291" level="85" type="L2Monster" name="White Tiger Captain">
  <!-- Confirmed CT2.5 -->
  <race>BEAST</race>
  <sex>MALE</sex>
@@ -3674,7 +3674,7 @@
  <height normal="17.5" />
  </collision>
  </npc>
- <npc id="13293" level="85" type="L2Npc">
+ <npc id="13293" level="85" type="L2Monster">
  <!-- Confirmed CT2.5 -->
  <race>CONSTRUCT</race>
  <sex>MALE</sex>
@@ -3709,7 +3709,7 @@
  <height normal="0.1" />
  </collision>
  </npc>
- <npc id="13294" level="85" type="L2Npc">
+ <npc id="13294" level="85" type="L2Monster">
  <!-- Confirmed CT2.5 -->
  <race>CONSTRUCT</race>
  <sex>MALE</sex>
Index: dist/game/data/scripts/events/CatchATiger/13292-12.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-12.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-12.htm (working copy)
@@ -0,0 +1,6 @@
+<html><head>
+<body>
+Employee of Magic Research Institute:<br>
+Looks like we have enough tigers for our study. I can't say I'm looking forward to the next part--but at least I didn't have to face the
+wild ones!
+</body></html>
Index: dist/game/data/scripts/events/CatchATiger/13292-04.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-04.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-04.htm (working copy)
@@ -0,0 +1,7 @@
+<html><head>
+<body>
+Employee of Magic Research Institute:<br>
+Sorry, we need at least <font color="LEVEL">20</font> Apigas before we'll give out a reward.<br>
+I'm not going anywhere, so take your time getting more.
+</body></html>
+
Index: dist/game/data/scripts/events/CatchATiger/13292-08.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-08.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-08.htm (working copy)
@@ -0,0 +1,13 @@
+<html><head><body>Employee of Magic Research Institute:
+<br>Oh, you have a kind heart!
+<br>I'll start you with a summoning scroll and some Sedative Potion, and I'll have more for you <font color="LEVEL">every 12 hours</font>.
+When you get out there, use the scroll to summon a beast from another dimension. Don't worry, we've worked out most of the kinks--they almost
+always call a White Tiger Cub these days. Use the sedative to put them to sleep, but try to do it without the White Tiger Matriarch knowing,
+because she gets kind of cranky. I find being in a group is the best way to do it. <font color="LEVEL">One thing to remember</font> is that the
+cubs can be easily scared away.<br>
+Once you subdue them, collect their Apiga, and bring it to us.<br>
+Oh, and if you happen to run into adult White Tigers, they have Golden Apiga, and we'll pay extra for that.<br>
+Oh, and get us those Apigas in record time, and we'll pay double. Not a bad way to make a living, eh?<br><br><br>
+<a action="bypass -h Quest CatchATiger 13292-09.htm">What are Apigas, exactly?</a>
+</body></html>
+
Index: dist/game/data/scripts/events/CatchATiger/13292-01.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-01.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-01.htm (working copy)
@@ -0,0 +1,12 @@
+<html><head>
+<body>
+Employee of Magic Research Institute:<br>
+Yeeeeeee--oh, it's just you. Sorry, I'm a bit on edge lately, what with all these extradimensional beasts.<br>
+I work for the Magic Research Institute. You've probably heard of our work before, but this project might be the death of me.
+Who thought it was a good idea to start summoning things from other dimensions, I ask you?<br>
+Hey, perhaps you can help us out with these tigers?<br><br><br>
+<a action="bypass -h Quest CatchATiger 13292-07.htm">What kind of tigers?</a><br>
+<a action="bypass -h Quest CatchATiger give_package">Purchase the White Tiger event pack (2010 Adena)</a><br>
+<a action="bypass -h Quest CatchATiger give_potions">Purchase 200 Sedative Potions (2010 Adena)</a><br>
+<a action="bypass -h Quest CatchATiger 13292-02.htm">Receive reward.</a></body></html>
+
Index: dist/game/data/scripts/events/CatchATiger/13292-05.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-05.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-05.htm (working copy)
@@ -0,0 +1,6 @@
+<html><head>
+<body>
+Employee of Magic Research Institute:<br>
+Oh dear, it doesn't look like you have <font color="LEVEL">20 Golden Apigas</font> yet.<br>
+I won't rush you. Take your time.
+</body></html>
Index: dist/game/data/scripts/events/CatchATiger/CatchATiger.java
===================================================================
--- dist/game/data/scripts/events/CatchATiger/CatchATiger.java (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/CatchATiger.java (working copy)
@@ -0,0 +1,666 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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.
+ *
+ * L2J DataPack 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 events.CatchATiger;
+
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.model.L2Party;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.event.LongTimeEvent;
+import com.l2jserver.gameserver.model.holders.SkillHolder;
+import com.l2jserver.gameserver.model.itemcontainer.Inventory;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.skills.Skill;
+import com.l2jserver.gameserver.network.NpcStringId;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.clientpackets.Say2;
+import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
+import com.l2jserver.gameserver.network.serverpackets.NpcSay;
+import com.l2jserver.gameserver.network.serverpackets.PlaySound;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.gameserver.util.Util;
+import com.l2jserver.util.Rnd;
+
+/**
+ * @author GKR Retail Event: Catch a Tiger
+ */
+public class CatchATiger extends LongTimeEvent
+{
+ private static final int PIG = 13196;
+ private static final int MANAGER = 13292;
+ private static final int BABY_TIGER = 13286;
+ private static final int BABY_TIGER_CAPTAIN = 13287;
+ private static final int GLOOMY_TIGER = 13288;
+ private static final int GLOOMY_TIGER_CAPTAIN = 13289;
+ private static final int WHITE_TIGER = 13290;
+ private static final int WHITE_TIGER_CAPTAIN = 13291;
+
+ private static final int SUMMONER = 13293;
+ private static final int BOSS_SUMMONER = 13294;
+
+ private static final int[] SKILLS_DMG_TO_ME =
+ {
+ 9088,
+ 9089
+ };
+ private static final SkillHolder[] SKILLS_DMG_BY_ME =
+ {
+ new SkillHolder(6133, 1),
+ new SkillHolder(6135, 1)
+ };
+ private static final int PAYMENT = 2010;
+ private static final long INTERVAL = 12L * 60 * 60 * 1000; // 12h
+ private static final int PACKAGE = 17066;
+ private static final int POTION = 17067;
+ private static final int APIGA = 14720;
+ private static final int GOLDEN_APIGA = 14721;
+ private static final int[] REWARDS =
+ {
+ 17080,
+ 17079,
+ 17078,
+ 17077,
+ 17076,
+ 17075,
+ 17074,
+ 17073,
+ 17072,
+ 17071,
+ 17070,
+ 17069
+ };
+ private static final int[] CHANCES =
+ {
+ 484871,
+ 227307,
+ 550,
+ 515,
+ 470,
+ 382,
+ 275,
+ 211,
+ 168,
+ 80,
+ 35,
+ 0
+ };
+
+ static final NpcStringId[] COUNTDOWN_MESSAGES =
+ {
+ NpcStringId.TIME_UP,
+ NpcStringId.N1_SECONDS_ARE_REMAINING,
+ NpcStringId.N2_SECONDS_ARE_REMAINING,
+ NpcStringId.N3_SECONDS_ARE_REMAINING,
+ NpcStringId.N4_SECONDS_ARE_REMAINING,
+ NpcStringId.N5_SECONDS_ARE_REMAINING,
+ NpcStringId.N6_SECONDS_ARE_REMAINING,
+ NpcStringId.N7_SECONDS_ARE_REMAINING,
+ NpcStringId.N8_SECONDS_ARE_REMAINING,
+ NpcStringId.N9_SECONDS_ARE_REMAINING,
+ NpcStringId.N10_SECONDS_ARE_REMAINING,
+ NpcStringId.N11_SECONDS_ARE_REMAINING,
+ NpcStringId.N12_SECONDS_ARE_REMAINING,
+ NpcStringId.N13_SECONDS_ARE_REMAINING,
+ NpcStringId.N14_SECONDS_ARE_REMAINING,
+ NpcStringId.N15_SECONDS_ARE_REMAINING,
+ NpcStringId.N16_SECONDS_ARE_REMAINING,
+ NpcStringId.N17_SECONDS_ARE_REMAINING,
+ NpcStringId.N18_SECONDS_ARE_REMAINING,
+ NpcStringId.N19_SECONDS_ARE_REMAINING,
+ NpcStringId.N20_SECONDS_ARE_REMAINING,
+ NpcStringId.N21_SECONDS_ARE_REMAINING,
+ NpcStringId.N22_SECONDS_ARE_REMAINING,
+ NpcStringId.N23_SECONDS_ARE_REMAINING,
+ NpcStringId.N24_SECONDS_ARE_REMAINING,
+ NpcStringId.N25_SECONDS_ARE_REMAINING,
+ NpcStringId.N26_SECONDS_ARE_REMAINING,
+ NpcStringId.N27_SECONDS_ARE_REMAINING,
+ NpcStringId.N28_SECONDS_ARE_REMAINING,
+ NpcStringId.N29_SECONDS_ARE_REMAINING,
+ NpcStringId.N30_SECONDS_ARE_REMAINING,
+ NpcStringId.N31_SECONDS_ARE_REMAINING,
+ NpcStringId.N32_SECONDS_ARE_REMAINING,
+ NpcStringId.N33_SECONDS_ARE_REMAINING,
+ NpcStringId.N34_SECONDS_ARE_REMAINING,
+ NpcStringId.N35_SECONDS_ARE_REMAINING,
+ NpcStringId.N36_SECONDS_ARE_REMAINING,
+ NpcStringId.N37_SECONDS_ARE_REMAINING,
+ NpcStringId.N38_SECONDS_ARE_REMAINING,
+ NpcStringId.N39_SECONDS_ARE_REMAINING,
+ NpcStringId.N40_SECONDS_ARE_REMAINING,
+ };
+
+ private static final NpcStringId[] PIG_SKILL_ATTACK_TEXT =
+ {
+ NpcStringId.WHATS_THIS_FOOD,
+ NpcStringId.MY_ENERGY_IS_OVERFLOWING_I_DONT_NEED_ANY_FATIGUE_RECOVERY_POTION,
+ NpcStringId.WHATS_THE_MATTER_THATS_AN_AMATEUR_MOVE
+ };
+
+ private static final NpcStringId[] PIG_ON_SPAWN_TEXT =
+ {
+ NpcStringId.ROAR_NO_OINK_OINK_SEE_IM_A_PIG_OINK_OINK,
+ NpcStringId.WHO_AM_I_WHERE_AM_I_OINK_OINK
+ };
+
+ private static final NpcStringId[] NO_SKILL_ATTACK_TEXT =
+ {
+ NpcStringId.HEY_ARE_YOU_PLANNING_ON_EATING_ME_USE_A_CUPIDS_FATIGUE_RECOVERY_POTION_ALREADY,
+ NpcStringId.ILL_PASS_ON_AN_AMATEURS_MERIDIAN_MASSAGE_USE_A_CUPIDS_FATIGUE_RECOVERY_POTION_ALREADY
+ };
+
+ private static final String[] SKILL_ATTACK_TEXT =
+ {
+ "*Roar* *Grunt Grunt* I don't feel like doing anything right now.",
+ "*Roar* Yeah, right there! That tickles!",
+ "[I feel kind of sleepy...",
+ "Wow I feel really tired today... I wonder why?",
+ "*Roar* My body feels as light as a feather."
+ };
+
+ private static final String[] DEATH_TEXT =
+ {
+ "*Roar* I feel like I could use a nap...!",
+ "*Meow* I'm sleepy. Think I'll go take a nap.",
+ "I can't feel my legs anymore... ZzzZzz"
+ };
+
+ private static final String[] FORTUNE_DEATH_TEXT =
+ {
+ "*Roar* I think I'll go to sleep.",
+ "So sleepy. You wouldn't happen to be the sandman, %name%, would you?",
+ "Incredible. From now on, I'll compare all massages to this one with %name%!"
+ };
+
+ private CatchATiger()
+ {
+ super(CatchATiger.class.getSimpleName(), "events");
+
+ addFirstTalkId(MANAGER);
+ addStartNpc(MANAGER);
+ addTalkId(MANAGER);
+
+ for (int i = BABY_TIGER; i <= WHITE_TIGER_CAPTAIN; i++)
+ {
+ addSpawnId(i);
+ addAttackId(i);
+ addKillId(i);
+ }
+
+ addSpawnId(SUMMONER);
+ addSpawnId(BOSS_SUMMONER);
+ addSpawnId(PIG);
+ }
+
+ @Override
+ public String onFirstTalk(L2Npc npc, L2PcInstance player)
+ {
+ QuestState qs = player.getQuestState(getName());
+ if (qs == null)
+ {
+ qs = newQuestState(player);
+ }
+
+ return isDropPeriod() ? "13292-01.htm" : "13292-11.htm";
+ }
+
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ QuestState qs = player.getQuestState(getName());
+ String htmltext = event.endsWith(".htm") ? event : "";
+ if (qs == null)
+ {
+ return null;
+ }
+
+ switch (event)
+ {
+ case "spawn_summon":
+ {
+ if (npc.getSummoner() != null)
+ {
+ int summonId;
+ if (Rnd.get(100) <= 75)
+ {
+ summonId = npc.getId() == SUMMONER ? GLOOMY_TIGER : GLOOMY_TIGER_CAPTAIN;
+ }
+ else
+ {
+ summonId = PIG;
+ }
+
+ L2Npc summon = addSpawn(summonId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, summonId == PIG ? 10000 : 360000);
+ summon.setSummoner(npc.getSummoner());
+ }
+ return null;
+ }
+ case "give_package":
+ {
+ if (isDropPeriod())
+ {
+ if (qs.getQuestItemsCount(Inventory.ADENA_ID) >= PAYMENT)
+ {
+ long now = System.currentTimeMillis();
+ String val = loadGlobalQuestVar(player.getAccountName());
+ long nextTime = val.equals("") ? 0 : Long.parseLong(val);
+
+ if (now > nextTime)
+ {
+ qs.startQuest();
+ qs.takeItems(Inventory.ADENA_ID, PAYMENT);
+ qs.giveItems(PACKAGE, 1);
+ saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + INTERVAL));
+ }
+ else
+ {
+ long remainingTime = (nextTime - System.currentTimeMillis()) / 1000;
+ int hours = (int) (remainingTime / 3600);
+ int minutes = (int) ((remainingTime % 3600) / 60);
+ SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES);
+ sm.addItemName(PACKAGE);
+ sm.addInt(hours);
+ sm.addInt(minutes);
+ player.sendPacket(sm);
+ }
+ }
+ else
+ {
+ htmltext = "13292-03.htm";
+ }
+ }
+ else
+ {
+ htmltext = "13292-12.htm";
+ }
+ break;
+ }
+ case "give_potions":
+ {
+ if (qs.getQuestItemsCount(Inventory.ADENA_ID) >= PAYMENT)
+ {
+ qs.takeItems(Inventory.ADENA_ID, PAYMENT);
+ qs.giveItems(POTION, 200);
+ }
+ else
+ {
+ htmltext = "13292-03.htm";
+ }
+ break;
+ }
+ case "give_reward":
+ {
+ if (qs.getQuestItemsCount(APIGA) >= 20)
+ {
+ htmltext = "13292-06.htm";
+ qs.takeItems(APIGA, 20);
+ int random = Rnd.get(1000000);
+ for (int i = 0; i < REWARDS.length; i++)
+ {
+ if (random >= CHANCES[i])
+ {
+ qs.giveItems(REWARDS[i], 1);
+ break;
+ }
+ }
+ }
+ else
+ {
+ htmltext = "13292-04.htm";
+ }
+ break;
+ }
+ case "give_adv_reward":
+ {
+ if (qs.getQuestItemsCount(GOLDEN_APIGA) >= 20)
+ {
+ htmltext = "13292-06.htm";
+ qs.takeItems(APIGA, 20);
+ qs.giveItems(17081, 1);
+ }
+ else
+ {
+ htmltext = "13292-05.htm";
+ }
+ break;
+ }
+ case "success":
+ {
+ ExShowScreenMessage sm = new ExShowScreenMessage(2, 0, 2, 0, 1, 0, 0, true, 1000, false, null, NpcStringId.MISSION_SUCCESS, null);
+ player.sendPacket(sm);
+ break;
+ }
+ }
+
+ return htmltext;
+ }
+
+ @Override
+ public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet, Skill skill)
+ {
+ if ((npc.getSummoner().getActingPlayer() == null) || !npc.getSummoner().getActingPlayer().isOnline())
+ {
+ npc.deleteMe();
+ }
+ else
+ {
+ int npcId = npc.getId();
+ if (Rnd.get(100) < 10)
+ {
+ npc.setTarget(attacker);
+ npc.doCast(SKILLS_DMG_BY_ME[0].getSkill());
+ npc.doCast(SKILLS_DMG_BY_ME[1].getSkill());
+ }
+
+ if ((skill != null) && Util.contains(SKILLS_DMG_TO_ME, skill.getId()))
+ {
+ if (!npc.isBusy() && (npcId >= BABY_TIGER) && (npcId <= WHITE_TIGER_CAPTAIN))
+ {
+ npc.setBusy(true); // there is only one chance :)
+ // Works for Tigers regardless of party, for Tiger Captains - only if party is gathered
+ if ((((npcId == BABY_TIGER) || (npcId == GLOOMY_TIGER) || (npcId == WHITE_TIGER)) || (((npcId == BABY_TIGER_CAPTAIN) || (npcId == GLOOMY_TIGER_CAPTAIN) || (npcId == WHITE_TIGER_CAPTAIN)) && attacker.isInParty() && !attacker.getParty().getMembers().isEmpty())) && (Rnd.get(100) < 30))
+ {
+ npc.setBusyMessage("fortune");
+ int counter = ((npcId == BABY_TIGER) || (npcId == GLOOMY_TIGER) || (npcId == WHITE_TIGER)) ? 10 : 40;
+ String snd = ((npcId == BABY_TIGER) || (npcId == GLOOMY_TIGER) || (npcId == WHITE_TIGER)) ? "EV_04" : "EV_03";
+ NpcStringId fstringId = ((npcId == BABY_TIGER) || (npcId == GLOOMY_TIGER) || (npcId == WHITE_TIGER)) ? NpcStringId.FORTUNE_TIMER_REWARD_INCREASES_2_TIMES_IF_COMPLETED_WITHIN_10_SECONDS : NpcStringId.FORTUNE_TIMER_REWARD_INCREASES_2_TIMES_IF_COMPLETED_WITHIN_40_SECONDS;
+ PlaySound ps = new PlaySound(1, snd, 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ());
+ ExShowScreenMessage sm = new ExShowScreenMessage(2, 0, 2, 0, 1, 0, 0, true, 1000, false, null, fstringId, null);
+
+ if ((npc.getId() == BABY_TIGER) || (npc.getId() == GLOOMY_TIGER))
+ {
+ attacker.sendPacket(ps);
+ attacker.sendPacket(sm);
+ }
+ else
+ {
+ attacker.getParty().broadcastPacket(ps);
+ attacker.getParty().broadcastPacket(sm);
+ }
+ ThreadPoolManager.getInstance().scheduleGeneral(new CountdownTask(npc, counter), 1000);
+ }
+ }
+ else if (npcId == PIG)
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), PIG_SKILL_ATTACK_TEXT[Rnd.get(3)]));
+ }
+ else
+ {
+ if (npc.getSummoner().getObjectId() == attacker.getObjectId())
+ {
+ if (Rnd.get(100) < 10)
+ {
+ // npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), 1801178 + Rnd.get(5)));
+ // I have client crash on fstringId, so String constructor is used here
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), SKILL_ATTACK_TEXT[Rnd.get(5)]));
+ }
+ }
+ else if (((npcId == BABY_TIGER) || (npcId == GLOOMY_TIGER) || (npcId == WHITE_TIGER)) && (Rnd.get(100) < 10))
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), NpcStringId.HEY_I_ALREADY_HAVE_AN_OWNER));
+ }
+ }
+ }
+ else if (Rnd.get(100) < 10)
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), NO_SKILL_ATTACK_TEXT[Rnd.get(2)]));
+ }
+ }
+
+ return super.onAttack(npc, attacker, damage, isPet, skill);
+ }
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
+ {
+ if ((npc.getSummoner().getActingPlayer() != null) && npc.getSummoner().getActingPlayer().isOnline())
+ {
+ QuestState qs = killer.getQuestState(getName());
+ if (qs == null)
+ {
+ qs = newQuestState(killer);
+ }
+
+ long owner_count = Rnd.get(2) + 1;
+ if ((npc.getId() == BABY_TIGER) || (npc.getId() == GLOOMY_TIGER) || (npc.getId() == WHITE_TIGER))
+ {
+ if (npc.getBusyMessage().equals("fortune"))
+ {
+ if (npc.isInsideRadius(killer, 1500, true, false))
+ {
+ if (npc.getId() == WHITE_TIGER)
+ {
+ long golden_count = Rnd.get(2);
+ if (golden_count > 0)
+ {
+ qs.giveItems(GOLDEN_APIGA, golden_count * 2);
+ }
+ }
+ qs.giveItems(APIGA, owner_count * 2);
+ ExShowScreenMessage sm = new ExShowScreenMessage(2, 0, 2, 0, 1, 0, 0, true, 5000, false, null, NpcStringId.MISSION_SUCCESS, null);
+ killer.sendPacket(sm);
+ }
+
+ // NpcSay ns = new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), 1801183 + Rnd.get(3));
+ // ns.addStringParameter(killer.getName());
+ NpcSay ns = new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), FORTUNE_DEATH_TEXT[Rnd.get(3)].replaceFirst("%.*?%", killer.getName()));
+ npc.broadcastPacket(ns);
+ }
+ else
+ {
+ if (npc.isInsideRadius(killer, 1500, true, false))
+ {
+ if (npc.getId() == WHITE_TIGER)
+ {
+ long golden_count = Rnd.get(2);
+ if (golden_count > 0)
+ {
+ qs.giveItems(GOLDEN_APIGA, golden_count * 2);
+ }
+ }
+ qs.giveItems(APIGA, owner_count);
+ }
+ // npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), 1801186 + Rnd.get(3)));
+ // I have client crash on fstringId, so String constructor is used here
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), DEATH_TEXT[Rnd.get(3)]));
+ }
+
+ if ((npc.getId() == GLOOMY_TIGER) && (Rnd.get(100) < 30))
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), NpcStringId.SORRY_BUT_ILL_LEAVE_MY_FRIEND_IN_YOUR_CARE_AS_WELL_THANKS)); // Sorry, but let me ask my friend too~ Thanks.
+ L2Npc monster = addSpawn(WHITE_TIGER, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 360000);
+ monster.setSummoner(npc.getSummoner());
+ }
+ }
+ else if ((npc.getId() == BABY_TIGER_CAPTAIN) || (npc.getId() == GLOOMY_TIGER_CAPTAIN) || (npc.getId() == WHITE_TIGER_CAPTAIN))
+ {
+ if ((!killer.isInParty()) || killer.getParty().getMembers().isEmpty())
+ {
+ if (npc.isInsideRadius(killer, 1500, true, false))
+ {
+ qs.giveItems(APIGA, owner_count);
+ }
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), NpcStringId.ISNT_IT_TOUGH_DOING_IT_ALL_ON_YOUR_OWN_NEXT_TIME_TRY_MAKING_A_PARTY_WITH_SOME_COMRADES));
+ }
+ else
+ {
+ L2Party party = killer.getParty();
+ if (npc.getBusyMessage().equals("fortune"))
+ {
+ if (npc.isInsideRadius(killer, 1500, true, false))
+ {
+ if (npc.getId() == WHITE_TIGER_CAPTAIN)
+ {
+ qs.giveItems(GOLDEN_APIGA, (long) (owner_count * party.getMemberCount() * 0.2 * 2));
+ }
+
+ qs.giveItems(APIGA, (long) (owner_count * party.getMemberCount() * 0.2 * 2));
+ }
+
+ // NpcSay ns = new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), 1801183 + Rnd.get(3));
+ // ns.addStringParameter(killer.getName());
+ NpcSay ns = new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), FORTUNE_DEATH_TEXT[Rnd.get(3)].replaceFirst("%.*?%", killer.getName()));
+ npc.broadcastPacket(ns);
+ ExShowScreenMessage sm = new ExShowScreenMessage(2, 0, 2, 0, 1, 0, 0, true, 5000, false, null, NpcStringId.MISSION_SUCCESS, null);
+
+ for (L2PcInstance partyMember : party.getMembers())
+ {
+ if ((partyMember != null) && !partyMember.isDead() && npc.isInsideRadius(partyMember, 1500, true, false))
+ {
+ QuestState qs2 = partyMember.getQuestState(getName());
+ if (qs2 == null)
+ {
+ qs2 = newQuestState(killer);
+ }
+
+ if (npc.getId() == WHITE_TIGER_CAPTAIN)
+ {
+ qs2.giveItems(GOLDEN_APIGA, owner_count * 2);
+ }
+
+ qs2.giveItems(APIGA, owner_count * 2);
+ partyMember.sendPacket(sm);
+ }
+ }
+
+ }
+ else
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), DEATH_TEXT[Rnd.get(3)]));
+ if (npc.isInsideRadius(killer, 1500, true, false))
+ {
+ if (npc.getId() == WHITE_TIGER_CAPTAIN)
+ {
+ qs.giveItems(GOLDEN_APIGA, (long) (owner_count * party.getMemberCount() * 0.2));
+ }
+
+ qs.giveItems(APIGA, (long) (owner_count * party.getMemberCount() * 0.2));
+ }
+
+ for (L2PcInstance partyMember : party.getMembers())
+ {
+ if ((partyMember != null) && !partyMember.isDead() && npc.isInsideRadius(partyMember, 1500, true, false))
+ {
+ QuestState qs2 = partyMember.getQuestState(getName());
+ if (qs2 == null)
+ {
+ qs2 = newQuestState(killer);
+ }
+
+ qs2.giveItems(APIGA, owner_count);
+ }
+ }
+ }
+ if ((npc.getId() == GLOOMY_TIGER_CAPTAIN) && (Rnd.get(100) < 30))
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), NpcStringId.SORRY_BUT_ILL_LEAVE_MY_FRIEND_IN_YOUR_CARE_AS_WELL_THANKS)); // Sorry, but let me ask my friend too~ Thanks.
+ L2Npc monster = addSpawn(WHITE_TIGER_CAPTAIN, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 360000);
+ monster.setSummoner(npc.getSummoner());
+ }
+ }
+ }
+ }
+
+ return super.onKill(npc, killer, isPet);
+ }
+
+ @Override
+ public String onSpawn(L2Npc npc)
+ {
+ int npcId = npc.getId();
+ if ((npcId >= BABY_TIGER) && (npcId <= WHITE_TIGER_CAPTAIN))
+ {
+ npc.disableCoreAI(true);
+ npc.setBusyMessage("");
+ npc.setBusy(false);
+ }
+ else if ((npcId == SUMMONER) || (npcId == BOSS_SUMMONER))
+ {
+ startQuestTimer("spawn_summon", 1000, npc, null); // TODO: Temp hack, summoner sets AFTER spawn, so it needs to make delay.
+ }
+ else if (npcId == PIG)
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getId(), PIG_ON_SPAWN_TEXT[Rnd.get(2)]));
+ }
+
+ return super.onSpawn(npc);
+ }
+
+ private class CountdownTask implements Runnable
+ {
+ private final L2Npc _npc;
+ private final int _counter;
+
+ CountdownTask(L2Npc npc, int counter)
+ {
+ _npc = npc;
+ _counter = counter;
+ }
+
+ @Override
+ public void run()
+ {
+ if (_npc != null)
+ {
+ ExShowScreenMessage sm = new ExShowScreenMessage(2, 0, 2, 0, 1, 0, 0, true, 1000, false, null, COUNTDOWN_MESSAGES[_counter], null);
+ if ((_npc.getSummoner().getActingPlayer() == null) || !_npc.getSummoner().getActingPlayer().isOnline())
+ {
+ _npc.deleteMe();
+ }
+ else if ((_npc.getId() == BABY_TIGER_CAPTAIN) && ((!_npc.getSummoner().isInParty()) || _npc.getSummoner().getParty().getMembers().isEmpty()))
+ {
+ _npc.setBusyMessage("");
+ }
+ else if (_npc.isDead())
+ {
+ startQuestTimer("success", 4000, _npc, _npc.getSummoner().getActingPlayer());
+ }
+ else if (_counter == 0)
+ {
+ _npc.setBusyMessage("");
+ if (_npc.getId() == BABY_TIGER_CAPTAIN)
+ {
+ _npc.getSummoner().getParty().broadcastPacket(sm);
+ }
+ else
+ {
+ _npc.getSummoner().sendPacket(sm);
+ }
+ }
+ else
+ {
+ if (_npc.getId() == BABY_TIGER_CAPTAIN)
+ {
+ _npc.getSummoner().getParty().broadcastPacket(sm);
+ }
+ else
+ {
+ _npc.getSummoner().sendPacket(sm);
+ }
+ ThreadPoolManager.getInstance().scheduleGeneral(new CountdownTask(_npc, _counter - 1), 1000);
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ new CatchATiger();
+ }
+}
\ No newline at end of file
Index: dist/game/data/scripts/events/CatchATiger/13292-09.htm
===================================================================
--- dist/game/data/scripts/events/CatchATiger/13292-09.htm (revision 0)
+++ dist/game/data/scripts/events/CatchATiger/13292-09.htm (working copy)
@@ -0,0 +1,7 @@
+<html><head>
+<body>Employee of Magic Research Institute:<br>
+They're strange magical tokens that each tiger carries. We don't really understand it, but we do know that a tiger will be docile to whomever
+holds its Apiga.<br>
+The tiger can go back to its own dimension, but once we have the Apigas, we can summon that particular tiger whenever we want, and study
+its particular magical signature.
+</body></html>
#15
L2 | Eventos / Evento Squash
Último mensaje por Swarlog - Jun 29, 2025, 12:07 AM
#16
L2 | Eventos / Evento Monster Rush
Último mensaje por Swarlog - Jun 29, 2025, 12:07 AM
CitarCORE:

### Eclipse Workspace Patch 1.0
#P L2_GameServer
Index: data/scripts/events/MonsterRush.java
===================================================================
--- data/scripts/events/MonsterRush.java (revision 0)
+++ data/scripts/events/MonsterRush.java (revision 0)
@@ -0,0 +1,297 @@
+package com.l2jserver.gameserver.events;
+
+import javolution.util.FastSet;
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.ai.CtrlIntention;
+import com.l2jserver.gameserver.datatables.NpcTable;
+import com.l2jserver.gameserver.model.L2CharPosition;
+import com.l2jserver.gameserver.model.L2Spawn;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.L2Attackable;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.TvTEvent;
+import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
+import com.l2jserver.util.Rnd;
+
+public class MonsterRush
+{
+ enum Status
+ {
+ INACTIVE,
+ STARTED,
+ REGISTER,
+ TELEPORT,
+ REWARDING
+
+ }
+
+ public static FastSet<L2PcInstance> _participants = new FastSet<L2PcInstance>();
+ public static FastSet<L2Npc> _monsters = new FastSet<L2Npc>();
+ public static Status _status = Status.INACTIVE;
+ public static int[] _miniIntervals ={40000,80000,120000,160000};
+ public static int[] _CoordsX ={17432,21380,18955,16613};
+ public static int[] _CoordsY ={147465,145848,142545,144201};
+ public static int[] _CoordsZ ={-3123,-3146,-3050,-2978};
+ public static int[][] _wave1Mons ={{21426,21404},{10,10}};
+ public static int[][] _wave2Mons ={{21426},{10}};
+ public static int[][] _wave3Mons ={{21426},{10}};
+ protected static L2Npc _lord = null;
+ public static int _wave = 1;
+ public static int X = 18864;
+ public static int Y = 145216;
+ public static int Z = -3132;
+
+ public static int getParticipatingPlayers()
+ {
+ return _participants.size();
+ }
+
+ protected static void monWave(final int _waveNum)
+ {
+ if(_status == Status.INACTIVE)
+ return;
+ if (_waveNum==2)
+ Announcements.getInstance().announceToAll("First wave has ended. Prepare for second wave!");
+ else if (_waveNum==3)
+ Announcements.getInstance().announceToAll("Second wave has ended. Prepare for last wave!");
+ if(_status == Status.INACTIVE)
+ return;
+ L2Npc mobas = null;
+ int[][] wave = _wave1Mons;
+ if (_waveNum==2)
+ wave = _wave2Mons;
+ else if (_waveNum==3)
+ wave = _wave3Mons;
+
+ for (int i=0;i<=wave[0].length-1;i++)
+ for (int a=1;a<=wave[1][i];a++)
+ for (int r=0;r<=_CoordsX.length-1;r++)
+ {
+ mobas = addSpawn(wave[0][i],_CoordsX[r],_CoordsY[r],_CoordsZ[r]);
+ mobas.getKnownList().addKnownObject(_lord);
+ _monsters.add(mobas);
+ }
+ for (L2Npc monster : _monsters)
+ {
+ ((L2Attackable) monster).addDamageHate(_lord,9000,9000);
+ monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, _lord, null);
+ }
+
+ for (int i=0;i<=_miniIntervals.length-1;i++)
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){public void run(){miniWave(_waveNum);}}, _miniIntervals[i]);
+
+ }
+
+ public static void abortEvent()
+ {
+ _status = Status.INACTIVE;
+ synchronized (_participants)
+ {
+ for (L2PcInstance player : _participants)
+ {
+ player.teleToLocation(X,Y,Z, true);
+ player.setTeam(0);
+ player.inMonsterRush=false;
+ }
+ }
+ for (L2Npc monster : _monsters)
+ {
+ monster.onDecay();
+ }
+ _monsters.clear();
+ _participants.clear();
+ Announcements.getInstance().announceToAll("Monster Rush: Event was aborted.");
+ }
+
+ public static void endByLordDeath()
+ {
+ endAndReward();
+ }
+
+ protected static void endAndReward()
+ {
+ if(_status == Status.INACTIVE)
+ return;
+ _status = Status.REWARDING;
+ for (L2Npc monster : _monsters)
+ {
+ monster.onDecay();
+ }
+ _monsters.clear();
+ if (L2World.getInstance().findObject(_lord.getObjectId()) == null)
+ {
+ Announcements.getInstance().announceToAll("Monster Rush: Lord was not protected!");
+ Announcements.getInstance().announceToAll("Monster Rush: Teleporting players back to town.");
+ Announcements.getInstance().announceToAll("Monster Rush: Event has ended.");
+ synchronized (_participants)
+ {
+ for (L2PcInstance player : _participants)
+ {
+ player.teleToLocation(X,Y,Z, true);
+ player.setTeam(0);
+ player.inMonsterRush=false;
+ }
+ }
+ }
+ else
+ {
+ Announcements.getInstance().announceToAll("Monster Rush: Lord was protected!");
+ Announcements.getInstance().announceToAll("Monster Rush: Teleporting players back to town.");
+ Announcements.getInstance().announceToAll("Monster Rush: Event has ended.");
+ _lord.deleteMe();
+ synchronized (_participants)
+ {
+ for (L2PcInstance player : _participants)
+ {
+ player.sendMessage("Town lord thanks you for help and rewards you then disappears.");
+ player.teleToLocation(X,Y,Z, true);
+ player.setTeam(0);
+ player.inMonsterRush =false;
+ }
+ }
+ }
+ _participants.clear();
+ _status = Status.INACTIVE;
+ }
+
+ protected static void miniWave(int _waveNum)
+ {
+ if(_status == Status.INACTIVE)
+ return;
+ int[][] wave = _wave1Mons;
+ if (_waveNum==2)
+ wave = _wave2Mons;
+ else if (_waveNum==3)
+ wave = _wave3Mons;
+ L2Npc mobas = null;
+ for (int i=0;i<=wave[0].length-1;i++)
+ for (int a=1;a<=Math.round(wave[1][i]*0.65);a++)
+ for (int r=0;r<=_CoordsX.length-1;r++)
+ {
+ mobas = addSpawn(wave[0][i],_CoordsX[r],_CoordsY[r],_CoordsZ[r]);
+ _monsters.add(mobas);
+ }
+ for (L2Npc monster : _monsters)
+ {
+ ((L2Attackable) monster).addDamageHate(_lord,7000,7000);
+ monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, _lord, null);
+ }
+ }
+
+ public static L2Npc addSpawn(int npcId, int x, int y, int z)
+ {
+ L2Npc result = null;
+ try
+ {
+ L2NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
+ if (template != null)
+ {
+ L2Spawn spawn = new L2Spawn(template);
+ spawn.setInstanceId(0);
+ spawn.setHeading(1);
+ spawn.setLocx(x);
+ spawn.setLocy(y);
+ spawn.setLocz(z);
+ spawn.stopRespawn();
+ result = spawn.spawnOne(true);
+
+ return result;
+ }
+ }
+ catch (Exception e1)
+ {
+ }
+
+ return null;
+ }
+
+ public static void doUnReg(L2PcInstance player)
+ {
+ if (_status == Status.REGISTER && _status != null)
+ {
+ if (_participants.contains(player))
+ {
+ _participants.remove(player);
+ player.sendMessage("You have succesfully unregistered from Monster Rush event.");
+ }
+ else
+ {
+ player.sendMessage("You aren't registered in this event.");
+ }
+ }
+ else
+ {
+ player.sendMessage("Event is inactive.");
+ }
+ }
+
+ public static void doReg(L2PcInstance player)
+ {
+ if (_status == Status.REGISTER && _status != null)
+ {
+ if (!_participants.contains(player))
+ {
+ _participants.add(player);
+ player.sendMessage("You have succesfully registered to Monster Rush event.");
+ }
+ else
+ {
+ player.sendMessage("You have already registered for this event.");
+ }
+ }
+ else
+ {
+ player.sendMessage("You cannot register now.");
+ }
+ }
+
+ public static void startRegister()
+ {
+ _status = Status.REGISTER;
+ _participants.clear();
+ Announcements.getInstance().announceToAll("Monster rush: Registration is open.");
+ }
+
+ public static void startEvent()
+ {
+ _status = Status.STARTED;
+ Announcements.getInstance().announceToAll("Registration is over. Teleporting players to town center in 20 seconds.");
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ public void run()
+ {
+ beginTeleport();
+ }
+ }, 20000);
+ }
+
+ protected static void beginTeleport()
+ {
+ _status = Status.TELEPORT;
+ _lord = addSpawn(25603,X,Y,Z);
+ _lord.setIsParalyzed(true);
+ synchronized (_participants)
+ {
+ for (L2PcInstance player : _participants)
+ {
+ if (player.isInOlympiadMode() || TvTEvent.isPlayerParticipant(player.getObjectId()))
+ {
+ _participants.remove(player);
+ return;
+ }
+ player.teleToLocation(X, Y, Z, true);
+ player.setTeam(2);
+ player.inMonsterRush=true;
+ }
+ Announcements.getInstance().announceToAll("Teleportation done. First monster wave will approach town in 1 minute!");
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){public void run(){monWave(1);}}, 60000);
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){public void run(){monWave(2);}}, 260000);
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){public void run(){monWave(3);}}, 460000);
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){public void run(){endAndReward();}}, 660000);
+ }
+ }
+}

Index: java/com/l2jserver/gameserver/model/actor/L2Npc.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Npc.java
+++ java/com/l2jserver/gameserver/model/actor/L2Npc.java
@@ -33,6 +33,7 @@
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.datatables.SpawnTable;
+import com.l2jserver.gameserver.events.MonsterRush;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.CastleManager;
import com.l2jserver.gameserver.instancemanager.DimensionalRiftManager;
@@ -2541,7 +2551,13 @@
{
if (!super.doDie(killer))
return false;
-
+
+ if (getTemplate().npcId == 25603)
+ {
+ this.deleteMe();
+ MonsterRush.endByLordDeath();
+ }
+
// normally this wouldn't really be needed, but for those few exceptions,
// we do need to reset the weapons back to the initial templated weapon.
_currentLHandId = getTemplate().lhand;

Index: java/com/l2jserver/gameserver/model/actor/L2Npc.java
===================================================================
--- com.l2jserver.gameserver.model.actor.instance.L2PcInstance; (revision 3514)
+++ com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
(working copy)
@@ -376,7 +385,9 @@
private Map<Integer, SubClass> _subClasses;

private PcAppearance _appearance;
-
+
+ public static boolean inMonsterRush = false;
+
/** The Identifier of the L2PcInstance */
private int _charId = 0x00030b7a;

BY http://www.l2jserver.com/forum/viewtopic.php?f=81&t=18495&p=98631
#17
L2 | Eventos / Evento Random Fight
Último mensaje por Swarlog - Jun 29, 2025, 12:06 AM
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
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)
@@ -17,6 +17,7 @@
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.zone.ZoneId;
 import net.sf.l2j.gameserver.network.SystemMessageId;
@@ -60,6 +61,13 @@
            return;
        }
         
+       if(RandomFight.players.contains(player))
+       {
+           player.sendMessage("You can't logout when you are in random fight event.");
+           player.sendPacket(ActionFailed.STATIC_PACKET);
+           return;
+       }
+     
        if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !player.isGM())
        {
            if (Config.DEBUG)
Index: config/players.properties
===================================================================
--- config/players.properties   (revision 1)
+++ config/players.properties   (working copy)
@@ -45,6 +45,15 @@
 # Death Penalty chance if killed by mob (in %), 20 by default
 DeathPenaltyChance = 20
 
+#Random Fight Event
+AllowRandomFight = True
+#Random Fight every how many minutes
+EveryMinutes = 3
+#ID of the reward Item , default:LIFE STONES
+RewardId=8762
+#COUNT of the reward item : default : 5
+RewardCount = 5
+
 #=============================================================
 #                      Inventory / Warehouse
 #=============================================================
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java  (revision 1)
+++ java/net/sf/l2j/gameserver/GameServer.java  (working copy)
@@ -90,6 +90,7 @@
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.model.PartyMatchRoomList;
 import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.entity.Castle;
 import net.sf.l2j.gameserver.model.entity.Hero;
 import net.sf.l2j.gameserver.model.olympiad.Olympiad;
@@ -237,6 +238,9 @@
        Olympiad.getInstance();
        Hero.getInstance();
         
+       if(Config.ALLOW_RANDOM_FIGHT)
+           RandomFight.getInstance();
+     
        Util.printSection("Four Sepulchers");
        FourSepulchersManager.getInstance().init();
         
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()
    {
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)
@@ -37,6 +37,7 @@
 
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
 import net.sf.l2j.gameserver.GameTimeController;
 import net.sf.l2j.gameserver.GeoData;
 import net.sf.l2j.gameserver.ItemsAutoDestroy;
@@ -103,6 +104,7 @@
 import net.sf.l2j.gameserver.model.PartyMatchRoom;
 import net.sf.l2j.gameserver.model.PartyMatchRoomList;
 import net.sf.l2j.gameserver.model.PartyMatchWaitingList;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.ShortCuts;
 import net.sf.l2j.gameserver.model.ShotType;
 import net.sf.l2j.gameserver.model.TradeList;
@@ -4077,6 +4079,19 @@
        {
            L2PcInstance pk = killer.getActingPlayer();
             
+           if(RandomFight.state == RandomFight.State.FIGHT)
+           {
+               if(RandomFight.players.contains(this) && RandomFight.players.contains(pk))
+               {
+                   pk.sendMessage("You are the winner!!!");
+                   Announcements.announceToAll("Random Fight Results:"+pk.getName()+" is the winner.");
+                   Announcements.announceToAll("Event Ended.");
+                   pk.addItem("",Config.RANDOM_FIGHT_REWARD_ID, Config.RANDOM_FIGHT_REWARD_COUNT, null, true);
+                   RandomFight.revert();
+                   RandomFight.clean();
+               }
+           }
+         
            // Clear resurrect xp calculation
            setExpBeforeDeath(0);
             
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 1)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -383,6 +383,11 @@
    public static boolean ALT_GAME_DELEVEL;
    public static int DEATH_PENALTY_CHANCE;
     
+   public static boolean ALLOW_RANDOM_FIGHT;
+   public static int EVERY_MINUTES;
+   public static int RANDOM_FIGHT_REWARD_ID;
+   public static int RANDOM_FIGHT_REWARD_COUNT;

    /** Inventory & WH */
    public static int INVENTORY_MAXIMUM_NO_DWARF;
    public static int INVENTORY_MAXIMUM_DWARF;
@@ -987,6 +992,12 @@
            ALT_GAME_DELEVEL = players.getProperty("Delevel", true);
            DEATH_PENALTY_CHANCE = players.getProperty("DeathPenaltyChance", 20);
             
+           ALLOW_RANDOM_FIGHT = players.getProperty("AllowRandomFight",true);
+           EVERY_MINUTES = players.getProperty("EveryMinutes",3);
+           RANDOM_FIGHT_REWARD_ID = players.getProperty("RewardId" , 8762);
+           RANDOM_FIGHT_REWARD_COUNT = players.getProperty("RewardCount" , 5);
+         
+         
            INVENTORY_MAXIMUM_NO_DWARF = players.getProperty("MaximumSlotsForNoDwarf", 80);
            INVENTORY_MAXIMUM_DWARF = players.getProperty("MaximumSlotsForDwarf", 100);
            INVENTORY_MAXIMUM_QUEST_ITEMS = players.getProperty("MaximumSlotsForQuestItems", 100);
Index: java/net/sf/l2j/gameserver/model/RandomFight.java
===================================================================
--- java/net/sf/l2j/gameserver/model/RandomFight.java   (revision 0)
+++ java/net/sf/l2j/gameserver/model/RandomFight.java   (revision 0)
@@ -0,0 +1,273 @@
+/*
+ * 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;
+
+import java.util.Vector;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
+import net.sf.l2j.gameserver.util.Broadcast;
+import net.sf.l2j.util.Rnd;
+
+/**
+ * @author lioy
+ *
+ */
+public class RandomFight
+{
+    public static enum State{INACTIVE,REGISTER,LOADING,FIGHT}
+    public static State state = State.INACTIVE;
+   
+   public static Vector<L2PcInstance> players = new Vector<>();

+   protected void openRegistrations()
+   {
+       state = State.REGISTER;
+       Broadcast.announceToOnlinePlayers("Random Fight Event will start in 1 minute.");
+       Broadcast.announceToOnlinePlayers("To register press ?register");
+       ThreadPoolManager.getInstance().scheduleGeneral(new checkRegist(), 60000 );
+   }
+   
+   protected void checkRegistrations()
+    {
+       state=State.LOADING;
+     
+       if(players.isEmpty() || players.size() < 2)
+       {
+           Broadcast.announceToOnlinePlayers("Random Fight Event will not start cause of no many partitipations, we are sorry.");
+           clean();
+           return;
+       }
+       Broadcast.announceToOnlinePlayers("Amount of players Registed: "+players.size());
+       Broadcast.announceToOnlinePlayers("2 Random players will be choosen in 30 seconds!");
+       ThreadPoolManager.getInstance().scheduleGeneral(new pickPlayers(), 30000 );
+    }
+   
+
+   protected void pickPlayers()
+    {
+       if(players.isEmpty() || players.size() < 2)
+        {
+           Broadcast.announceToOnlinePlayers("Random Fight Event aborted because no many partitipations, we are sorry.");
+           clean();
+           return;
+       }
+     
+       for(L2PcInstance p : players)
+           if(p.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(p))
+           {
+               players.remove(p);
+               p.sendMessage("You automatically left from event because of your olympiad obligations.");
+           }
+
+     
+       int rnd1=Rnd.get(players.size());
+       int rnd2=Rnd.get(players.size());
+     
+       while(rnd2==rnd1)
+           rnd2=Rnd.get(players.size());
+     
+       for(L2PcInstance player : players)
+       {
+           if(player != players.get(rnd1) && player != players.get(rnd2))
+               players.remove(player);
+       }
+     
+       Broadcast.announceToOnlinePlayers("Players selected: "+players.firstElement().getName()+" || "+players.lastElement().getName());
+       Broadcast.announceToOnlinePlayers("Players will be teleported in 15 seconds");
+       ThreadPoolManager.getInstance().scheduleGeneral(new teleportPlayers(), 15000);
+    }
+   
+
+   protected void teleport()
+    {
+       if(players.isEmpty() || players.size() < 2)
+        {
+           Broadcast.announceToOnlinePlayers("Random Fight Event aborted because no many partitipations, we are sorry.");
+           clean();
+           return;
+       }
+       Broadcast.announceToOnlinePlayers("Players teleported!");
+     
+       players.firstElement().teleToLocation(113474,15552,3968,0);
+       players.lastElement().teleToLocation(112990,15489,3968,0);
+       players.firstElement().setTeam(1);
+       players.lastElement().setTeam(2);
+     
+       //para,etc
+     
+       players.firstElement().sendMessage("Fight will begin in 15 seconds!");
+       players.lastElement().sendMessage("Fight will begin in 15 seconds!");
+     
+       ThreadPoolManager.getInstance().scheduleGeneral(new fight(), 15000);
+    }

+   protected void startFight()
+    {
+     
+       if(players.isEmpty() || players.size() < 2)
+        {
+           Broadcast.announceToOnlinePlayers("One of the players isn't online, event aborted we are sorry!");
+           clean();
+           return;
+       }
+     
+       state = State.FIGHT;
+       Broadcast.announceToOnlinePlayers("FIGHT STARTED!");
+       players.firstElement().sendMessage("Start Fight!!");
+       players.lastElement().sendMessage("Start Fight!");
+       ThreadPoolManager.getInstance().scheduleGeneral(new checkLast(), 120000 );
+    }
+   
+    protected void lastCheck()
+    {
+       if(state == State.FIGHT)
+       {
+           if(players.isEmpty() || players.size() < 2)
+           {
+               revert();
+               clean();
+               return;
+           }
+         
+           int alive=0;
+           for(L2PcInstance player : players)
+           {
+               if(!player.isDead())
+                   alive++;
+           }
+         
+           if(alive==2)
+           {
+               Broadcast.announceToOnlinePlayers("Random Fight ended tie!");
+               clean();
+               revert();
+           }
+       }
+    }

+   public static void revert()
+   {
+       if(!players.isEmpty())
+       for(L2PcInstance p : players)
+       {
+           if(p == null)
+               continue;
+         
+           if(p.isDead())
+               p.doRevive();
+         
+           p.setCurrentHp(p.getMaxHp());
+           p.setCurrentCp(p.getMaxCp());
+           p.setCurrentMp(p.getMaxMp());
+           p.broadcastUserInfo();
+           p.teleToLocation(82698,148638,-3473,0);
+     
+       }
+   }

+   public static void clean()
+   {
+     
+       if(state == State.FIGHT)
+           for(L2PcInstance p : players)
+               p.setTeam(0);
+
+     
+       players.clear();
+       state = State.INACTIVE;
+     
+   }

+   protected RandomFight()
+   {
+       ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Event(), 60000 * Config.EVERY_MINUTES , 60000 * Config.EVERY_MINUTES);
+   }

+   public static RandomFight getInstance()
+   {
+       return SingletonHolder._instance;
+   }

+   private static class SingletonHolder
+   {
+       protected static final RandomFight _instance = new RandomFight();
+   }

+   protected class Event implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           if(state == State.INACTIVE)
+               openRegistrations();
+       }
+     
+   }

+   protected class checkRegist implements Runnable
+   {
+
+       @Override
+       public void run()
+       {
+               checkRegistrations();
+       }
+     
+   }

+   protected class pickPlayers implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           pickPlayers();
+       }
+     
+   }

+   protected class teleportPlayers implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           teleport();
+       }
+     
+   }

+   protected class fight implements Runnable
+   {
+
+       @Override
+       public void run()
+       {
+           startFight();
+       }
+     
+   }

+   protected class checkLast implements Runnable
+   {
+       @Override
+       public void run()
+       {
+           lastCheck();
+       }
+     
+   }
+}
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)
@@ -17,11 +17,13 @@
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
+import net.sf.l2j.gameserver.model.RandomFight;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.zone.ZoneId;
 import net.sf.l2j.gameserver.network.L2GameClient;
 import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
 import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
 import net.sf.l2j.gameserver.network.serverpackets.CharSelectInfo;
 import net.sf.l2j.gameserver.network.serverpackets.RestartResponse;
 import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
@@ -66,6 +68,13 @@
            return;
        }
         
+       if(RandomFight.players.contains(player))
+       {
+           player.sendMessage("You can't restart when you are in random fight event.");
+           player.sendPacket(ActionFailed.STATIC_PACKET);
+           return;
+       }
+     
        if (AttackStanceTaskManager.getInstance().getAttackStanceTask(player) && !player.isGM())
        {
            if (Config.DEBUG)

CitarMODIFICACIÓN:

Cambiar esto:

for(L2PcInstance player : players)
{
    if(player != players.get(rnd1) && player != players.get(rnd2))
      players.remove(player);
}

Por esto otro:

// fix bluur.
  for (Iterator<L2PcInstance> i = players.iterator(); i.hasNext();)
  {
        L2PcInstance player = i.next();
           
          if (player != players.get(rnd1) && player != players.get(rnd2))
              i.remove();
   }

Créditos: Asked by discorder25, Lioympas
#18
L2 | Eventos / Evento Player Vs Player
Último mensaje por Swarlog - Jun 29, 2025, 12:05 AM

CitarINFORMACIÓN:

- El evento es todos contra todos, el admin iniciar el evento con el comando "// pvp_start" y termina con "// pvp_end".
- Recompensa se encuentra en el archivo events.properties
- Todos los jugadores inscritos son llamados a la arena y el recuento comienza.
- ¿Quién mató a entre 5, 15 y 25 asesinatos seguidos (no puede morir) serán los ganadores.
- Quien murió reinicia la cuenta de las muertes.
- Es auto generar la matriz tiene que VILAGE cuando estás en el evento.
- Usted puede dar el personaje del héroe en el máximo kill consecutivo (25)
- Se ejecuta durante un tiempo que se está configurando en minutos

CitarCORE:

### Eclipse Workspace Patch 1.0
#P trunk 2
Index: aCis/acis_game/java/net/sf/l2j/gameserver/model/entity/custom/PvPEvent.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/model/entity/custom/PvPEvent.java (revision 0)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/model/entity/custom/PvPEvent.java (working copy)
@@ -0,0 +1,230 @@
+package net.sf.l2j.gameserver.model.entity.custom;
+
+import java.util.ArrayList;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.datatables.MapRegionTable;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.util.Broadcast;
+import net.sf.l2j.util.Rnd;
+
+/**
+ * @author Leoonardo and Bluur
+ */
+public class PvPEvent implements Runnable
+{
+ private static ArrayList<L2PcInstance> _players = new ArrayList<>();
+ private static EventState pvpstates = EventState.INACTIVE;
+ private static int allplayers = 0;
+
+ public enum EventState{
+ INACTIVE,REGISTER,TELEPORT,FIGHT,END;
+ }
+ public static void starting()
+ {
+ setStatePVP(EventState.REGISTER);
+ Broadcast.announceToOnlinePlayers("Will start the registrations for the event in a verse one.");
+
+ for (L2PcInstance p : L2World.getInstance().getAllPlayers().values())
+ {
+ if (p == null)
+ return;
+
+ regWindow(p);
+ }
+ time(Config.PVP_EVENT_REG_TIME);
+ if(_players.size() < 2){
+ Broadcast.announceToOnlinePlayers("The event was canceled due to lack of players.");
+ _players.clear();
+ setStatePVP(EventState.INACTIVE);
+ return;
+ }
+ setStatePVP(EventState.TELEPORT);
+ Broadcast.announceToOnlinePlayers("Stay tuned to the teleporter.");
+ Broadcast.announceToOnlinePlayers("Total number of participants: " + allplayers);
+ Broadcast.announceToOnlinePlayers("10 seconds to teleport players registered");
+ time(10);
+ teleporting();
+ Broadcast.announceToOnlinePlayers("The event ends in " + Config.PVP_EVENT_TIME / 60 + " minutes.");
+ time(Config.PVP_EVENT_TIME);
+ Broadcast.announceToOnlinePlayers("The time is up!");
+ reload();
+ }
+
+ public static void teleporting()
+ {
+ Broadcast.announceToOnlinePlayers("HaHaHa, We're going to fight !!!!.");
+ for (L2PcInstance player : _players)
+ {
+ if (player == null)
+ return;
+ player.teleToLocation(Config.PVP_EVENT_X, Config.PVP_EVENT_Y, Config.PVP_EVENT_Z, Rnd.get(100));
+ }
+ Broadcast.announceToOnlinePlayers("Kill all!.");
+ setStatePVP(EventState.FIGHT);
+ }
+
+ public static void finish()
+ {
+ for (L2PcInstance player : _players)
+ {
+ if (player == null)
+ return;
+
+ player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+ }
+
+ allplayers = 0;
+ _players.clear();
+ setStatePVP(EventState.INACTIVE);
+ Broadcast.announceToOnlinePlayers("Event Finish time over!!!");
+ }
+
+ public static void regWindow(L2PcInstance p)
+ {
+ NpcHtmlMessage html = new NpcHtmlMessage(1);
+ html.setFile("data/html/mods/pvp/event.htm");
+ p.sendPacket(html);
+ }
+
+ private static void reload()
+ {
+ for (L2PcInstance player : _players)
+ {
+ if (player == null)
+ return;
+
+ player.setPointPvPEvent(0);
+ player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
+ }
+
+ allplayers = 0;
+ _players.clear();
+ setStatePVP(EventState.INACTIVE);
+ }
+
+ public static boolean checkPlayerInEvent(L2PcInstance p)
+ {
+ return _players.contains(p);
+ }
+
+ public static void onDie(L2PcInstance player, L2PcInstance killer)
+ {
+ if (player != null)
+ {
+ countKills(killer);
+ res(player, 5 * 1000);
+ }
+ }
+
+ private static void res(final L2PcInstance player, long millis)
+ {
+ if (player != null)
+ {
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ player.doRevive();
+ player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
+ player.setCurrentCp(player.getMaxCp());
+ player.setPointPvPEvent(0);
+ player.teleToLocation(Config.PVP_EVENT_X, Config.PVP_EVENT_Y, Config.PVP_EVENT_Z, 0);
+ }
+ }, millis);
+ }
+ }
+
+ private static void countKills(L2PcInstance p)
+ {
+ p.setPointPvPEvent(p.getPointPvPEvent() + 1);
+
+ switch (p.getPointPvPEvent())
+ {
+ case 5:
+ Broadcast.announceToOnlinePlayers(p.getName() + " have been successfully awarded 5 kills, congratulations.");
+ Broadcast.announceToOnlinePlayers(p.getName() + " 5 consecutive kills !!!");
+ for(int[] recebendo : getRewards())
+ p.addItem("Reward Item", recebendo[0], recebendo[1], p, true);
+ break;
+ case 15:
+ Broadcast.announceToOnlinePlayers(p.getName() + " have been successfully awarded 15 kills, congratulations.");
+ Broadcast.announceToOnlinePlayers(p.getName() + " 15 consecutive kills !!!");
+ for(int[] recebendo : getRewards())
+ p.addItem("Reward Item", recebendo[0], recebendo[1], p, true);
+ break;
+ case 25:
+ Broadcast.announceToOnlinePlayers(p.getName() + " have been successfully awarded heroi and items, congratulations.");
+ Broadcast.announceToOnlinePlayers(p.getName() + " 25 consecutive kills !!!");
+ p.setHero(Config.PVP_EVENT_SETHERO);
+ p.setPointPvPEvent(0);
+ for(int[] recebendo : getRewards())
+ p.addItem("Reward Item", recebendo[0], recebendo[1], p, true);
+ break;
+ }
+ }
+ private static final int [][] getRewards(){
+ return Config.PVP_EVENT_REWARDS;
+ }
+ public static void registerPlayer(L2PcInstance player)
+ {
+ if (getStatePVP() == EventState.INACTIVE || getStatePVP() == EventState.END)
+ {
+ player.sendMessage("This event is offline.");
+ return;
+ }
+ else if (getStatePVP() == EventState.TELEPORT)
+ {
+ player.sendMessage("This event in teleport.");
+ return;
+ }
+ else if (getStatePVP() == EventState.FIGHT)
+ {
+ player.sendMessage("This event in progress.");
+ return;
+ }
+ else if (player.getKarma() > 0 || player.isInOlympiadMode() || player.isCursedWeaponEquipped())
+ {
+ player.sendMessage("you can't register");
+ return;
+ }
+ else if (checkPlayerInEvent(player))
+ {
+ player.sendMessage("you're already registred in evento.");
+ return;
+ }
+ _players.add(player);
+ allplayers++;
+ player.sendMessage("you have been successfully registered");
+ }
+
+ private static void time(int segundos)
+ {
+ try
+ {
+ Thread.sleep(segundos * 1000);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("[PvP Event]: Erro in method: time()");
+ }
+ }
+    public static void setStatePVP(EventState state)
+    {
+     pvpstates = state;
+    }

+    public static EventState getStatePVP()
+    {
+        return pvpstates;
+    }
+ @Override
+ public void run()
+ {
+ starting();
+ }
+}
Index: aCis/acis_game/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminPVP.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminPVP.java (revision 0)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminPVP.java (working copy)
@@ -0,0 +1,31 @@
+package net.sf.l2j.gameserver.handler.admincommandhandlers;
+
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent.EventState;
+
+public class AdminPVP implements IAdminCommandHandler {
+
+ private static final String[] ADMIN_COMMANDS = { "admin_pvp_start",
+ "admin_pvp_end" };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance activeChar) {
+ if (command.startsWith("admin_pvp_start"))
+ if (PvPEvent.getStatePVP() != EventState.INACTIVE) {
+ activeChar.sendMessage("[PVP] Evento esta em progresso.");
+ return false;
+ }
+ ThreadPoolManager.getInstance().scheduleAi(new PvPEvent(), 0);
+ activeChar.sendMessage("[PVP]: Evento executado.");
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList() {
+ return ADMIN_COMMANDS;
+ }
+
+}
Index: aCis/acis_game/config/events.properties
===================================================================
--- aCis/acis_game/config/events.properties (revision 7)
+++ aCis/acis_game/config/events.properties (working copy)
@@ -1,4 +1,19 @@
 #=============================================================
+# Player vs Player // Created Leonardo and Bluur
+#=============================================================
+# Event total time in seconds.
+PVPEventTime = 300
+# Coord Arena and Respawn.
+EventTeleportX = -87895
+EventTeleportY = 142150
+EventTeleportZ = -3646
+# Rewards Event.
+# id,count.
+PVPEventRewards = 6622,1
+# Event player set hero for 25 kills.
+PVPEventSetHero = false
+
+#=============================================================
 #                          Olympiad
 #=============================================================
 # Olympiad start time hour, default 18 (6PM).
Index: aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (working copy)
@@ -18,6 +18,7 @@
 import net.sf.l2j.gameserver.instancemanager.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
 import net.sf.l2j.gameserver.model.zone.ZoneId;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
@@ -52,7 +53,12 @@
  player.sendPacket(ActionFailed.STATIC_PACKET);
  return;
  }
-
+ if (PvPEvent.checkPlayerInEvent(player))
+ {
+ player.sendPacket(SystemMessageId.NO_LOGOUT_HERE);
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
  if (player.isInsideZone(ZoneId.NO_RESTART))
  {
  player.sendPacket(SystemMessageId.NO_LOGOUT_HERE);
Index: aCis/acis_game/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
@@ -55,6 +55,7 @@
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPetition;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPledge;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPolymorph;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPVP;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRepairChar;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRes;
 import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRideWyvern;
@@ -117,6 +118,7 @@
  registerAdminCommandHandler(new AdminPledge());
  registerAdminCommandHandler(new AdminPolymorph());
  registerAdminCommandHandler(new AdminRepairChar());
+ registerAdminCommandHandler(new AdminPVP());
  registerAdminCommandHandler(new AdminRes());
  registerAdminCommandHandler(new AdminRideWyvern());
  registerAdminCommandHandler(new AdminShop());
\ No newline at end of file
Index: aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
@@ -28,6 +28,7 @@
 import net.sf.l2j.gameserver.model.actor.instance.L2OlympiadManagerInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.entity.Hero;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
 import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
@@ -93,6 +94,10 @@
  {
  playerHelp(activeChar, _command.substring(12));
  }
+ else if (_command.startsWith("join_pvp"))
+ {
+       PvPEvent.registerPlayer(activeChar);
+ }
  else if (_command.startsWith("npc_"))
  {
  if (!activeChar.validateBypass(_command))
Index: aCis/acis_game/java/net/sf/l2j/Config.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/Config.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/Config.java (working copy)
@@ -138,7 +138,15 @@
  // --------------------------------------------------
  // Events settings
  // --------------------------------------------------
-
+ /** Player Vs Player*/
+ public static int PVP_EVENT_TIME;
+ public static int PVP_EVENT_REG_TIME;
+ public static int PVP_EVENT_X;
+ public static int PVP_EVENT_Y;
+ public static int PVP_EVENT_Z;
+ public static int [][] PVP_EVENT_REWARDS;
+ public static boolean PVP_EVENT_SETHERO;
+
  /** Olympiad */
  public static int ALT_OLY_START_TIME;
  public static int ALT_OLY_MIN;
@@ -809,6 +817,13 @@
 
  // Events config
  ExProperties events = load(EVENTS_FILE);
+ PVP_EVENT_TIME = events.getProperty("PVPEventTime", 300);
+ PVP_EVENT_REG_TIME = events.getProperty("PVPEventRegisterTime", 30);
+ PVP_EVENT_X = events.getProperty("EventTeleportX", 0);
+ PVP_EVENT_Y = events.getProperty("EventTeleportY", 0);
+ PVP_EVENT_Z = events.getProperty("EventTeleportZ", 0);
+ PVP_EVENT_REWARDS = parseItemsList(events.getProperty("PVPEventRewards", "6622,1"));
+ PVP_EVENT_SETHERO = events.getProperty("PVPEventSetHero", false);
  ALT_OLY_START_TIME = events.getProperty("AltOlyStartTime", 18);
  ALT_OLY_MIN = events.getProperty("AltOlyMin", 0);
  ALT_OLY_CPERIOD = events.getProperty("AltOlyCPeriod", 21600000);
Index: aCis/acis_game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -127,6 +127,7 @@
 import net.sf.l2j.gameserver.model.entity.Duel;
 import net.sf.l2j.gameserver.model.entity.Hero;
 import net.sf.l2j.gameserver.model.entity.Siege;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
 import net.sf.l2j.gameserver.model.holder.ItemHolder;
 import net.sf.l2j.gameserver.model.holder.SkillUseHolder;
 import net.sf.l2j.gameserver.model.item.Henna;
@@ -575,9 +576,8 @@
  private final int _race[] = new int[2];
 
  private final BlockList _blockList = new BlockList(this);
-
+ private int _pointsPvPEvent;
  private int _team = 0;
-
  private int _alliedVarkaKetra = 0; // lvl of alliance with ketra orcs or varka silenos, used in quests and aggro checks [-5,-1] varka, 0 neutral, [1,5] ketra
 
  private Location _fishingLoc;
@@ -4025,7 +4025,7 @@
  if (killer != null)
  {
  L2PcInstance pk = killer.getActingPlayer();
-
+ PvPEvent.onDie(this, pk);
  // Clear resurrect xp calculation
  setExpBeforeDeath(0);
 
@@ -9843,7 +9843,16 @@
  {
  _punishTimer = time;
  }
-
+ public void setPointPvPEvent(int point)
+ {
+     _pointsPvPEvent = point;
+ }
+
+ public int getPointPvPEvent()
+ {
+      return _pointsPvPEvent;
+ }
+
  private void updatePunishState()
  {
  if (getPunishLevel() != PunishLevel.NONE)
Index: aCis/acis_game/java/net/sf/l2j/gameserver/network/serverpackets/Die.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/network/serverpackets/Die.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/network/serverpackets/Die.java (working copy)
@@ -21,6 +21,7 @@
 import net.sf.l2j.gameserver.model.actor.L2Character;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.entity.Castle;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
 
 public class Die extends L2GameServerPacket
 {
@@ -57,6 +58,10 @@
 
  writeC(0x06);
  writeD(_charObjId);
+
+ if (_activeChar instanceof L2PcInstance && PvPEvent.checkPlayerInEvent(((L2PcInstance)_activeChar)))
+      return;
+
  writeD(0x01); // to nearest village
 
  if (_clan != null)
Index: aCis/acis_game/java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java (working copy)
@@ -22,7 +22,9 @@
 
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
 import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
 import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
 import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
 import net.sf.l2j.gameserver.templates.StatsSet;
@@ -256,7 +258,12 @@
  player.sendPacket(SystemMessageId.ONLY_NOBLESS_CAN_PARTICIPATE_IN_THE_OLYMPIAD);
  return false;
  }
-
+ if (PvPEvent.checkPlayerInEvent(player))
+ {
+ player.sendMessage("You are registered in another event, please try again later...");
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ return false;
+ }
  if (player.isSubClassActive())
  {
  player.sendPacket(SystemMessageId.YOU_CANT_JOIN_THE_OLYMPIAD_WITH_A_SUB_JOB_CHARACTER);
Index: aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -37,6 +37,8 @@
 import net.sf.l2j.gameserver.model.entity.ClanHall;
 import net.sf.l2j.gameserver.model.entity.Couple;
 import net.sf.l2j.gameserver.model.entity.Siege;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent.EventState;
 import net.sf.l2j.gameserver.model.olympiad.Olympiad;
 import net.sf.l2j.gameserver.model.quest.Quest;
 import net.sf.l2j.gameserver.model.quest.QuestState;
@@ -173,7 +175,10 @@
  activeChar.sendPacket(SystemMessageId.WELCOME_TO_LINEAGE);
  SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);
  Announcements.getInstance().showAnnouncements(activeChar);
-
+ if (PvPEvent.getStatePVP() == EventState.REGISTER){
+ PvPEvent.regWindow(activeChar);
+ }
+
  // if player is DE, check for shadow sense skill at night
  if (activeChar.getRace() == Race.DarkElf && activeChar.getSkillLevel(294) == 1)
  activeChar.sendPacket(SystemMessage.getSystemMessage((GameTimeController.getInstance().isNight()) ? SystemMessageId.NIGHT_S1_EFFECT_APPLIES : SystemMessageId.DAY_S1_EFFECT_DISAPPEARS).addSkillName(294));
Index: aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java (revision 7)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java (working copy)
@@ -18,6 +18,7 @@
 import net.sf.l2j.gameserver.instancemanager.SevenSignsFestival;
 import net.sf.l2j.gameserver.model.L2Party;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.entity.custom.PvPEvent;
 import net.sf.l2j.gameserver.model.zone.ZoneId;
 import net.sf.l2j.gameserver.network.L2GameClient;
 import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
@@ -59,6 +60,12 @@
  sendPacket(RestartResponse.valueOf(false));
  return;
  }
+ if (PvPEvent.checkPlayerInEvent(player))
+ {
+ player.sendPacket(SystemMessageId.NO_LOGOUT_HERE);
+ sendPacket(RestartResponse.valueOf(false));
+ return;
+ }
 
  if (player.isInStoreMode())
  {
 

CitarDATA:

### Eclipse Workspace Patch 1.0
#P trunk 2
Index: aCis/acis_datapack/data/xml/admin_commands_rights.xml
===================================================================
--- aCis/acis_datapack/data/xml/admin_commands_rights.xml (revision 7)
+++ aCis/acis_datapack/data/xml/admin_commands_rights.xml (working copy)
@@ -370,4 +370,7 @@
  <aCar name="admin_zone_visual" accessLevel="1" />
  <aCar name="admin_zone_visual_clear" accessLevel="1" />
 
+ <!-- CUSTOM -->
+ <aCar name="admin_pvp_start" accessLevel="1" />
+ <aCar name="admin_pvp_end" accessLevel="1" />
 </list>
\ No newline at end of file
Index: aCis/acis_datapack/data/html/mods/pvp/event.htm
===================================================================
--- aCis/acis_datapack/data/html/mods/pvp/event.htm (revision 0)
+++ aCis/acis_datapack/data/html/mods/pvp/event.htm (working copy)
@@ -0,0 +1,59 @@
+<html>
+<title>Event Manager</title>
+<body>
+<center>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+<table bgcolor=000000 width=300 height=40>
+<tr>
+<td width="300" align="center"><font color="666666">Lineage II - PVP EVENT</font></td>
+</tr>
+</table>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+<br>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+</center>
+<center>
+<table bgcolor=000000 width=300 height=12>
+<tr>
+<td width="300" align="center"><font color="FF0000">Event Manager</font></td>
+</tr>
+<tr>
+<td width="300" align="center"><font color="666666">...Event Info...</font></td>
+</tr>
+</table>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+<br>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+<table border=0 bgcolor=000000 width=300 height=10>
+<tr>
+<td width="300" align="center"><font color="FF9900">Deseja participar do evento ? - </font></td>
+</tr>
+</table>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+<br>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+<table border=0 bgcolor=000000 width=300 height=20>
+<tr>
+<td align="center" width="300"><button value="Join" action="bypass -h join_pvp" width=85 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal"></center></td>
+</tr>
+</table>
+<center><img src="L2UI.SquareGray" width=300 height=1></center>
+<td><img src="L2UI.SquareBlank" width=40 height=2></td>
+<center><img src=L2UI.SquareGray width=250 height=1></center>
+</center>
+</body>
+</html>
\ No newline at end of file

CitarIMPLEMENTACIONES:

### Eclipse Workspace Patch 1.0
#P trunk 2
Index: aCis/acis_game/java/net/sf/l2j/gameserver/model/entity/custom/PvPEvent.java
===================================================================
--- aCis/acis_game/java/net/sf/l2j/gameserver/model/entity/custom/PvPEvent.java (revision 8)
+++ aCis/acis_game/java/net/sf/l2j/gameserver/model/entity/custom/PvPEvent.java (working copy)
@@ -197,6 +197,11 @@
  player.sendMessage("you're already registred in evento.");
  return;
  }
+ else if (_players.size() >= 99)
+ {
+ player.sendMessage("Event is full players : "+allplayers);
+ return;
+ }
  _players.add(player);
  allplayers++;
  player.sendMessage("you have been successfully registered");
#19
L2 | Eventos / Evento Navidad (Darki699)
Último mensaje por Swarlog - Jun 29, 2025, 12:05 AM
En este evento los jugadores ganan artículos especiales de Navidad (como toquinha papá noel, cajas de música) en un intervalo de tiempo aleatorio. Se dice también algunas frases de navidad por NPCs azar.

Comando para activarlo: //christmas_start
Comando para desactivar el evento: //christmas_end

CitarCODE:

Index: /trunk/PvP-GS/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
===================================================================
--- /trunk/PvP-GS/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 34)
+++ /trunk/PvP-GS/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 42)
@@ -118,4 +118,5 @@
         registerAdminCommandHandler(new AdminNoble());
         registerAdminCommandHandler(new AdminReload());
+        registerAdminCommandHandler(new AdminChristmas());
         _log.config("AdminCommandsHandler: Loaded " + _datatable.size() + " handlers.");
  }
Index: /trunk/PvP-GS/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChristmas.java
===================================================================
--- /trunk/PvP-GS/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChristmas.java (revision 42)
+++ /trunk/PvP-GS/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminChristmas.java (revision 42)
@@ -0,0 +1,69 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.sf.l2j.gameserver.handler.admincommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.instancemanager.ChristmasManager;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ *
+ * @version $Revision: 1.2.4.4 $ $Date: 2007/07/31 10:06:02 $
+ */
+public class AdminChristmas implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS = {"admin_christmas_start", "admin_christmas_end"};
+
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+
+
+        if (command.equals("admin_christmas_start"))
+        {
+        startChristmas(activeChar);
+        }
+       
+        else if (command.equals("admin_christmas_end"))
+        {
+        endChristmas(activeChar);
+        }
+
+        return true;
+ }
+
+
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+
+
+ private void startChristmas(L2PcInstance activeChar)
+ {
+ ChristmasManager.getInstance().init(activeChar);
+ }
+
+ private void endChristmas(L2PcInstance activeChar)
+ {
+ ChristmasManager.getInstance().end(activeChar);
+ }
+
+
+}
Index: /trunk/PvP-GS/java/net/sf/l2j/gameserver/instancemanager/ChristmasManager.java
===================================================================
--- /trunk/PvP-GS/java/net/sf/l2j/gameserver/instancemanager/ChristmasManager.java (revision 42)
+++ /trunk/PvP-GS/java/net/sf/l2j/gameserver/instancemanager/ChristmasManager.java (revision 42)
@@ -0,0 +1,797 @@
+/*
+ * 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.sf.l2j.gameserver.instancemanager;
+
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.Future;
+import java.util.logging.Logger;
+
+import javolution.util.FastList;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.datatables.ItemTable;
+import net.sf.l2j.gameserver.datatables.NpcTable;
+import net.sf.l2j.gameserver.datatables.SpawnTable;
+import net.sf.l2j.gameserver.idfactory.IdFactory;
+import net.sf.l2j.gameserver.model.L2Attackable;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.L2Spawn;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
+import net.sf.l2j.gameserver.templates.L2NpcTemplate;
+
+/**
+ * control for sequence of Christmas.
+ * @version 1.00
+ * @author  Darki699
+ */
+
+public class ChristmasManager
+{
+ private static ChristmasManager _instance = new ChristmasManager();
+   
+
+ // list of trees.
+    protected List<L2NpcInstance> objectQueue = new FastList<L2NpcInstance>();
+   
+    protected Random rand = new Random();
+
+    static final Logger _log = Logger.getLogger(ItemsOnGroundManager.class.getName());
+
+    // X-Mas message list
+    protected String[]
+                     
+            message = {
+    "Ho Ho Ho... Merry Christmas!",
+    "God is Love...",
+    "Christmas is all about love...",
+    "Christmas is thus about God and Love...",
+    "Love is the key to peace among all Lineage creature kind..",
+    "Love is the key to peace and happiness within all creation...",
+    "Love needs to be practiced - Love needs to flow - Love needs to make happy...",
+    "Love starts with your partner, children and family and expands to all world.",
+    "God bless all kind.",
+    "God bless Lineage.",
+    "Forgive all.",
+    "Ask for forgiveness even from all the \"past away\" ones.",
+    "Give love in many different ways to your family members, relatives, neighbors and \"foreigners\".",
+    "Enhance the feeling within yourself of being a member of a far larger family than your physical family",
+    "MOST important - Christmas is a feast of BLISS given to YOU from God and all beloved ones back home in God !!",
+    "Open yourself for all divine bliss, forgiveness and divine help that is offered TO YOU by many others AND GOD.",
+    "Take it easy. Relax these coming days.",
+    "Every day is Christmas day - it is UP TO YOU to create the proper inner attitude and opening for love toward others AND from others within YOUR SELF !",
+    "Peace and Silence. Reduced activities. More time for your most direct families. If possible NO other dates or travel may help you most to actually RECEIVE all offered bliss.",
+    "What ever is offered to you from God either enters YOUR heart and soul or is LOST for GOOD !!! or at least until another such day - next year Christmas or so !!",
+    "Divine bliss and love NEVER can be stored and received later.",
+    "There is year round a huge quantity of love and bliss available from God and your Guru and other loving souls, but Christmas days are an extended period FOR ALL PLANET",
+    "Please open your heart and accept all love and bliss - For your benefit as well as for the benefit of all your beloved ones.",
+    "Beloved children of God",
+    "Beyond Christmas days and beyond Christmas season - The Christmas love lives on, the Christmas bliss goes on, the Christmas feeling expands.",
+    "The holy spirit of Christmas is the holy spirit of God and God's love for all days.",
+    "When the Christmas spirit lives on and on...",
+    "When the power of love created during the pre-Christmas days is kept alive and growing.",
+    "Peace among all mankind is growing as well =)",
+    "The holy gift of love is an eternal gift of love put into your heart like a seed.",
+    "Dozens of millions of humans worldwide are changing in their hearts during weeks of pre-Christmas time and find their peak power of love on Christmas nights and Christmas days.",
+    "What is special during these days, to give all of you this very special power of love, the power to forgive, the power to make others happy, power to join the loved one on his or her path of loving life.",
+    "It only is your now decision that makes the difference !",
+    "It only is your now focus in life that makes all the changes. It is your shift from purely worldly matters toward the power of love from God that dwells within all of us that gave you the power to change your own behavior from your normal year long behavior.",
+    "The decision of love, peace and happiness is the right one.",
+    "Whatever you focus on is filling your mind and subsequently filling your heart.",
+    "No one else but you have change your focus these past Christmas days and the days of love you may have experienced in earlier Christmas seasons.",
+    "God's love is always present.",
+    "God's Love has always been in same power and purity and quantity available to all of you.",
+    "Expand the spirit of Christmas love and Christmas joy to span all year of your life...",
+    "Do all year long what is creating this special Christmas feeling of love joy and happiness.",
+    "Expand the true Christmas feeling, expand the love you have ever given at your maximum power of love days ... ",
+    "Expand the power of love over more and more days.",
+    "Re-focus on what has brought your love to its peak power and refocus on those objects and actions in your focus of mind and actions.",
+    "Remember the people and surrounding you had when feeling most happy, most loved, most magic",
+    "People of true loving spirit - who all was present, recall their names, recall the one who may have had the greatest impact in love those hours of magic moments of love...",
+    "The decoration of your surrounding - Decoration may help to focus on love - Or lack of decoration may make you drift away into darkness or business - away from love...",
+    "Love songs, songs full of living joy - any of the thousands of true touching love songs and happy songs do contribute to the establishment of an inner attitude perceptible of love.",
+    "Songs can fine tune and open our heart for love from God and our loved ones.",
+    "Your power of will and focus of mind can keep Christmas Love and Christmas joy alive beyond Christmas season for eternity",
+    "Enjoy your love for ever!",
+    "Christmas can be every day - As soon as you truly love every day =)",
+    "Christmas is when you love all and are loved by all.",
+    "Christmas is when you are truly happy by creating true happiness in others with love from the bottom of your heart.",
+    "Secret in God's creation is that no single person can truly love without ignition of his love.",
+    "You need another person to love and to receive love, a person to truly fall in love to ignite your own divine fire of love. ",
+    "God created many and all are made of love and all are made to love...",
+    "The miracle of love only works if you want to become a fully loving member of the family of divine love.",
+    "Once you have started to fall in love with the one God created for you - your entire eternal life will be a permanent fire of miracles of love ... Eternally !",
+    "May all have a happy time on Christmas each year. Merry Christmas!",
+    "Christmas day is a time for love. It is a time for showing our affection to our loved ones. It is all about love.",
+    "Have a wonderful Christmas. May god bless our family. I love you all.",
+    "Wish all living creatures a Happy X-mas and a Happy New Year! By the way I would like us to share a warm fellowship in all places.",
+    "Just as animals need peace of mind, poeple and also trees need peace of mind. This is why I say, all creatures are waiting upon the Lord for their salvation. May God bless you all creatures in the whole world.",
+    "Merry Xmas!",
+    "May the grace of Our Mighty Father be with you all during this eve of Christmas. Have a blessed Christmas and a happy New Year.",
+    "Merry Christmas my children. May this new year give all of the things you rightly deserve. And may peace finally be yours.",
+    "I wish everybody a Merry Christmas! May the Holy Spirit be with you all the time.",
+    "May you have the best of Christmas this year and all your dreams come true.",
+    "May the miracle of Christmas fill your heart with warmth and love. Merry Christmas!"
+    },
+   
+    sender = {
+    "Santa Claus", "Papai Noel", "Shengdan Laoren", "Santa", "Viejo Pascuero", "Sinter Klaas", "Father Christmas", "Saint Nicholas",
+    "Joulupukki", "Pere Noel", "Saint Nikolaus", "Kanakaloka", "De Kerstman", "Winter grandfather", "Babbo Natale", "Hoteiosho", "Kaledu Senelis", "Black Peter", "Kerstman", 
+    "Julenissen","Swiety Mikolaj","Ded Moroz","Julenisse","El Nino Jesus","Jultomten","Reindeer Dasher","Reindeer Dancer","Christmas Spirit","Reindeer Prancer","Reindeer Vixen",
+    "Reindeer Comet","Reindeer Cupid","Reindeer Donner","Reindeer Donder","Reindeer Dunder","Reindeer Blitzen","Reindeer Bliksem","Reindeer Blixem","Reindeer Rudolf","Christmas Elf" 
+    };
+   
+    // Presents List:
+    protected int[] presents = {
+    5560,5560,5560,5560,5560, /* x-mas tree */
+    5560,5560,5560,5560,5560,
+    5561,5561,5561,5561,5561, /* special x-mas tree */
+    5562, 5562, 5562, 5562, /* 1st Carol */
+    5563, 5563, 5563, 5563, /* 2nd Carol */
+    5564, 5564, 5564, 5564, /* 3rd Carol */
+    5565, 5565, 5565, 5565, /* 4th Carol */
+    5566, 5566, 5566, 5566, /* 5th Carol */
+    5583, 5583, /* 6th Carol */
+    5584, 5584, /* 7th Carol */
+    5585, 5585, /* 8th Carol */
+    5586, 5586, /* 9th Carol */
+    5587, 5587, /* 10th Carol */
+    6403, 6403, 6403, 6403, /* Star Shard */
+    6403, 6403, 6403, 6403,
+    6406, 6406, 6406, 6406, /* FireWorks */
+    6407, 6407, /* Large FireWorks */
+    5555, /* Token of Love */
+    7836, /* Santa Hat #1 */
+    9138, /* Santa Hat #2 */
+    8936, /* Santa's Antlers Hat */
+    6394, /* Red Party Mask */
+    5808 /* Black Party Mask */
+   
+    };
+   
+   
+    // The message task sent at fixed rate
+    @SuppressWarnings("unchecked")
+ protected Future _XMasMessageTask = null,
+    _XMasPresentsTask = null;
+   
+    // Manager should only be Initialized once:
+    protected int isManagerInit = 0;
+
+   
+    // Interval of Christmas actions:
+    protected long _IntervalOfChristmas = 600000; // 10 minutes
+   
+    private final int   first = 25000,
+ last = 73099;
+   
+    /************************************** Initial Functions **************************************/
+
+       
+        /**
+         * Empty constructor
+         * Does nothing
+         */
+        public ChristmasManager()
+        {
+        // nothing.
+        }
+
+
+        /**
+         * returns an instance of <b>this</b> InstanceManager.
+         */
+        public static ChristmasManager getInstance()
+        {
+            if (_instance == null) _instance = new ChristmasManager();
+
+            return _instance;
+        }
+       
+       
+        /**
+         *  initialize <b>this</b> ChristmasManager
+         */
+        public void init(L2PcInstance activeChar)
+        {
+       
+        if (isManagerInit > 0)
+        {
+        activeChar.sendMessage("Christmas Manager has already begun or is processing. Please be patient....");
+        return;
+        }
+       
+        activeChar.sendMessage("Started!!!! This will take a 2-3 hours (in order to reduce system lags to a minimum), please be patient... The process is working in the background and will spawn npcs, give presents and messages at a fixed rate.");
+       
+        //Tasks:
+       
+        spawnTrees();   
+       
+        startFestiveMessagesAtFixedRate();
+        isManagerInit++;
+       
+        givePresentsAtFixedRate();
+        isManagerInit++;
+       
+       
+        checkIfOkToAnnounce();
+       
+        }
+
+       
+        /**
+         *  ends <b>this</b> ChristmasManager
+         */
+        public void end(L2PcInstance activeChar)
+        {
+       
+        if (isManagerInit < 4)
+        {
+       
+        if (activeChar != null)
+        activeChar.sendMessage("Christmas Manager is not activated yet. Already Ended or is now processing....");
+        return;
+       
+        }
+       
+        if (activeChar != null)
+        activeChar.sendMessage("Terminating! This may take a while, please be patient...");
+       
+        //Tasks:
+
+        ThreadPoolManager.getInstance().executeTask(new DeleteSpawns());
+       
+        endFestiveMessagesAtFixedRate();
+        isManagerInit--;
+       
+        endPresentGivingAtFixedRate();
+        isManagerInit--;
+       
+        checkIfOkToAnnounce();
+       
+        }
+
+       
+        /************************************- Tree management -*************************************/   
+       
+       
+        /**
+         * Main function - spawns all trees.
+         */
+       
+        public void spawnTrees()
+        {
+
+        GetTreePos gtp = new GetTreePos(first);
+        ThreadPoolManager.getInstance().executeTask(gtp);
+     
+        }
+       
+       
+        /**
+         * returns a random X-Mas tree Npc Id.
+         * @return int tree Npc Id.
+         */
+       
+        int getTreeId()
+        {
+       
+        int[] ids = { 13006 , 13007 };
+        return ids[ rand.nextInt(ids.length) ];
+       
+        }
+       
+       
+        /**
+         * gets random world positions according to spawned world objects
+         * and spawns x-mas trees around them... 
+         */
+       
+        public class GetTreePos implements Runnable
+        {
+
+        private int _iterator;
+       
+        @SuppressWarnings("unchecked")
+ private Future _task;
+       
+       
+        public GetTreePos(int iter)
+        {
+        _iterator = iter;
+        }
+       
+       
+        @SuppressWarnings("unchecked")
+ public void setTask(Future task)
+        {
+        _task = task;
+        }
+       
+       
+        public void run()
+        {
+       
+            if (_task != null)
+            {
+            _task.cancel(true);
+            _task = null;
+            }
+       
+       
+        try
+            {
+        L2Object obj = null;
+        while (obj == null)
+        {
+          obj = SpawnTable.getInstance().getTemplate(_iterator).getLastSpawn();
+          _iterator++;
+         
+          if (obj != null && obj instanceof L2Attackable)
+          if (rand.nextInt(100) > 10)
+          obj = null;
+        }
+       
+            if ( obj != null && rand.nextInt(100) > 50 )
+            {
+       
+            spawnOneTree( getTreeId() ,
+            obj.getX() + rand.nextInt(200) - 100 ,
+            obj.getY() + rand.nextInt(200) - 100 ,
+            obj.getZ());
+            }
+            }
+           
+            catch (Throwable t)  { }
+       
+           
+            if (_iterator >= last)
+            {
+            isManagerInit++;
+
+            SpawnSantaNPCs ssNPCs = new SpawnSantaNPCs(first);
+           
+            _task = ThreadPoolManager.getInstance().scheduleGeneral(ssNPCs, 300);
+            ssNPCs.setTask(_task);
+                   
+            return;
+            }
+           
+            _iterator++;
+            GetTreePos gtp = new GetTreePos(_iterator);
+       
+        _task = ThreadPoolManager.getInstance().scheduleGeneral(gtp, 300);
+        gtp.setTask(_task);
+           
+            }
+           
+
+        }
+
+       
+        /**
+         * Delete all x-mas spawned trees from the world. 
+         * Delete all x-mas trees spawns, and clears the L2NpcInstance tree queue.
+         */
+       
+        public class DeleteSpawns implements Runnable
+        {
+       
+        public void run()
+        {
+       
+            if (objectQueue == null || objectQueue.isEmpty())
+            return;
+           
+            for (L2NpcInstance deleted : objectQueue)
+            {
+           
+            if (deleted == null)
+            continue;
+           
+            else
+            {
+                try
+                {
+               
+                L2World.getInstance().removeObject(deleted);
+               
+                deleted.decayMe();
+                deleted.deleteMe();
+               
+               
+                }
+               
+                catch(Throwable t) { continue; }
+            }
+
+            }
+           
+            objectQueue.clear();
+            objectQueue = null;
+       
+            isManagerInit = isManagerInit - 2;
+            checkIfOkToAnnounce();
+           
+        }
+       
+        }
+       
+       
+        /**
+         * Spawns one x-mas tree at a given location x,y,z
+         * @param id - int tree npc id.
+         * @param x - int loc x
+         * @param y - int loc y
+         * @param z - int loc z
+         */
+       
+        void spawnOneTree(int id, int x, int y, int z)
+        {
+            try
+            {
+           
+            L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(id);
+            L2Spawn spawn = new L2Spawn(template1);
+               
+            spawn.setId(IdFactory.getInstance().getNextId());
+               
+            spawn.setLocx(x);
+                spawn.setLocy(y);
+                spawn.setLocz(z);
+               
+                L2NpcInstance tree = spawn.spawnOne();
+                L2World.getInstance().storeObject(tree);
+                objectQueue.add(tree);
+               
+            }
+           
+            catch(Throwable t){}
+        }
+       
+       
+        /****************************- send players festive messages -*****************************/
+       
+       
+        /**
+         * Ends X-Mas messages sent to players, and terminates the thread.
+         */
+       
+        private void endFestiveMessagesAtFixedRate()
+        {
+        if (_XMasMessageTask != null)
+        {
+        _XMasMessageTask.cancel(true);
+        _XMasMessageTask = null;
+        }
+        }
+       
+       
+        /**
+         * Starts X-Mas messages sent to all players, and initialize the thread.
+         */
+       
+        private void startFestiveMessagesAtFixedRate()
+        {
+        SendXMasMessage XMasMessage = new SendXMasMessage();
+        _XMasMessageTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(XMasMessage, 60000, _IntervalOfChristmas);
+        }
+       
+       
+       
+        /**
+         * Sends X-Mas messages to all world players.
+         * @author Darki699
+         */
+       
+        class SendXMasMessage implements Runnable
+        {
+        public void run()
+        {
+        try
+        {
+        for (L2PcInstance pc : L2World.getInstance().getAllPlayers())
+        {
+        if (pc == null)
+        continue;
+       
+        else if (pc.isOnline() == 0)
+        continue;
+       
+        pc.sendPacket ( getXMasMessage() );
+       
+        }
+        }
+       
+        catch (Throwable t){}
+        }
+        }
+
+
+        /**
+         * Returns a random X-Mas message.
+         * @return CreatureSay message
+         */
+       
+        CreatureSay getXMasMessage()
+        {
+        CreatureSay cs = new CreatureSay (0,
+        17,
+        getRandomSender(),
+        getRandomXMasMessage());
+        return cs;
+        }
+       
+   
+       
+        /**
+         * Returns a random name of the X-Mas message sender, sent to players
+         * @return String of the message sender's name
+         */
+       
+        private String getRandomSender()
+        {
+        return sender [ rand.nextInt(sender.length) ];
+        }
+       
+       
+        /**
+         * Returns a random X-Mas message String
+         * @return String containing the random message.
+         */
+       
+        private String getRandomXMasMessage()
+        {
+        return message [ rand.nextInt(message.length) ];
+        }
+       
+       
+       
+        /*******************************- give special items trees -********************************/
+        //Trees , Carols , Tokens of love, Fireworks, Santa Hats.
+       
+
+        /**
+         * Starts X-Mas Santa presents sent to all players, and initialize the thread.
+         */
+       
+        private void givePresentsAtFixedRate()
+        {
+        XMasPresentGivingTask XMasPresents = new XMasPresentGivingTask();
+        _XMasPresentsTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(XMasPresents, _IntervalOfChristmas, _IntervalOfChristmas*3);   
+        }
+       
+       
+        class XMasPresentGivingTask implements Runnable
+        {
+        public void run()
+        {
+        try
+        {
+        for (L2PcInstance pc : L2World.getInstance().getAllPlayers())
+        {
+        if (pc == null)
+        continue;
+       
+        else if (pc.isOnline() == 0)
+        continue;
+       
+        else if (pc.GetInventoryLimit() <= pc.getInventory().getSize())
+        {
+        pc.sendMessage("Santa wanted to give you a Present but your inventory was full :(");
+        continue;
+        }
+       
+        else if (rand.nextInt(100) < 50)
+        {
+           
+        int itemId = getSantaRandomPresent();
+       
+        L2ItemInstance item = ItemTable.getInstance().createItem("Christmas Event", itemId, 1, pc);
+        pc.getInventory().addItem("Christmas Event", item.getItemId(), 1, pc, pc);
+       
+        String itemName = ItemTable.getInstance().getTemplate(itemId).getName();
+       
+        SystemMessage sm;
+                            sm = new SystemMessage(SystemMessageId.EARNED_ITEM);
+                            sm.addString( itemName + " from Santa's Present Bag..");
+                            pc.broadcastPacket(sm);
+                           
+        }
+       
+        }
+        }
+       
+        catch (Throwable t) {}
+        }
+        }
+       
+       
+        int getSantaRandomPresent()
+        {
+        return  presents [ rand.nextInt(presents.length) ] ;
+        }
+       
+       
+        /**
+         * Ends X-Mas present giving to players, and terminates the thread.
+         */
+       
+        private void endPresentGivingAtFixedRate()
+        {
+        if (_XMasPresentsTask != null)
+        {
+        _XMasPresentsTask.cancel(true);
+        _XMasPresentsTask = null;
+        }
+        }
+       
+        /************************************- spawn NPCs in towns -***************************************/
+       
+        //NPC Ids: 31863 , 31864
+        public class SpawnSantaNPCs implements Runnable
+        {
+
+        private int _iterator;
+       
+        private Future<?> _task;   
+       
+       
+        public SpawnSantaNPCs(int iter)
+        {
+        _iterator = iter;
+        }
+       
+       
+        public void setTask(Future<?> task)
+        {
+        _task = task;
+        }
+       
+        public void run()
+        {
+       
+            if (_task != null)
+            {
+            _task.cancel(true);
+            _task = null;
+            }
+       
+       
+        try
+            {
+           
+        L2Object obj = null;
+        while (obj == null)
+        {
+        obj = SpawnTable.getInstance().getTemplate(_iterator).getLastSpawn();
+        _iterator++;
+        if (obj != null && obj instanceof L2Attackable)
+        obj = null;
+        }
+           
+                if ( obj != null &&
+                rand.nextInt(100)<80 &&
+                obj instanceof L2NpcInstance )
+               
+                {
+               
+                spawnOneTree ( getSantaId() ,
+            obj.getX() + rand.nextInt(500) - 250 ,
+            obj.getY() + rand.nextInt(500) - 250 ,
+            obj.getZ());
+                   
+               
+                }
+               
+
+     
+            }
+            catch(Throwable t){}
+
+                if (_iterator >= last)
+                {
+                    isManagerInit++;
+                    checkIfOkToAnnounce();
+                   
+                    return;
+                }
+           
+                _iterator++;
+                SpawnSantaNPCs ssNPCs = new SpawnSantaNPCs(_iterator);
+               
+                _task = ThreadPoolManager.getInstance().scheduleGeneral(ssNPCs, 300);
+                ssNPCs.setTask(_task);
+
+        }
+
+        }
+       
+       
+        int getSantaId()
+        {
+        return ((rand.nextInt(100)<50) ? 31863 : 31864);
+        }
+
+       
+       
+        void checkIfOkToAnnounce()
+        {
+        if (isManagerInit == 4)
+        {
+        Announcements.getInstance().announceToAll("Christmas Event has begun, have a Merry Christmas and a Happy New Year.");
+        Announcements.getInstance().announceToAll("Christmas Event will end in 24 hours.");
+        _log.info("ChristmasManager:Init ChristmasManager was started successfully, have a festive holiday.");
+       
+        EndEvent ee = new EndEvent();
+        Future<?> task = ThreadPoolManager.getInstance().scheduleGeneral(ee , 86400000);
+        ee.setTask(task);
+       
+        isManagerInit = 5;
+        }
+       
+        if (isManagerInit == 0)
+        {
+        Announcements.getInstance().announceToAll("Christmas Event has ended... Hope you enjoyed the festivities.");
+        _log.info("ChristmasManager:Terminated ChristmasManager.");
+       
+        isManagerInit = -1;
+        }
+        }
+       
+       
+        public class EndEvent implements Runnable
+        {
+       
+        private Future<?> _task;
+       
+       
+        public void setTask(Future<?> task)
+        {
+        _task = task;
+        }
+       
+       
+        public void run()
+        {
+        if (_task != null)
+        {
+        _task.cancel(true);
+        _task = null;
+        }
+       
+        end(null);
+       
+        }
+       
+        }
+       
+        /************************************- special NPCs -***************************************/
+       
+        /******************************- show PCs with santa hats -*********************************/
+       
+       
+    }   
+

By: Darki699
#20
L2 | Eventos / Evento Capture Buzz
Último mensaje por Swarlog - Jun 29, 2025, 12:04 AM
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.datatables import DoorTable
from net.sf.l2j.gameserver.datatables import        SkillTable
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
from net.sf.l2j.gameserver import Announcements
from net.sf.l2j import L2DatabaseFactory
from net.sf.l2j.gameserver.ai import CtrlIntention
from net.sf.l2j.util import Rnd
from java.lang import System
from net.sf.l2j.gameserver.model import L2World

qn = "5556_Base"
# =======================================
#                НЕ ТРОГАЕМ
# =======================================
closed=1
res_timer=0
npc1=0
npc2=0
TEAM1 = []
TEAM2 = []
attacked = 0
annom = 1
# =======================================
#                КОНФИГ
# =======================================
NAME = "3AXBAT bA3bI" # Название (только английские символы)
LOC = "Goddard" # Место, где вы поставили регистрирующего НПЦ.
REGISTER = 55558 # Регистрирующий нпц. НЕ ЗАБЫВАЕМ ДЕЛАТЬ ЕГО БЕССМЕРТНЫМ.
locr = [147712,-55520,-2733] # Соответственно координаты, где будет появляться НПЦ
PENI = 4037 # Итем, необходимый для участия
PENI_KOL = 0 # Сколько итемов необходимо для участия. Если хотите чтобы участие было бесплатным - поставте 0
LEVEL = 76 # Минимальный уровень, на котором игрок сможет принять участие в ивенте.
AFTER_RESTART = 10 # Время, которое пройдёт от запуска сервера(перезагрузки скрипта) до начала ивента.
TIME_FOR_WAIT = 120 # Время между ивентами в минутах
TIME_FOR_REG = 10 # Время на регистрацию в минутах
ANNOUNCE_INTERVAL = 2 # Как часто аннонсить о регистрации на ивент в минутах.
YCH_MIN = 2 # Минимальное количество участников в команде
YCH_MAX = 20 # Максимальное количество участников в команде
REWARD =[[6673,3,100],[5556,1,100]] # Список наград. Выдаётся каждому участнику. Формат записи: [[itemId1,count1,chance1],[itemId2,count2,chanceN],...[itemIdN,countN,chanceN]]
t1 =[175732,-87983,-5107] # Место телепорта 1 команды и 1 базы
t2 =[172713,-87983,-5107] # Место телепорта 2 команды и 1 базы
BASE1 = 55561 # ИД НПЦ базы №1
BASE2 = 55562 # ИД НПЦ базы №2
com1 = "Dark power" # Название 1 команды
com2 = "Light power" # Название 2 команды
RES_TIME = 8 # Время, через которое будут ресаться дохлые игроки - секунды.


class Quest (JQuest) :
 def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

 def init_LoadGlobalData(self) :
   self.startQuestTimer("open", AFTER_RESTART *60000, None, None)
   return

 def onTalk (Self,npc,player):
  global TEAM1,TEAM2,npc1,npc2,closed
  st = player.getQuestState(qn)
  npcId = npc.getNpcId()
  if npcId == REGISTER:
   if closed<>1:
    if not player.isInOlympiadMode() :
     if player.getLevel() >= LEVEL:
      if player.getName() not in TEAM1 + TEAM2 :
       if len(TEAM1)>len(TEAM2) :
        kolych = len(TEAM1)
       else:
        kolych = len(TEAM2)
       if kolych <= YCH_MAX :
        if PENI_KOL<>0:   
         if st.getQuestItemsCount(PENI)>PENI_KOL:
           st.takeItems(PENI,PENI_KOL)
           if len(TEAM1)>len(TEAM2):
            TEAM2.append(player.getName())
            return "reg.htm"
           else:
            TEAM1.append(player.getName())
            return "reg.htm"
         else:
           st.exitQuest(1)
           return "nopeni.htm"
        else:
           if len(TEAM1)>len(TEAM2):
            TEAM2.append(player.getName())
            return "reg.htm"
           else:
            TEAM1.append(player.getName())
            return "reg.htm"
       else:
         return "max.htm"
      else:
       return "yje.htm"
     else:
      return "lvl.htm"
    else:
     return "You register in olympiad games now"
   else:
    return "noreg.htm"
  return

 def onAdvEvent (self,event,npc,player):
   global TEAM1,TEAM2,npc1,npc2,res_timer,annom,closed
   if event == "open" :
     TEAM1=[]
     TEAM2=[]
     closed=0
     annom=1
     npc=self.addSpawn(REGISTER,locr[0],locr[1],locr[2],30000,False,0)
     self.startQuestTimer("close", TIME_FOR_REG*60000, npc, None)
     self.startQuestTimer("announce", ANNOUNCE_INTERVAL*60000, None, None)
     Announcements.getInstance().announceToAll("Opened registration for "+str(NAME)+" event! You can register in "+str(LOC)+".")
   if event == "close":
    res_timer = 1
    self.startQuestTimer("res", RES_TIME*1000, None, None)
    self.startQuestTimer("open", TIME_FOR_WAIT*60000, None, None)
    for nm in TEAM1:
     i=L2World.getInstance().getPlayer(nm)
     if i<>None:
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM1.remove(nm)
     else:
       TEAM1.remove(nm)
    for nm in TEAM2:
     i=L2World.getInstance().getPlayer(nm)
     if i<>None:
      if not i.isOnline() or i.isInOlympiadMode():
       TEAM2.remove(nm)
     else:
       TEAM2.remove(nm)
    while abs(len(TEAM1)-len(TEAM2))>1:
     if len(TEAM1)>len(TEAM2):
      self.saveGlobalQuestVar(str(TEAM1[0].getObjectId()), "team2")
      TEAM2.append(TEAM1[0])
      TEAM1.remove(TEAM1[0])
     else:
      self.saveGlobalQuestVar(str(TEAM2[0].getObjectId()), "team1")
      TEAM1.append(TEAM2[0])
      TEAM2.remove(TEAM2[0])
    if (len(TEAM1)+len(TEAM2))< 2*YCH_MIN :
      npc.deleteMe()
      closed=1
      Announcements.getInstance().announceToAll("Event "+str(NAME)+" was canceled due lack of participation.")
    else:
      closed=1
      Announcements.getInstance().announceToAll("Event "+str(NAME)+" has started!")
      npc.deleteMe()
      npc1=self.addSpawn(BASE1,t1[0],t1[1],t1[2],30000,False,0)
      npc2=self.addSpawn(BASE2,t2[0],t2[1],t2[2],30000,False,0)
      for nm in TEAM1 :
       i=L2World.getInstance().getPlayer(nm)
       if i<>None:
        if i.isOnline() :
         i.stopAllEffects()
         i.setTeam(2)
         i.broadcastStatusUpdate()
         i.broadcastUserInfo()
         i.teleToLocation(t1[0]+100,t1[1],t1[2])
      for nm in TEAM2 :
       i=L2World.getInstance().getPlayer(nm)
       if i<>None:
        if i.isOnline() :
         i.stopAllEffects()
         i.setTeam(1)
         i.broadcastStatusUpdate()
         i.broadcastUserInfo()
         i.teleToLocation(t2[0]+100,t2[1],t2[2])
   if event == "announce" and closed==0 and (TIME_FOR_REG - ANNOUNCE_INTERVAL * annom)>0:
     Announcements.getInstance().announceToAll(str(TIME_FOR_REG - ANNOUNCE_INTERVAL * annom ) + " minutes until event "+str(NAME)+" will start! You can register in "+str(LOC)+". There are "+str(len(TEAM1))+" Dark warriors and "+str(len(TEAM2))+" Heroes of Light.")
     annom=annom+1
     self.startQuestTimer("announce", ANNOUNCE_INTERVAL*60000, None, None)
   if event == "return_1" :
     res_timer = 0
     for nm in TEAM1 :
      i=L2World.getInstance().getPlayer(nm)
      if i<>None:
       if i.isOnline() :
        i.teleToLocation(locr[0],locr[1],locr[2])
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
     for nm in TEAM2 :
      i=L2World.getInstance().getPlayer(nm)
      if i<>None:
       if i.isOnline() :
        i.teleToLocation(locr[0],locr[1],locr[2])
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
     Announcements.getInstance().announceToAll("Event "+str(NAME)+" has ended. "+str(com1)+" win!")
   if event == "return_2" :
     res_timer = 0
     for nm in TEAM1 :
      i=L2World.getInstance().getPlayer(nm)
      if i<>None:
       if i.isOnline() :
        i.teleToLocation(locr[0],locr[1],locr[2])
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
     for nm in TEAM2 :
      i=L2World.getInstance().getPlayer(nm)
      if i<>None:
       if i.isOnline() :
        i.teleToLocation(locr[0],locr[1],locr[2])
        i.setTeam(0)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
     Announcements.getInstance().announceToAll("Event "+str(NAME)+" has ended. "+str(com2)+" win!")
   if event == "exit" :
     if player.getName() in TEAM1:
      TEAM1.remove(player.getName())
     else:
      TEAM2.remove(player.getName())
     return "exit.htm"
   if event == "res" and res_timer==1:
    self.startQuestTimer("res", RES_TIME*1000, None, None)
    for nm in TEAM1:
     i=L2World.getInstance().getPlayer(nm)
     if i<>None:
      if i.isOnline() :
       if i.isDead():
        i.doRevive()
        i.setCurrentCp(i.getMaxCp())
        i.setCurrentHp(i.getMaxHp())
        i.setCurrentMp(i.getMaxMp())
        i.stopAllEffects()
        i.setTeam(0)
        i.setTeam(2)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
        i.teleToLocation(t1[0],t1[1],t1[2])
    for nm in TEAM2:
     i=L2World.getInstance().getPlayer(nm)
     if i<>None:
      if i.isOnline() :
       if i.isDead():
        i.doRevive()
        i.setCurrentCp(i.getMaxCp())
        i.setCurrentHp(i.getMaxHp())
        i.setCurrentMp(i.getMaxMp())
        i.stopAllEffects()
        i.setTeam(0)
        i.setTeam(1)
        i.broadcastStatusUpdate()
        i.broadcastUserInfo()
        i.teleToLocation(t2[0],t2[1],t2[2])
   return

 def onAttack (self,npc,player,damage,isPet):
  npcId = npc.getNpcId()
  if npcId == BASE2 and player.getName() not in TEAM1 :
     player.reduceCurrentHp(99999,player)
  if npcId == BASE1 and player.getName() not in TEAM2 :
     player.reduceCurrentHp(99999,player)
  return   

 def onSkillSee (self,npc,player,skill,targets,isPet) :
     if player.getTarget() == npc and skill.getId() in [1218,1015,1258,1011,1401,58,1217,329]:
      player.setTeam(0)
      player.broadcastStatusUpdate()
      player.broadcastUserInfo()     
      player.teleToLocation(locr[0],locr[1],locr[2])
      if player.getName() in TEAM1 :
       TEAM1.remove(player.getName())
      elif player.getName() in TEAM2 :
       TEAM2.remove(player.getName())
 
 def onKill(self,npc,player,isPet):
  global TEAM1,TEAM2,npc1,npc2,res_timer
  npcId = npc.getNpcId()
  if npcId == BASE1:
   res_timer=0
   self.startQuestTimer("return_2", 10000, None, None) 
   npc2.deleteMe()
   for nm in TEAM2 :
    i=L2World.getInstance().getPlayer(nm)
    if i<>None:
     if i.isOnline() :
      for id, count, chance in REWARD :
       if Rnd.get(100)<=chance :
        i.getQuestState(qn).giveItems(id,count)
  if npcId == BASE2:
   res_timer=0
   self.startQuestTimer("return_1", 10000, None, None)
   npc1.deleteMe()
   for nm in TEAM1 :
    i=L2World.getInstance().getPlayer(nm)
    if i<>None:
     if i.isOnline() :
      for id, count, chance in REWARD :
       if Rnd.get(100)<=chance :
        i.getQuestState(qn).giveItems(id,count)
  return

QUEST = Quest(5556, qn, "Base")

QUEST.addKillId(int(BASE1))
QUEST.addAttackId(int(BASE1))
QUEST.addKillId(int(BASE2))
QUEST.addAttackId(int(BASE2))
QUEST.addStartNpc(int(REGISTER))
QUEST.addTalkId(int(REGISTER))
QUEST.addSkillSeeId(int(BASE1))
QUEST.addSkillSeeId(int(BASE2))