Jump to content
  • 0

Java Code To Village.


Question

Posted

Hello guys.. What i mean with Java Code to Village? I want a code that when i press to Village to teleport me to the main town and not to the nearest location..

 

if you didnt understand me tell me to explain it more.. thank kk bb qq

Recommended Posts

  • 0
Posted

http://pastebin.com/U4x09qs3what to change for frozen version?

Δοκίμασε να περάσεις μία μόνο αυτά..

Θα αρχίσεις από το 1ο "+" μέχρι το τελευταίο. Τα υπόλοιπα είναι για να κάνεις search που να τα βάλεις.

 

L2PcInstance.java

 

    /**
     * Create a new SkillDat object and set the player _currentPetSkill.<br>
     * <br>
     * @param currentSkill
     * @param ctrlPressed
     * @param shiftPressed
     */
+   
    @SuppressWarnings("javadoc")
    public void giveItems(boolean dagger,boolean sagi,boolean mage,boolean duelist,boolean tit,boolean nixas,boolean paladin,boolean FSeeker,boolean dreadnought,boolean HellKnight,boolean swordMuse,boolean dancer)
    {
            final int[] armorIdDagger = {6590,6379,6380,6381,6382,920,858,858,889,889};
            final int[] armorIdSagi = {7577,6379,6380,6381,6382,920,858,858,889,889};
            final int[] armorIdMage = {6608,2407,5767,5779,512,920,858,858,889,889};       
            final int[] armorIdDuelist = {6580,6373,6374,6375,6376,6378,920,858,858,889,889};
            final int[] armorIdTit = {6605,6373,6374,6375,6376,6378,920,858,858,889,889};
            final int[] armorIdNixas = {6604,6379,6380,6381,6382,920,858,858,889,889};
            final int[] armorIdPaladin = {6581,6373,6374,6375,6376,6377,6378,920,858,858,889,889};
            final int[] armorIdFSeeker = {6585,6373,6374,6375,6376,6377,6378,920,858,858,889,889};
            final int[] armorIddreadnought = {6601,6373,6374,6375,6376,6378,920,858,858,889,889};  
            final int[] armorIdhellKnight = {6581,6373,6374,6375,6376,6377,6378,920,858,858,889,889};      
            final int[] armorIdswordMuse = {6581,6379,6380,6381,6382,920,858,858,889,889,6377};                    
            final int[] armorIdDancer = {6580,6379,6380,6381,6382,920,858,858,889,889};

            if(dagger)
            {
            if (armorIdDagger.length == 0)
                    return;
            L2ItemInstance items = null;
            for (int id : armorIdDagger)
            {              
                    getInventory().addItem("Armors", id, 1, this, null);           
                    items = getInventory().getItemByItemId(id);
                    items.updateDatabase();
                    getInventory().equipItemAndRecord(items);
                    getInventory().reloadEquippedItems();  
            this.broadcastCharInfo();
            this.sendPacket(new InventoryUpdate());
            this.sendPacket(new ItemList(this, false));
            this.sendPacket(new StatusUpdate(this));
            }
            }
            else if(sagi)
            {
                    if (armorIdSagi.length == 0)
                            return;
                    L2ItemInstance items = null;
                    for (int id : armorIdSagi)
                    {
                            getInventory().addItem("Armors", id, 1, this, null);           
                            items = getInventory().getItemByItemId(id);
                            items.updateDatabase();
                            getInventory().equipItemAndRecord(items);
                            getInventory().reloadEquippedItems();  
                    this.broadcastCharInfo();
                    this.sendPacket(new InventoryUpdate());
                    this.sendPacket(new ItemList(this, false));
                    this.sendPacket(new StatusUpdate(this));
                    }
            }
            else if(mage)
                    {
                            if (armorIdMage.length == 0)
                                    return;
                            L2ItemInstance items = null;
                            for (int id : armorIdMage)
                            {
                                    getInventory().addItem("Armors", id, 1, this, null);           
                                    items = getInventory().getItemByItemId(id);
                                    items.updateDatabase();
                                    getInventory().equipItemAndRecord(items);
                                    getInventory().reloadEquippedItems();  
                            this.broadcastCharInfo();
                            this.sendPacket(new InventoryUpdate());
                            this.sendPacket(new ItemList(this, false));
                            this.sendPacket(new StatusUpdate(this));                                       
                            }
                    }
            else if(duelist)
                            {
                                    if (armorIdDuelist.length == 0)
                                            return;
                                    L2ItemInstance items = null;
                                    for (int id : armorIdDuelist)
                                    {
                                            getInventory().addItem("Armors", id, 1, this, null);           
                                            items = getInventory().getItemByItemId(id);
                                            items.updateDatabase();
                                            getInventory().equipItemAndRecord(items);
                                            getInventory().reloadEquippedItems();  
                                    this.broadcastCharInfo();
                                    this.sendPacket(new InventoryUpdate());
                                    this.sendPacket(new ItemList(this, false));
                                    this.sendPacket(new StatusUpdate(this));       
                                    }
                            }
            else if(tit)
                                    {
                                            if (armorIdTit.length == 0)
                                                    return;
                                            L2ItemInstance items = null;
                                            for (int id : armorIdTit)
                                            {
                                                    getInventory().addItem("Armors", id, 1, this, null);           
                                                    items = getInventory().getItemByItemId(id);
                                                    items.updateDatabase();
                                                    getInventory().equipItemAndRecord(items);
                                                    getInventory().reloadEquippedItems();  
                                            this.broadcastCharInfo();
                                            this.sendPacket(new InventoryUpdate());
                                            this.sendPacket(new ItemList(this, false));
                                            this.sendPacket(new StatusUpdate(this));                                       
                                            }
                                    }
            else if(nixas)
                                            {
                                                    if (armorIdNixas.length == 0)
                                                            return;
                                                    L2ItemInstance items = null;
                                                    for (int id : armorIdNixas)
                                                    {
                                                            getInventory().addItem("Armors", id, 1, this, null);           
                                                            items = getInventory().getItemByItemId(id);
                                                            items.updateDatabase();
                                                            getInventory().equipItemAndRecord(items);
                                                            getInventory().reloadEquippedItems();  
                                                    this.broadcastCharInfo();
                                                    this.sendPacket(new InventoryUpdate());
                                                    this.sendPacket(new ItemList(this, false));
                                                    this.sendPacket(new StatusUpdate(this));
                                                    }
                                            }
            else if(paladin)
                                                    {
                                                            if (armorIdPaladin.length == 0)
                                                                    return;
                                                            L2ItemInstance items = null;
                                                            for (int id : armorIdPaladin)
                                                            {
                                                                    getInventory().addItem("Armors", id, 1, this, null);           
                                                                    items = getInventory().getItemByItemId(id);
                                                                    items.updateDatabase();
                                                                    getInventory().equipItemAndRecord(items);
                                                                    getInventory().reloadEquippedItems();  
                                                            this.broadcastCharInfo();
                                                            this.sendPacket(new InventoryUpdate());
                                                            this.sendPacket(new ItemList(this, false));
                                                            this.sendPacket(new StatusUpdate(this));
                                                            }                                                      
                                            }
            else if(FSeeker)
            {
                    if (armorIdFSeeker.length == 0)
                            return;
                    L2ItemInstance items = null;
                    for (int id : armorIdFSeeker)
                    {
                            getInventory().addItem("Armors", id, 1, this, null);           
                            items = getInventory().getItemByItemId(id);
                            items.updateDatabase();
                            getInventory().equipItemAndRecord(items);
                            getInventory().reloadEquippedItems();  
                    this.broadcastCharInfo();
                    this.sendPacket(new InventoryUpdate());
                    this.sendPacket(new ItemList(this, false));
                    this.sendPacket(new StatusUpdate(this));
                    }                                                      
    }
            else if(dreadnought)
            {
                    if (armorIddreadnought.length == 0)
                            return;
                    L2ItemInstance items = null;
                    for (int id : armorIddreadnought)
                    {
                            getInventory().addItem("Armors", id, 1, this, null);           
                            items = getInventory().getItemByItemId(id);
                            items.updateDatabase();
                            getInventory().equipItemAndRecord(items);
                            getInventory().reloadEquippedItems();  
                    this.broadcastCharInfo();
                    this.sendPacket(new InventoryUpdate());
                    this.sendPacket(new ItemList(this, false));
                    this.sendPacket(new StatusUpdate(this));
                    }
    }
            else if(HellKnight)
            {
                    if (armorIdhellKnight.length == 0)
                            return;
                    L2ItemInstance items = null;
                    for (int id : armorIdhellKnight)
                    {
                            getInventory().addItem("Armors", id, 1, this, null);           
                            items = getInventory().getItemByItemId(id);
                            items.updateDatabase();
                            getInventory().equipItemAndRecord(items);
                            getInventory().reloadEquippedItems();  
                    this.broadcastCharInfo();
                    this.sendPacket(new InventoryUpdate());
                    this.sendPacket(new ItemList(this, false));
                    this.sendPacket(new StatusUpdate(this));
                    }
    }
            else if(swordMuse)
            {
            if (armorIdswordMuse.length == 0)
                    return;
            L2ItemInstance items = null;
            for (int id : armorIdswordMuse)
            {              
                    getInventory().addItem("Armors", id, 1, this, null);           
                    items = getInventory().getItemByItemId(id);
                    items.updateDatabase();
                    getInventory().equipItemAndRecord(items);
                    getInventory().reloadEquippedItems();  
            this.broadcastCharInfo();
            this.sendPacket(new InventoryUpdate());
            this.sendPacket(new ItemList(this, false));
            this.sendPacket(new StatusUpdate(this));
            }
            }
            else if(dancer)
            {
            if (armorIdDancer.length == 0)
                    return;
            L2ItemInstance items = null;
            for (int id : armorIdDancer)
            {              
                    getInventory().addItem("Armors", id, 1, this, null);           
                    items = getInventory().getItemByItemId(id);
                    items.updateDatabase();
                    getInventory().equipItemAndRecord(items);
                    getInventory().reloadEquippedItems();  
            this.broadcastCharInfo();
            this.sendPacket(new InventoryUpdate());
            this.sendPacket(new ItemList(this, false));
            this.sendPacket(new StatusUpdate(this));
            }
            }
}
    
    
    /**
     *
     */
    private void broadcastCharInfo()
    {        
+    }
    public void setCurrentPetSkill(final L2Skill currentSkill, final boolean ctrlPressed, final boolean shiftPressed)

 

 

