|
@@ -12,9 +12,9 @@
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
-
|
|
|
package handlers.voicedcommandhandlers;
|
|
|
|
|
|
+import java.sql.Connection;
|
|
|
import java.sql.PreparedStatement;
|
|
|
import java.sql.ResultSet;
|
|
|
import java.util.logging.Level;
|
|
@@ -59,27 +59,34 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
"gotolove"
|
|
|
};
|
|
|
|
|
|
- /**
|
|
|
- * @see com.l2jserver.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
|
|
- */
|
|
|
@Override
|
|
|
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
|
|
{
|
|
|
if (activeChar == null)
|
|
|
+ {
|
|
|
return false;
|
|
|
+ }
|
|
|
if (command.startsWith("engage"))
|
|
|
+ {
|
|
|
return engage(activeChar);
|
|
|
+ }
|
|
|
else if (command.startsWith("divorce"))
|
|
|
+ {
|
|
|
return divorce(activeChar);
|
|
|
+ }
|
|
|
else if (command.startsWith("gotolove"))
|
|
|
+ {
|
|
|
return goToLove(activeChar);
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public boolean divorce(L2PcInstance activeChar)
|
|
|
{
|
|
|
if (activeChar.getPartnerId() == 0)
|
|
|
+ {
|
|
|
return false;
|
|
|
+ }
|
|
|
|
|
|
int _partnerId = activeChar.getPartnerId();
|
|
|
int _coupleId = activeChar.getCoupleId();
|
|
@@ -94,20 +101,28 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
|
|
|
}
|
|
|
else
|
|
|
+ {
|
|
|
activeChar.sendMessage("You have broken up as a couple.");
|
|
|
+ }
|
|
|
|
|
|
final L2PcInstance partner = L2World.getInstance().getPlayer(_partnerId);
|
|
|
if (partner != null)
|
|
|
{
|
|
|
partner.setPartnerId(0);
|
|
|
if (partner.isMarried())
|
|
|
+ {
|
|
|
partner.sendMessage("Your spouse has decided to divorce you.");
|
|
|
+ }
|
|
|
else
|
|
|
+ {
|
|
|
partner.sendMessage("Your fiance has decided to break the engagement with you.");
|
|
|
+ }
|
|
|
|
|
|
// give adena
|
|
|
if (AdenaAmount > 0)
|
|
|
+ {
|
|
|
partner.addAdena("WEDDING", AdenaAmount, null, false);
|
|
|
+ }
|
|
|
}
|
|
|
CoupleManager.getInstance().deleteCouple(_coupleId);
|
|
|
return true;
|
|
@@ -137,12 +152,18 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
int skillLevel = 1;
|
|
|
|
|
|
if (activeChar.getLevel() > 40)
|
|
|
+ {
|
|
|
skillLevel = 2;
|
|
|
+ }
|
|
|
|
|
|
if (activeChar.isMageClass())
|
|
|
+ {
|
|
|
skillId = 4362;
|
|
|
+ }
|
|
|
else
|
|
|
+ {
|
|
|
skillId = 4361;
|
|
|
+ }
|
|
|
|
|
|
final L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel);
|
|
|
if (activeChar.getFirstEffect(skill) == null)
|
|
@@ -162,22 +183,26 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
activeChar.sendMessage("Is there something wrong with you, are you trying to go out with youself?");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (ptarget.isMarried())
|
|
|
+
|
|
|
+ if (ptarget.isMarried())
|
|
|
{
|
|
|
activeChar.sendMessage("Player already married.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (ptarget.isEngageRequest())
|
|
|
+
|
|
|
+ if (ptarget.isEngageRequest())
|
|
|
{
|
|
|
activeChar.sendMessage("Player already asked by someone else.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (ptarget.getPartnerId() != 0)
|
|
|
+
|
|
|
+ if (ptarget.getPartnerId() != 0)
|
|
|
{
|
|
|
activeChar.sendMessage("Player already engaged with someone else.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (ptarget.getAppearance().getSex() == activeChar.getAppearance().getSex() && !Config.L2JMOD_WEDDING_SAMESEX)
|
|
|
+
|
|
|
+ if ((ptarget.getAppearance().getSex() == activeChar.getAppearance().getSex()) && !Config.L2JMOD_WEDDING_SAMESEX)
|
|
|
{
|
|
|
activeChar.sendMessage("Gay marriage is not allowed on this server!");
|
|
|
return false;
|
|
@@ -186,20 +211,20 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
// check if target has player on friendlist
|
|
|
boolean FoundOnFriendList = false;
|
|
|
int objectId;
|
|
|
- java.sql.Connection con = null;
|
|
|
+ Connection con = null;
|
|
|
try
|
|
|
{
|
|
|
con = L2DatabaseFactory.getInstance().getConnection();
|
|
|
- PreparedStatement statement;
|
|
|
- statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
|
|
|
+ final PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
|
|
|
statement.setInt(1, ptarget.getObjectId());
|
|
|
- ResultSet rset = statement.executeQuery();
|
|
|
-
|
|
|
+ final ResultSet rset = statement.executeQuery();
|
|
|
while (rset.next())
|
|
|
{
|
|
|
objectId = rset.getInt("friendId");
|
|
|
if (objectId == activeChar.getObjectId())
|
|
|
+ {
|
|
|
FoundOnFriendList = true;
|
|
|
+ }
|
|
|
}
|
|
|
statement.close();
|
|
|
}
|
|
@@ -232,79 +257,94 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
activeChar.sendMessage("You're not married.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.getPartnerId() == 0)
|
|
|
+
|
|
|
+ if (activeChar.getPartnerId() == 0)
|
|
|
{
|
|
|
activeChar.sendMessage("Couldn't find your fiance in the Database - Inform a Gamemaster.");
|
|
|
_log.severe("Married but couldn't find parter for " + activeChar.getName());
|
|
|
return false;
|
|
|
}
|
|
|
- else if (GrandBossManager.getInstance().getZone(activeChar) != null)
|
|
|
+
|
|
|
+ if (GrandBossManager.getInstance().getZone(activeChar) != null)
|
|
|
{
|
|
|
activeChar.sendMessage("You are inside a Boss Zone.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isCombatFlagEquipped())
|
|
|
+
|
|
|
+ if (activeChar.isCombatFlagEquipped())
|
|
|
{
|
|
|
activeChar.sendMessage("While you are holding a Combat Flag or Territory Ward you can't go to your love!");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isCursedWeaponEquipped())
|
|
|
+
|
|
|
+ if (activeChar.isCursedWeaponEquipped())
|
|
|
{
|
|
|
activeChar.sendMessage("While you are holding a Cursed Weapon you can't go to your love!");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (GrandBossManager.getInstance().getZone(activeChar) != null)
|
|
|
+
|
|
|
+ if (GrandBossManager.getInstance().getZone(activeChar) != null)
|
|
|
{
|
|
|
activeChar.sendMessage("You are inside a Boss Zone.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isInJail())
|
|
|
+
|
|
|
+ if (activeChar.isInJail())
|
|
|
{
|
|
|
activeChar.sendMessage("You are in Jail!");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isInOlympiadMode())
|
|
|
+
|
|
|
+ if (activeChar.isInOlympiadMode())
|
|
|
{
|
|
|
activeChar.sendMessage("You are in the Olympiad now.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (L2Event.isParticipant(activeChar))
|
|
|
+
|
|
|
+ if (L2Event.isParticipant(activeChar))
|
|
|
{
|
|
|
activeChar.sendMessage("You are in an event.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isInDuel())
|
|
|
+
|
|
|
+ if (activeChar.isInDuel())
|
|
|
{
|
|
|
activeChar.sendMessage("You are in a duel!");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.inObserverMode())
|
|
|
+
|
|
|
+ if (activeChar.inObserverMode())
|
|
|
{
|
|
|
activeChar.sendMessage("You are in the observation.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (SiegeManager.getInstance().getSiege(activeChar) != null && SiegeManager.getInstance().getSiege(activeChar).getIsInProgress())
|
|
|
+
|
|
|
+ if ((SiegeManager.getInstance().getSiege(activeChar) != null) && SiegeManager.getInstance().getSiege(activeChar).getIsInProgress())
|
|
|
{
|
|
|
activeChar.sendMessage("You are in a siege, you cannot go to your partner.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isFestivalParticipant())
|
|
|
+
|
|
|
+ if (activeChar.isFestivalParticipant())
|
|
|
{
|
|
|
activeChar.sendMessage("You are in a festival.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
|
|
|
+
|
|
|
+ if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
|
|
|
{
|
|
|
activeChar.sendMessage("You are in the dimensional rift.");
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
// Thanks nbd
|
|
|
- else if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
|
|
|
+ if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
|
|
|
{
|
|
|
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND))
|
|
|
+
|
|
|
+ if (activeChar.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND))
|
|
|
{
|
|
|
activeChar.sendMessage("You are in area which blocks summoning.");
|
|
|
return false;
|
|
@@ -316,62 +356,74 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
activeChar.sendMessage("Your partner is not online.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (activeChar.getInstanceId() != partner.getInstanceId())
|
|
|
+
|
|
|
+ if (activeChar.getInstanceId() != partner.getInstanceId())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in another World!");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isInJail())
|
|
|
+
|
|
|
+ if (partner.isInJail())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in Jail.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isCursedWeaponEquipped())
|
|
|
+
|
|
|
+ if (partner.isCursedWeaponEquipped())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is holding a Cursed Weapon and you can't go to your love!");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (GrandBossManager.getInstance().getZone(partner) != null)
|
|
|
+
|
|
|
+ if (GrandBossManager.getInstance().getZone(partner) != null)
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is inside a Boss Zone.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isInOlympiadMode())
|
|
|
+
|
|
|
+ if (partner.isInOlympiadMode())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in the Olympiad now.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (L2Event.isParticipant(partner))
|
|
|
+
|
|
|
+ if (L2Event.isParticipant(partner))
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in an event.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isInDuel())
|
|
|
+
|
|
|
+ if (partner.isInDuel())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in a duel.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isFestivalParticipant())
|
|
|
+
|
|
|
+ if (partner.isFestivalParticipant())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in a festival.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isInParty() && partner.getParty().isInDimensionalRift())
|
|
|
+
|
|
|
+ if (partner.isInParty() && partner.getParty().isInDimensionalRift())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in dimensional rift.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.inObserverMode())
|
|
|
+
|
|
|
+ if (partner.inObserverMode())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in the observation.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (SiegeManager.getInstance().getSiege(partner) != null && SiegeManager.getInstance().getSiege(partner).getIsInProgress())
|
|
|
+
|
|
|
+ if ((SiegeManager.getInstance().getSiege(partner) != null) && SiegeManager.getInstance().getSiege(partner).getIsInProgress())
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in a siege, you cannot go to your partner.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isIn7sDungeon() && !activeChar.isIn7sDungeon())
|
|
|
+
|
|
|
+ if (partner.isIn7sDungeon() && !activeChar.isIn7sDungeon())
|
|
|
{
|
|
|
final int playerCabal = SevenSigns.getInstance().getPlayerCabal(activeChar.getObjectId());
|
|
|
final boolean isSealValidationPeriod = SevenSigns.getInstance().isSealValidationPeriod();
|
|
@@ -394,36 +446,38 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if (!TvTEvent.onEscapeUse(partner.getObjectId()))
|
|
|
+
|
|
|
+ if (!TvTEvent.onEscapeUse(partner.getObjectId()))
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in an event.");
|
|
|
return false;
|
|
|
}
|
|
|
- else if (partner.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND))
|
|
|
+
|
|
|
+ if (partner.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND))
|
|
|
{
|
|
|
activeChar.sendMessage("Your partner is in area which blocks summoning.");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
final int teleportTimer = Config.L2JMOD_WEDDING_TELEPORT_DURATION * 1000;
|
|
|
- activeChar.sendMessage("After " + teleportTimer / 60000 + " min. you will be teleported to your partner.");
|
|
|
+ activeChar.sendMessage("After " + (teleportTimer / 60000) + " min. you will be teleported to your partner.");
|
|
|
activeChar.getInventory().reduceAdena("Wedding", Config.L2JMOD_WEDDING_TELEPORT_PRICE, activeChar, null);
|
|
|
|
|
|
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
|
|
- //SoE Animation section
|
|
|
+ // SoE Animation section
|
|
|
activeChar.setTarget(activeChar);
|
|
|
activeChar.disableAllSkills();
|
|
|
|
|
|
final MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, teleportTimer, 0);
|
|
|
- Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 810000/*900*/);
|
|
|
+ Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 810000/* 900 */);
|
|
|
final SetupGauge sg = new SetupGauge(0, teleportTimer);
|
|
|
activeChar.sendPacket(sg);
|
|
|
- //End SoE Animation section
|
|
|
+ // End SoE Animation section
|
|
|
|
|
|
final EscapeFinalizer ef = new EscapeFinalizer(activeChar, partner.getX(), partner.getY(), partner.getZ(), partner.isIn7sDungeon());
|
|
|
// continue execution later
|
|
|
activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, teleportTimer));
|
|
|
- activeChar.forceIsCasting(GameTimeController.getGameTicks() + teleportTimer / GameTimeController.MILLIS_IN_TICK);
|
|
|
+ activeChar.forceIsCasting(GameTimeController.getGameTicks() + (teleportTimer / GameTimeController.MILLIS_IN_TICK));
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -449,9 +503,11 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
public void run()
|
|
|
{
|
|
|
if (_activeChar.isDead())
|
|
|
+ {
|
|
|
return;
|
|
|
+ }
|
|
|
|
|
|
- if(SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz) != null && SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz).getIsInProgress())
|
|
|
+ if ((SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz) != null) && SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz).getIsInProgress())
|
|
|
{
|
|
|
_activeChar.sendMessage("Your partner is in siege, you can't go to your partner.");
|
|
|
return;
|
|
@@ -472,9 +528,6 @@ public class Wedding implements IVoicedCommandHandler
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @see com.l2jserver.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
|
|
|
- */
|
|
|
@Override
|
|
|
public String[] getVoicedCommandList()
|
|
|
{
|