Evento Dimensional

Iniciado por Swarlog, Jun 29, 2025, 12:12 AM

Tema anterior - Siguiente tema

Swarlog


CitarCORE:

### Eclipse Workspace Patch 1.0
#P L2j_Pirama
Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandlers/Dimension.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/VoicedCommandHandlers/Dimension.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandlers/Dimension.java    (working copy)
@@ -0,0 +1,63 @@
+package net.sf.l2j.gameserver.handler.VoicedCommandHandlers;
+
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+public class Dimension implements IVoicedCommandHandler
+{
+    private static String[] _voicedCommands =
+    {
+        "exit",
+        "tele1",
+        "tele2",
+        "tele3"
+    };
+   
+    @Override
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+    {
+        if (command.equalsIgnoreCase("exit"))
+        {
+            activeChar.setDimensionId(1);
+            if (activeChar.getPet() != null)
+            {
+                activeChar.getPet().setDimensionId(activeChar.getDimensionId());
+            }
+            activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0);
+        }
+        if (command.equalsIgnoreCase("tele1"))
+        {
+            activeChar.setDimensionId(2);
+            if (activeChar.getPet() != null)
+            {
+                activeChar.getPet().setDimensionId(activeChar.getDimensionId());
+            }
+            activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0);
+        }
+        if (command.equalsIgnoreCase("tele2"))
+        {
+            activeChar.setDimensionId(3);
+            if (activeChar.getPet() != null)
+            {
+                activeChar.getPet().setDimensionId(activeChar.getDimensionId());
+            }
+            activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0);
+        }
+        if (command.equalsIgnoreCase("tele3"))
+        {
+            activeChar.setDimensionId(-1);
+            if (activeChar.getPet() != null)
+            {
+                activeChar.getPet().setDimensionId(activeChar.getDimensionId());
+            }
+            activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0);
+        }
+        return true;
+    }
+   
+    @Override
+    public String[] getVoicedCommandList()
+    {
+        return _voicedCommands;
+    }
+}
Index: java/net/sf/l2j/gameserver/model/entity/L2Dimension.java
===================================================================
--- java/net/sf/l2j/gameserver/model/entity/L2Dimension.java    (revision 0)
+++ java/net/sf/l2j/gameserver/model/entity/L2Dimension.java    (working copy)
@@ -0,0 +1,101 @@
+/*
+ * 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.entity;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ai.CtrlIntention;
+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.model.L2Object;
+import net.sf.l2j.gameserver.model.L2Spawn;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+
+public final class L2Dimension
+{
+    public final static int ItemId = Config.Item_Id_1; // ID of the item needed
+    public final static int ItemCount = Config.Item_Count_1; // Amount of it
+    public final static String ItemName = ItemTable.getInstance().getTemplate(Config.Item_Id_1).getName(); // name displayed
+   
+    public static void teleportCharacter(L2PcInstance player, int x, int y, int z)
+    {
+        if (player.getPet() != null)
+        {
+            player.getPet().setDimensionId(player.getParty().getLeader().getObjectId());
+        }
+        player.setDimensionId(player.getParty().getLeader().getObjectId());
+        player.getAI().setIntention(CtrlIntention.IDLE);
+        player.teleToLocation(Config.Char_Tele_x, Config.Char_Tele_y, Config.Char_Tele_z, 10);
+        player.sendMessage("Your Party Teleport to Dimension " + player.getDimensionId() + " !!! ");
+    }
+   
+    public static void teleportCharacterBack(L2PcInstance player, int x, int y, int z)
+    {
+        if (player.getPet() != null)
+        {
+            player.getPet().setDimensionId(1);
+        }
+        player.setDimensionId(1);
+        player.getAI().setIntention(CtrlIntention.IDLE);
+        player.teleToLocation(Config.Back_Char_Tele_x, Config.Back_Char_Tele_y, Config.Back_Char_Tele_z, 10);
+        player.sendMessage("Your Party Teleport Back to Word !!! ");
+    }
+   
+    public static void spawn(L2PcInstance activeChar, String monsterId, int respawnTime, boolean permanent)
+    {
+        L2Object target = activeChar.getTarget();
+        if (target == null)
+            target = activeChar;
+       
+        NpcTemplate template;
+       
+        if (monsterId.matches("[0-9]*")) // First parameter was an ID number
+            template = NpcTable.getInstance().getTemplate(Integer.parseInt(monsterId));
+        else
+        // First parameter wasn't just numbers, so go by name not ID
+        {
+            monsterId = monsterId.replace('_', ' ');
+            template = NpcTable.getInstance().getTemplateByName(monsterId);
+        }
+       
+        try
+        {
+            L2Spawn spawn = new L2Spawn(template);
+            spawn.setDimensionId(activeChar.getObjectId());
+            spawn.setLocx(Config.Mob_Tele_x);
+            spawn.setLocy(Config.Mob_Tele_y);
+            spawn.setLocz(Config.Mob_Tele_z);
+            spawn.setHeading(activeChar.getHeading());
+            spawn.setRespawnDelay(respawnTime);
+           
+            {
+                SpawnTable.getInstance().addNewSpawn(spawn, permanent);
+                spawn.init();
+            }
+           
+            if (!permanent)
+                spawn.stopRespawn();
+           
+            activeChar.sendMessage("Spawned " + template.getName() + ".");
+           
+        }
+        catch (Exception e)
+        {
+            activeChar.sendPacket(SystemMessageId.APPLICANT_INFORMATION_INCORRECT);
+        }
+    }
+}
Index: java/net/sf/l2j/gameserver/model/L2Party.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Party.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/L2Party.java    (working copy)
@@ -428,6 +428,12 @@
         if (isInCommandChannel())
             player.sendPacket(ExCloseMPCC.STATIC_PACKET);
        
+        if (player.getDimensionId() > 50)
+        {
+            player.setDimensionId(1);
+            player.teleToLocation(player.getX(), player.getY(), player.getZ(), 0);
+        }
+       
         if (isLeader && _members.size() > 1 && (Config.ALT_LEAVE_PARTY_LEADER || type == MessageType.Disconnected))
             broadcastToPartyMembersNewLeader();
         else if (_members.size() == 1)
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java    (revision 63)
+++ 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.L2Dimension;
 import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
@@ -162,6 +163,7 @@
                 if (heroid > 0)
                     Hero.getInstance().showHeroDiary(activeChar, heroclass, heroid, heropage);
             }
+           
             else if (_command.startsWith("arenachange")) // change
             {
                 final boolean isManager = activeChar.getCurrentFolkNPC() instanceof L2OlympiadManagerInstance;
@@ -181,10 +183,77 @@
                 final int arenaId = Integer.parseInt(_command.substring(12).trim());
                 activeChar.enterOlympiadObserverMode(arenaId);
             }
+           
+            else if (_command.startsWith("dimension"))
+            {
+                try
+                {
+                    String value = _command.substring(9);
+                    StringTokenizer s = new StringTokenizer(value, " ");
+                    String id = s.nextToken();
+                   
+                    if (activeChar.getParty() == null)
+                    {
+                        activeChar.sendMessage("You are not in a party.");
+                        return;
+                    }
+                   
+                    if (activeChar.getParty().getLeader() != activeChar)
+                    {
+                        activeChar.sendMessage("Only your party leader can back your party.");
+                        return;
+                    }
+                    if (activeChar.getInventory().getItemByItemId(Config.Item_Id_1) == null)
+                    {
+                        activeChar.sendMessage("Not enough "+ L2Dimension.ItemName +" .");
+                        return;
+                    }
+                    if ((activeChar.getInventory().getItemByItemId(Config.Item_Id_1).getCount() == Config.Item_Count_1) || (activeChar.getInventory().getItemByItemId(Config.Item_Id_1).getCount() >= Config.Item_Count_1))
+                    {
+                        if (Config.Destroy_Item)
+                        {
+                        activeChar.destroyItemByItemId("", L2Dimension.ItemId, Config.Item_Count_1, activeChar, true);
+                        activeChar.sendMessage("Destroy " + L2Dimension.ItemCount + "  " + L2Dimension.ItemName + " for Teleport.");
+                        activeChar.broadcastUserInfo();
+                        }
+                    }
+                    else
+                    {
+                        activeChar.sendMessage("Not enough "+ L2Dimension.ItemName +" "+ L2Dimension.ItemCount +" .");
+                        return;
+                    }
+                   
+                    for (L2PcInstance pm : activeChar.getParty().getPartyMembers())
+                        L2Dimension.teleportCharacter(pm, activeChar.getX(), activeChar.getY(), activeChar.getZ());
+                   
+                    L2Dimension.spawn(activeChar, id, 0, false);
+                }
+                catch (Exception e)
+                {
+                    _log.log(Level.WARNING, "Bad RequestBypassToServer: dimension ", e);
+                }
+            }
+            else if (_command.startsWith("dimensionback"))
+            {
+                if (activeChar.getParty() == null)
+                {
+                    activeChar.sendMessage("You are not in a party.");
+                   
+                }
+               
+                if (activeChar.getParty().getLeader() != activeChar)
+                {
+                    activeChar.sendMessage("Only your party leader can back your party.");
+                   
+                }
+                for (L2PcInstance pm : activeChar.getParty().getPartyMembers())
+                    L2Dimension.teleportCharacterBack(pm, activeChar.getX(), activeChar.getY(), activeChar.getZ());
+               
+            }
         }
         catch (Exception e)
         {
-            _log.log(Level.WARNING, "Bad RequestBypassToServer: ", e);
+            _log.log(Level.WARNING, "Bad RequestBypassToServer: dimensionback", e);
         }
     }
    
Index: java/net/sf/l2j/gameserver/datatables/SpawnTable.java
===================================================================
--- java/net/sf/l2j/gameserver/datatables/SpawnTable.java    (revision 63)
+++ java/net/sf/l2j/gameserver/datatables/SpawnTable.java    (working copy)
@@ -94,6 +94,11 @@
                         spawnDat.setRespawnDelay(rset.getInt("respawn_delay"));
                         spawnDat.setRandomRespawnDelay(rset.getInt("respawn_rand"));
                        
+                        if (rset.getInt("dimensionid") == 1)
+                            spawnDat.setDimensionId(1);
+                        else
+                            spawnDat.setDimensionId(rset.getInt("dimensionid"));
+                       
                         switch (rset.getInt("periodOfDay"))
                         {
                             case 0: // default
@@ -137,13 +142,14 @@
         {
             try (Connection con = L2DatabaseFactory.getInstance().getConnection())
             {
-                PreparedStatement statement = con.prepareStatement("INSERT INTO spawnlist (npc_templateid,locx,locy,locz,heading,respawn_delay) values(?,?,?,?,?,?)");
+                PreparedStatement statement = con.prepareStatement("INSERT INTO spawnlist (npc_templateid,locx,locy,locz,heading,respawn_delay,dimensionid) values(?,?,?,?,?,?,?)");
                 statement.setInt(1, spawn.getNpcId());
                 statement.setInt(2, spawn.getLocx());
                 statement.setInt(3, spawn.getLocy());
                 statement.setInt(4, spawn.getLocz());
                 statement.setInt(5, spawn.getHeading());
                 statement.setInt(6, spawn.getRespawnDelay() / 1000);
+                statement.setInt(7, spawn.getDimensionId());
                 statement.execute();
                 statement.close();
             }
Index: java/net/sf/l2j/gameserver/model/L2Skill.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Skill.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/L2Skill.java    (working copy)
@@ -1571,6 +1571,12 @@
                        
                         if (addSummon(activeChar, partyMember, radius, false))
                             targetList.add(partyMember.getPet());
+                   
+                        if (activeChar.getDimensionId() != partyMember.getDimensionId())
+                        {
+                            activeChar.sendMessage("Your Party is is another Dimension !");
+                            player.leaveParty();
+                        }
                     }
                 }
                 return targetList.toArray(new L2Character[targetList.size()]);
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java    (revision 63)
+++ java/net/sf/l2j/Config.java    (working copy)
@@ -51,11 +51,40 @@
     public static final String PLAYERS_FILE = "./config/players.properties";
     public static final String SERVER_FILE = "./config/server.properties";
     public static final String SIEGE_FILE = "./config/siege.properties";
+    public static final String DIMENSION_FILE = "./config/dimension.properties";
    
     // --------------------------------------------------
     // Clans settings
     // --------------------------------------------------
+    public static boolean Destroy_Item;
+    public static int Item_Id_1;
+    public static int Item_Count_1;
    
+    public static int Char_Tele_x;
+    public static int Char_Tele_y;
+    public static int Char_Tele_z;
+   
+    public static int Back_Char_Tele_x;
+    public static int Back_Char_Tele_y;
+    public static int Back_Char_Tele_z;
+   
+    public static int Mob_Tele_x;
+    public static int Mob_Tele_y;
+    public static int Mob_Tele_z;
+   
+    public static boolean REWARD_PARTY;
+    public static boolean REWARD_NOBLE;
+    public static boolean REWARD_HERO;
+    public static int REWARD_HERO_DAYS;
+   
+    public static boolean REWARD_SKILL;
+    public static int REWARD_SKILL_ID;
+    public static int REWARD_SKILL_LVL;
+   
+    public static boolean REWARD_ITEMS;
+    public static int REWARD_ITEM_ID;
+    public static int REWARD_ITEM_COUNT;
+   
     /** Clans */
     public static int ALT_CLAN_JOIN_DAYS;
     public static int ALT_CLAN_CREATE_DAYS;