Και εδώ το ίδιο... από το πρώτο "+".

 

L2ClassMasterInstance.java

 

    /** The _instance. */
    private static L2ClassMasterInstance _instance;
+    private int newJobLevel;
 
            player.setBaseClass(classId);
            
+            if(newJobLevel == 3  && !player.isSubClassActive())
+                autoEquip(player);
            
            // player.setBaseClass(player.getActiveClass());
 
 
        html.setHtml(sb.toString());
        player.sendPacket(html);
        html = null;
        sb = null;
        return;
    }
+
    private static void autoEquip(final L2PcInstance player)
    {
            final ClassId HDagger =ClassId.adventurer;
            final ClassId Sagi =ClassId.sagittarius;
            final ClassId Duelist =ClassId.duelist;
            final ClassId Tit =ClassId.titan;
            final ClassId Nixas =ClassId.grandKhauatari;
            final ClassId Paladin =ClassId.phoenixKnight;
            final ClassId MSentinel =ClassId.moonlightSentinel;
            final ClassId FSeeker =ClassId.fortuneSeeker;
            final ClassId Maestro =ClassId.maestro;
            final ClassId dreadnought =ClassId.dreadnought;
            final ClassId hellKnight =ClassId.hellKnight;
            final ClassId evaTemplar =ClassId.evaTemplar;
            final ClassId swordMuse =ClassId.swordMuse;
            final ClassId windRider =ClassId.windRider;
            final ClassId shillienTemplar =ClassId.shillienTemplar;
            final ClassId spectralDancer =ClassId.spectralDancer;
            final ClassId ghostHunter =ClassId.ghostHunter;
            final ClassId ghostSentinel =ClassId.ghostSentinel;
           
            if(player.getClassId().equals(HDagger))
                    player.giveItems(true,false,false,false,false,false,false,false,false,false,false,false);
                   
            else if(player.getClassId().equals(Sagi))
                    player.giveItems(false,true,false,false,false,false,false,false,false,false,false,false);
                   
            else if(player.getClassId().isMage())
                    player.giveItems(false,false,true,false,false,false,false,false,false,false,false,false);
           
            else if(player.getClassId().equals(Duelist))
                    player.giveItems(false,false,false,true,false,false,false,false,false,false,false,false);
           
            else if(player.getClassId().equals(Tit))
                    player.giveItems(false,false,false,false,true,false,false,false,false,false,false,false);
           
            else if(player.getClassId().equals(Nixas))
                    player.giveItems(false,false,false,false,false,true,false,false,false,false,false,false);
           
            else if(player.getClassId().equals(Paladin))
                    player.giveItems(false,false,false,false,false,false,true,false,false,false,false,false);
           
            else if(player.getClassId().equals(MSentinel))
                    player.giveItems(false,true,false,false,false,false,false,false,false,false,false,false);
           
            else if(player.getClassId().equals(FSeeker))
                    player.giveItems(false,false,false,false,false,false,false,true,false,false,false,false);
           
            else if(player.getClassId().equals(Maestro))
                    player.giveItems(false,false,false,false,false,false,false,true,false,false,false,false);
           
            else if(player.getClassId().equals(dreadnought))
                    player.giveItems(false,false,false,false,false,false,false,false,true,false,false,false);
           
            else if(player.getClassId().equals(hellKnight))
                    player.giveItems(false,false,false,false,false,false,false,false,false,true,false,false);
           
            else if(player.getClassId().equals(evaTemplar))
                    player.giveItems(false,false,false,false,false,false,false,false,false,true,false,false);
           
            else if(player.getClassId().equals(swordMuse))                 
                    player.giveItems(false,false,false,false,false,false,false,false,false,false,true,false);
           
            else if(player.getClassId().equals(windRider))                 
                    player.giveItems(true,false,false,false,false,false,false,false,false,false,false,false);
           
            else if(player.getClassId().equals(shillienTemplar))
                    player.giveItems(false,false,false,false,false,false,false,true,false,false,false,false);
                           
            else if(player.getClassId().equals(spectralDancer))
                    player.giveItems(false,false,false,false,false,false,false,false,false,false,false,true);
           
            else if(player.getClassId().equals(ghostHunter))
                    player.giveItems(true,false,false,false,false,false,false,false,false,false,false,false);
           
            else if(player.getClassId().equals(ghostSentinel))
                    player.giveItems(false,true,false,false,false,false,false,false,false,false,false,false);
           
+    }
  • 0
