Evento Custom que habilita uma guerra entre 2 times, 1 defendendo e outro atacando, cada player que conseguir sumonar o fortles ganha status de hero ate deslogar ou server dar restart

Código:
Index: /Trunk/L2JSuper_CORE/config/fos_engine.properties
===================================================================
--- /Trunk/L2JSuper_CORE/config/fos_engine.properties (revision 26)
+++ /Trunk/L2JSuper_CORE/config/fos_engine.properties (revision 26)
@@ -0,0 +1,26 @@
+# Setting for Fortress Siege Events
+# FortressSiegeEvenTeams = NO|BALANCE|SHUFFLE
+# NO means: not even teams.
+# BALANCE means: Players can only join team with lowest player count.
+# SHUFFLE means: Players can only participate to the event and not direct to a team. Teams will be schuffeled in teleporting teams.
+FortressSiegeEvenTeams = SHUFFLE
+# players that are not participated in FortressSiege can target FortressSiege participants?
+FortressSiegeAllowInterference = False
+# FortressSiege participants can use potions?
+FortressSiegeAllowPotions = False
+# FortressSiege participants can summon by item?
+FortressSiegeAllowSummon = False
+# remove all effects of FortressSiege participants on event start?
+FortressSiegeonstartRemoveAllEffects = False
+# unsummon pet of FortressSiege participants on event start?
+FortressSiegeonstartUnsummonPet = False
+# on revive participants regain full hp/mp/cp ?
+FortressSiegeReviveRecovery = False
+# announce all team statistics
+FortressSiegeAnnounceTeamStats = True
+# give price with 0 kills
+FortressSiegePriceNoKills = True
+# players with cursed weapon are allowed to join ?
+FortressSiegeJoinWithCursedWeapon = False
+# players from the same IP are allowed to join ?
+FortressSiegeSameIPPlayersAllowed = True

Index: /Trunk/L2JSuper_CORE/java/com/it/br/Config.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/Config.java (revision 20)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/Config.java (revision 26)
@@ -2484,4 +2484,13 @@
         else if (pName.equalsIgnoreCase("WeddingFormalWear")) L2JMOD_WEDDING_FORMALWEAR = Boolean.parseBoolean(pValue);
         else if (pName.equalsIgnoreCase("WeddingDivorceCosts")) L2JMOD_WEDDING_DIVORCE_COSTS = Integer.parseInt(pValue);
+        // Fortress siege engine
+        else if (pName.equalsIgnoreCase("FortressSiegeEvenTeams"))  FortressSiege_EVEN_TEAMS = pValue;
+        else if (pName.equalsIgnoreCase("FortressSiegeSameIPPlayersAllowed")) FortressSiege_SAME_IP_PLAYERS_ALLOWED = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("FortressSiegeAllowInterference")) FortressSiege_ALLOW_INTERFERENCE = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("FortressSiegeSameIPPlayersAllowed")) FortressSiege_SAME_IP_PLAYERS_ALLOWED = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("FortressSiegeAllowPotions")) FortressSiege_ALLOW_POTIONS = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("FortressSiegeAllowSummon")) FortressSiege_ALLOW_SUMMON = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("FortressSiegeonstartRemoveAllEffects")) FortressSiege_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("FortressSiegeonstartUnsummonPet")) FortressSiege_ON_START_UNSUMMON_PET = Boolean.parseBoolean(pValue);
         else if (pName.equalsIgnoreCase("TvTEventEnabled")) TVT_EVENT_ENABLED = Boolean.parseBoolean(pValue);
         else if (pName.equalsIgnoreCase("TvTEventInterval")) TVT_EVENT_INTERVAL = Integer.parseInt(pValue);
@@ -2530,4 +2539,51 @@
         Config.saveHexid(serverId, string, HEXID_FILE);
     }
+
+    //  *******************************************************************************************    
+    public static final String  FOS_ENGINE_FILE        = "./config/fos_engine.properties";
+    //  *******************************************************************************************
+    public static String FortressSiege_EVEN_TEAMS;
+    public static boolean FortressSiege_SAME_IP_PLAYERS_ALLOWED;
+    public static boolean FortressSiege_ALLOW_INTERFERENCE;
+    public static boolean FortressSiege_ALLOW_POTIONS;
+    public static boolean FortressSiege_ALLOW_SUMMON;
+    public static boolean FortressSiege_ON_START_REMOVE_ALL_EFFECTS;
+    public static boolean FortressSiege_ON_START_UNSUMMON_PET;
+    public static boolean FortressSiege_ANNOUNCE_TEAM_STATS;
+    public static boolean FortressSiege_JOIN_CURSED;    
+    public static boolean FortressSiege_REVIVE_RECOVERY;
+    public static boolean FortressSiege_PRICE_NO_KILLS;
+    //  *******************************************************************************************    
+    //  *******************************************************************************************
+    public static void loadFosEngineConfig()
+    {
+        _log.info("loading " + FOS_ENGINE_FILE);
+        try
+        {
+           Properties fosEngineSettings = new Properties();
+           InputStream is = new FileInputStream(new File(FOS_ENGINE_FILE));  
+           fosEngineSettings.load(is);
+           is.close();
+           
+           FortressSiege_EVEN_TEAMS = fosEngineSettings.getProperty("FortressSiegeEvenTeams", "BALANCE");
+           FortressSiege_SAME_IP_PLAYERS_ALLOWED = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeSameIPPlayersAllowed", "false"));
+           FortressSiege_ALLOW_INTERFERENCE = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAllowInterference", "false"));
+           FortressSiege_SAME_IP_PLAYERS_ALLOWED = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeSameIPPlayersAllowed", "false"));
+           FortressSiege_ALLOW_POTIONS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAllowPotions", "false"));
+           FortressSiege_ALLOW_SUMMON = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAllowSummon", "false"));
+           FortressSiege_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeonstartRemoveAllEffects", "true"));
+           FortressSiege_ON_START_UNSUMMON_PET = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeonstartUnsummonPet", "true"));
+           FortressSiege_REVIVE_RECOVERY = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeReviveRecovery", "false"));
+           FortressSiege_ANNOUNCE_TEAM_STATS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeAnnounceTeamStats", "false"));
+           FortressSiege_PRICE_NO_KILLS = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegePriceNoKills", "false"));
+           FortressSiege_JOIN_CURSED = Boolean.parseBoolean(fosEngineSettings.getProperty("FortressSiegeJoinWithCursedWeapon", "true"));                   
+        }
+        catch (Exception e)
+        {
+               _log.warning("Failed to Load " + FOS_ENGINE_FILE + " File.");
+            e.printStackTrace();
+        }
+    }
+
     /**
      * Save hexadecimal ID of the server in the properties file.
@@ -2535,4 +2591,5 @@
      * @param fileName (String) : name of the properties file
      */