@@ -688,6 +717,38 @@
         {
             _log.info("Loading gameserver configuration files.");
            
+           
+            ExProperties dimension = load(DIMENSION_FILE);
+           
+            Destroy_Item = dimension.getProperty("DestroyItem", true);
+            Item_Id_1 = dimension.getProperty("ItemId1", 57);
+            Item_Count_1 = dimension.getProperty("ItemCount1", 10);
+           
+            Char_Tele_x = dimension.getProperty("CharTelex", 83256);
+            Char_Tele_y = dimension.getProperty("CharTeley", 148634);
+            Char_Tele_z = dimension.getProperty("CharTelez", -3409);
+                       
+            Back_Char_Tele_x = dimension.getProperty("BackCharTelex", 83597);
+            Back_Char_Tele_y = dimension.getProperty("BackCharTeley", 147888);
+            Back_Char_Tele_z = dimension.getProperty("BackCharTelez", -3405);
+           
+            Mob_Tele_x = dimension.getProperty("MobTelex", 82646);
+            Mob_Tele_y = dimension.getProperty("MobTeley", 148613);
+            Mob_Tele_z = dimension.getProperty("MobTelez", -3473);
+           
+            REWARD_PARTY = dimension.getProperty("RewardParty", false);
+            REWARD_NOBLE = dimension.getProperty("RewardNoble", false);
+            REWARD_HERO = dimension.getProperty("RewardHero", false);
+            REWARD_HERO_DAYS = dimension.getProperty("RewardHeroDays", 0);
+           
+            REWARD_SKILL = dimension.getProperty("RewardSkill", false);
+            REWARD_SKILL_ID = dimension.getProperty("RewardSillId", 0);
+            REWARD_SKILL_LVL = dimension.getProperty("RewardSkillLvl", 0);
+           
+            REWARD_ITEMS = dimension.getProperty("RewardItem", true);
+            REWARD_ITEM_ID = dimension.getProperty("RewardItemId", 57);
+            REWARD_ITEM_COUNT = dimension.getProperty("RewardItemCound", 1000);
+           
             // Clans settings
             ExProperties clans = load(CLANS_FILE);
             ALT_CLAN_JOIN_DAYS = clans.getProperty("DaysBeforeJoinAClan", 5);
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java    (revision 63)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSpawn.java    (working copy)
@@ -263,6 +263,7 @@
             spawn.setLocx(target.getX());
             spawn.setLocy(target.getY());
             spawn.setLocz(target.getZ());
+            spawn.setDimensionId(activeChar.getDimensionId());
             spawn.setHeading(activeChar.getHeading());
             spawn.setRespawnDelay(respawnTime);
            
Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java    (revision 63)
+++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java    (working copy)
@@ -87,7 +87,7 @@
                 for (L2PcInstance player : plrs)
                 {
                    
-                    if (player != null && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
+                    if (player != null && player.getDimensionId() == activeChar.getDimensionId() && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
                         player.sendPacket(cs);
                 }
             }
Index: java/net/sf/l2j/gameserver/model/actor/L2Summon.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/L2Summon.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/actor/L2Summon.java    (working copy)
@@ -91,6 +91,8 @@
     {
         super(objectId, template);
        
+        setDimensionId(owner.getDimensionId());
+       
         _showSummonAnimation = true;
         _owner = owner;
         _ai = new L2SummonAI(new AIAccessor());
Index: config/dimension.properties
===================================================================
--- config/dimension.properties    (revision 0)
+++ config/dimension.properties    (working copy)
@@ -0,0 +1,55 @@
+#========================================================
+#                        Dimension                        #
+#========================================================
+DestroyItem = true
+
+ItemId1 = 57
+ItemCount1 = 10
+
+#poy na kani teleport ton Char
+
+CharTelex = 83256
+CharTeley = 148634
+CharTelez = -3409
+
+#otan skotosi to mod se pio simio na girisi o char
+
+BackCharTelex = 83597
+BackCharTeley = 147888
+BackCharTelez = -3405
+
+#se pio simio na kani spawn to mod
+
+MobTelex = 82646
+MobTeley = 148613
+MobTelez = -3473
+
+# Reward party ?
+RewardParty = false
+
+# Give Noblesse ?
+RewardNoble = false
+
+# Give Hero ?
+RewardHero = false
+
+# How many days to give the status of Hero ?  0 - Until relogin. -1 - Forever.
+RewardHeroDays = 0
+
+# Give Skill ?
+RewardSkill = false
+
+# Skill's ID.
+RewardSillId = 0
+
+# Skill's LvL.
+RewardSkillLvl = 0
+
+# Give Items ?
+RewardItem = false
+
+# Item's ID.
+RewardItemId = 57
+
+# Item's Count.
+RewardItemCound = 1000
Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (revision 63)
+++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java    (working copy)
@@ -24,7 +24,7 @@
 import javolution.util.FastMap;
 
 import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.VoicedCommandHandlers.Dimension;
 
 public class VoicedCommandHandler
 {
@@ -48,7 +48,7 @@
         _datatable = new FastMap<>();
        
 
+        registerVoicedCommandHandler(new Dimension());
        
     }
    
Index: java/net/sf/l2j/gameserver/network/clientpackets/Action.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/Action.java    (revision 63)
+++ java/net/sf/l2j/gameserver/network/clientpackets/Action.java    (working copy)
@@ -64,6 +64,12 @@
             return;
         }
        
+        if (obj.getDimensionId() != activeChar.getDimensionId())
+        {
+            activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+            return;
+        }
+       
         switch (_actionId)
         {
             case 0:
Index: java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java    (working copy)
@@ -946,6 +946,15 @@
         {
             assert _itm.getPosition().getWorldRegion() == null;
            
+            if (_dropper != null)
+            {
+                setDimensionId(_dropper.getDimensionId());
+            }
+            else
+            {
+                setDimensionId(1);
+            }
+           
             if (Config.GEODATA > 0 && _dropper != null)
             {
                 Location dropDest = PathFinding.getInstance().canMoveToTargetLoc(_dropper.getX(), _dropper.getY(), _dropper.getZ(), _x, _y, _z);
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTeleport.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTeleport.java    (revision 63)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTeleport.java    (working copy)
@@ -92,7 +92,7 @@
                     activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
                     return false;
                 }
-               
+                player.setDimensionId(activeChar.getDimensionId());
                 teleportCharacter(player, activeChar.getX(), activeChar.getY(), activeChar.getZ());
             }
             catch (StringIndexOutOfBoundsException e)
@@ -250,7 +250,7 @@
             int x = target.getX();
             int y = target.getY();
             int z = target.getZ();
-           
+            activeChar.setDimensionId(target.getDimensionId());
             activeChar.getAI().setIntention(CtrlIntention.IDLE);
             activeChar.teleToLocation(x, y, z, 0);
             activeChar.sendMessage("You have teleported to " + target.getName() + ".");
Index: java/net/sf/l2j/gameserver/model/L2Object.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Object.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/L2Object.java    (working copy)
@@ -34,6 +34,8 @@
     private ObjectPoly _poly;
     private ObjectPosition _position;
    
+    private int dimensionId = 1;
+   
     private boolean _isVisible;
    
     public L2Object(int objectId)
@@ -345,4 +347,14 @@
     {
         return false;
     }
+   
+    public int getDimensionId()
+    {
+        return dimensionId;
+    }
+   
+    public void setDimensionId(int dimensionId)
+    {
+        this.dimensionId = dimensionId;
+    }
 }
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/model/actor/knownlist/PcKnownList.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/knownlist/PcKnownList.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/actor/knownlist/PcKnownList.java    (working copy)
@@ -100,11 +100,15 @@
    
     public final void refreshInfos()
     {
+        final L2PcInstance player = (L2PcInstance) _activeObject;
         for (L2Object object : _knownObjects.values())
         {
             if (object instanceof L2PcInstance && ((L2PcInstance) object).inObserverMode())
                 continue;
            
+            if (object.getDimensionId() != player.getDimensionId())
+                continue;
+           
             sendInfoFrom(object);
         }
     }
Index: java/net/sf/l2j/gameserver/model/L2Spawn.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Spawn.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/L2Spawn.java    (working copy)
@@ -75,6 +75,8 @@
     /** If True a L2Npc is respawned each time that another is killed */
     private boolean _doRespawn;
    
+    private int _dimensionid = 1;
+   
     private L2Npc _lastSpawn;
     private static List<SpawnListener> _spawnListeners = new ArrayList<>();
    
@@ -288,7 +290,7 @@
      */
     public void init()
     {
-        doSpawn();
+        doSpawn().setDimensionId(getDimensionId());
         _doRespawn = true;
     }
    
@@ -508,4 +510,14 @@
     {
         return "L2Spawn [_template=" + getNpcId() + ", _locX=" + _locX + ", _locY=" + _locY + ", _locZ=" + _locZ + ", _heading=" + _heading + "]";
     }
+    public int getDimensionId()
+    {
+        return _dimensionid;
+    }
+   
+    public void setDimensionId(int dimensionId)
+    {
+        _dimensionid = dimensionId;
+    }
+   
 }
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/model/actor/knownlist/ObjectKnownList.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/knownlist/ObjectKnownList.java    (revision 63)
+++ java/net/sf/l2j/gameserver/model/actor/knownlist/ObjectKnownList.java    (working copy)
@@ -50,6 +50,10 @@
         if (!Util.checkIfInShortRadius(getDistanceToWatchObject(object), _activeObject, object, true))
             return false;
        
+        // Check if they are at different dimensions
+        if (object.getDimensionId() != getActiveObject().getDimensionId())
+            return false;
+       
         // add object to known list and check if object already existed there
         return _knownObjects.put(object.getObjectId(), object) == null;
     }
