Index: L2NpcInstance.java
===================================================================
--- L2NpcInstance.java (revision 3497)
+++ L2NpcInstance.java (working copy)
@@ -23,6 +23,7 @@
import javolution.util.FastList;
import net.sf.l2j.Config;
import net.sf.l2j.Config.CacheType;
+import net.sf.l2j.gameserver.GameTimeController;
import net.sf.l2j.gameserver.Olympiad;
import net.sf.l2j.gameserver.SevenSigns;
import net.sf.l2j.gameserver.SevenSignsFestival;
@@ -45,6 +46,8 @@
import net.sf.l2j.gameserver.instancemanager.TownManager;
import net.sf.l2j.gameserver.instancemanager.games.Lottery;
import net.sf.l2j.gameserver.instancemanager.grandbosses.BaiumManager;
+import net.sf.l2j.gameserver.instancemanager.SiegeManager;
+import net.sf.l2j.gameserver.model.entity.Siege;
import net.sf.l2j.gameserver.model.L2Attackable;
import net.sf.l2j.gameserver.model.L2Character;
import net.sf.l2j.gameserver.model.L2Clan;
@@ -58,6 +61,7 @@
import net.sf.l2j.gameserver.model.L2Summon;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.L2WorldRegion;
+import net.sf.l2j.gameserver.model.zone.L2Zone;
import net.sf.l2j.gameserver.model.MobGroupTable;
import net.sf.l2j.gameserver.model.NpcInventory;
import net.sf.l2j.gameserver.model.L2Skill.SkillTargetType;
@@ -88,6 +92,7 @@
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.NpcInfo;
import net.sf.l2j.gameserver.network.serverpackets.RadarControl;
+import net.sf.l2j.gameserver.network.serverpackets.SetupGauge;
import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
@@ -99,6 +104,7 @@
import net.sf.l2j.gameserver.templates.L2NpcTemplate;
import net.sf.l2j.gameserver.templates.L2Weapon;
import net.sf.l2j.tools.random.Rnd;
+import net.sf.l2j.gameserver.util.Broadcast;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -1251,6 +1257,10 @@
{
makeCPRecovery(player);
}
+ else if (command.startsWith("gotolove"))
+ {
+ goToLove(player);
+ }
else if (command.startsWith("SupportMagic"))
{
makeSupportMagic(player);
@@ -2065,7 +2075,232 @@
player.sendPacket(sm);
}
+ private static class EscapeFinalizer implements Runnable
+ {
+ private L2PcInstance _activeChar;
+ private int _partnerx;
+ private int _partnery;
+ private int _partnerz;
+ private boolean _to7sDungeon;
+
+ EscapeFinalizer(L2PcInstance activeChar, int x, int y, int z, boolean to7sDungeon)
+ {
+ _activeChar = activeChar;
+ _partnerx = x;
+ _partnery = y;
+ _partnerz = z;
+ _to7sDungeon = to7sDungeon;
+ }
+
+ public void run()
+ {
+ if (_activeChar.isDead())
+ return;
+ _activeChar.setIsIn7sDungeon(_to7sDungeon);
+ _activeChar.enableAllSkills();
+ try
+ {
+ _activeChar.teleToLocation(_partnerx, _partnery, _partnerz);
+ }
+ catch (Throwable e) { _log.error(e.getMessage(),e); }
+ }
+ }
+
+ public boolean goToLove(L2PcInstance activeChar)
+ {
+ if (activeChar.isCastingNow() || activeChar.isMovementDisabled()
+ || activeChar.isMuted() || activeChar.isAlikeDead())
+ return false;
+
+ Siege siege = SiegeManager.getInstance().getSiege(activeChar);
+
+ if(!activeChar.isMaried())
+ {
+ activeChar.sendMessage("You're not married.");
+ return false;
+ }
+ else if (activeChar.getPartnerId()==0)
+ {
+ activeChar.sendMessage("Couldn't find your fiance in Database - Inform a Gamemaster.");
+ _log.error("Married but couldn't find partner for "+activeChar.getName());
+ return false;
+ }
+ // Check to see if the player is in olympiad.
+ else if (activeChar.isInOlympiadMode())
+ {
+ activeChar.sendMessage("You are in Olympiad!");
+ return false;
+ }
+ // Check to see if the player is in observer mode
+ else if (activeChar.inObserverMode())
+ {
+ activeChar.sendMessage("You are in observer mode.");
+ return false;
+ }
+ // Check to see if the player is in an event
+ else if (activeChar.isInFunEvent())
+ {
+ activeChar.sendMessage("You are in event now.");
+ return false;
+ }
+ // Check to see if the player is in a festival.
+ else if (activeChar.isFestivalParticipant())
+ {
+ activeChar.sendMessage("You can't escape from a festival.");
+ return false;
+ }
+ // Check to see if the player is in dimensional rift.
+ else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
+ {
+ activeChar.sendMessage("You are in the dimensional rift.");
+ return false;
+ }
+ // Check to see if player is in jail
+ else if (activeChar.isInJail() || activeChar.isInsideZone(L2Zone.FLAG_JAIL))
+ {
+ activeChar.sendMessage("You can't escape from jail.");
+ return false;
+ }
+ // Check if player is in Siege
+ else if(siege != null && siege.getIsInProgress())
+ {
+ activeChar.sendMessage("You are in siege, you can't go to your partner.");
+ return false;
+ }
+ // Check if player is in Duel
+ else if (activeChar.isInDuel())
+ {
+ activeChar.sendMessage("You are in a duel!");
+ return false;
+ }
+ // Check if player is a Cursed Weapon owner
+ else if (activeChar.isCursedWeaponEquipped())
+ {
+ activeChar.sendMessage("You are currently holding a cursed weapon.");
+ return false;
+ }
+ // Check if player is in a Monster Derby Track
+ else if (activeChar.isInsideZone(L2Zone.FLAG_NOESCAPE))
+ {
+ activeChar.sendMessage("You cannot escape from here.");
+ return false;
+ }
+
+ L2PcInstance partner;
+ partner = (L2PcInstance)L2World.getInstance().findObject(activeChar.getPartnerId());
+ if(partner != null)
+ {
+ siege = SiegeManager.getInstance().getSiege(partner);
+ }
+ else
+ {
+ activeChar.sendMessage("Your partner is not online.");
+ return false;
+ }
+
+ if (partner.isInJail() || partner.isInsideZone(L2Zone.FLAG_JAIL))
+ {
+ activeChar.sendMessage("Your partner is in jail.");
+ return false;
+ }
+ else if (partner.isInOlympiadMode())
+ {
+ activeChar.sendMessage("Your partner is in Olympiad now.");
+ return false;
+ }
+ else if (partner.inObserverMode())
+ {
+ activeChar.sendMessage("Your partner is in observer mode.");
+ return false;
+ }
+ else if (partner.isInDuel())
+ {
+ activeChar.sendMessage("Your partner is in a duel.");
+ return false;
+ }
+ else if (partner.isInFunEvent())
+ {
+ activeChar.sendMessage("Your partner is in an event.");
+ return false;
+ }
+ else if (DimensionalRiftManager.getInstance().checkIfInRiftZone
+ (partner.getX(), partner.getY(), partner.getZ(), false))
+ {
+ activeChar.sendMessage("Your partner is in dimensional rift.");
+ return false;
+ }
+ else if (partner.isFestivalParticipant())
+ {
+ activeChar.sendMessage("Your partner is in a festival.");
+ return false;
+ }
+ else if(siege != null && siege.getIsInProgress())
+ {
+ if (partner.getAppearance().getSex())
+ activeChar.sendMessage("Your partner is in siege, you can't go to her.");
+ else
+ activeChar.sendMessage("Your partner is in siege, you can't go to him.");
+ return false;
+ }
+ else if (partner.isCursedWeaponEquipped())
+ {
+ activeChar.sendMessage("Your partner is currently holding a cursed weapon.");
+ return false;
+ }
+ else if (partner.isInsideZone(L2Zone.FLAG_NOESCAPE))
+ {
+ activeChar.sendMessage("Your partner is in a unsuitable area for teleporting.");
+ return false;
+ }
+ else if (partner.isIn7sDungeon() && !activeChar.isIn7sDungeon())
+ {
+ int playerCabal = SevenSigns.getInstance().getPlayerCabal(activeChar);
+ boolean isSealValidationPeriod = SevenSigns.getInstance().isSealValidationPeriod();
+ int compWinner = SevenSigns.getInstance().getCabalHighestScore();
+
+ if (isSealValidationPeriod)
+ {
+ if (playerCabal != compWinner)
+ {
+ activeChar.sendMessage("Your Partner is in a Seven Signs Dungeon and you are not in the winner Cabal!");
+ return false;
+ }
+ }
+ else
+ {
+ if (playerCabal == SevenSigns.CABAL_NULL)
+ {
+ activeChar.sendMessage("Your Partner is in a Seven Signs Dungeon and you are not registered!");
+ return false;
+ }
+ }
+ }
+
+ int teleportTimer = Config.WEDDING_TELEPORT_INTERVAL*1000;
+
+ activeChar.sendMessage("After " + teleportTimer/60000 + " min. you will be teleported to your fiance.");
+ activeChar.getInventory().reduceAdena("Wedding", Config.WEDDING_TELEPORT_PRICE, activeChar, null);
+
+ activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
+ //SoE Animation section
+ activeChar.setTarget(activeChar);
+ activeChar.disableAllSkills();
+
+ MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, teleportTimer, 0);
+ Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 810000/*900*/);
+ SetupGauge sg = new SetupGauge(0, teleportTimer);
+ activeChar.sendPacket(sg);
+ //End SoE Animation section
+
+ EscapeFinalizer ef = new EscapeFinalizer(activeChar,partner.getX(),partner.getY(),partner.getZ(),partner.isIn7sDungeon());
+ // continue execution later
+ activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, teleportTimer));
+ activeChar.setSkillCastEndTime(10+GameTimeController.getGameTicks()+teleportTimer/GameTimeController.MILLIS_IN_TICK);
+
+ return true;
+ }
+
/**
* Add Newbie helper buffs to L2Player according to its level.
*