+
     public static void saveHexid(int serverId, String hexId, String fileName)
     {
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2NpcInstance.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2NpcInstance.java (revision 10)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2NpcInstance.java (revision 26)
@@ -67,4 +67,5 @@
 import com.it.br.gameserver.model.entity.Castle;
 import com.it.br.gameserver.model.entity.L2Event;
+import com.it.br.gameserver.model.entity.FortressSiege;
 import com.it.br.gameserver.model.quest.Quest;
 import com.it.br.gameserver.model.quest.QuestState;
@@ -127,5 +128,7 @@
     private int _castleIndex = -2;
 
-    public boolean isEventMob = false;
+    public boolean isEventMob = false,
+                  _isEventMobFOS = false,
+                  _isFOS_Artifact = false;
     private boolean _isInTown = false;
 
@@ -688,6 +691,10 @@
 
                     // Open a chat window on client with the text of the L2NpcInstance
-                    if(isEventMob){ L2Event.showEventHtml(player, String.valueOf(getObjectId())); }
-                    else
+                    if(isEventMob)
+                       L2Event.showEventHtml(player, String.valueOf(getObjectId()));
+                    else if (_isEventMobFOS)
+                        FortressSiege.showEventHtml(player, String.valueOf(getObjectId()));
+                    else if (_isFOS_Artifact)
+                       FortressSiege.showArtifactHtml(player, String.valueOf(getObjectId()));                    else
                     {
                         Quest[] qlsa = getTemplate().getEventQuests(Quest.QuestEventType.QUEST_START); 
@@ -2087,5 +2094,5 @@
             case 31771:
             case 31772:
-                if (player.isHero())
+                if (player.isHero() && !player.isFakeHero())
                     filename = Olympiad.OLYMPIAD_HTML_FILE + "hero_main.htm";
                 else
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2PcInstance.java (revision 10)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2PcInstance.java (revision 26)
@@ -132,4 +132,5 @@
 import com.it.br.gameserver.model.entity.L2Event;
 import com.it.br.gameserver.model.entity.Siege;
+import com.it.br.gameserver.model.entity.FortressSiege;
 import com.it.br.gameserver.model.entity.TvTEvent;
 import com.it.br.gameserver.model.quest.Quest;
@@ -402,4 +403,12 @@
        private boolean _observerMode = false;
 
+       /** FOS Engine parameters */
+       public String   _teamNameFOS;
+       public int              _originalNameColorFOS,
+                                       _countFOSKills,
+                               _originalKarmaFOS;
+       public boolean  _inEventFOS = false,
+                                       _FOSRulerSkills = false;
+
        /** Stored from last ValidatePosition **/
        private Point3D _lastClientPosition = new Point3D(0, 0, 0);
@@ -512,5 +521,6 @@
     
        private Point3D _currentSkillWorldPosition;
-       
+
+        private boolean _fakeHero = false;
        //GM related variables
        private boolean _isGm;
@@ -2393,4 +2403,6 @@
                        sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
                }
+        else if (FortressSiege._sitForced && _inEventFOS)
+            sendMessage("The Admin/GM handle if you sit or stand in this match!");
                else if (_waitTypeSitting && !isInStoreMode() && !isAlikeDead())
                {
@@ -3402,4 +3414,12 @@
                        return;
                }
+        if ((FortressSiege._started && !Config.FortressSiege_ALLOW_INTERFERENCE))
+        {
+            if ((_inEventFOS && !player._inEventFOS) || (!_inEventFOS && player._inEventFOS))
+            {
+                player.sendPacket(new ActionFailed());
+                return;
+            }
+        }
 
                // Check if the L2PcInstance is confused
@@ -3433,5 +3453,5 @@
                        {
                                // Check if this L2PcInstance is autoAttackable
-                               if (isAutoAttackable(player))
+                               if (isAutoAttackable(player) || (player._inEventFOS && FortressSiege._started))
                                {
                                        // Player with lvl < 21 can't attack a cursed weapon holder
@@ -3470,4 +3490,9 @@
                }
        }
+
+    public boolean isInFunEvent()
+    {
+       return(atEvent || (FortressSiege._started && _inEventFOS));
+    }
 
        /**
@@ -4276,4 +4301,36 @@
                {
                        L2PcInstance pk = null;
+            if ((killer instanceof L2PcInstance &&((L2PcInstance)killer)._inEventFOS) && _inEventFOS)
+            {
+                if (FortressSiege._teleport || FortressSiege._started)
+                {
+                    if (!(((L2PcInstance)killer)._teamNameFOS.equals(_teamNameFOS)))
+                        ((L2PcInstance)killer)._countFOSKills++;
+                    else{
+                        ((L2PcInstance)killer).sendMessage("Team Kills do not count as kills. They will only harm you in this event");
+                        ((L2PcInstance)killer)._countFOSKills--;
+                    }
+                    sendMessage("You will be revived and teleported to team spot in 10 seconds!");
+                    ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){
+                        public void run(){
+                            teleToLocation(FortressSiege._teamsX.get(FortressSiege._teams.indexOf(_teamNameFOS)), FortressSiege._teamsY.get(FortressSiege._teams.indexOf(_teamNameFOS)), FortressSiege._teamsZ.get(FortressSiege._teams.indexOf(_teamNameFOS)), false);
+                            doRevive();
+                            updateFOSTitleFlag();
+                        }
+                    }, 10000);
+                }
+            }
+            else if (_inEventFOS){
+                if (FortressSiege._teleport || FortressSiege._started){
+                    sendMessage("You will be revived and teleported to team spot in 10 seconds!");
+                    ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){
+                        public void run(){
+                               teleToLocation(FortressSiege._teamsX.get(FortressSiege._teams.indexOf(_teamNameFOS)), FortressSiege._teamsY.get(FortressSiege._teams.indexOf(_teamNameFOS)), FortressSiege._teamsZ.get(FortressSiege._teams.indexOf(_teamNameFOS)), false);                            
+                            doRevive();
+                            updateFOSTitleFlag();
+                        }
+                    }, 10000);
+                }
+            }
                        if (killer instanceof L2PcInstance)
                                pk = (L2PcInstance) killer;
@@ -4367,5 +4424,5 @@
        private void onDieDropItem(L2Character killer)
        {
-               if (atEvent || killer == null)
+               if (atEvent || (FortressSiege._started && _inEventFOS) || killer == null)
             return;
 
@@ -4484,4 +4541,5 @@
                if (target == null) return;
                if (!(target instanceof L2PlayableInstance)) return;
+               if (_inEventFOS) return;
 
                L2PcInstance targetPlayer = null;
@@ -4580,4 +4638,7 @@
     public void increasePvpKills()
     {
+        if ((FortressSiege._started && _inEventFOS))
+            return;
+
         // Add karma to attacker and increase its PK counter
         setPvpKills(getPvpKills() + 1);
@@ -4609,5 +4670,7 @@
     public void increasePkKillsAndKarma(int targLVL)
     {
-        int baseKarma           = Config.KARMA_MIN_KARMA;
+        if ((FortressSiege._started && _inEventFOS))
+            return;
+       int baseKarma           = Config.KARMA_MIN_KARMA;
         int newKarma            = baseKarma;
         int karmaLimit          = Config.KARMA_MAX_KARMA;
@@ -4701,4 +4764,5 @@
        {
                if (isInsideZone(ZONE_PVP)) return;
+               if ((FortressSiege._started && _inEventFOS)) return;
                setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
 
@@ -4718,5 +4782,6 @@
         if (player_target == null)
            return;
-
+        if ((_inEventFOS && FortressSiege._started && player_target._inEventFOS))  
+            return; 
         if ((isInDuel() && player_target.getDuelId() == getDuelId())) return;
         if ((!isInsideZone(ZONE_PVP) || !player_target.isInsideZone(ZONE_PVP)) && player_target.getKarma() == 0)
@@ -4776,5 +4841,5 @@
                // Calculate the Experience loss
                long lostExp = 0;
-               if (!atEvent)
+               if (!atEvent && !_inEventFOS)
                        if (lvl < Experience.MAX_LEVEL)
                                lostExp = Math.round((getStat().getExpForLevel(lvl+1) - getStat().getExpForLevel(lvl)) * percentLost /100);
@@ -7403,5 +7468,5 @@
 
                        // Check if a Forced ATTACK is in progress on non-attackable target
-                       if (!target.isAutoAttackable(this) && !forceUse &&
+                       if (!target.isAutoAttackable(this) && !forceUse && !(_inEventFOS && FortressSiege._started) &&
                                        sklTargetType != SkillTargetType.TARGET_AURA &&
                                        sklTargetType != SkillTargetType.TARGET_CLAN &&
@@ -7532,15 +7597,24 @@
                                if (!checkPvpSkill(target, skill) && (getAccessLevel() < Config.GM_PEACEATTACK))
                 {
-                                       // Send a System Message to the L2PcInstance
-                                       sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
-
-                                       // Send a Server->Client packet ActionFailed to the L2PcInstance
-                                       sendPacket(new ActionFailed());
-                                       return;
-                               }
-               }
-
-        if (sklTargetType == SkillTargetType.TARGET_HOLY &&
-                       !TakeCastle.checkIfOkToCastSealOfRule(this, false))
+                           // Send a System Message to the L2PcInstance
+                           sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
+       
+                           // Send a Server->Client packet ActionFailed to the L2PcInstance
+                           sendPacket(new ActionFailed());
+                           return;
+                }
+        }
+        if (sklTargetType == SkillTargetType.TARGET_HOLY && 
+                (!FortressSiege.checkIfOkToCastSealOfRule(this) && !TakeCastle.checkIfOkToCastSealOfRule(this, false)))
+        {
+            sendPacket(new ActionFailed());
+            abortCast();
+            return;
+        }
+        if (sklTargetType == SkillTargetType.TARGET_HOLY && FortressSiege.checkIfOkToCastSealOfRule(this))
+               FortressSiege.Announcements(getName()+" from team "+FortressSiege._teams.get(0)+" has begun engraving the Artifact.");
+
+        if (sklType == SkillType.SIEGEFLAG && 
+                       !SiegeFlag.checkIfOkToPlaceFlag(this, false))
         {
             sendPacket(new ActionFailed());
@@ -7602,4 +7676,7 @@
        public boolean checkPvpSkill(L2Object target, L2Skill skill)
        {
+        if ((_inEventFOS && FortressSiege._started))
+            return true;
+
                // check for PC->PC Pvp status
                if (
@@ -8375,4 +8452,8 @@
        }
 
+       public void setFakeHero(boolean hero){
+               _fakeHero = hero;
+        }
+
        public void setHero(boolean hero)
        {
@@ -8405,4 +8486,9 @@
                return _OlympiadStart;
        }
+
+    public boolean isFakeHero()
+    {
+        return _fakeHero;
+    }
 
     public boolean isHero()
@@ -8492,4 +8578,16 @@
                return true;
        }
+
+    public boolean checkFOS(){
+       return FortressSiege.checkIfOkToCastSealOfRule(this);
+    }
+
+    public Map<Integer,L2Skill> returnSkills(){
+       return _skills;
+    }
+
+    public void updateFOSTitleFlag(){
+       FortressSiege.setTitleSiegeFlags(this);
+    }
 
     public boolean isNoble()
@@ -9244,5 +9342,11 @@
                                getParty().getDimensionalRift().memberRessurected(this);
                }
-       }
+        if((_inEventFOS && FortressSiege._started && Config.FortressSiege_REVIVE_RECOVERY))
+        {
+            getStatus().setCurrentHp(getMaxHp());
+            getStatus().setCurrentMp(getMaxMp());
+            getStatus().setCurrentCp(getMaxCp());
+        }
+     }
 
        @Override
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2ArtefactInstance.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2ArtefactInstance.java (revision 1)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2ArtefactInstance.java (revision 26)
@@ -82,4 +82,8 @@
        public void onAction(L2PcInstance player)
        {
+               if (_isFOS_Artifact && player._inEventFOS){
+                       super.onAction(player);
+                       return;
+               }
                if (!canTarget(player)) return;
 
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2DoorInstance.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2DoorInstance.java (revision 1)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/actor/instance/L2DoorInstance.java (revision 26)
@@ -42,4 +42,5 @@
 import com.it.br.gameserver.model.actor.status.DoorStatus;
 import com.it.br.gameserver.model.entity.Castle;
+import com.it.br.gameserver.model.entity.FortressSiege;
 import com.it.br.gameserver.model.entity.ClanHall;
 import com.it.br.gameserver.network.L2GameClient;
@@ -292,4 +293,7 @@
     {
         if (isUnlockable())
+            return true;
+       // Attackable during fortress sieges by event participators only
+        if (FortressSiege.isDoorAttackable(getDoorId(),attacker))
             return true;
 
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/L2Skill.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/L2Skill.java (revision 1)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/L2Skill.java (revision 26)
@@ -126,4 +126,5 @@
         TARGET_ENEMY_SUMMON,
         TARGET_OWNER_PET,
+        TARGET_ENEMY_ALLY,
         TARGET_SIGNET_GROUND, 
         TARGET_SIGNET, 
@@ -1333,8 +1334,9 @@
             case TARGET_HOLY:
             {
-                if (activeChar instanceof L2PcInstance)
-                {
-                    if (activeChar.getTarget() instanceof L2ArtefactInstance)
-                        return new L2Character[] {(L2ArtefactInstance) activeChar.getTarget()};
+               if (activeChar instanceof L2PcInstance){
+                       if (activeChar.getTarget() instanceof L2ArtefactInstance)
+                                return new L2Character[] {(L2ArtefactInstance) activeChar.getTarget()};
+                       else if ( ((L2PcInstance)activeChar).checkFOS())
+                                        return new L2Character[] {(L2NpcInstance) activeChar.getTarget()};
                 }
 
@@ -2053,4 +2055,46 @@
                 return targetList.toArray(new L2Character[targetList.size()]);
             }
+            case TARGET_ENEMY_ALLY:
+            {
+                //int charX, charY, charZ, targetX, targetY, targetZ, dx, dy, dz;
+                int radius = getSkillRadius();
+                L2Character newTarget;
+                
+                if (getCastRange() > -1 && target != null)
+                {
+                    newTarget = target;
+                }
+                else
+                    newTarget = activeChar;
+                
+                if (newTarget != activeChar || isSkillTypeOffensive())
+                    targetList.add(newTarget);
+                
+                for (L2Character obj : activeChar.getKnownList().getKnownCharactersInRadius(radius))
+                {
+                    if (obj == newTarget || obj == activeChar)
+                            continue;
+                    
+                    if (obj instanceof L2Attackable)
+                    {
+                        if(!obj.isAlikeDead())
+                        {
+                            // Don't add this target if this is a PC->PC pvp casting and pvp condition not met
+                            if (activeChar instanceof L2PcInstance && !((L2PcInstance)activeChar).checkPvpSkill(obj, this))
+                                continue;
+                            
+                            // check if both attacker and target are L2PcInstances and if they are in same party or clan
+                            if (   (activeChar instanceof L2PcInstance && obj instanceof L2PcInstance) && 
+                                 (((L2PcInstance)activeChar).getClanId() != ((L2PcInstance)obj).getClanId() ||
+                                 (((L2PcInstance)activeChar).getAllyId() != ((L2PcInstance)obj).getAllyId() &&
+                                 ((((L2PcInstance)activeChar).getParty() != null && ((L2PcInstance)obj).getParty() != null) &&
+                                 ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() != ((L2PcInstance)obj).getParty().getPartyLeaderOID() ))))
+                                continue;
+                            
+                            targetList.add(obj);
+                        }
+                    }
+                }
+            }
             case TARGET_ENEMY_SUMMON:
             {
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/L2Character.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/L2Character.java (revision 1)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/L2Character.java (revision 26)
@@ -69,4 +69,5 @@
 import com.it.br.gameserver.model.actor.status.CharStatus;
 import com.it.br.gameserver.model.entity.Duel;
+import com.it.br.gameserver.model.entity.FortressSiege;
 import com.it.br.gameserver.model.quest.Quest;
 import com.it.br.gameserver.model.quest.QuestState;
@@ -75,4 +76,5 @@
 import com.it.br.gameserver.pathfinding.geonodes.GeoPathFinding;
 import com.it.br.gameserver.serverpackets.ActionFailed;
+import com.it.br.gameserver.serverpackets.SocialAction;
 import com.it.br.gameserver.serverpackets.Attack;
 import com.it.br.gameserver.serverpackets.ChangeMoveType;
@@ -330,4 +332,7 @@
                if (_isPendingRevive) doRevive();
 
+               if (FortressSiege._started && (this instanceof L2PcInstance) && ((L2PcInstance)this)._inEventFOS)
+                       FortressSiege.setTitleSiegeFlags((L2PcInstance)this);
+
                // Modify the position of the pet if necessary
                if(getPet() != null)
@@ -592,5 +597,14 @@
                if (Config.DEBUG)
             _log.fine(getName()+" doAttack: target="+target);
-
+        if (target instanceof L2PlayableInstance && this instanceof L2PlayableInstance){
+               L2Object[] o;
+               if (FortressSiege._started)
+                       o = (eventBlocker(new L2Object[] {target},true)); // This adds another check for protected zone in fortress sieges. 
+               else
+                       o = (eventBlocker(new L2Object[] {target},false)); // A Filter to take out any players not in events.
+               if (o!=null && o[0]!=null && o[0] instanceof L2Character)
+                       target = (L2Character)o[0];
+               else target = null;
+        }
                if (isAlikeDead() || target == null || (this instanceof L2NpcInstance && target.isAlikeDead())
                 || (this instanceof L2PcInstance && target.isDead() && !target.isFakeDeath())
@@ -1233,4 +1247,16 @@
                }
 
+        if (FortressSiege._started && this instanceof L2PcInstance && ((L2PcInstance)this)._inEventFOS && (skill.getTargetType() == L2Skill.SkillTargetType.TARGET_CLAN || skill.getTargetType() == L2Skill.SkillTargetType.TARGET_ALLY || skill.getTargetType() == L2Skill.SkillTargetType.TARGET_ENEMY_ALLY))
+               targets = getFOSTargets(skill);        
+        if (this instanceof L2PlayableInstance){
+               if (FortressSiege._started && skill.isOffensive())
+                       targets = eventBlocker(targets,true); // Special check made here, to not allow players in protected zone to be hit by players IN THE EVENT (a.k.a. safe zone)
+               else
+                       targets = eventBlocker(targets,false); // A Filter to take out any playables not in events or vice versa.
+        }
+        if (targets == null || (targets.length == 0)){
+               getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
+               return;
+        }
                // Set the target of the skill in function of Skill Type and Target Type
                L2Character target = null;
@@ -1422,4 +1448,95 @@
        }
 
+       /** 
+       *Since in this event we create 2 clans, all ally,clan skills should be directed to the event participators 
+       *@param L2Skill skill that is casted
+       *@return L2Object[] target list of the event participators 
+       **/
+       private L2Object[] getFOSTargets(L2Skill skill){
+               L2Skill.SkillTargetType type = skill.getTargetType();
+               FastTable<L2PcInstance> targetList = new FastTable<L2PcInstance>(); 
+               if (type == L2Skill.SkillTargetType.TARGET_CLAN || type == L2Skill.SkillTargetType.TARGET_ALLY)
+                       for(L2PcInstance member : FortressSiege._players)
+                               if (member._teamNameFOS.equals(((L2PcInstance)this)._teamNameFOS) && member.isInsideRadius(this, skill.getSkillRadius(), true, false))
+                                       targetList.add(member);
+                               else if (type == L2Skill.SkillTargetType.TARGET_ENEMY_ALLY)
+                                       for(L2PcInstance target : FortressSiege._players)
+                                               if (!target._teamNameFOS.equals(((L2PcInstance)this)._teamNameFOS) && target.isInsideRadius(this, skill.getSkillRadius(), true, false))
+                                                       targetList.add(target);
+               return targetList.toArray(new L2Object[targetList.size()]);
+       }
+
+    /**
+     * Function is used to filter out targets during an event.
+     * @param targets - Target list L2Object[] received
+     * @param offensive - true to check Offensive skills or hits from players IN THE EVENT as well. false to check ALL interference
+     * @return L2Object[] - New target list, with event participants excluded
+     */
+    private L2Object[] eventBlocker(L2Object[] targets, boolean offensive){
+        try{
+               //If events are not running skip this check. Code efficiency.
+               if (!FortressSiege._started)
+                       return targets;
+               //Let's find the caster:
+               L2PcInstance caster = null;
+               if (this instanceof L2PcInstance)
+                       caster = (L2PcInstance)this;
+               else if (this instanceof L2Summon)
+                       caster = ((L2Summon)this).getOwner();
+               if (caster == null)
+                       return targets;
+               //Check the targets:
+               for (int x=0 ; x<targets.length ; x++){
+               if (targets[x] == null || !(targets[x] instanceof L2PlayableInstance))
+                       continue; // Don't check mobs
+               //Find the player to check if he is in event confronting him with the caster:
+               L2PcInstance target = null;
+               if (targets[x] instanceof L2PcInstance)
+                       target = (L2PcInstance)targets[x];
+               else if (targets[x] instanceof L2Summon)
+                       target = ((L2Summon)targets[x]).getOwner();
+               if (target == null)
+                       continue;
+               //Run the check, change off limit targets to null:
+               if ((FortressSiege._started && !Config.FortressSiege_ALLOW_INTERFERENCE))
+               {
+                    if ((target._inEventFOS && !caster._inEventFOS) || (!target._inEventFOS && caster._inEventFOS))
+                       targets[x]=null;
+                    else if (FortressSiege._started && offensive) // only sent here when we called to check offensive attacks (not buffs, heals etc...)
+                       if ((target._inEventFOS && FortressSiege.inProtectedZone((L2Character)targets[x],caster)) || (caster._inEventFOS && FortressSiege.inProtectedZone(this,caster)))
+                               targets[x]=null;                    
+               }
+               }
+               //At this point we have an array of targets which some are null, let's clean this array:
+               
+               return removeAllNullTargets(targets);
+        }
+        catch (Throwable t){
+               return removeAllNullTargets(targets);
+        }
+    }
+    
+       /**
+       * @param targets a target list with null targets 
+       * @return a target list without null targets
+       */
+    public L2Object[] removeAllNullTargets(L2Object[] targets){
+               if (targets == null)
+                       return null;
+               int size = 0;
+               for (int x=0; x<targets.length ; x++)
+                       if (targets[x]!=null)
+                               size++;
+               if (size == 0)
+                       return null;
+               L2Object[] newTargets = new L2Object[size];
+               size = 0;
+               for (int x=0; x<targets.length ; x++)
+                       if (targets[x]!=null){
+                               newTargets[size] = targets[x]; 
+                               size++;
+                       }
+               return newTargets;
+       }
        /**
         * Index according to skill id the current timestamp of use.<br><br>
@@ -6007,4 +6124,15 @@
                                        else
                                                skill.useSkill(this, targets);
+                       if (skill.getTargetType() == SkillTargetType.TARGET_HOLY && this instanceof L2PcInstance && FortressSiege.checkIfOkToCastSealOfRule((L2PcInstance)this)){
+               FortressSiege.Announcements(getName()+" finished casting Seal Of Ruler. "+((L2PcInstance)this)._teamNameFOS+" has taken "+FortressSiege._eventName+"!");
+               if (!((L2PcInstance)this).isHero()){
+                       ((L2PcInstance)this).sendMessage("You have been rewarded with a Hero status from this event");
+                       ((L2PcInstance)this).setHero(true);
+                       ((L2PcInstance)this).setFakeHero(true); // Since it's only for the event, we don't want him to get Hero gear from the event manager.
+               }
+               ((L2PcInstance)this).getAppearance().setTitleColor(0, 0, 255);
+               ((L2PcInstance)this).sendPacket(new SocialAction(getObjectId(), 16));
+               FortressSiege.doSwap();
+            }
 
                                        if ((this instanceof L2PcInstance) || (this instanceof L2Summon))
                                        
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/entity/FortressSiege.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/entity/FortressSiege.java (revision 26)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/model/entity/FortressSiege.java (revision 26)
@@ -0,0 +1,1520 @@
+/*
+ * 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
+ */
+
+/**
+ * 
+ * @author FBIagent / fixed and moded for l2jfree by SqueezeD & Darki699
+ * 
+ */
+
+package com.it.br.gameserver.model.entity;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javolution.text.TextBuilder;
+import com.it.br.Config;
+import com.it.br.L2DatabaseFactory;
+import com.it.br.gameserver.ThreadPoolManager;
+import com.it.br.gameserver.ai.CtrlEvent;
+import com.it.br.gameserver.datatables.DoorTable;
+import com.it.br.gameserver.datatables.ItemTable;
+import com.it.br.gameserver.datatables.NpcTable;
+import com.it.br.gameserver.datatables.SpawnTable;
+import com.it.br.util.Rnd;
+import com.it.br.gameserver.model.L2Effect;
+import com.it.br.gameserver.model.L2Party;
+import com.it.br.gameserver.model.L2Spawn;
+import com.it.br.gameserver.model.L2Summon;
+import com.it.br.gameserver.model.L2World;
+import com.it.br.gameserver.model.PcInventory;
+import com.it.br.gameserver.model.actor.instance.L2PcInstance;
+import com.it.br.gameserver.model.actor.instance.L2PetInstance;
+import com.it.br.gameserver.network.SystemMessageId;
+import com.it.br.gameserver.serverpackets.ActionFailed;
+import com.it.br.gameserver.serverpackets.ItemList;
+import com.it.br.gameserver.serverpackets.MagicSkillUser;
+import com.it.br.gameserver.serverpackets.NpcHtmlMessage;
+import com.it.br.gameserver.serverpackets.SocialAction;
+import com.it.br.gameserver.serverpackets.StatusUpdate;
+import com.it.br.gameserver.serverpackets.SystemMessage;
+import com.it.br.gameserver.serverpackets.CreatureSay;
+import com.it.br.gameserver.templates.L2NpcTemplate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import com.it.br.gameserver.serverpackets.UserInfo;
+import com.it.br.gameserver.serverpackets.Relationchanged;
+import com.it.br.gameserver.model.L2Skill;
+import com.it.br.gameserver.datatables.SkillTable;
+import com.it.br.gameserver.serverpackets.SkillList;
+import com.it.br.gameserver.model.actor.instance.L2NpcInstance;
+import com.it.br.gameserver.model.L2Character;
+import com.it.br.gameserver.handler.admincommandhandlers.AdminFortressSiegeEngine;
+
+/**
+ * Fortress Siege Event
+ * @author Darki699
+ * @comment: So many fortresses, I hate to see them go to waste ;]
+ */
+public class FortressSiege
+{   
+    private final static Log _log = LogFactory.getLog(FortressSiege.class.getName());    
+    public static boolean                                      _joining = false,
+                                                                               _teleport = false,
+                                                                               _started = false,
+                                                                               _sitForced = false;
+    public static int                                          _FlagNPC = 35062, 
+                                                                               _npcId = 0,
+                                                                               _npcX = 0,
+                                                                               _npcY = 0,
+                                                                               _npcZ = 0,
+                                                                               _npcHeading = 0,
+                                                                               _rewardId = 0,
+                                                                               _rewardAmount = 0,
+                                                                               _minlvl = 0,
+                                                                               _maxlvl = 0,
+                                                                               _joinTime = 0,
+                                                                               _eventTime = 0,
+                                                                               _minPlayers = 0,
+                                                                               _maxPlayers = 0,
+                                                                               _flagX = 0,
+                                                                               _flagY = 0,
+                                                                               _flagZ = 0,
+                                                                                       _topScore = 0,
+                                                                                       eventCenterX=0,
+                                                                                       eventCenterY=0,
+                                                                                       eventCenterZ=0,
+                                                                               _door[] = new int[6];
+    public static String                                       _eventName = new String(),
+                                                               _eventDesc = new String(),
+                                                               _joiningLocationName = new String(),
+                                                                               _topTeam = new String();
+    public static Vector<Integer>                      _teamPlayersCount = new Vector<Integer>(),
+                                                       _teamColors = new Vector<Integer>(2),
+                                                       _teamsX = new Vector<Integer>(2),
+                                                       _teamsY = new Vector<Integer>(2),
+                                                       _teamsZ = new Vector<Integer>(2),
+                                                       _teamPointsCount = new Vector<Integer>(2);
+    public static Vector<String>                       _teams = new Vector<String>(2),
+                                                                               _savePlayers = new Vector<String>(),
+                                                                               _savePlayerTeams = new Vector<String>();
+    public static Vector<L2PcInstance>                 _players = new Vector<L2PcInstance>(),
+                                                                               _playersShuffle = new Vector<L2PcInstance>();
+    public static L2Spawn                                      _npcSpawn,
+                                                                               _flagSpawn;
+    /** Constructor for FortressSiege Class. Calls an Immediate wipe of all Siege data.*/
+    FortressSiege(){
+       resetData();
+    }
+    
+    /**
+     * Resets ALL The Event Siege data.
+     **/
+    public static void resetData(){
+        
+       healDoors();
+       closeDoors();
+               eventCenterX=0;
+               eventCenterY=0;
+               eventCenterZ=0;
+       _topTeam = new String();
+       _door = new int[6];
+       _eventName = new String();
+        _eventDesc = new String();
+        _joiningLocationName = new String();
+        _teams = new Vector<String>();
+        _teams.add("");
+        _teams.add("");
+        _savePlayers = new Vector<String>();
+        _savePlayerTeams = new Vector<String>();
+        
+        if (_players!=null && !_players.isEmpty())
+               for (L2PcInstance player: _players){
+                       if (player == null)
+                               continue;
+                       player._countFOSKills=0;
+                       removeSealOfRuler(player);
+                       player._inEventFOS=false;
+                       if (player.getKarma()== player._originalKarmaFOS)
+                               player.setKarma(0);
+                       else
+                               player.setKarma(player._originalKarmaFOS);
+                       if (player.getAppearance().getNameColor() ==  player._originalNameColorFOS)
+                               player.getAppearance().setNameColor(0xFFFFFF);
+                       else
+                               player.getAppearance().setNameColor(player._originalNameColorFOS);
+                       player.setSiegeState((byte)0);
+                player.sendPacket(new UserInfo(player));
+                for (L2PcInstance p : _players)
+                       p.sendPacket(new Relationchanged(player, player.getRelation(p), player.isAutoAttackable(p)));
+                player.broadcastUserInfo();
+               }
+        
+        if (_playersShuffle!=null && !_playersShuffle.isEmpty())
+               for (L2PcInstance player: _playersShuffle){
+                       if (player == null)
+                               continue;
+                       player._countFOSKills=0;
+                       player._inEventFOS=false;
+               }
+        
+        _players = new Vector<L2PcInstance>();
+        _playersShuffle = new Vector<L2PcInstance>();
+        _teamPlayersCount = new Vector<Integer>();
+        _teamPlayersCount.add(0);
+        _teamPlayersCount.add(0);
+        _teamPointsCount = new Vector<Integer>();
+        _teamPointsCount.add(0);
+        _teamPointsCount.add(0);
+        _teamColors = new Vector<Integer>();
+        _teamColors.add(0xffffff);
+        _teamColors.add(0xffffff);
+        _teamsX = new Vector<Integer>();
+        _teamsX.add(0);
+        _teamsX.add(0);
+        _teamsY = new Vector<Integer>();
+        _teamsY.add(0);
+        _teamsY.add(0);
+        _teamsZ = new Vector<Integer>();
+        _teamsZ.add(0);
+        _teamsZ.add(0);
+        _flagSpawn = null;
+       _flagX = 0;
+       _flagY = 0;
+       _flagZ = 0;
+        _joining = false;
+        _teleport = false;
+        _started = false;
+        _sitForced = false;
+        _npcId = 0;
+        _npcX = 0;
+        _npcY = 0;
+        _npcZ = 0;
+        _npcHeading = 0;
+        _rewardId = 0;
+        _rewardAmount = 0;
+        _topScore = 0;
+        _minlvl = 0;
+        _maxlvl = 0;
+        _joinTime = 0;
+        _eventTime = 0;
+        _minPlayers = 0;
+        _maxPlayers = 0;
+    }
+    
+    public static void autoLoadData(){
+       AdminFortressSiegeEngine a = new AdminFortressSiegeEngine();
+       a.showSiegeLoadPage(null,true);
+    }
+    
+    /**
+     * Loads Fortress Siege data from MySql, depending on which siege we want
+     * @param fortressSiege String containing the String siege name which will be loaded  
+     */
+    public static void loadData(String fortressSiege)
+    {
+        resetData();
+       java.sql.Connection con = null;
+        try{
+            PreparedStatement statement;
+            ResultSet rs;
+            con = L2DatabaseFactory.getInstance().getConnection();
+            statement = con.prepareStatement("Select * from fortress_siege");
+            rs = statement.executeQuery();
+            while (rs.next()){
+                _eventName = rs.getString("eventName");
+                _eventDesc = rs.getString("eventDesc");
+                _joiningLocationName = rs.getString("joiningLocation");
+                _minlvl = rs.getInt("minlvl");
+                _maxlvl = rs.getInt("maxlvl");
+                _npcId = rs.getInt("npcId");
+                _npcX = rs.getInt("npcX");
+                _npcY = rs.getInt("npcY");
+                _npcZ = rs.getInt("npcZ");
+                _npcHeading = rs.getInt("npcHeading");
+                _rewardId = rs.getInt("rewardId");
+                _rewardAmount = rs.getInt("rewardAmount"); 
+                _joinTime = rs.getInt("joinTime");
+                _eventTime = rs.getInt("eventTime");
+                _minPlayers = rs.getInt("minPlayers");
+                _maxPlayers = rs.getInt("maxPlayers");
+                eventCenterX = rs.getInt("centerX");
+                eventCenterY = rs.getInt("centerY");
+                eventCenterZ = rs.getInt("centerZ");
+                _teams.set(0,rs.getString("team1Name"));
+                _teamsX.set(0,rs.getInt("team1X"));
+                _teamsY.set(0,rs.getInt("team1Y"));
+                _teamsZ.set(0,rs.getInt("team1Z"));
+                _teamColors.set(0,rs.getInt("team1Color"));
+                _teams.set(1,rs.getString("team2Name"));
+                _teamsX.set(1,rs.getInt("team2X"));
+                _teamsY.set(1,rs.getInt("team2Y"));
+                _teamsZ.set(1,rs.getInt("team2Z"));
+                _teamColors.set(1,rs.getInt("team2Color"));
+                _flagX = rs.getInt("flagX");
+                _flagY = rs.getInt("flagY");
+                _flagZ = rs.getInt("flagZ");
+                _door[0] = rs.getInt("innerDoor1");
+                _door[1] = rs.getInt("innerDoor2");
+                _door[2] = rs.getInt("innerDoor3");
+                _door[3] = rs.getInt("innerDoor4");
+                _door[4] = rs.getInt("outerDoor1");
+                _door[5] = rs.getInt("outerDoor2");
+                if(_eventName.equalsIgnoreCase(fortressSiege))
+                       break;
+            }
+            statement.close();
+        }
+        catch (Exception e){
+            _log.error("Exception: FortressSiege.loadData(): " + e.toString());
+        }finally {try { con.close(); } catch (Exception e) {}}
+    }
+    
+    /** Saves Fortress Siege Data to MySQL*/
+    public static void saveData()
+    {
+        java.sql.Connection con = null;
+        try{
+            con = L2DatabaseFactory.getInstance().getConnection();
+            PreparedStatement statement;
+            statement = con.prepareStatement("REPLACE INTO fortress_siege (eventName, eventDesc, joiningLocation, minlvl, maxlvl, npcId, npcX, npcY, npcZ, npcHeading, rewardId, rewardAmount, joinTime, eventTime, minPlayers, maxPlayers, centerX, centerY, centerZ, team1Name, team1X, team1Y, team1Z, team1Color, team2Name, team2X, team2Y, team2Z, team2Color, flagX, flagY, flagZ, innerDoor1, innerDoor2, innerDoor3, innerDoor4, outerDoor1, outerDoor2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");  
+
+            statement.setString(1, _eventName);
+            statement.setString(2, _eventDesc);
+            statement.setString(3, _joiningLocationName);
+            statement.setInt(4, _minlvl);
+            statement.setInt(5, _maxlvl);
+            statement.setInt(6, _npcId);
+            statement.setInt(7, _npcX);
+            statement.setInt(8, _npcY);
+            statement.setInt(9, _npcZ);
+            statement.setInt(10, _npcHeading);
+            statement.setInt(11, _rewardId);
+            statement.setInt(12, _rewardAmount);
+            statement.setInt(13, _joinTime);
+            statement.setInt(14, _eventTime);
+            statement.setInt(15, _minPlayers);
+            statement.setInt(16, _maxPlayers);
+            statement.setInt(17, eventCenterX);
+            statement.setInt(18, eventCenterY);
+            statement.setInt(19, eventCenterZ);
+            statement.setString(20, _teams.get(0));
+            statement.setInt(21, _teamsX.get(0));
+            statement.setInt(22, _teamsY.get(0));
+            statement.setInt(23, _teamsZ.get(0));
+            statement.setInt(24, _teamColors.get(0));
+            statement.setString(25, _teams.get(1));
+            statement.setInt(26, _teamsX.get(1));
+            statement.setInt(27, _teamsY.get(1));
+            statement.setInt(28, _teamsZ.get(1));
+            statement.setInt(29, _teamColors.get(1));
+            statement.setInt(30, _flagX);
+            statement.setInt(31, _flagY);
+            statement.setInt(32, _flagZ);
+            statement.setInt(33, _door[0]);
+            statement.setInt(34, _door[1]);
+            statement.setInt(35, _door[2]);
+            statement.setInt(36, _door[3]);
+            statement.setInt(37, _door[4]);
+            statement.setInt(38, _door[5]);
+            statement.execute();
+            statement.close();
+        }catch (Exception e){
+            _log.error("Exception: FortressSiege.saveData(): " + e.getMessage());
+        }finally {try { con.close(); } catch (Exception e) {}}
+    }
+    
+    /** Checks if Minimum level does'nt exceed Maximum level, so Max lvl should be set first*/
+    public static boolean checkMinLevel(int minlvl){
+        return (_maxlvl >= minlvl);
+    }
+    
+    /** Checks if Maximum Level is Greater than or Equal to Minimum Level*/
+    public static boolean checkMaxLevel(int maxlvl){
+        return (_minlvl <= maxlvl);
+    }
+    
+    /**
+     * Sets team position to the player position. 
+     * @param teamName - String name of the team who's positions are set.
+     * @param activeChar - The L2PcInstance that sets the position.
+     */ 
+    public static void setTeamPos(String teamName, L2PcInstance activeChar){
+        int index = _teams.indexOf(teamName);
+        if (index > -1){
+               _teamsX.set(index, activeChar.getX());
+               _teamsY.set(index, activeChar.getY());
+               _teamsZ.set(index, activeChar.getZ());
+        }
+        else
+               activeChar.sendMessage("No such team name.");
+    }
+    
+    public static void setTeamColor(String teamName, int color){
+        int index = _teams.indexOf(teamName);
+        if (index > -1)
+               _teamColors.set(index, color);
+    }
+    
+    public static void dumpData()
+    {
+        _log.info("");
+        if (!_joining && !_teleport && !_started){
+               _log.info("<<--------------------------------------------->>");
+            _log.info(">> Fortress Siege Engine infos dump (INACTIVE) <<");
+            _log.info("<<-----^-------^^--------^-------^^------^----->>");
+        }
+        else if (_joining && !_teleport && !_started){
+               _log.info("<<-------------------------------------------->>");
+            _log.info(">> Fortress Siege Engine infos dump (JOINING) <<");
+            _log.info("<<----^-------^^--------^-------^^------^----->>");
+        }
+        else if (!_joining && _teleport && !_started){
+               _log.info("<<--------------------------------------------->>");
+            _log.info(">> Fortress Siege Engine infos dump (TELEPORT) <<");
+            _log.info("<<-----^-------^^--------^-------^^------^----->>");
+        }
+        else if (!_joining && !_teleport && _started){
+            _log.info("<<-------------------------------------------->>");
+            _log.info(">> Fortress Siege Engine infos dump (STARTED) <<");
+            _log.info("<<----^-------^^--------^-------^^------^----->>");
+        }
+        _log.info("Fortress Name: " + _eventName);
+        _log.info("Description  : " + _eventDesc);
+        _log.info("Join location: " + _joiningLocationName);
+        _log.info("Minimum level: " + _minlvl);
+        _log.info("Maximum level: " + _maxlvl);
+        _log.info("");
+        _log.info("##########################");
+        _log.info("# _teams(Vector<String>) #");
+        _log.info("##########################");
+        for (String team : _teams)
+           _log.info(team + " Siege Flags Taken :" + _teamPointsCount.get(_teams.indexOf(team)));
+        if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE")){
+            _log.info("");
+            _log.info("#########################################");
+            _log.info("# _playersShuffle(Vector<L2PcInstance>) #");
+            _log.info("#########################################");
+            for (L2PcInstance player : _playersShuffle)
+                if (player != null)
+                    _log.info("Name: " + player.getName());
+        }
+        _log.info("");
+        _log.info("##################################");
+        _log.info("# _players(Vector<L2PcInstance>) #");
+        _log.info("##################################");
+        for (L2PcInstance player : _players)
+            if (player != null)
+                _log.info("Name: " + player.getName() + "   Team: " + player._teamNameFOS);
+        _log.info("");
+        _log.info("#####################################################################");
+        _log.info("# _savePlayers(Vector<String>) and _savePlayerTeams(Vector<String>) #");
+        _log.info("#####################################################################");
+        for (String player : _savePlayers)
+            _log.info("Name: " + player + "    Team: " + _savePlayerTeams.get(_savePlayers.indexOf(player)));
+        _log.info("");
+        _log.info("");
+       System.out.println("**********==Fortress Siege==************");
+       System.out.println("FortressSiege._teamPointsCount:"+_teamPointsCount.toString());
+       System.out.println("FortressSiege._flagSpawn:  "+_flagSpawn.toString());
+       System.out.println("FortressSiege._flagsX:     "+_flagX);
+       System.out.println("FortressSiege._flagsY:     "+_flagY);
+       System.out.println("FortressSiege._flagsZ:     "+_flagZ);
+        System.out.println("************EOF**************\n");
+        System.out.println("");
+    }
+    
+    public static void startJoin(L2PcInstance activeChar)
+    {
+        if (!startJoinOk()){
+            activeChar.sendMessage("Event not setted propertly.");
+            if (_log.isDebugEnabled())_log.debug("Fortress Siege Engine[startJoin(" + activeChar.getName() + ")]: startJoinOk() = false");
+                return;
+        }
+        _joining = true;
+        spawnEventNpc();
+        Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
+    }
+    
+    public static void startJoin()
+    {
+        if (!startJoinOk()){
+            _log.warn("Event not setted propertly.");
+            if (_log.isDebugEnabled())_log.debug("Fortress Siege Engine[startJoin(startJoinOk() = false");
+                return;
+        }
+        _joining = true;
+        spawnEventNpc();
+        Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
+    }
+    
+       public static boolean startJoinOk(){
+        if (_started || _teleport || _joining || _teams.size() > 2 || _teams.size() < 1 || _eventName.equals("") ||
+            _joiningLocationName.equals("") || _eventDesc.equals("") || _npcId == 0 || _flagX == 0 || _flagY == 0 || _flagZ == 0 ||
+            _npcX == 0 || _npcY == 0 || _npcZ == 0 || _rewardId == 0 || _rewardAmount == 0 || _door[0]==0 || _door[1] == 0 || _door[2]==0 || 
+            _door[3]==0 || _door[4]==0 || _door[5]==0 || _teamsX.contains(0) || _teamsY.contains(0) || _teamsZ.contains(0))
+            return false;
+        return true;
+    }
+    
+       //New color Announcements 8D for FOS
+       public static void Announcements(String announce){
+               CreatureSay cs = new CreatureSay(0, 18, "", "Announcements: "+announce);
+               if (!_started && !_teleport)
+                       for (L2PcInstance player: L2World.getInstance().getAllPlayers()){
+                               if (player != null)
+                                       if (player.isOnline()!=0)
+                                               player.sendPacket(cs);
+                       }
+               else{
+                       if (_players!=null && !_players.isEmpty())
+                               for (L2PcInstance player: _players){
+                                       if (player != null)
+                                               if (player.isOnline()!=0)
+                                                       player.sendPacket(cs);
+                               }
+               }
+       }
+    
+    private static void spawnEventNpc(){
+        L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(_npcId);
+        try{
+            _npcSpawn = new L2Spawn(tmpl);
+            _npcSpawn.setLocx(_npcX);
+            _npcSpawn.setLocy(_npcY);
+            _npcSpawn.setLocz(_npcZ);
+            _npcSpawn.setAmount(1);
+            _npcSpawn.setHeading(_npcHeading);
+            _npcSpawn.setRespawnDelay(1);
+            SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
+            _npcSpawn.init();
+            _npcSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
+            _npcSpawn.getLastSpawn().setTitle(_eventName);
+            _npcSpawn.getLastSpawn()._isEventMobFOS = true;
+            _npcSpawn.getLastSpawn().isAggressive();
+            _npcSpawn.getLastSpawn().decayMe();
+            _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
+            _npcSpawn.getLastSpawn().broadcastPacket(new MagicSkillUser(_npcSpawn.getLastSpawn(), _npcSpawn.getLastSpawn(), 1034, 1, 1, 1));
+        }
+        catch (Exception e){
+            _log.error("Fortress Siege Engine[spawnEventNpc(exception: " + e.getMessage());
+        }
+    }
+    
+    public static void unspawnEventNpc(){
+        if (_npcSpawn == null)
+            return;
+        _npcSpawn.getLastSpawn().deleteMe();
+        _npcSpawn.stopRespawn();
+        SpawnTable.getInstance().deleteSpawn(_npcSpawn, true);
+    }    
+
+    /** returns true if max players is higher than, or equal to, participated players */
+    public static boolean checkMaxPlayers(int players){
+        return (_maxPlayers >= players);
+    }
+    
+    /** returns true if there are more players participated than the minimum required */
+    public static boolean checkMinPlayers(int players){
+        return (_minPlayers <= players);
+    }
+    
+       public static void showArtifactHtml(L2PcInstance eventPlayer, String objectId){
+       if (eventPlayer == null)
+               return;
+        try{
+            NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+            TextBuilder replyMSG = new TextBuilder("<html><head><body><center>");
+            replyMSG.append("Sacred Artifact<br><br>");
+            replyMSG.append("<font color=\"00FF00\">" + _eventName + " Artifact</font><br1>");
+            if (eventPlayer._teamNameFOS!=null && eventPlayer._teamNameFOS.equals(_teams.get(1)))
+               replyMSG.append("<font color=\"LEVEL\">This is your Sacred Artifact. Defend it!</font><br1>");
+            else 
+               replyMSG.append("<font color=\"LEVEL\">Use the Seal Of Ruler Skill to Complete this Siege!</font><br1>");
+            if (!_started)
+               replyMSG.append("The Siege is not in progress yet.<br>Wait for a Admin/GM to start the event.<br>");                    
+            replyMSG.append("</center></body></html>");
+            adminReply.setHtml(replyMSG.toString());
+            eventPlayer.sendPacket(adminReply);
+        }
+        catch (Exception e){
+            System.out.println("FOS Engine[showArtifactHtml(" + eventPlayer.getName() + ", " + objectId + ")]: exception: " + e.getStackTrace());
+        }
+    }
+    /** Shows the Event Html to the player, depending on the stage of the event, minimum/maximum players, and more variables */
+    public static void showEventHtml(L2PcInstance eventPlayer, String objectId){
+        try{
+            NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+            TextBuilder replyMSG = new TextBuilder("<html><body>");
+            replyMSG.append("Fortress Siege Event<br><br><br>");
+            replyMSG.append("Current event...<br1>");
+            replyMSG.append("    ... name: <font color=\"00FF00\">" + _eventName + "</font><br1>");
+            replyMSG.append("    ... description: <font color=\"00FF00\">" + _eventDesc + "</font><br><br>");
+            if (!_started && !_joining)
+                replyMSG.append("<center>Wait till the admin/gm starts the participation.</center>");
+            else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && !checkMaxPlayers(_playersShuffle.size())){
+                if (!_started){
+                    replyMSG.append("Currently participated : <font color=\"00FF00\">" + _playersShuffle.size() +".</font><br>");
+                    replyMSG.append("Admin set max players : <font color=\"00FF00\">" + _maxPlayers + "</font><br><br>");
+                    replyMSG.append("<font color=\"FFFF00\">You can't participate in this event.</font><br>");
+                }
+            }
+            else if (eventPlayer.isCursedWeaponEquipped() && !Config.FortressSiege_JOIN_CURSED)
+                replyMSG.append("<font color=\"FFFF00\">You can't participate to this event with a cursed Weapon.</font><br>");
+            else if (!_started && _joining && eventPlayer.getLevel()>=_minlvl && eventPlayer.getLevel()<_maxlvl){
+                if (_players.contains(eventPlayer) || _playersShuffle.contains(eventPlayer) || checkShufflePlayers(eventPlayer)){
+                    if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE"))
+                        replyMSG.append("You participated already in team <font color=\"LEVEL\">" + eventPlayer._teamNameFOS + "</font><br><br>");
+                    else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
+                        replyMSG.append("You participated already!<br><br>");
+                    replyMSG.append("<table border=\"0\"><tr>");
+                    replyMSG.append("<td width=\"200\">Wait util the event starts or</td>");
+                    replyMSG.append("<td width=\"60\"><center><button value=\"Remove\" action=\"bypass -h npc_" + objectId + "_fos_player_leave\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></td>");
+                    replyMSG.append("<td width=\"100\">your participation!</td>");
+                    replyMSG.append("</tr></table>");
+                }
+                else{
+                    replyMSG.append("You want to participate in the event?<br><br>");
+                    replyMSG.append("<td width=\"200\">Admin set Minimum level : <font color=\"00FF00\">" + _minlvl + "</font></td><br>");
+                    replyMSG.append("<td width=\"200\">Admin set Maximum level : <font color=\"00FF00\">" + _maxlvl + "</font></td><br><br>");
+                    if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")){
+                        replyMSG.append("<center><table border=\"0\">");
+                        for (String team : _teams){
+                            replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font> (" + teamPlayersCount(team) + " joined)</td>");
+                            replyMSG.append("<td width=\"60\"><button value=\"Join\" action=\"bypass -h npc_" + objectId + "_fos_player_join " + team + "\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
+                        }
+                        replyMSG.append("</table></center>");
+                    }
+                    else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE")){
+                        replyMSG.append("<center><table border=\"0\">");
+                        for (String team : _teams)
+                            replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font></td>");
+                        replyMSG.append("</table></center><br>");
+                        replyMSG.append("<button value=\"Join\" action=\"bypass -h npc_" + objectId + "_fos_player_join eventShuffle\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
+                        replyMSG.append("Teams will be generated randomly!");
+                    }
+                }
+           }
+             else if (_started && !_joining)
+                replyMSG.append("<center>The Fortress Siege has already begun.</center>");
+            else if (eventPlayer.getLevel()<_minlvl || eventPlayer.getLevel()>_maxlvl ){
+                replyMSG.append("You are level : <font color=\"00FF00\">" + eventPlayer.getLevel() +"</font><br>");
+                replyMSG.append("Admin set Minimum level : <font color=\"00FF00\">" + _minlvl + "</font><br>");
+                replyMSG.append("Admin set Maximum level : <font color=\"00FF00\">" + _maxlvl + "</font><br><br>");
+                replyMSG.append("<font color=\"FFFF00\">You can not participate in this event.</font><br>");
+            }
+            replyMSG.append("</body></html>");
+            adminReply.setHtml(replyMSG.toString());
+            eventPlayer.sendPacket(adminReply);
+            eventPlayer.sendPacket( new ActionFailed() );
+        }
+        catch (Exception e){
+            _log.error("FortressSiege Engine[showEventHtml(" + eventPlayer.getName() + ", " + objectId + ")]: exception" + e.getMessage());
+        }
+    }
+    
+    /** Searches the list of shuffled players to find if the eventPlayer is one of them */
+    public static boolean checkShufflePlayers(L2PcInstance eventPlayer){
+       try{
+               for(L2PcInstance player: _playersShuffle)
+                       if(player==null){
+                               _playersShuffle.remove(player);
+                               continue;
+                       }
+                       else if(player.getObjectId()==eventPlayer.getObjectId()){
+                               eventPlayer._inEventFOS = true;
+                               eventPlayer._countFOSKills = 0;
+                               return true;
+                       }
+                       //Just incase a player got a new objectid after DC or reconnect
+                       else if(player.getName().equals(eventPlayer.getName())){
+                               _playersShuffle.remove(player);
+                               _playersShuffle.add(eventPlayer);
+                               eventPlayer._inEventFOS = true;
+                               eventPlayer._countFOSKills = 0;
+                               return true;
+                       }
+       }
+       catch (Throwable t){System.out.println("Error: FortressSiege.checkShufflePlayers: "+t.toString());}
+       return false;
+    }
+    
+    public static int teamPointsCount(String teamName){
+        int index = _teams.indexOf(teamName);
+        return (index == -1) ? -1 : _teamPointsCount.get(index);
+    }
+    
+    public static void setTeamPointsCount(String teamName, int teamPointCount){
+        int index = _teams.indexOf(teamName);
+        if (index > -1)
+               _teamPointsCount.set(index, teamPointCount);
+    }
+    
+    public static int teamPlayersCount(String teamName){
+        int index = _teams.indexOf(teamName);
+        return (index == -1) ? -1 : _teamPlayersCount.get(index);
+    }
+    
+    public static void setTeamPlayersCount(String teamName, int teamPlayersCount){
+        int index = _teams.indexOf(teamName);
+        if (index > -1)
+               _teamPlayersCount.set(index, teamPlayersCount);
+    }
+    
+    public static void addPlayer(L2PcInstance player, String teamName){
+        if (!_joining || !addPlayerOk(teamName, player))
+            return;
+        if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")){
+            player._teamNameFOS = teamName;
+            _players.add(player);
+            setTeamPlayersCount(teamName, teamPlayersCount(teamName)+1);
+        }
+        else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
+            _playersShuffle.add(player);
+        player._inEventFOS = true;
+        player._countFOSKills = 0;
+    }
+    
+    public static boolean addPlayerOk(String teamName, L2PcInstance eventPlayer){
+       if (teamName == null || eventPlayer == null)
+               return false;
+       if (checkShufflePlayers(eventPlayer) || eventPlayer._inEventFOS){
+               eventPlayer.sendMessage("You already participated in this event!");
+               return false;
+       }       
+       for(L2PcInstance player: _players)
+               if(player.getObjectId()==eventPlayer.getObjectId() || player.getName().equals(eventPlayer.getName())){
+                eventPlayer.sendMessage("You already participated in this event!"); 
+                return false;
+               }
+       if(_players.contains(eventPlayer)){
+            eventPlayer.sendMessage("You already participated in this event!"); 
+            return false;
+       }
+        if (Config.FortressSiege_EVEN_TEAMS.equals("NO"))
+            return true;
+        else if (Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")){
+            boolean allTeamsEqual = true;
+            int countBefore = -1;
+            for (int playersCount : _teamPlayersCount){
+                if (countBefore == -1)
+                    countBefore = playersCount;
+                if (countBefore != playersCount){
+                    allTeamsEqual = false;
+                    break;
+                }
+                countBefore = playersCount;
+            }
+            if (allTeamsEqual)
+                return true;
+            countBefore = Integer.MAX_VALUE;
+            for (int teamPlayerCount : _teamPlayersCount){
+                if (teamPlayerCount < countBefore)
+                    countBefore = teamPlayerCount;
+            }
+            Vector<String> joinableTeams = new Vector<String>();
+            for (String team : _teams){
+                if (teamPlayersCount(team) == countBefore)
+                    joinableTeams.add(team);
+            }
+            if (joinableTeams.contains(teamName))
+                return true;
+        }
+        else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE"))
+            return true;
+        eventPlayer.sendMessage("Too many players in team \"" + teamName + "\"");
+        return false;
+    }
+    
+    public static void removePlayer(L2PcInstance player){
+       if(player._inEventFOS){
+               if(!_joining){
+                       player.getAppearance().setNameColor(player._originalNameColorFOS);
+                       player.setKarma(player._originalKarmaFOS);
+                       player.broadcastUserInfo();
+               }
+               player._teamNameFOS = new String();
+               player._countFOSKills = 0;
+               player._inEventFOS = false;
+               if ((Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")) && _players.contains(player)){
+                       setTeamPlayersCount(player._teamNameFOS, teamPlayersCount(player._teamNameFOS)-1);
+                       _players.remove(player);
+               }
+               else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && (!_playersShuffle.isEmpty() && _playersShuffle.contains(player)))
+                       _playersShuffle.remove(player);
+       }
+    }
+    
+    public static void removeOfflinePlayers(){
+       try{
+               if(_playersShuffle== null || _playersShuffle.isEmpty())
+                       return;
+                       for(L2PcInstance player: _playersShuffle)
+                               if(player==null || player.isOnline()==0)
+                                       _playersShuffle.remove(player);
+       }catch (Throwable t){return;}
+    }
+    
+    public static void teleportStart(){
+        if (!_joining || _started || _teleport)
+            return;
+        if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && checkMinPlayers(_playersShuffle.size())){
+               removeOfflinePlayers();
+               shuffleTeams();
+        }
+        else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && !checkMinPlayers(_playersShuffle.size())){
+            Announcements("Not enough players for this event. Minimum Requested : " + _minPlayers +", Participated : " + _playersShuffle.size());
+            return;
+        }
+        _joining = false;
+        Announcements(_eventName + "(FOS): Teleport to team spot in 10 seconds!");
+        setUserData();
+        ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){
+            public void run(){
+                FortressSiege.sit();
+                FortressSiege.spawnFlag();
+                for (L2PcInstance player : _players){
+                    if (player !=  null){
+                       FortressSiege.setSealOfRuler(player);
+                       if (Config.FortressSiege_ON_START_UNSUMMON_PET){
+                            //Remove Summon's buffs
+                            if (player.getPet() != null){
+                                L2Summon summon = player.getPet();
+                                for (L2Effect e : summon.getAllEffects())
+                                    if (e != null) e.exit();
+                                if (summon instanceof L2PetInstance)
+                                    summon.unSummon(player);
+                            }
+                        }
+                        if (Config.FortressSiege_ON_START_REMOVE_ALL_EFFECTS)
+                            for (L2Effect e : player.getAllEffects())
+                                if (e != null) e.exit();
+                        //Remove player from his party
+                        L2Party party = player.getParty();
+                        if (party != null)
+                            party.removePartyMember(player);
+                        player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)));
+                    }
+                }
+            }
+        }, 10000);
+        _teleport = true;
+    }
+    
+    /** Sets the Player name color and karma, and adds siege properties*/
+    public static void setUserData(){
+        if (_players==null || _players.isEmpty())
+               return;
+       for (L2PcInstance player : _players){
+            if (player==null)
+               continue;
+               player.getAppearance().setNameColor(_teamColors.get(_teams.indexOf(player._teamNameFOS)));
+            player.setKarma(0);
+            player.broadcastUserInfo();
+            setTitleSiegeFlags(player);
+        }
+    }
+    
+    public static void setTitleSiegeFlags(L2PcInstance player){
+        if (player==null)
+               return;
+       if (player._teamNameFOS.equals(_teams.get(0))){ // attacking team = attackers siege flag sign
+               player.setSiegeState((byte)1);
+            player.sendPacket(new UserInfo(player));
+            for (L2PcInstance p : _players)
+               p.sendPacket(new Relationchanged(player, player.getRelation(p), player.isAutoAttackable(p)));
+        }
+        if (player._teamNameFOS.equals(_teams.get(1))){ // defending team = defender siege flag sign
+               player.setSiegeState((byte)2);
+            player.sendPacket(new UserInfo(player));
+            for (L2PcInstance p : _players)
+               p.sendPacket(new Relationchanged(player, player.getRelation(p), player.isAutoAttackable(p)));
+        }      
+    }
+    
+       public static void refreshSkillList(L2PcInstance player){
+               SkillList response = new SkillList();
+               L2Skill[] skills = player.getAllSkills();
+               for (int i = 0; i < skills.length; i++){
+                       L2Skill s = skills[i];
+            if (s == null) 
+                continue;
+                       if (s.getId() > 9000)
+                               continue; // fake skills to change base stats
+                       response.addSkill(s.getId(), s.getLevel(), s.isPassive());
+               }
+               player.sendPacket(response);
+       }
+
+       public static boolean checkIfOkToCastSealOfRule(L2PcInstance player){
+               if (!_started)
+                       return false;
+               if (    player.getTarget() instanceof L2NpcInstance && 
+                               ((L2NpcInstance)player.getTarget())._isFOS_Artifact && 
+                               player._inEventFOS && player._teamNameFOS.equals(_teams.get(0)) )
+                       return true;
+               return false;
+       }
+    
+       public static void setSealOfRuler(L2PcInstance player){
+               try{
+                       L2Skill sealOfRuler = SkillTable.getInstance().getInfo(246, 1);
+                       if (!player.returnSkills().containsValue(sealOfRuler))
+                               player.addSkill(sealOfRuler, false);
+                       else // must keep this skill after the semi-siege
+                               player._FOSRulerSkills = true;
+                       refreshSkillList(player);
+                       player.sendMessage("You have been given the Seal Of Ruler skill for this event.");
+               }catch (Throwable t){return;}
+       }
+       
+       public static void removeSealOfRuler(L2PcInstance player){
+               try{
+                       L2Skill sealOfRuler = SkillTable.getInstance().getInfo(246, 1);
+                       if (player.returnSkills().containsValue(sealOfRuler) && !player._FOSRulerSkills){
+                               player.removeSkill(sealOfRuler, false);
+                               refreshSkillList(player);
+                       }
+                       else
+                               player._FOSRulerSkills = false;
+               }catch (Throwable t){return;}
+       }
+       
+    public static void shuffleTeams(){
+        int teamCount = 0;
+        _teamPlayersCount.set(0,0);
+        _teamPlayersCount.set(1,0);
+        while(true){
+            if (_playersShuffle.isEmpty() || _playersShuffle==null)
+                break;
+            int randomIndex = Rnd.nextInt(_playersShuffle.size());
+            L2PcInstance player = _playersShuffle.get(randomIndex);            
+            player._originalNameColorFOS = player.getAppearance().getNameColor();
+            player._originalKarmaFOS = player.getKarma();
+            player._teamNameFOS = _teams.get(teamCount);
+            _players.add(player);
+            _playersShuffle.remove(randomIndex);
+            _savePlayers.add(player.getName());
+            _savePlayerTeams.add(_teams.get(teamCount));
+            _teamPlayersCount.set(teamCount,_teamPlayersCount.get(teamCount)+1);
+            checkForSameIP(player, teamCount); // Checks for more players from the same IP and puts them in the same team
+            if (teamCount == (_teams.size()-1))
+                       teamCount = 0;
+            else       teamCount++;
+        }
+        //Since we add same IPs to same teams this may cause the teams to be uneven in numbers. 
+        //so we shift amount of players until the teams are even.
+        while (_teamPlayersCount.get(0)>_teamPlayersCount.get(1)+1)
+               movePlayerFromTeamToTeam(0,1);
+        while (_teamPlayersCount.get(1)>_teamPlayersCount.get(0)+1){
+               movePlayerFromTeamToTeam(1,0);
+        }
+    }
+    
+    /**
+     * Moves a player from fromTeam team to toTeam team
+     * @param fromTeam - index of the team to move a player from 
+     * @param toTeam - index of the team to move a player to
+     */
+    private static void movePlayerFromTeamToTeam(int fromTeam, int toTeam){
+       int index = 0;
+       for (L2PcInstance p : _players)
+               if (p._teamNameFOS.equals(_teams.get(fromTeam))){
+                       index = _players.indexOf(p);
+                       break;
+               }
+       L2PcInstance player = _players.get(index);
+       player._teamNameFOS = _teams.get(toTeam);
+       _savePlayerTeams.set(index,_teams.get(toTeam));
+       _teamPlayersCount.set(fromTeam,_teamPlayersCount.get(fromTeam)-1);
+       _teamPlayersCount.set(toTeam,_teamPlayersCount.get(toTeam)+1);
+    }
+    
+    /**
+     * Finds all players from the same IP and places them in the same teams, or if FortressSiege_SAME_IP_PLAYERS_ALLOWED reached, throws them from the event ;]
+     * @param player L2PcInstance of the player that has already been removed from the queue
+     */
+    private static void checkForSameIP(L2PcInstance player, int teamNumber){
+       try{
+       String playerIP = getIP(player);
+       if (playerIP == null)
+               return;
+       for (L2PcInstance same : _playersShuffle){
+               if (same == null){
+                       _playersShuffle.remove(same);
+                       continue;
+               }
+               String sameIP = getIP(same);
+               if (sameIP == null)
+                       continue;
+               if (!sameIP.equals(playerIP))
+                       continue;
+               //Now we are left with equal IPs:
+               if (!Config.FortressSiege_SAME_IP_PLAYERS_ALLOWED){
+                       String msg = "Admin does not allow players from the same IP to participate. Player "+player.getName()+" from IP "+playerIP+" is already joined. So player "+same.getName()+" may not join this event!";
+                       player.sendMessage(msg);
+                       same.sendMessage(msg);
+                       removePlayer(same);
+                       continue;
+               }
+               //So we allow players from the same IP to join the event:
+            same._originalNameColorFOS = same.getAppearance().getNameColor();
+            same._originalKarmaFOS = same.getKarma();
+            same._teamNameFOS = _teams.get(teamNumber);
+            _players.add(same);
+            _playersShuffle.remove(same);
+            _savePlayers.add(same.getName());
+            _savePlayerTeams.add(_teams.get(teamNumber));
+            _teamPlayersCount.set(teamNumber,_teamPlayersCount.get(teamNumber)+1);
+       }
+       }catch(Throwable t){}
+    }
+    
+    private static String getIP(L2PcInstance player){
+               String ip=null;
+       try{
+                       StringTokenizer clientinfo= new StringTokenizer(player.getClient().toString()," ]:-[");
+                       clientinfo.nextToken();
+                       clientinfo.nextToken();
+                       clientinfo.nextToken();
+                       clientinfo.nextToken();
+                       clientinfo.nextToken();
+                       ip = clientinfo.nextToken();
+               }catch (Exception e) {}
+               return ip;
+    }
+    
+    public static void sit(){
+        if (_sitForced)
+               _sitForced = false;
+        else
+               _sitForced = true;  
+        for (L2PcInstance player : _players)
+            if (player != null){
+                if (_sitForced){
+                    player.stopMove(null, false);
+                    player.abortAttack();
+                    player.abortCast();
+                    if (!player.isSitting())
+                        player.sitDown();
+                }
+                else if (player.isSitting())
+                        player.standUp();
+            }
+    }
+    
+    /** It's not alway random, only for the Artifacts that I didn't know where they should go =P */
+    public static int getRandomFlagId(){
+       int[] flagId = {        31508,31509,31541,35514,35515,
+                                               35322,35323,35469,31512                 };
+       if (_eventName.contains("Ketra"))
+               return 31558;
+       else if (_eventName.contains("Varka"))
+               return 31560;
+       else if (_eventName.contains("Saint"))
+               return 31510;
+       return flagId[Rnd.get(flagId.length)];
+    }
+    
+    public static void spawnFlag(){
+               L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(getRandomFlagId());
+               try{
+                       _flagSpawn = new L2Spawn(tmpl);
+                       _flagSpawn.setLocx(_flagX);
+                       _flagSpawn.setLocy(_flagY);
+                       _flagSpawn.setLocz(_flagZ);
+                       _flagSpawn.setAmount(1);
+                       _flagSpawn.setHeading(0);
+                       _flagSpawn.setRespawnDelay(1);
+                       SpawnTable.getInstance().addNewSpawn(_flagSpawn, false);
+                       _flagSpawn.init();
+                       _flagSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
+                       _flagSpawn.getLastSpawn().setTitle(_eventName);
+                       _flagSpawn.getLastSpawn().decayMe();
+                       _flagSpawn.getLastSpawn().spawnMe(_flagSpawn.getLastSpawn().getX(), _flagSpawn.getLastSpawn().getY(), _flagSpawn.getLastSpawn().getZ());
+                       _flagSpawn.getLastSpawn()._isFOS_Artifact = true;
+               }catch(Exception e){
+                               System.out.println("Fortress Siege Engine[spawnAllFlags()]: exception: " + e.getStackTrace());
+                       }
+    }
+   
+    public static void unspawnFlag(){
+       try{
+               if (_flagSpawn == null || _teams == null)
+                       return;
+                       _flagSpawn.getLastSpawn().deleteMe();
+                       _flagSpawn.stopRespawn();
+                       SpawnTable.getInstance().deleteSpawn(_flagSpawn, true);
+       }catch(Throwable t){ return; }
+    }
+    
+    public static void startEvent(L2PcInstance activeChar){
+        if (!startEventOk()){
+            if (_log.isDebugEnabled())_log.debug("Fortress Siege Engine[startEvent(" + activeChar.getName() + ")]: startEventOk() = false");
+            return;
+        }
+        _teleport = false;
+        sit();
+        _started = true;
+        _teamPointsCount.set(1, 1); // Start with 1 point for defenders, then 2 points for each successful siege
+       Announcements(_eventName + "(FOS): Started. Let the battles begin!");
+       try{
+               for (int x=0 ; x<4 ; x++)
+                       if (DoorTable.getInstance().getDoor(_door[x])!=null)
+                               DoorTable.getInstance().getDoor(_door[x]).openMe();
+       }catch(Throwable t){return;}
+    }
+    
+    public static boolean startAutoEvent(){
+        if (!startEventOk()){
+            if (_log.isDebugEnabled())_log.debug("Fortress Siege Engine[startEvent]: startEventOk() = false");
+            return false;
+        }
+        _teleport = false;
+        sit();
+        _started = true;
+        Announcements(_eventName + "(FOS): Started. Let the battles begin!");
+       try{
+               for (int x=0 ; x<4 ; x++)
+                       if (DoorTable.getInstance().getDoor(_door[x])!=null)
+                               DoorTable.getInstance().getDoor(_door[x]).openMe();
+       }catch(Throwable t){return true;}
+        return true;
+    }
+    
+    private static boolean startEventOk(){
+        if (_joining || !_teleport || _started)
+            return false;
+        if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")){
+            if (_teamPlayersCount.contains(0))
+                return false;
+        }
+        return true;
+    }
+    
+    public static void abortEvent(){
+        if (!_joining && !_teleport && !_started)
+            return;
+        if (_joining && !_teleport && !_started){
+               unspawnEventNpc();
+               resetData();
+               _joining = false;
+               Announcements(_eventName + "(FOS): Siege aborted!");
+               return;
+        }
+        _joining = false;
+        _teleport = false;
+        _started = false;
+        unspawnEventNpc();
+        unspawnFlag();
+        Announcements(_eventName + "(FOS): Match aborted!");
+        teleportFinish();
+    }
+    
+    public static void teleportFinish(){
+        Announcements(_eventName + "(FOS): Teleport back to participation NPC in 10 seconds!");
+        ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){
+            public void run(){
+                for (L2PcInstance player : _players){
+                    if (player !=  null && player.isOnline()!=0)
+                        player.teleToLocation(_npcX, _npcY, _npcZ);
+                }
+                resetData();
+            }
+        }, 10000);
+    }
+    
+    public static void finishEvent(){
+        if (!finishEventOk()){
+            if (_log.isDebugEnabled())_log.debug("FortressSiege Engine[finishEvent]: finishEventOk() = false");
+            return;
+        }
+        _started = false;
+        unspawnEventNpc();
+        unspawnFlag();
+        processTopTeam(); // and also divides team points to get the number of successful sieges
+        if (_topScore != 0)
+            playKneelAnimation(_topTeam);
+        if(Config.FortressSiege_ANNOUNCE_TEAM_STATS){
+            Announcements(_eventName + " Team Statistics:");
+            Announcements("Team: " + _teams.get(0) + " - Successful Sieges: " + _teamPointsCount.get(0));
+            Announcements("Team: " + _teams.get(1) + " - Successful Sieges: " + _teamPointsCount.get(1));
+        }
+        teleportFinish();
+    }
+    
+    private static boolean finishEventOk(){
+        return(_started);
+    }
+    
+    public static void processTopTeam(){
+       if (_teamPointsCount.get(0)<2 && _teamPointsCount.get(1)<2){ // 2 loosing teams
+               _teamPointsCount.set(0,0);
+               _teamPointsCount.set(1,0);
+               Announcements(_eventName + "(FOS): No Successful Engravings were made. "+_teams.get(1)+" succeeded to protect the Fortress!");
+               Announcements(_eventName + "(FOS): "+_teams.get(1)+" wins!");
+               rewardTeam(_teams.get(1));
+               return;
+       }
+       else{
+               _teamPointsCount.set(0,(_teamPointsCount.get(0)/2)); // Needed to decrease the attacker point
+               _teamPointsCount.set(1,(_teamPointsCount.get(1)/2)); // Remember that they get 2 points for each siege!
+       }
+       if (_teamPointsCount.get(0)>_teamPointsCount.get(1)){
+               Announcements(_eventName + "(FOS): Team " + _teams.get(0) + " wins the match, with " + _teamPointsCount.get(0) + " successful sieges!");
+               rewardTeam(_teams.get(0));
+       }
+       else if (_teamPointsCount.get(1)>_teamPointsCount.get(0)){
+               Announcements(_eventName + "(FOS): Team " + _teams.get(1) + " wins the match, with " + _teamPointsCount.get(1) + " successful sieges!");
+               rewardTeam(_teams.get(1));
+       }
+       else{  
+               Announcements(_eventName + "(FOS): Maximum Successful sieges : " + _teamPointsCount.get(0) + " Sieges! It's a tie.");
+               rewardTeam(null);
+       }
+    }
+    
+    /** In this event if both team made EQUAL successful sieges, prize is divided into 2 ONLY if it's stackable */
+    public static void rewardTeam(String teamName){
+       if (!ItemTable.getInstance().createDummyItem(_rewardId).isStackable() && teamName==null)
+               return; // If the prize is not stackable, and no Winning team, return
+       if (teamName == null)
+               Announcements(_eventName + "(FOS): The prize will be divided between both teams.");
+       int stackableCount = _rewardAmount;
+       for (L2PcInstance player : _players){
+            if (player != null){
+                if ((teamName == null || player._teamNameFOS.equals(teamName)) && (player._countFOSKills>0 || Config.FortressSiege_PRICE_NO_KILLS)){
+                       _rewardAmount = stackableCount; 
+                       if (teamName==null && _rewardAmount>1)
+                       _rewardAmount = (_rewardAmount+1)/2;
+                       PcInventory inv = player.getInventory();
+                    if (ItemTable.getInstance().createDummyItem(_rewardId).isStackable())
+                        inv.addItem("FortressSiege: " + _eventName, _rewardId, _rewardAmount, player, null);
+                    else
+                        for (int i=0;i<=_rewardAmount-1;i++)
+                            inv.addItem("FortressSiege: " + _eventName, _rewardId, 1, player, null);
+                    SystemMessage sm;
+                    if (_rewardAmount > 1){
+                        sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
+                        sm.addItemName(_rewardId);
+                        sm.addNumber(_rewardAmount);
+                        player.sendPacket(sm);
+                    }
+                    else{
+                        sm = new SystemMessage(SystemMessageId.EARNED_ITEM);
+                        sm.addItemName(_rewardId);
+                        player.sendPacket(sm);
+                    }
+                    StatusUpdate su = new StatusUpdate(player.getObjectId());
+                    su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
+                    player.sendPacket(su);
+                    NpcHtmlMessage nhm = new NpcHtmlMessage(5);
+                    TextBuilder replyMSG = new TextBuilder("");
+                    replyMSG.append("<html><body>Your team did a good job. Look in your inventory for the reward.</body></html>");
+                    nhm.setHtml(replyMSG.toString());
+                    player.sendPacket(nhm);
+                               ItemList il = new ItemList(player, true);
+                               player.sendPacket(il);
+                    // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
+                    player.sendPacket( new ActionFailed() );
+                }
+            }
+        }
+    }
+    
+    public static void playKneelAnimation(String teamName){
+       for (L2PcInstance player : _players)
+               if (player != null && player.isOnline()!=0){
+                if (!player._teamNameFOS.equals(teamName)){
+                       player.broadcastPacket(new SocialAction(player.getObjectId(), 7));
+                       player.broadcastPacket(new SocialAction(player.getObjectId(), 13));
+                }
+                else{
+                       player.broadcastPacket(new SocialAction(player.getObjectId(), 16));
+                       player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
+                }
+            }
+    }
+    
+    public static void doSwap(){
+       sit();//stop everything;
+       healDoors(); // restore all doors
+       closeDoors(); // close all inner doors
+       Announcements(_eventName + "(FOS): Teleport to team spots. In 20 seconds the Siege continues!");//announce to players
+       _teamPointsCount.set(0, _teamPointsCount.get(0)+2);//give points to the attacking side
+       String team = _teams.get(0);//swap teams
+       _teams.set(0,_teams.get(1));
+       _teams.set(1,team);
+       int points = _teamPointsCount.get(0);//swap points!
+       _teamPointsCount.set(0,_teamPointsCount.get(1));
+       _teamPointsCount.set(1,points);
+       for (L2PcInstance player : _players)//swap title flags
+               setTitleSiegeFlags(player);
+               try{
+                       for (int x=0 ; x<4 ; x++)
+                       if (DoorTable.getInstance().getDoor(_door[x])!=null)
+                               DoorTable.getInstance().getDoor(_door[x]).closeMe();
+               }catch(Throwable t){}
+               for (L2PcInstance player : _players)
+                       player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)), false);
+               ThreadPoolManager.getInstance().scheduleGeneral(new Runnable(){//teleport players back to reverse positions
+               public void run(){
+               try{
+                       for (int x=0 ; x<4 ; x++)
+                               if (DoorTable.getInstance().getDoor(_door[x])!=null)
+                                       DoorTable.getInstance().getDoor(_door[x]).openMe();
+               }catch(Throwable t){}                           
+                       sit();
+                       if (Rnd.get(30)<11)
+                               Announcements(_eventName + "(FOS): Let the sieges continue!");//announce to players
+                       else if (Rnd.get(30)<11)
+                               Announcements(_eventName + "(FOS): ...and the battles begin again!");//announce to players
+                       else
+                               Announcements(_eventName + "(FOS): May the best team win!");//announce to players
+               }
+       }, 20000);
+    }
+    
+    private static void closeDoors(){
+       try{
+                       for (int x=0 ; x<6 ; x++)
+                       if (_door[x]<=0)
+                               continue;
+                       else if (DoorTable.getInstance().getDoor(_door[x])!=null){
+                               DoorTable.getInstance().getDoor(_door[x]).closeMe();
+                       }
+       }catch(Throwable t){return;}
+    }
+    
+    private static void healDoors(){
+       try{
+                       for (int x=0 ; x<6 ; x++)
+                       if (_door[x]<=0)
+                               continue;
+                       else if (DoorTable.getInstance().getDoor(_door[x])!=null){
+                               DoorTable.getInstance().getDoor(_door[x]).doRevive();
+                               DoorTable.getInstance().getDoor(_door[x]).spawnMe();
+                               DoorTable.getInstance().getDoor(_door[x]).getStatus().setCurrentHp(DoorTable.getInstance().getDoor(_door[x]).getMaxHp());
+                       }
+       }catch(Throwable t){return;}
+    }
+    
+    public static boolean isDoorAttackable(int id,L2Character attacker){
+        if (!_started)
+                return false;
+       for (int doorId : _door){
+               if (doorId!=id)
+                       continue;
+               if (attacker instanceof L2PcInstance && ((L2PcInstance)attacker)._inEventFOS)
+                       return true;
+               else if (attacker instanceof L2Summon && ((L2Summon)attacker).getOwner()._inEventFOS)
+                       return true;
+               else if (attacker instanceof L2PetInstance && ((L2PetInstance)attacker).getOwner()._inEventFOS)
+                       return true;
+       }
+       return false;
+    }
+    
+    /** Returns true if the L2Character is in the protected siege spawn zone (both attacker/defender spawns are protected) */
+    public static boolean inProtectedZone(L2Character cha, L2PcInstance attacker){
+       if (cha == null || attacker == null)
+               return false;
+       //This is the function: isInsideRadius(object.getX(), object.getY(), object.getZ(), radius, checkZ, strictCheck); (corners are left unchecked)
+       if (    cha.isInsideRadius(eventCenterX, eventCenterY, eventCenterZ, 584, true, true) ||
+                       cha.isInsideRadius(_teamsX.get(0), _teamsY.get(0), _teamsZ.get(0), 300, true, true) ){  
+           attacker.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
+           attacker.getAI().notifyEvent(CtrlEvent.EVT_CANCEL);
+           attacker.sendPacket(new ActionFailed());
+               return true;
+       }
+       return false;
+    }
+    
+    public static synchronized void addDisconnectedPlayer(L2PcInstance player){
+       if ((Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && (_teleport || _started)) || (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE")  && (_teleport || _started))){
+            if (Config.FortressSiege_ON_START_REMOVE_ALL_EFFECTS)
+                for (L2Effect e : player.getAllEffects())
+                    if (e != null)
+                        e.exit();
+            player._teamNameFOS = _savePlayerTeams.get(_savePlayers.indexOf(player.getName()));
+            player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)));
+            if(!_players.contains(player.getName()))
+                _players.add(player);
+            player._originalNameColorFOS = player.getAppearance().getNameColor();
+            player._originalKarmaFOS = player.getKarma();
+            player._inEventFOS = true;
+            player._countFOSKills = 0;
+            player.getAppearance().setNameColor(_teamColors.get(_teams.indexOf(player._teamNameFOS)));
+            player.setKarma(0);
+            setSealOfRuler(player);
+            setTitleSiegeFlags(player);
+            player.broadcastUserInfo();
+        }
+    }
+    
+    /**************************-- Auto Events Engine --******************************/
+    
+    /** Starts the autoevent engine, generates a random event and runs it */
+    public static void autoEvent(){
+       if(startAutoJoin()){
+               if(_joinTime > 0) waiter(_joinTime * 60 * 1000); // minutes for join event
+               else if(_joinTime <= 0){
+                       abortEvent();
+                       return;
+               }
+               if(teleportAutoStart()){
+                       waiter(1 * 60 * 1000); // 1 min wait time untill start fight after teleported
+                       if(startAutoEvent()){
+                               waiter(_eventTime * 60 * 1000); // minutes for event time
+                               finishEvent();
+                       }
+               }
+               else if (!teleportAutoStart())
+                       abortEvent();
+       }
+    }
+    
+    public static boolean teleportAutoStart()
+    {
+        if (!_joining || _started || _teleport)
+            return false;
+        if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && checkMinPlayers(_playersShuffle.size())){
+               removeOfflinePlayers();
+                       shuffleTeams();
+        }
+        else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE") && !checkMinPlayers(_playersShuffle.size())){
+               Announcements("Not enough players for event. Min Requested : " + _minPlayers +", Participating : " + _playersShuffle.size());
+            return false;
+        }
+        _joining = false;
+        Announcements(_eventName + "(FOS): Teleport to team spot in 10 seconds!");
+        setUserData();
+        ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+        {
+            public void run()
+            {
+                sit();
+                spawnFlag();
+                for (L2PcInstance player : _players){
+                    if (player !=  null){
+                       setSealOfRuler(player);
+                       if (Config.FortressSiege_ON_START_UNSUMMON_PET){
+                            //Remove Summon's buffs
+                            if (player.getPet() != null){
+                                L2Summon summon = player.getPet();
+                                for (L2Effect e : summon.getAllEffects())
+                                    if (e != null) e.exit();
+                                if (summon instanceof L2PetInstance)
+                                    summon.unSummon(player);
+                            }
+                        }
+                        if (Config.FortressSiege_ON_START_REMOVE_ALL_EFFECTS){
+                            for (L2Effect e : player.getAllEffects())
+                               if (e != null) e.exit();
+                        }
+                        //Remove player from his party
+                        if (player.getParty() != null){
+                            L2Party party = player.getParty();
+                            party.removePartyMember(player);
+                        }
+                        player.teleToLocation(_teamsX.get(_teams.indexOf(player._teamNameFOS)), _teamsY.get(_teams.indexOf(player._teamNameFOS)), _teamsZ.get(_teams.indexOf(player._teamNameFOS)));
+                    }
+                }
+            }
+        }, 10000);
+        _teleport = true;
+        return true;
+    }
+    
+    public static boolean startAutoJoin(){
+        if (!startJoinOk()){
+            if (_log.isDebugEnabled())_log.debug("FortressSiege Engine[startJoin]: startJoinOk() = false");
+                return false;
+        }
+        _joining = true;
+        spawnEventNpc();
+        Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
+        return true;
+    }
+    
+    private static void waiter(long interval){
+               long startWaiterTime = System.currentTimeMillis();
+               int seconds = (int)(interval / 1000);
+               while (startWaiterTime + interval > System.currentTimeMillis()){
+                       seconds--; // here because we don't want to see two time announce at the same time
+                       if (!_joining && !_started && !_teleport)
+                               break;
+                       if (_joining || _started || _teleport){
+                               switch (seconds){
+                                       case 3600: // 1 hour left
+                                               if (_joining){
+                                                       Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
+                                                       Announcements("Fortress Siege Event: " + seconds / 60 / 60 + " hour(s) till registration close!");
+                                               }
+                                               else if (_started)
+                                                       Announcements("Fortress Siege Event: " + seconds / 60 / 60 + " hour(s) till event finish!");
+                                               break;
+                                       case 1800: // 30 minutes left
+                                       case 900: // 15 minutes left
+                                       case 600: //  10 minutes left 
+                                       case 300: // 5 minutes left
+                                       case 240: // 4 minutes left
+                                       case 180: // 3 minutes left
+                                       case 120: // 2 minutes left
+                                       case 60: // 1 minute left
+                                               if (_joining){
+                                                       removeOfflinePlayers();
+                                                       Announcements(_eventName + "(FOS): Joinable in " + _joiningLocationName + "!");
+                                                       Announcements("Fortress Siege Event: " + seconds / 60 + " minute(s) till registration close!");
+                                               }
+                                               else if (_started)
+                                                       Announcements("Fortress Siege Event: " + seconds / 60 + " minute(s) till event finish!");
+                                               break;
+                                       case 30: // 30 seconds left
+                                       case 15: // 15 seconds left
+                                       case 10: // 10 seconds left
+                                       case 5: // 5 seconds left
+                                       case 4: // 4 seconds left
+                                       case 3: // 3 seconds left
+                                       case 2: // 2 seconds left
+                                       case 1: // 1 seconds left
+                                               if (_joining)
+                                                       Announcements("Fortress Siege Event: " + seconds + " second(s) till registration close!");
+                                               else if (_teleport)
+                                                       Announcements("Fortress Siege Event: " + seconds + " seconds(s) till start fight!");
+                                               else if (_started)
+                                                       Announcements("Fortress Siege Event: " + seconds + " second(s) till event finish!");
+                                               
+                                               break;
+                               }
+                       }
+                       long startOneSecondWaiterStartTime = System.currentTimeMillis();
+                       // only the try catch with Thread.sleep(1000) give bad countdown on high wait times
+                       while (startOneSecondWaiterStartTime + 1000 > System.currentTimeMillis()){
+                               try{
+                                       Thread.sleep(1);
+                               }
+                               catch (InterruptedException ie)
+                               {}
+                       }
+               }
+       }
+}
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/voicedcommandhandlers/VoicedAIOCmd.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/voicedcommandhandlers/VoicedAIOCmd.java (revision 24)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/voicedcommandhandlers/VoicedAIOCmd.java (revision 26)
@@ -26,4 +26,5 @@
 import com.it.br.gameserver.handler.IVoicedCommandHandler;
 import com.it.br.gameserver.model.actor.instance.L2PcInstance;