Posted

No..

 

 

 

    Index: java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java

    ===================================================================

    --- java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java    (revision 4422)

    +++ java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java    (working copy)

    @@ -178,7 +178,8 @@

                        break;

                       

                    default:

    -                   loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);

    +                   loc = new Location(X, Y, Z);

                        break;

                }

               

 

  • 0
Posted (edited)

thats the problem now at eclipse.. what can i do?? need at L2PcInstance a method. but how to do it??

You added it in the wrong place, no need at L2PcInstance, just scroll down and add this method.

 

P.S. autoequip code is really hardcoded.

P.S.S. If you use autoequip in this class, delete static.

Edited by numl0ckas
  • 0
Posted (edited)

You added it in the wrong place, no need at L2PcInstance, just scroll down and add this method.

 

P.S. autoequip code is really hardcoded.

P.S.S. If you use autoequip in this class, delete static.

what you mean?? can you explain me more??

 

+ ayami's code for the To Village button didnt work.. anyone gives me an idea??

Edited by Nosti21
  • 0
Posted (edited)

what you mean?? can you explain me more??

 

+ ayami's code for the To Village button didnt work.. anyone gives me an idea??

You have give a try in the code i give you before? ( the second post on page 2).

 

 

give a try here

 

RequestRestartPoint.Java