@@ -69,7 +73,10 @@
         // remove object from known list and check if object existed in there
         return _knownObjects.remove(object.getObjectId()) != null;
     }
-   
+    public L2Object getActiveObject()
+    {
+        return _activeObject;
+    }
     /**
      * Remove object from known list, which are beyond distance to forget.
      */
@@ -81,6 +88,9 @@
             // object is not visible or out of distance to forget, remove from known list
             if (!object.isVisible() || !Util.checkIfInShortRadius(getDistanceToForgetObject(object), _activeObject, object, true))
                 removeKnownObject(object);
+            // Check if they are at different dimensions
+            if (object.getDimensionId() != getActiveObject().getDimensionId())
+                removeKnownObject(object);
         }
     }
    
Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java    (revision 63)
+++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java    (working copy)
@@ -70,6 +70,12 @@
             return;
         }
        
+        if (target.getDimensionId() != requestor.getDimensionId())
+        {
+            requestor.sendMessage("This player is in Another Instance !");
+            return;
+        }
+       
         if (target.getClient().isDetached())
         {
             requestor.sendMessage("The player you tried to invite is in offline mode.");

CitarDATA:

### Eclipse Workspace Patch 1.0
#P L2j_Pirama_Data
Index: data/scripts.cfg
===================================================================
--- data/scripts.cfg    (revision 62)
+++ data/scripts.cfg    (working copy)
@@ -379,6 +379,7 @@
 custom/NpcLocationInfo/NpcLocationInfo.java
 custom/HeroCirclet/HeroCirclet.java
 custom/HeroWeapon/HeroWeapon.java
+custom/SuperMonster/SuperMonster.java
 
 # Vehicles
 
Index: data/xml/npcs/100-199.xml
===================================================================
--- data/xml/npcs/100-199.xml    (revision 0)
+++ data/xml/npcs/100-199.xml    (working copy)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<list>
+    <npc id="100" idTemplate="31324" name="Kaliopi" title="Dimension Baby">
+        <set name="level" val="70"/>
+        <set name="radius" val="8"/>
+        <set name="height" val="23"/>
+        <set name="rHand" val="316"/>
+        <set name="lHand" val="0"/>
+        <set name="type" val="L2Npc"/>
+        <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="16"/>
+        </skills>
+    </npc>
+    <npc id="101" idTemplate="31324" name="Boss" title="">
+        <set name="level" val="80"/>
+        <set name="radius" val="13"/>
+        <set name="height" val="11.5"/>
+        <set name="rHand" val="0"/>
+        <set name="lHand" val="0"/>
+        <set name="type" val="L2RaidBoss"/>
+        <set name="exp" val="2346616"/>
+        <set name="sp" val="1166150"/>
+        <set name="hp" val="82980"/>
+        <set name="mp" val="1641"/>
+        <set name="hpRegen" val="319"/>
+        <set name="mpRegen" val="3"/>
+        <set name="pAtk" val="5267"/>
+        <set name="pDef" val="1011"/>
+        <set name="mAtk" val="3790"/>
+        <set name="mDef" val="493"/>
+        <set name="crit" val="4"/>
+        <set name="atkSpd" val="253"/>
+        <set name="str" val="60"/>
+        <set name="int" val="76"/>
+        <set name="dex" val="73"/>
+        <set name="wit" val="70"/>
+        <set name="con" val="57"/>
+        <set name="men" val="80"/>
+        <set name="corpseTime" val="7"/>
+        <set name="walkSpd" val="40"/>
+        <set name="runSpd" val="170"/>
+        <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="4169" level="7"/>
+            <skill id="4172" level="7"/>
+            <skill id="4173" level="7"/>
+            <skill id="4177" level="7"/>
+            <skill id="4416" level="11"/>
+            <skill id="4494" level="1"/>
+            <skill id="4837" level="1"/>
+        </skills>
+    </npc>
+</list>
\ No newline at end of file
Index: data/scripts/custom/SuperMonster/SuperMonster.java
===================================================================
--- data/scripts/custom/SuperMonster/SuperMonster.java    (revision 0)
+++ data/scripts/custom/SuperMonster/SuperMonster.java    (working copy)
@@ -0,0 +1,175 @@
+package custom.SuperMonster;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.concurrent.TimeUnit;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.model.L2Skill;
+import net.sf.l2j.gameserver.model.actor.L2Npc;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.entity.L2Dimension;
+import net.sf.l2j.gameserver.model.quest.Quest;
+
+/**
+ * @author SoFace
+ */
+public class SuperMonster extends Quest
+{
+    // Monsters's ID.
+    private static final int MONSTERS[] =
+    {
+        101
+    };
+   
+    private static final boolean REWARD_PARTY = Config.REWARD_PARTY; // Reward party ?
+   
+    private final static boolean REWARD_NOBLE = Config.REWARD_NOBLE; // Give Noblesse ?
+   
+    private final static boolean REWARD_HERO = Config.REWARD_HERO; // Give Hero ?
+    private final static int REWARD_HERO_DAYS = Config.REWARD_HERO_DAYS; // How many days to give the status of Hero ?
+                                                    // 0 - Until relogin. -1 - Forever.
+   
+    private final static boolean REWARD_SKILL = Config.REWARD_SKILL; // Give Skill ?
+    private final static int REWARD_SKILL_ID = Config.REWARD_SKILL_ID; // Skill's ID.
+    private final static int REWARD_SKILL_LVL = Config.REWARD_SKILL_LVL; // Skill's LvL.
+   
+    private final static boolean REWARD_ITEMS = Config.REWARD_ITEMS; // Give Items ?
+    private final static int REWARD_ITEM_ID = Config.REWARD_ITEM_ID; // Item's ID.
+    private final static int REWARD_ITEM_COUNT = Config.REWARD_ITEM_COUNT; // Count.
+   
+    public SuperMonster()
+    {
+        super(-1, "SuperMonster", "custom");
+       
+        for (int mobs : MONSTERS)
+            addKillId(mobs);
+    }
+   
+    @Override
+    public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
+    {
+        L2Skill skill = SkillTable.getInstance().getInfo(REWARD_SKILL_ID, REWARD_SKILL_LVL);
+       
+        if (REWARD_PARTY)
+        {
+            if (player.getParty() != null)
+            {
+                for (L2PcInstance members : player.getParty().getPartyMembers())
+                {
+                    members.sendMessage("Congratulations ! You killed The SuperMonster !");
+                   
+                    if (REWARD_ITEMS)
+                        members.addItem("Add", REWARD_ITEM_ID, REWARD_ITEM_COUNT, members, true);
+                    if (REWARD_SKILL)
+                        members.addSkill(skill, true);
+                    if (REWARD_HERO)
+                    {
+                        if (!player.isHero())
+                            addHero(player, REWARD_HERO_DAYS);
+                        else
+                            player.sendMessage("You already Hero.");
+                    }
+                    if (REWARD_NOBLE)
+                    {
+                        if (!members.isNoble())
+                            members.setNoble(true, true);
+                        else
+                            members.sendMessage("You already Noblesse.");
+                    }
+                    for (L2PcInstance pm : player.getParty().getPartyMembers())
+                        L2Dimension.teleportCharacterBack(pm, player.getX(), player.getY(), player.getZ());
+                    members.broadcastUserInfo();
+                }
+            }
+            else
+            {
+                player.sendMessage("Congratulations ! You killed The SuperMonster !");
+               
+                if (REWARD_ITEMS)
+                    player.addItem("Add", REWARD_ITEM_ID, REWARD_ITEM_COUNT, player, true);
+                if (REWARD_SKILL)
+                    player.addSkill(skill, true);
+                if (REWARD_HERO)
+                {
+                    if (!player.isHero())
+                        addHero(player, REWARD_HERO_DAYS);
+                    else
+                        player.sendMessage("You already Hero.");
+                }
+                if (REWARD_NOBLE)
+                {
+                    if (!player.isNoble())
+                        player.setNoble(true, true);
+                    else
+                        player.sendMessage("You already Noblesse.");
+                }
+                for (L2PcInstance pm : player.getParty().getPartyMembers())
+                    L2Dimension.teleportCharacterBack(pm, player.getX(), player.getY(), player.getZ());
+                player.broadcastUserInfo();
+            }
+        }
+        else
+        {
+            player.sendMessage("Congratulations ! You killed The SuperMonster !");
+           
+            if (REWARD_ITEMS)
+                player.addItem("Add", REWARD_ITEM_ID, REWARD_ITEM_COUNT, player, true);
+            if (REWARD_SKILL)
+                player.addSkill(skill, true);
+            if (REWARD_HERO)
+            {
+                if (!player.isHero())
+                    addHero(player, REWARD_HERO_DAYS);
+                else
+                    player.sendMessage("You already Hero.");
+            }
+            if (REWARD_NOBLE)
+            {
+                if (!player.isNoble())
+                    player.setNoble(true, true);
+                else
+                    player.sendMessage("You already Noblesse.");
+            }
+            for (L2PcInstance pm : player.getParty().getPartyMembers())
+                L2Dimension.teleportCharacterBack(pm, player.getX(), player.getY(), player.getZ());
+            player.broadcastUserInfo();
+        }
+       
+        return null;
+    }
+   
+    private static void addHero(L2PcInstance player, int days)
+    {
+        long _heroExpire = 0L;
+       
+        player.setHero(true);
+        player.broadcastUserInfo();
+       
+        if (days == 0)
+        {
+            _heroExpire = 3L;
+            return;
+        }
+        _heroExpire = (days == -1 ? 1L : System.currentTimeMillis() + TimeUnit.DAYS.toMillis(days));
+       
+        try (Connection con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement stm = con.prepareStatement("UPDATE `characters` SET `hero`=? WHERE `obj_Id`=?"))
+        {
+            stm.setLong(1, _heroExpire);
+            stm.setInt(2, player.getObjectId());
+            stm.execute();
+        }
+        catch (SQLException e)
+        {
+            _log.warning("[SuperMonster] addHero(days) error: ");
+        }
+    }
+   
+    public static void main(String args[])
+    {
+        new SuperMonster();
+    }
+}
Index: data/html/default/100.htm
===================================================================
--- data/html/default/100.htm    (revision 0)
+++ data/html/default/100.htm    (working copy)
@@ -0,0 +1,17 @@
+<html><title> </title>
+<br>
+<center>
+<img src="l2ui.SquareWhite" width=300 height=1><br>
+<center> Hello Adventurer !<br>
+<img src="l2ui.SquareWhite" width=300 height=1><br>
+I Need your help <br>
+1 Monster took my baby and all my belongings <br>in another Dimension.<br>
+This Monster is very Strong.<br>I won't leave you go alone !<br>
+You need 1 <font color="CC0000">Item 1</font>.<br>
+To saw me your power so i can trust you !!!<br>
+And 1 Strong <font color="CC0000">Party</font> to Survive !!!
+<img src="l2ui.SquareWhite" width=300 height=1><br>
+</center>
+<br><br>
+<center><button value="Dimension" action="bypass -h dimension 101" width=88 height=15 back="l2ui.SystemWindowButton" fore="l2ui.SystemWindowButton_click"></td>
+</html>
\ No newline at end of file
Index: sql/change_spawn.sql
===================================================================
--- sql/change_spawn.sql    (revision 0)
+++ sql/change_spawn.sql    (working copy)
@@ -0,0 +1 @@
+alter table `spawnlist` add column `dimensionid` int(3) NOT NULL DEFAULT '1' ;
\ No newline at end of file