+import com.it.br.gameserver.model.entity.TvTEvent;
 import com.it.br.gameserver.serverpackets.NpcHtmlMessage;
 
@@ -140,5 +141,5 @@
                        return false;
                }
-            else if (Config.TVT_EVENT_ENABLED && TvTEvet.isStarted() && TvTEvent.isPlayerParticipant(activeChar.getObjectId())) 
+            else if (Config.TVT_EVENT_ENABLED && TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(activeChar.getObjectId())) 
             {
                 activeChar.sendMessage("You can't use this command while you are in the TvTEvent.");
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/voicedcommandhandlers/loc.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/voicedcommandhandlers/loc.java (revision 24)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/voicedcommandhandlers/loc.java (revision 26)
@@ -22,4 +22,5 @@
 import com.it.br.gameserver.handler.IVoicedCommandHandler;
 import com.it.br.gameserver.model.actor.instance.L2PcInstance;
+import com.it.br.gameserver.model.entity.TvTEvent;
 
 /**
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/AdminCommandHandler.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/AdminCommandHandler.java (revision 1)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/AdminCommandHandler.java (revision 26)
@@ -86,7 +86,9 @@
 import com.it.br.gameserver.handler.admincommandhandlers.AdminUnblockIp;
 import com.it.br.gameserver.handler.admincommandhandlers.AdminZone;
+import com.it.br.gameserver.handler.admincommandhandlers.AdminFortressSiegeEngine;
 import com.it.br.gameserver.model.actor.instance.L2PcInstance;
+
 /**
-* update by Guma
+* update by Kinho!
 */
 /**
@@ -178,4 +180,5 @@
         registerAdminCommandHandler(new AdminHero());
         registerAdminCommandHandler(new AdminNoble());
+        registerAdminCommandHandler(new AdminFortressSiegeEngine());
                _log.config("AdminCommandHandler: Loading " + _datatable.size() + " handlers.");
        }
Index: /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/admincommandhandlers/AdminFortressSiegeEngine.java
===================================================================
--- /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/admincommandhandlers/AdminFortressSiegeEngine.java (revision 26)
+++ /Trunk/L2JSuper_CORE/java/com/it/br/gameserver/handler/admincommandhandlers/AdminFortressSiegeEngine.java (revision 26)
@@ -0,0 +1,435 @@
+/*
+ * 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.
+ *
+ * The GNU General Public License - GNU Project - Free Software Foundation (FSF)
+ */
+
+/**
+ * Fortress Siege Event
+ * @author Darki699
+ * @comment: So many fortresses, I hate to see them go to waste ;]
+ */
+
+package com.it.br.gameserver.handler.admincommandhandlers;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import com.it.br.util.Rnd;
+import javolution.text.TextBuilder;
+import com.it.br.Config;
+import com.it.br.L2DatabaseFactory;
+import com.it.br.gameserver.handler.IAdminCommandHandler;
+import com.it.br.gameserver.datatables.ItemTable;
+import com.it.br.gameserver.model.L2Object;
+import com.it.br.gameserver.model.actor.instance.L2DoorInstance;
+import com.it.br.gameserver.model.actor.instance.L2PcInstance;
+import com.it.br.gameserver.model.entity.FortressSiege;
+import com.it.br.gameserver.serverpackets.NpcHtmlMessage;
+
+/**
+ * Fortress Siege Event
+ * @author Darki699
+ * @comment: So many fortresses, I hate to see them go to waste ;]
+ */
+
+public class AdminFortressSiegeEngine implements IAdminCommandHandler {
+
+ private static final String[] ADMIN_COMMANDS = {"admin_fos",
+                                           "admin_fos_name", "admin_fos_desc", "admin_fos_join_loc","admin_fos_tele1","admin_fos_tele2",
+                                           "admin_fos_minlvl", "admin_fos_maxlvl","admin_fos_door6","admin_fos_tele3",
+                                           "admin_fos_npc", "admin_fos_npc_pos", "admin_fos_door1","admin_fos_door2","admin_fos_door3",
+                                           "admin_fos_reward", "admin_fos_reward_amount","admin_fos_door4","admin_fos_door5",
+                                           "admin_fos_teamname", "admin_fos_team_pos", "admin_fos_team_color","admin_fos_team_flag","admin_fos_team_cent",
+                                           "admin_fos_join", "admin_fos_teleport", "admin_fos_start", "admin_fos_abort", "admin_fos_finish",
+                                           "admin_fos_sit", "admin_fos_dump", "admin_fos_save", "admin_fos_load", "admin_fos_jointime", 
+                                           "admin_fos_eventtime", "admin_fos_autoevent","admin_fos_minplayers","admin_fos_maxplayers"};
+ 
+ private static final int REQUIRED_LEVEL = 100;
+
+    public boolean useAdminCommand(String command, L2PcInstance activeChar)
+    {
+        try{
+       if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM())) return false;
+        if (command.equals("admin_fos"))
+            showMainPage(activeChar);
+        else if (command.startsWith("admin_fos_name ")){
+            FortressSiege._eventName = command.substring(15);
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_tele1")){
+               activeChar.teleToLocation(FortressSiege._teamsX.get(0), FortressSiege._teamsY.get(0), FortressSiege._teamsZ.get(0));
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_tele2")){
+               activeChar.teleToLocation(FortressSiege._teamsX.get(1), FortressSiege._teamsY.get(1), FortressSiege._teamsZ.get(1));
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_tele3")){
+               activeChar.teleToLocation(FortressSiege._flagX, FortressSiege._flagY, FortressSiege._flagZ);
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_desc ")){
+            FortressSiege._eventDesc = command.substring(15);
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_minlvl ")){
+            if (!FortressSiege.checkMinLevel(Integer.valueOf(command.substring(17))))
+                return false;
+            FortressSiege._minlvl = Integer.valueOf(command.substring(17));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_door")){
+            L2Object target = activeChar.getTarget();
+            if (target==null)
+               activeChar.sendMessage("Nothing targeted!");
+            else if (target instanceof L2DoorInstance){
+               int doorId = ((L2DoorInstance)target).getDoorId();
+               if (doorId>0)
+                       FortressSiege._door[Integer.valueOf(command.substring(14))-1]=doorId;
+            }
+            else
+                activeChar.sendMessage("Incorrect target.");
+            showMainPage(activeChar);                  
+        }
+        else if (command.equals("admin_fos_team_flag")){
+            FortressSiege._flagX = activeChar.getX();
+            FortressSiege._flagY = activeChar.getY();
+            FortressSiege._flagZ = activeChar.getZ();
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_team_cent")){
+            FortressSiege.eventCenterX = activeChar.getX();
+            FortressSiege.eventCenterY = activeChar.getY();
+            FortressSiege.eventCenterZ = activeChar.getZ();
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_maxlvl ")){
+            if (!FortressSiege.checkMaxLevel(Integer.valueOf(command.substring(17))))
+                return false;
+            FortressSiege._maxlvl = Integer.valueOf(command.substring(17));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_minplayers ")){
+            FortressSiege._minPlayers = Integer.valueOf(command.substring(21));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_maxplayers ")){
+            FortressSiege._maxPlayers = Integer.valueOf(command.substring(21));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_join_loc ")){
+            FortressSiege._joiningLocationName = command.substring(19);
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_npc ")){
+            FortressSiege._npcId = Integer.valueOf(command.substring(14));
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_npc_pos")){
+            FortressSiege._npcX = activeChar.getX();
+            FortressSiege._npcY = activeChar.getY();
+            FortressSiege._npcZ = activeChar.getZ();
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_reward ")){
+            FortressSiege._rewardId = Integer.valueOf(command.substring(17));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_reward_amount ")){
+            FortressSiege._rewardAmount = Integer.valueOf(command.substring(24));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_jointime ")){
+            FortressSiege._joinTime = Integer.valueOf(command.substring(19));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_eventtime ")){
+            FortressSiege._eventTime = Integer.valueOf(command.substring(20));
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_teamname ")){
+            String[] params;
+            params = command.split(" ");
+            if (params.length < 3){
+               activeChar.sendMessage("Wrong usage: //fos_teamname <1 or 2> <team name>");
+               return false;
+            }
+            FortressSiege._teams.set(Integer.valueOf(params[1])-1, params[2]);
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_team_pos ")){
+            String teamName = command.substring(19);
+            FortressSiege.setTeamPos(teamName, activeChar);
+            showMainPage(activeChar);
+        }
+        else if (command.startsWith("admin_fos_team_color ")){
+            String[] params;
+            params = command.split(" ");
+            if (params.length < 3){
+                activeChar.sendMessage("Wrong usage: //fos_team_color <colorHex> <team name>");
+                return false;
+            }
+            FortressSiege.setTeamColor(command.substring(params[0].length()+params[1].length()+2), Integer.decode("0x" + params[1]));
+            showMainPage(activeChar);
+        }
+        else if(command.equals("admin_fos_join"))
+        {
+               FortressSiege.startJoin(activeChar);
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_teleport"))
+        {
+            FortressSiege.teleportStart();
+            showMainPage(activeChar);
+        }
+        else if(command.equals("admin_fos_start"))
+        {
+               FortressSiege.startEvent(activeChar);
+            showMainPage(activeChar);
+        }
+        else if(command.equals("admin_fos_abort"))
+        {
+            activeChar.sendMessage("Aborting event");
+            FortressSiege.abortEvent();
+            showMainPage(activeChar);
+        }
+        else if(command.equals("admin_fos_finish"))
+        {
+            FortressSiege.finishEvent();
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_sit"))
+        {
+            FortressSiege.sit();
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_load")){
+               showSiegeLoadPage(activeChar,false);
+        }
+        else if (command.startsWith("admin_fos_load ")){
+               String siegeName = command.substring(15);
+               FortressSiege.loadData(siegeName);
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_autoevent"))
+        {
+               if (FortressSiege._joining || FortressSiege._started || FortressSiege._teleport){
+                       activeChar.sendMessage("Event is already in progress. Wait until the event ends or Abort it.");
+                       return false;
+               }
+               if(FortressSiege._joinTime>0 && FortressSiege._eventTime>0){
+                       FortressSiege.autoEvent();
+               }
+               else
+                       activeChar.sendMessage("Wrong usage: join time or event time invallid.");
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_save"))
+        {
+            FortressSiege.saveData();
+            showMainPage(activeChar);
+        }
+        else if (command.equals("admin_fos_dump")){
+            FortressSiege.dumpData();
+            showMainPage(activeChar);
+        }
+        return true;
+        }catch(Throwable t){
+               activeChar.sendMessage("The command was not used correctly:"+t.toString());
+               return false;
+        }
+    }
+
+    public String[] getAdminCommandList()
+    {
+        return ADMIN_COMMANDS;
+    }
+
+    private boolean checkLevel(int level) 
+    {
+        return (level >= REQUIRED_LEVEL);
+    }
+
+    public void showSiegeLoadPage(L2PcInstance activeChar,boolean autoLoad){
+       NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+        TextBuilder replyMSG = new TextBuilder("<html><body>");
+        replyMSG.append("<center><font color=\"LEVEL\">[FortressSiege Engine by Darki699]</font></center><br><br><br>");
+       java.sql.Connection con = null;
+        try{
+            PreparedStatement statement;
+            ResultSet rs;
+            con = L2DatabaseFactory.getInstance().getConnection();
+            statement = con.prepareStatement("Select * from fortress_siege");
+            rs = statement.executeQuery();
+            String _eventName="";
+            while(rs.next()){
+                _eventName = rs.getString("eventName");
+                if (autoLoad && Rnd.get(100)<10){
+                       statement.close();
+                       break;
+                }
+                rs.getString("eventDesc");rs.getString("joiningLocation");rs.getInt("minlvl");
+                rs.getInt("maxlvl");rs.getInt("npcId");rs.getInt("npcX");rs.getInt("npcY");
+                rs.getInt("npcZ");rs.getInt("npcHeading");rs.getInt("rewardId");rs.getInt("rewardAmount"); 
+                rs.getInt("joinTime");rs.getInt("eventTime");rs.getInt("minPlayers");rs.getInt("maxPlayers");
+                rs.getInt("centerX");rs.getInt("centerY");rs.getInt("centerZ");rs.getString("team1Name");
+                rs.getInt("team1X");rs.getInt("team1Y");rs.getInt("team1Z");rs.getInt("team1Color");
+                rs.getString("team2Name");rs.getInt("team2X");rs.getInt("team2Y");rs.getInt("team2Z");
+                rs.getInt("team2Color");rs.getInt("flagX");rs.getInt("flagY");rs.getInt("flagZ");                
+                replyMSG.append("<button value=\"Load\" action=\"bypass -h admin_fos_load "+_eventName+"\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"> ");
+                if (FortressSiege._eventName!=null && FortressSiege._eventName.equals(_eventName))
+                       replyMSG.append("<font color=\"FF0000\">"+_eventName+"</font><font color=\"LEVEL\"><-- *loaded*</font><br1>");
+                else
+                       replyMSG.append("<font color=\"00FF00\">"+_eventName+"</font><br1>");
+            }
+            statement.close();
+            if (autoLoad){
+               FortressSiege.loadData(_eventName);
+                if (activeChar!=null) showMainPage(activeChar);
+               return;
+            }
+            replyMSG.append("</body></html>");
+            adminReply.setHtml(replyMSG.toString());
+            if (activeChar!=null) activeChar.sendPacket(adminReply);            
+        }catch (Exception e){
+            System.out.println("Exception: AdminFortressSiegeEngine.showSiegeLoadPage: " + e.getMessage());
+        }finally {try { con.close(); } catch (Exception e) {}}
+
+    }
+    public void showMainPage(L2PcInstance activeChar){
+
+       NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+        TextBuilder replyMSG = new TextBuilder("<html><body>");
+        try{
+        replyMSG.append("<center><font color=\"LEVEL\">[FortressSiege Engine by Darki699]</font></center><br><br><br>");
+        replyMSG.append("<table><tr><td><edit var=\"input1\" width=\"125\"></td><td><edit var=\"input2\" width=\"125\"></td></tr></table>");
+        replyMSG.append("<table border=\"0\"><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Name\" action=\"bypass -h admin_fos_name $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Description\" action=\"bypass -h admin_fos_desc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Join Location\" action=\"bypass -h admin_fos_join_loc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Max lvl\" action=\"bypass -h admin_fos_maxlvl $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Min lvl\" action=\"bypass -h admin_fos_minlvl $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Max players\" action=\"bypass -h admin_fos_maxplayers $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Min players\" action=\"bypass -h admin_fos_minplayers $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"NPC\" action=\"bypass -h admin_fos_npc $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"NPC Pos\" action=\"bypass -h admin_fos_npc_pos\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Reward\" action=\"bypass -h admin_fos_reward $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Reward Amount\" action=\"bypass -h admin_fos_reward_amount $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Join Time\" action=\"bypass -h admin_fos_jointime $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Event Time\" action=\"bypass -h admin_fos_eventtime $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Team Name\" action=\"bypass -h admin_fos_teamname $input1 $input2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Team Color\" action=\"bypass -h admin_fos_team_color $input1 $input2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Team Pos\" action=\"bypass -h admin_fos_team_pos $input1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Siege Flag\" action=\"bypass -h admin_fos_team_flag\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Central\" action=\"bypass -h admin_fos_team_cent\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td></td></tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Join\" action=\"bypass -h admin_fos_join\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Teleport\" action=\"bypass -h admin_fos_teleport\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Start\" action=\"bypass -h admin_fos_start\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Abort\" action=\"bypass -h admin_fos_abort\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Finish\" action=\"bypass -h admin_fos_finish\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Sit Force\" action=\"bypass -h admin_fos_sit\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Dump\" action=\"bypass -h admin_fos_dump\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Save\" action=\"bypass -h admin_fos_save\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Load\" action=\"bypass -h admin_fos_load\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Auto Event\" action=\"bypass -h admin_fos_autoevent\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><br>");
+        replyMSG.append("Doors:<br1><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Outer #1\" action=\"bypass -h admin_fos_door5\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Outer #2\" action=\"bypass -h admin_fos_door6\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td></td></tr></table><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Inner #1\" action=\"bypass -h admin_fos_door1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Inner #2\" action=\"bypass -h admin_fos_door2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Inner #3\" action=\"bypass -h admin_fos_door3\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Inner #4\" action=\"bypass -h admin_fos_door4\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td></td><td></td></tr></table><br><table><tr>");
+        replyMSG.append("<td width=\"100\"><button value=\"Tele>Team1\" action=\"bypass -h admin_fos_tele1\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Tele>Team2\" action=\"bypass -h admin_fos_tele2\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("<td width=\"100\"><button value=\"Tele>Artf\" action=\"bypass -h admin_fos_tele3\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
+        replyMSG.append("</tr></table><br><br>");
+        replyMSG.append("Current event...<br1>");
+        replyMSG.append("    ... name: <font color=\"00FF00\">" + FortressSiege._eventName + "</font><br1>");
+        replyMSG.append("    ... description: <font color=\"00FF00\">" + FortressSiege._eventDesc + "</font><br1>");
+        replyMSG.append("    ... joining location name: <font color=\"00FF00\">" + FortressSiege._joiningLocationName + "</font><br1>");
+        replyMSG.append("    ... joining NPC ID: <font color=\"00FF00\">" + FortressSiege._npcId + " on pos " + FortressSiege._npcX + "," + FortressSiege._npcY + "," + FortressSiege._npcZ + "</font><br1>");
+        replyMSG.append("    ... reward ID  : <font color=\"00FF00\">" + FortressSiege._rewardId + "</font><br1>");
+        if ( ItemTable.getInstance().getTemplate(FortressSiege._rewardId) != null)
+               replyMSG.append("    ... reward Item: <font color=\"00FF00\">" +  ItemTable.getInstance().getTemplate(FortressSiege._rewardId).getName() + "</font><br1>");
+        else
+               replyMSG.append("    ... reward Item: <font color=\"00FF00\">(unknown)</font><br1>");
+        replyMSG.append("    ... reward Amount: <font color=\"00FF00\">" + FortressSiege._rewardAmount + "</font><br><br>");
+        replyMSG.append("    ... Min lvl: <font color=\"00FF00\">" + FortressSiege._minlvl + "</font><br>");
+        replyMSG.append("    ... Max lvl: <font color=\"00FF00\">" + FortressSiege._maxlvl + "</font><br><br>");
+        replyMSG.append("    ... Min Players: <font color=\"00FF00\">" + FortressSiege._minPlayers + "</font><br>");
+        replyMSG.append("    ... Max Players: <font color=\"00FF00\">" + FortressSiege._maxPlayers + "</font><br><br>");
+        replyMSG.append("    ... Joining Time: <font color=\"00FF00\">" + FortressSiege._joinTime + "</font><br>");
+        replyMSG.append("    ... Event Time  : <font color=\"00FF00\">" + FortressSiege._eventTime + "</font><br><br>");
+        replyMSG.append("Current teams:<br1>");
+        replyMSG.append("<center><table border=\"0\">");
+        
+        if (FortressSiege._teams!=null && !FortressSiege._teams.isEmpty())
+        for (String team : FortressSiege._teams){
+            replyMSG.append("<tr><td width=\"100\"><font color=\"LEVEL\">" + team + "</font>");
+            if (Config.FortressSiege_EVEN_TEAMS.equals("NO") || Config.FortressSiege_EVEN_TEAMS.equals("BALANCE"))
+                replyMSG.append(" (" + FortressSiege._teamPlayersCount.get(FortressSiege._teams.indexOf(team)) + " joined)");
+            else if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE")){
+                if (FortressSiege._teleport || FortressSiege._started)
+                    replyMSG.append(" (" + FortressSiege._teamPlayersCount.get(FortressSiege._teams.indexOf(team)) + " in)");
+            }
+            replyMSG.append("</td></tr><tr><td>");
+            replyMSG.append(FortressSiege._teamColors.get(FortressSiege._teams.indexOf(team)));
+            replyMSG.append("</td></tr><tr><td>");
+            replyMSG.append(FortressSiege._teamsX.get(FortressSiege._teams.indexOf(team)) + ", " + FortressSiege._teamsY.get(FortressSiege._teams.indexOf(team)) + ", " + FortressSiege._teamsZ.get(FortressSiege._teams.indexOf(team)));
+            replyMSG.append("</td></tr>");
+        }
+        replyMSG.append("<tr><td>Siege Flag:  "+FortressSiege._flagX + ", " + FortressSiege._flagY+ ", " + FortressSiege._flagZ+"</td></tr>");
+        replyMSG.append("<tr><td>Center Room: "+FortressSiege.eventCenterX + ", " + FortressSiege.eventCenterY+ ", " + FortressSiege.eventCenterZ+"</td></tr>");
+        replyMSG.append("<tr><td>Fortress Door Ids: "+FortressSiege._door[4] + ", " + FortressSiege._door[5]+"</td></tr>");
+        replyMSG.append("<tr><td>Central Door Ids : "+FortressSiege._door[0] + ", " + FortressSiege._door[1] + ", " + FortressSiege._door[2] + ", " + FortressSiege._door[3]+"</td></tr>");
+        replyMSG.append("</table></center>");
+        if (Config.FortressSiege_EVEN_TEAMS.equals("SHUFFLE")){
+            if (FortressSiege._joining){
+                replyMSG.append("<br1>");
+                replyMSG.append(FortressSiege._playersShuffle.size() + " players participating. Waiting to shuffle in teams(done on teleport)!");
+                replyMSG.append("<br><br>");
+            }
+        }
+        replyMSG.append("</body></html>");
+        adminReply.setHtml(replyMSG.toString());
+        activeChar.sendPacket(adminReply);
+        }catch(Throwable t){
+               try{
+                replyMSG.append("</body></html>");
+                adminReply.setHtml(replyMSG.toString());
+                activeChar.sendPacket(adminReply);
+               }
+               catch(Throwable e){return;}
+        }
+    }
+}
Index: /Trunk/L2JSuper_CORE/config/command-privileges.properties
===================================================================
--- /Trunk/L2JSuper_CORE/config/command-privileges.properties (revision 1)
+++ /Trunk/L2JSuper_CORE/config/command-privileges.properties (revision 26)
@@ -17,4 +17,49 @@
 admin_admin4 = 100
 admin_admin5 = 100
+
+#########################
+###  Fortress Sieges  ###
+#########################
+admin_fos = 100
+admin_fos_name = 100
+admin_fos_desc = 100
+admin_fos_join_loc = 100
+admin_fos_tele1 = 100
+admin_fos_tele2 = 100
+admin_fos_minlvl = 100
+admin_fos_maxlvl = 100
+admin_fos_door6 = 100
+admin_fos_tele3 = 100
+admin_fos_npc = 100
+admin_fos_npc_pos = 100
+admin_fos_door1 = 100
+admin_fos_door2 = 100
+admin_fos_door3 = 100
+admin_fos_reward = 100
+admin_fos_reward_amount = 100
+admin_fos_door4 = 100
+admin_fos_door5 = 100
+admin_fos_teamname = 100
+admin_fos_team_pos = 100
+admin_fos_team_color = 100
+admin_fos_team_flag = 100
+admin_fos_team_cent = 100
+admin_fos_join = 100
+admin_fos_teleport = 100
+admin_fos_start = 100
+admin_fos_abort = 100
+admin_fos_finish = 100
+admin_fos_sit = 100
+admin_fos_dump = 100
+admin_fos_save = 100
+admin_fos_load = 100
+admin_fos_jointime = 100
+admin_fos_eventtime = 100
+admin_fos_autoevent = 100
+admin_fos_minplayers = 100
+admin_fos_maxplayers = 100
+admin_recall_gm = 100
+admin_recall_offline = 100
+
 # ===================
 # COMMON COMMANDS   =
Index: /Trunk/L2JSuper_DP/sql/fos_engine.sql
===================================================================
--- /Trunk/L2JSuper_DP/sql/fos_engine.sql (revision 26)
+++ /Trunk/L2JSuper_DP/sql/fos_engine.sql (revision 26)
@@ -0,0 +1,26 @@
+-
+-- Table structure for table `fortress_siege`
+--
+
+CREATE TABLE IF NOT EXISTS `fortress_siege` (
+  `eventName` varchar(255) NOT NULL default '',
+  `eventDesc` varchar(255) NOT NULL default '',
+  `joiningLocation` varchar(255) NOT NULL default '',
+  `minlvl` int(4) NOT NULL default '0',
+  `maxlvl` int(4) NOT NULL default '0',
+  `npcId` int(8) NOT NULL default '0',
+  `npcX` int(11) NOT NULL default '0',
+  `npcY` int(11) NOT NULL default '0',
+  `npcZ` int(11) NOT NULL default '0',
+  `npcHeading` int(11) NOT NULL default '0',
+  `rewardId` int(11) NOT NULL default '0',
+  `rewardAmount` int(11) NOT NULL default '0',
+  `joinTime` int(11) NOT NULL default '0',
+  `eventTime` int(11) NOT NULL default '0',
+  `minPlayers` int(4) NOT NULL default '0',
+  `maxPlayers` int(4) NOT NULL default '0',
+  `centerX` int(11) NOT NULL default '0',
+  `centerY` int(11) NOT NULL default '0',
+  `centerZ` int(11) NOT NULL default '0',
+  `team1Name` varchar(255) NOT NULL default '',
+  `team1X` int(11) NOT NULL default '0',
+  `team1Y` int(11) NOT NULL default '0',
+  `team1Z` int(11) NOT NULL default '0',
+  `team1Color` int(11) NOT NULL default '0',
+  `team2Name` varchar(255) NOT NULL default '',
+  `team2X` int(11) NOT NULL default '0',
+  `team2Y` int(11) NOT NULL default '0',
+  `team2Z` int(11) NOT NULL default '0',
+  `team2Color` int(11) NOT NULL default '0',
+  `flagX` int(11) NOT NULL default '0',
+  `flagY` int(11) NOT NULL default '0',
+  `flagZ` int(11) NOT NULL default '0',
+  `innerDoor1` int(11) NOT NULL default '0',
+  `innerDoor2` int(11) NOT NULL default '0',
+  `innerDoor3` int(11) NOT NULL default '0',
+  `innerDoor4` int(11) NOT NULL default '0',
+  `outerDoor1` int(11) NOT NULL default '0',
+  `outerDoor2` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`eventName`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `fortress_siege`
+--
+
+INSERT INTO `fortress_siege` VALUES
+('Abandoned Camp Fortress Siege', 'Siege the Abandoned Fortress', 'Gludin Village', 71, 81, 30373, -84801, 150939, -3129, 0, 57, 1000, 15, 45, 40, 200, -52766, 156487, -2079, 'Blue', -45494, 156091, -1489, 16711680, 'Red', -53000, 156581, -1897, 6684927, -52767, 156503, -1131, 18220003, 18220002, 18220005, 18220004, 18220008, 18220001),
+('Alligator Beach Fortress Siege', 'Siege the Alligator Isle  Fortress', 'Town of Heine', 71, 81, 30290, 111372, 218705, -3466, 0, 57, 1000, 15, 45, 40, 200, 118417, 204933, -3333, 'Blue', 124978, 210106, -1855, 16711680, 'Red', 118622, 205071, -3176, 6684927, 118425, 204922, -2410, 23240002, 23240003, 23240007, 23240006, 23240008, 23240001),
+('Border Outpost Fortress Siege', 'Siege the Outpost Fortress', 'Town of Oren', 71, 81, 31285, 81504, 53674, -1487, 0, 57, 1000, 15, 45, 40, 200, 111364, -15154, -1021, 'Blue', 110369, -20863, -462, 16711680, 'Red', 111371, -14834, -838, 6684927, 111359, -15120, -72, 23170004, 23170005, 23170009, 23170008, 23170001, 23170012),
+('Cruma Tower Fortress Siege', 'Siege the Cruma Fortress', 'Elven Village', 71, 81, 30109, 45656, 50440, -3016, 0, 57, 1000, 15, 45, 40, 200, 11546, 94970, -3426, 'Blue', 8802, 101977, -2489, 16711680, 'Red', 11548, 95305, -3269, 6684927, 11518, 95004, -2503, 20200002, 20200003, 20200007, 20200006, 20200008, 20200001),
+('Devastated Castle', 'Siege the Devastated Castle', 'Town of Aden', 71, 81, 35421, 147473, 26014, -2039, 0, 57, 1000, 15, 45, 40, 200, 177839, -18598, -2240, 'Blue', 184872, -15882, -1522, 16711680, 'Red', 177856, -18615, -2240, 6684927, 178298, -17623, -2201, 25170006, 25170005, 25170004, 25170003, 25170002, 25170001),
+('Devils Pass Fortress Siege', 'Siege the Devils Pass Fortress', 'Town of Goddard', 71, 81, 30849, 147694, -55540, -2734, 0, 57, 1000, 15, 45, 40, 200, 100708, -55336, -645, 'Blue', 95458, -63046, -174, 16711680, 'Red', 100426, -55292, -514, 6684927, 100720, -55334, 277, 23160006, 23160007, 23160005, 23160004, 23160001, 23160008),
+('Devotion Fortress Siege', 'Siege the Fortress of Devotion', 'Dark Elf Village', 71, 81, 30462, 12116, 16656, -4584, 0, 57, 1000, 15, 45, 40, 200, -53247, 91214, -2821, 'Blue', -55768, 84623, -1925, 16711680, 'Red', -53240, 91548, -2664, 6684927, -53229, 91221, -1898, 18200002, 18200003, 18200012, 18200011, 18200010, 18200001),
+('Field of Silence Fortress Siege', 'Siege the Silenced Field Fortress', 'Heine', 71, 81, 30288, 111389, 219491, -3546, 0, 57, 1000, 15, 45, 40, 200, 73112, 185973, -2607, 'Blue', 65929, 175231, -2138, 16711680, 'Red', 72945, 186225, -2450, 6684927, 73121, 185988, -1658, 22230004, 22230005, 22230007, 22230006, 22230008, 22230001),
+('Floran Agricultural Fortress Siege', 'Siege the Floran Fortress', 'Town of Dion', 71, 81, 30187, 15820, 142833, -2706, 0, 57, 1000, 15, 45, 40, 200, 5615, 149754, -2889, 'Blue', 338, 140472, -1608, 16711680, 'Red', 5332, 149737, -2732, 6684927, 5607, 149760, -1966, 20220024, 20220025, 20220023, 20220022, 20220021, 20220026),
+('Forsaken Plains Fortress Siege', 'Siege the Forsaken Fortress', 'Town of Aden', 71, 81, 30474, 147141, 26170, -2048, 0, 57, 1000, 15, 45, 40, 200, 189926, 39731, -3410, 'Blue', 184375, 43263, -2884, 16711680, 'Red', 189935, 40059, -3253, 6684927, 189928, 39748, -2487, 25190006, 25190007, 25190009, 25190008, 25190001, 25190012),
+('Giran Arena Fortress Siege', 'Siege the Giran Fortress', 'Town of Dion', 71, 81, 31321, 15788, 142848, -2706, 0, 57, 1000, 15, 45, 40, 200, 60271, 139432, -1754, 'Blue', 52771, 138768, -1235, 16711680, 'Red', 60332, 139719, -1623, 6684927, 60280, 139448, -857, 21220006, 21220007, 21220002, 21220003, 21220001, 21220008),
+('Giran DVC Fortress Siege', 'Siege the Giran DVC Fortress', 'Town of Giran', 71, 81, 30066, 83360, 147903, -3405, 0, 57, 1000, 15, 45, 40, 200, 126085, 123330, -2585, 'Blue', 122293, 118941, -2241, 16711680, 'Red', 126089, 123591, -2429, 6684927, 126085, 123342, -1662, 23210007, 23210006, 23210011, 23210010, 23210001, 23210012),
+('Hunters Fortress Siege', 'Siege the Hunters Village Fortress', 'Hunters Village', 71, 81, 30026, 117817, 76627, -2600, 0, 57, 1000, 15, 45, 40, 200, 125241, 95126, -2140, 'Blue', 133079, 100462, -991, 16711680, 'Red', 125237, 95416, -1984, 6684927, 125250, 95162, -1217, 23200003, 23200002, 23200009, 23200008, 23200001, 23200012),
+('Ketra Orcs Fortress Siege', 'Siege the Ketra Fortress', 'Town of Goddard', 71, 81, 30862, 147715, -55515, -2734, 0, 57, 1000, 15, 45, 40, 200, 159155, -70315, -2864, 'Blue', 156275, -66893, -1696, 16711680, 'Red', 158901, -70140, -2707, 6684927, 159127, -70286, -1942, 24150004, 24150005, 24150006, 24150007, 24150003, 24150008),
+('Langk Fortress Siege', 'Siege the Langk Fortress', 'Gludin Village', 71, 81, 30297, -82112, 150625, -3129, 0, 57, 1000, 15, 45, 40, 200, -22707, 219807, -3236, 'Blue', -15316, 205368, -2362, 16711680, 'Red', -22401, 219796, -3079, 6684927, -22693, 219801, -2313, 19240006, 19240007, 19240008, 19240009, 19240005, 19240010),
+('Narsell Lake Fortress Siege', 'Siege the Lake Fortress', 'Town of Aden', 71, 81, 30689, 147422, 26009, -2013, 0, 57, 1000, 15, 45, 40, 200, 154908, 55311, -3254, 'Blue', 162137, 61611, -1945, 16711680, 'Red', 154700, 55473, -3098, 6684927, 154863, 55320, -2331, 24190009, 24190008, 24190007, 24190006, 24190010, 24190005),
+('Northern Waterfall Fortress Siege', 'Siege the Waterfall Fortress', 'Town of Oren', 71, 81, 30699, 83114, 53833, -1465, 0, 57, 1000, 15, 45, 40, 200, 72859, 4267, -3045, 'Blue', 71847, -3991, -2711, 16711680, 'Red', 72695, 4468, -2888, 6684927, 72840, 4283, -2122, 22180004, 22180005, 22180002, 22180003, 22180008, 22180001),
+('Oren Fortress Siege', 'Siege the Oren Fortress', 'Town of Oren', 71, 81, 30008, 83130, 53329, -1440, 0, 57, 1000, 15, 45, 40, 200, 79232, 91045, -2884, 'Blue', 86997, 104410, -1259, 16711680, 'Red', 79504, 91195, -2727, 6684927, 79262, 91069, -1961, 22200005, 22200004, 22200007, 22200006, 22200001, 22200012),
+('Plunderous Plain Fortress Siege', 'Siege the Plunderous Fortress', 'Schuttgart', 71, 81, 30910, 87416, -143124, -1293, 0, 57, 1000, 15, 45, 40, 200, 109483, -141223, -2983, 'Blue', 90058, -140574, -911, 16711680, 'Red', 109213, -141148, -2800, 6684927, 109469, -141216, -2034, 23130005, 23130004, 23130003, 23130002, 23130006, 23130001),
+('Race Track Fortress Siege', 'Siege the Race Track  Fortress', 'Town of Dion', 71, 81, 30195, 16218, 144166, -2981, 0, 57, 1000, 15, 45, 40, 200, 16582, 188047, -2924, 'Blue', 23365, 179858, -1839, 16711680, 'Red', 16757, 188340, -2767, 6684927, 16587, 188072, -2002, 20230005, 20230004, 20230009, 20230008, 20230003, 20230003),
+('Swamp of Screams Fortress Siege', 'Siege the Screaming Fortress', 'Rune Township', 71, 81, 30900, 43957, -47711, -823, 0, 57, 1000, 15, 45, 40, 200, 69833, -61430, -2786, 'Blue', 76854, -50916, -1971, 16711680, 'Red', 69964, -61124, -2630, 6684927, 69834, -61434, -1863, 22160005, 22160004, 22160009, 22160008, 22160001, 22160012),
+('Valley of Saints Fortress Siege', 'Siege the Saint Fortress', 'Rune Township', 71, 81, 31276, 43561, -48758, -798, 0, 57, 1000, 15, 45, 40, 200, 72160, -94767, -1428, 'Blue', 69088, -85022, -1372, 16711680, 'Red', 72301, -94461, -1272, 6684927, 72169, -94737, -505, 22150006, 22150007, 22150002, 22150003, 22150008, 22150001),
+('Bandit Stronghold', 'Siege the Bandit Stronghold', 'Town of Oren', 71, 81, 30990, 83137, 53328, -1440, 0, 57, 1000, 15, 40, 10, 200, 80428, -15418, -704, 'Blue', 87500, -23341, -995, 16711680, 'Red', 80428, -15418, -704, 6684927, 80127, -15404, -1805, 22170004, 22170003, 22170004, 22170003, 22170001, 22170002),
+('Fortress of the Dead', 'Siege the Fortress of the Dead', 'Rune Township', 71, 81, 31538, 44104, -48539, -797, 0, 57, 1000, 15, 40, 10, 200, 58149, -27479, 578, 'Blue', 59555, -37667, 403, 16711680, 'Red', 58153, -27485, 578, 6684927, 57953, -25830, 592, 21170004, 21170003, 21170004, 21170003, 21170002, 21170006);
Creditos: Dark699