default:
if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)
            {
             loc = new Location(17836, 170178, -3507);// Floran Village
             break;
            }
-      loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
-      break;
-    }
+            loc = new Location(Config.LOCX, Config.LOCY, Config.LOCZ);// Respawn Village          
+            break;
+          }

Config.java

public static boolean NEW_PLAYER_EFFECT;
+
+// Custom respawn after die.
+public static int LOCX;
+public static int LOCY;
+public static int LOCZ;
 
 
NEW_PLAYER_EFFECT = Boolean.parseBoolean(frozenSettings.getProperty("NewPlayerEffect", "True"));
+ 
+   // Custom respawn after die
+   LOCX = Integer.parseInt(frozenSettings.getProperty("LocationX", "put a loc here"));
+   LOCY = Integer.parseInt(frozenSettings.getProperty("LocationY", "put a loc here"));
+   LOCZ = Integer.parseInt(frozenSettings.getProperty("LocationZ", "put a loc here"));

frozen.properties

# New players get fireworks the first time they log in
# Default: False
NewPlayerEffect = False
+
+ # Custom respawn for dead players
+ LocationX = put a loc here
+ LocationY = put a loc here
+ LocationZ = put a loc here
Edited by 'Baggos'
  • 0
Posted

 

You have give a try in the code i give you before? ( the second post on page 2).

 

 

give a try here

 

RequestRestartPoint.Java

- default:
-      if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)
-      {
-       loc = new Location(17836, 170178, -3507);// Floran Village
-       break;
-      }
-      loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
-      break;
-    }
 
+ default:
+      if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN && Config.CUSTOM_RESPAWN)
+      {
+       loc = new Location(17836, 170178, -3507);// Floran Village
+       loc = new Location(Config.LOCX, Config.LOCY, Config.LOCZ);// Respawn Village
+       break;
+      }
+    }

Config.java

public static boolean NEW_PLAYER_EFFECT;
+
+// Custom respawn after death.
+public static boolean CUSTOM_RESPAWN;
+public static int LOCX;
+public static int LOCY;
+public static int LOCZ;
 
 
NEW_PLAYER_EFFECT = Boolean.parseBoolean(frozenSettings.getProperty("NewPlayerEffect", "True"));
+ 
+   // Custom respawn after dead
+   CUSTOM_RESPAWN = Boolean.parseBoolean(frozenSettings.getProperty("CustomRespawnEnable", "True"));
+   LOCX = Integer.parseInt(frozenSettings.getProperty("LocationX", "put a loc here"));
+   LOCY = Integer.parseInt(frozenSettings.getProperty("LocationY", "put a loc here"));
+   LOCZ = Integer.parseInt(frozenSettings.getProperty("LocationZ", "put a loc here"));

 

 

That will work with Karma Baggos ... -.-

  • 0
Posted

That will work with Karma Baggos ... -.-

oh yes.. you have right... where is my mind...

 

then i hope with this

 

default:

      if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)

      {

       loc = new Location(17836, 170178, -3507);// Floran Village

      }

+    

+      if (Config.CUSTOM_RESPAWN)

+       loc = new Location(Config.LOCX, Config.LOCY, Config.LOCZ);// Respawn Village

+       break;

+      }

 

or just like that. (without to put Enable config).

 

default:

      if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)

      {

       loc = new Location(17836, 170178, -3507);// Floran Village

+     loc = new Location(Config.LOCX, Config.LOCY, Config.LOCZ);// Respawn Village

      }

  • 0
Posted

oh yes.. you have right... where is my mind...

 

then i hope with this

 

default:

      if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)

      {

       loc = new Location(17836, 170178, -3507);// Floran Village

      }

+    

+      if (Config.CUSTOM_RESPAWN)

+       loc = new Location(Config.LOCX, Config.LOCY, Config.LOCZ);// Respawn Village

+       break;

+      }

 

or just like that. (without to put Enable config).

 

default:

      if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)

      {

       loc = new Location(17836, 170178, -3507);// Floran Village

+     loc = new Location(Config.LOCX, Config.LOCY, Config.LOCZ);// Respawn Village

      }

Just stop and read the code...

  • 0
Posted (edited)

Just stop and read the code...

 

Yeah Baggos... you do the same mistake again :P

And if you want to make it with config..

if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)
{
loc = new Location(17836, 170178, -3507);// Floran Village
break;
}
+ if(Config.CUSTOM_RESPAWN)
+ {
+ loc = new Location(Config.RESPAWN_X, Config.RESPAWN_Y, Config.RESPAWN_Z);
+ }
loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
break;	

/For Topic...

 

http://www.maxcheaters.com/topic/180110-respawn-location-after-death/?hl=respawn

Edited by activeChar.getAdena()
  • 0
Posted

Just stop and read the code...

Tessa if you look over, the 've changed.

i typed two times the same mistake, making copy/paste from the old.

 

default:

      if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)

      {

       loc = new Location(17836, 170178, -3507);// Floran Village

       break;

      }

-      loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);

+       loc = new Location(Config.LOCX, Config.LOCY, Config.LOCZ);// Respawn Village After Die

      break;

    }

Guest
This topic is now closed to further replies.



  • Posts

    • what pack you use  send me on discord for it
    • package custom.events.RandomZoneEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.ScheduledFuture; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.time.SchedulingPattern; import org.l2jmobius.commons.time.TimeUtil; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.managers.ZoneManager; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.quest.Event; import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneType; import org.l2jmobius.gameserver.model.zone.type.RandomZone; import org.l2jmobius.gameserver.util.Broadcast; /** * Random Zone Event - Activates one random PvP zone temporarily. No modifica la clase de la zona: usa flags PvP en runtime. * @author Juan */ public class RandomZoneEvent extends Event { private static final String CONFIG_FILE = "data/scripts/custom/events/RandomZoneEvent/config.xml"; private static int EVENT_DURATION_MINUTES = 15; private static boolean _isActive = false; private ScheduledFuture<?> _eventTask = null; private final List<ZoneType> _availableZones = new ArrayList<>(); private ZoneType _activeZone = null; public RandomZoneEvent() { loadConfig(); loadZones(); registerZoneListeners(); } /** * Registra listeners a TODAS LAS ZONAS random */ private void registerZoneListeners() { for (ZoneType zone : _availableZones) { addEnterZoneId(zone.getId()); addExitZoneId(zone.getId()); LOGGER.info("[RandomZoneEvent] Registered listener for zone: " + zone.getName()); } } private void loadConfig() { new IXmlReader() { @Override public void load() { parseDatapackFile(CONFIG_FILE); } @Override public void parseDocument(Document doc, File file) { forEach(doc, "event", eventNode -> { final StatSet att = new StatSet(parseAttributes(eventNode)); final String name = att.getString("name"); for (Node node = eventNode.getFirstChild(); node != null; node = node.getNextSibling()) { if ("schedule".equals(node.getNodeName())) { final StatSet attributes = new StatSet(parseAttributes(node)); final String pattern = attributes.getString("pattern"); final SchedulingPattern schedulingPattern = new SchedulingPattern(pattern); final StatSet params = new StatSet(); params.set("Name", name); params.set("SchedulingPattern", pattern); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer("Schedule_" + name, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Event " + name + " scheduled at " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } }); } }.load(); } private void loadZones() { for (ZoneType zone : ZoneManager.getInstance().getAllZones(RandomZone.class)) { if ((zone.getName() != null) && zone.getName().toLowerCase().startsWith("random_zone")) { _availableZones.add(zone); LOGGER.info("[RandomZoneEvent] Loaded zone: " + zone.getName() + " (id=" + zone.getId() + ")"); } } LOGGER.info("[RandomZoneEvent] Total random zones loaded: " + _availableZones.size()); } @Override public void onTimerEvent(String event, StatSet params, Npc npc, Player player) { if (event.startsWith("Schedule_")) { eventStart(null); final SchedulingPattern schedulingPattern = new SchedulingPattern(params.getString("SchedulingPattern")); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer(event, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Rescheduled for " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } @Override public boolean eventStart(Player eventMaker) { if (_isActive) { if (eventMaker != null) { eventMaker.sendMessage("RandomZoneEvent already active."); } return false; } if (_availableZones.isEmpty()) { Broadcast.toAllOnlinePlayers("[RandomZoneEvent] No zones configured."); return false; } _isActive = true; Broadcast.toAllOnlinePlayers("⚔️ Random Zone Event has started!"); _eventTask = ThreadPool.schedule(this::activateRandomZone, 5_000); return true; } private void activateRandomZone() { _activeZone = _availableZones.get(new Random().nextInt(_availableZones.size())); _activeZone.setEnabled(true); Broadcast.toAllOnlinePlayers("🔥 Random Zone Event: " + _activeZone.getName() + " is now PvP for " + EVENT_DURATION_MINUTES + " minutes!"); _eventTask = ThreadPool.schedule(this::eventStop, EVENT_DURATION_MINUTES * 60 * 1000L); } @Override public boolean eventStop() { if (!_isActive) { return false; } _isActive = false; if (_eventTask != null) { _eventTask.cancel(true); _eventTask = null; } if (_activeZone != null) { _activeZone.setEnabled(false); Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended. " + _activeZone.getName() + " is back to normal."); _activeZone = null; } else { Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended."); } return true; } @Override public void onEnterZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, true); if (creature.isPlayer()) { creature.sendMessage("Esta zona está en modo PvP temporalmente."); } } } @Override public void onExitZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, false); if (creature.isPlayer()) { creature.sendMessage("Abandonaste la zona PvP temporal."); } } } @Override public boolean eventBypass(Player player, String bypass) { return true; } @Override public String onEvent(String event, Npc npc, Player player) { return super.onEvent(event, npc, player); } @Override public String onFirstTalk(Npc npc, Player player) { return null; } public static void main(String[] args) { new RandomZoneEvent(); } } i have this but its not working
    • ZonePvPSpawnBossRadio=0 ZonePvPSpawnBossBarakiel=0 at the Customs.ini in L2Server folder. Im prety sure this is it because i had the same problem with you in cruma 1 floor for example and i couldn't fix it but i fixed it finally by changing these 2 lines
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock