Addition of Movie enum.

This commit is contained in:
MobiusDev 2018-05-23 13:28:18 +00:00
parent f9e6716ef0
commit 4114fee07c
24 changed files with 279 additions and 76 deletions

View File

@ -21,6 +21,7 @@ import java.util.GregorianCalendar;
import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@ -38,8 +39,6 @@ public class Lindvior extends AbstractNpcAI
private static final int TOMARIS = 32552;
private static final int ARTIUS = 32559;
private static int LINDVIOR_SCENE_ID = 1;
private static final int RESET_HOUR = 18;
private static final int RESET_MIN = 58;
private static final int RESET_DAY_1 = Calendar.TUESDAY;
@ -85,7 +84,7 @@ public class Lindvior extends AbstractNpcAI
{
if ((pl.getZ() >= 1100) && (pl.getZ() <= 3100))
{
pl.showQuestMovie(LINDVIOR_SCENE_ID);
playMovie(pl, Movie.SC_LINDVIOR);
}
});
}

View File

@ -27,6 +27,7 @@ import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.instancemanager.SoIManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
@ -352,12 +353,7 @@ public class HeartInfinityAttack extends AbstractNpcAI
conquestBegun = true;
ThreadPool.schedule(() ->
{
for (int objId : world.getAllowed())
{
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
player.showQuestMovie(2); // ExStartScenePlayer.SCENE_ECHMUS_OPENING
}
playMovie(world, Movie.SC_ECHMUS_OPENING);
ThreadPool.schedule(() -> conquestBegins(world), 62500);
}, 20000);
}

View File

@ -27,6 +27,7 @@ import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.instancemanager.SoDManager;
import com.l2jmobius.gameserver.model.L2CommandChannel;
@ -1486,7 +1487,7 @@ public class SeedOfDestruction extends AbstractNpcAI
continue;
}
SetMovieMode(plr, true);
plr.showQuestMovie(6);
playMovie(plr, Movie.SC_BOSS_TIAT_ENDING_SUCCES);
}
Delete(npc);
for (L2Npc mob : InstanceManager.getInstance().getInstance(world.getInstanceId()).getNpcs())
@ -1708,7 +1709,7 @@ public class SeedOfDestruction extends AbstractNpcAI
continue;
}
SetMovieMode(player, true);
player.showQuestMovie(5);
playMovie(player, Movie.SC_BOSS_TIAT_OPENING);
world.ZoneWaitForTP = false;
}
}

View File

@ -22,6 +22,7 @@ import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.AirShipManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.ClanPrivilege;
@ -92,7 +93,7 @@ public abstract class AirShipController extends AbstractNpcAI
protected int[] _fuelTable = null;
protected int _movieId = 0;
protected Movie _movie = null;
protected boolean _isBusy = false;
protected L2ControllableAirShipInstance _dockedShip = null;
@ -296,15 +297,9 @@ public abstract class AirShipController extends AbstractNpcAI
// Ship is not empty - display movie to passengers and dock
if (!_dockedShip.isEmpty())
{
if (_movieId != 0)
if (_movie != null)
{
for (L2PcInstance passenger : _dockedShip.getPassengers())
{
if (passenger != null)
{
passenger.showQuestMovie(_movieId);
}
}
playMovie(_dockedShip.getPassengers(), _movie);
}
ThreadPool.schedule(_decayTask, 1000);

View File

@ -16,6 +16,7 @@
*/
package ai.areas.Gracia.vehicles.KeucereusNorthController;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.VehiclePathPoint;
@ -87,7 +88,7 @@ public final class KeucereusNorthController extends AirShipController
_teleportsTable = TELEPORTS;
_fuelTable = FUEL;
_movieId = 1001;
_movie = Movie.LAND_KSERTH_B;
validityCheck();
}

View File

@ -16,6 +16,7 @@
*/
package ai.areas.Gracia.vehicles.KeucereusSouthController;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.VehiclePathPoint;
@ -87,7 +88,7 @@ public final class KeucereusSouthController extends AirShipController
_oustLoc = new Location(-186148, 246296, 1360);
_movieId = 1000;
_movie = Movie.LAND_KSERTH_A;
validityCheck();
}

View File

@ -16,6 +16,7 @@
*/
package ai.areas.Gracia.vehicles.SoDController;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.VehiclePathPoint;
@ -77,7 +78,7 @@ public final class SoDController extends AirShipController
_teleportsTable = TELEPORTS;
_fuelTable = FUEL;
_movieId = 1003;
_movie = Movie.LAND_DISTRUCTION_A;
validityCheck();
}

View File

@ -16,6 +16,7 @@
*/
package ai.areas.Gracia.vehicles.SoIController;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.VehiclePathPoint;
@ -81,7 +82,7 @@ public final class SoIController extends AirShipController
_teleportsTable = TELEPORTS;
_fuelTable = FUEL;
_movieId = 1002;
_movie = Movie.LAND_UNDEAD_A;
validityCheck();
}

View File

@ -18,6 +18,7 @@ package instances.IceQueensCastle;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
@ -107,7 +108,7 @@ public final class IceQueensCastle extends AbstractInstance
{
if (npc != null)
{
player.showQuestMovie(21);
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
}

View File

@ -23,6 +23,7 @@ import java.util.List;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.MountType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2CommandChannel;
import com.l2jmobius.gameserver.model.L2Party;
@ -245,7 +246,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
world.getNpc(SUPP_KEGOR).deleteMe();
freya.decayMe();
manageMovie(world, 20);
manageMovie(world, Movie.SC_BOSS_FREYA_ENDING_B);
cancelQuestTimer("FINISH_WORLD", controller, null);
startQuestTimer("FINISH_WORLD", 58500, controller, null);
break;
@ -258,7 +259,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
{
world.closeDoor(DOOR_ID);
world.setStatus(1);
manageMovie(world, 15);
manageMovie(world, Movie.SC_BOSS_FREYA_OPENING);
startQuestTimer("STAGE_1_START", 53500, controller, null);
break;
}
@ -285,7 +286,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
world.setParameter("freya", null);
freya.deleteMe();
manageDespawnMinions(world);
manageMovie(world, 16);
manageMovie(world, Movie.SC_BOSS_FREYA_PHASECH_A);
startQuestTimer("STAGE_1_PAUSE", 24100 - 1000, controller, null);
}
break;
@ -317,7 +318,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
case "STAGE_2_MOVIE":
{
manageMovie(world, 23);
manageMovie(world, Movie.SC_ICE_HEAVYKNIGHT_SPAWN);
startQuestTimer("STAGE_2_GLAKIAS", 7000, controller, null);
break;
}
@ -344,7 +345,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
case "STAGE_2_FAILED":
{
manageMovie(world, 22);
manageMovie(world, Movie.SC_BOSS_FREYA_DEFEAT);
startQuestTimer("STAGE_2_FAILED2", 22000, npc, null);
break;
}
@ -355,7 +356,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
case "STAGE_3_MOVIE":
{
manageMovie(world, 17);
manageMovie(world, Movie.SC_BOSS_FREYA_PHASECH_B);
startQuestTimer("STAGE_3_START", 21500, controller, null);
break;
}
@ -874,7 +875,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
players.setIsInvul(true);
players.abortAttack();
}
manageMovie(world, 18);
manageMovie(world, Movie.SC_BOSS_KEGOR_INTRUSION);
startQuestTimer("SPAWN_SUPPORT", 27000, controller, null);
}
@ -1133,7 +1134,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
case FREYA_STAND_HARD:
{
world.setParameter("isSupportActive", false);
manageMovie(world, 19);
manageMovie(world, Movie.SC_BOSS_FREYA_ENDING_A);
manageDespawnMinions(world);
finishInstance(world);
DecayTaskManager.getInstance().cancel(npc);
@ -1368,13 +1369,13 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
}
private void manageMovie(InstanceWorld world, int movie)
private void manageMovie(InstanceWorld world, Movie movie)
{
for (L2PcInstance players : world.getParameters().getList("playersInside", L2PcInstance.class))
for (L2PcInstance player : world.getParameters().getList("playersInside", L2PcInstance.class))
{
if ((players != null) && (players.getInstanceId() == world.getInstanceId()))
if ((player != null) && (player.getInstanceId() == world.getInstanceId()))
{
players.showQuestMovie(movie);
playMovie(player, movie);
}
}
}

View File

@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
@ -205,7 +206,7 @@ public final class SSQDisciplesNecropolisPast extends AbstractInstance
{
if (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4)
{
player.showQuestMovie(13);
playMovie(player, Movie.SSQ_SEALING_EMPEROR_2ND);
startQuestTimer("TELEPORT", 27000, null, player);
}
break;
@ -458,7 +459,7 @@ public final class SSQDisciplesNecropolisPast extends AbstractInstance
if (world != null)
{
world.openDoor(DISCIPLES_NECROPOLIS_DOOR);
talker.showQuestMovie(12);
playMovie(talker, Movie.SSQ_SEALING_EMPEROR_1ST);
startQuestTimer("FIGHT", 1000, null, talker);
}
}

View File

@ -18,6 +18,7 @@ package instances.SSQMonasteryOfSilence;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
@ -220,7 +221,7 @@ public final class SSQMonasteryOfSilence extends AbstractInstance
}
case "START_MOVIE":
{
player.showQuestMovie(24);
playMovie(player, Movie.SSQ2_HOLY_BURIAL_GROUND_OPENING);
break;
}
case "BACK":
@ -294,7 +295,7 @@ public final class SSQMonasteryOfSilence extends AbstractInstance
}
case "START_MOVIE_Q10295":
{
player.showQuestMovie(26);
playMovie(player, Movie.SSQ2_SOLINA_TOMB_OPENING);
break;
}
case "CASKET_ROOM":
@ -427,7 +428,7 @@ public final class SSQMonasteryOfSilence extends AbstractInstance
}
case "START_MOVIE_Q10296":
{
player.showQuestMovie(29);
playMovie(player, Movie.SSQ2_BOSS_OPENING);
startQuestTimer("TELEPORT_SPACE", 60000, npc, player);
world.getParameters().getObject("elcadia", L2Npc.class).teleToLocation(ELCADIA_LOC, world.getInstanceId(), 0);
break;
@ -484,7 +485,7 @@ public final class SSQMonasteryOfSilence extends AbstractInstance
world.setParameter("deadSolinaGuardianCount", deadSolinaGuardianCount);
if (deadSolinaGuardianCount == 4)
{
player.showQuestMovie(27);
playMovie(player, Movie.SSQ2_SOLINA_TOMB_CLOSING);
final QuestState st = player.getQuestState(Q10295_SevenSignsSolinasTomb.class.getSimpleName());
if ((st != null) && st.isMemoState(1))
{
@ -495,7 +496,7 @@ public final class SSQMonasteryOfSilence extends AbstractInstance
}
case ETIS_VAN_ETINA:
{
player.showQuestMovie(30);
playMovie(player, Movie.SSQ2_BOSS_CLOSING);
world.getParameters().getObject("elcadia", L2Npc.class).teleToLocation(ELCADIA_LOC, world.getInstanceId(), 0);
startQuestTimer("TELEPORT_TO_PLAYER", 63000, npc, player);
final QuestState st = player.getQuestState(Q10296_SevenSignsOneWhoSeeksThePowerOfTheSeal.class.getSimpleName());

View File

@ -17,6 +17,7 @@
package instances.SSQSanctumOfTheLordsOfDawn;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
@ -220,7 +221,7 @@ public final class SSQSanctumOfTheLordsOfDawn extends AbstractInstance
final L2PcInstance pl = L2World.getInstance().getPlayer(objId);
if (pl != null)
{
pl.showQuestMovie(11);
playMovie(pl, Movie.SSQ_RITUAL_OF_PRIEST);
startQuestTimer("spawn", 35000, null, talker);
}
}

View File

@ -16,6 +16,7 @@
*/
package quests.Q00192_SevenSignsSeriesOfDoubt;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
@ -77,7 +78,7 @@ public final class Q00192_SevenSignsSeriesOfDoubt extends Quest
if (qs.isCond(1))
{
qs.setCond(2, true);
player.showQuestMovie(8);
playMovie(player, Movie.SSQ_SUSPICIOUS_DEATHS);
startQuestTimer("back", 32000, npc, player);
return "";
}

View File

@ -18,6 +18,7 @@ package quests.Q00193_SevenSignsDyingMessage;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
@ -118,7 +119,7 @@ public final class Q00193_SevenSignsDyingMessage extends Quest
{
takeItems(player, DEADMANS_HERB, -1);
qs.setCond(4, true);
player.showQuestMovie(9);
playMovie(player, Movie.SSQ_DYING_MASSAGE);
return "";
}
break;

View File

@ -16,6 +16,7 @@
*/
package quests.Q00194_SevenSignsMammonsContract;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@ -99,7 +100,7 @@ public final class Q00194_SevenSignsMammonsContract extends Quest
if (qs.isCond(1))
{
qs.setCond(2, true);
player.showQuestMovie(10);
playMovie(player, Movie.SSQ_CONTRACT_OF_MAMMON);
return "";
}
break;

View File

@ -18,6 +18,7 @@ package quests.Q00198_SevenSignsEmbryo;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@ -182,7 +183,7 @@ public final class Q00198_SevenSignsEmbryo extends Quest
cancelQuestTimers("heal");
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.S1_YOU_MAY_HAVE_WON_THIS_TIME_BUT_NEXT_TIME_I_WILL_SURELY_CAPTURE_YOU).addStringParameter(partyMember.getName()));
npc.deleteMe();
partyMember.showQuestMovie(14);
playMovie(partyMember, Movie.SSQ_EMBRYO);
return super.onKill(npc, player, isSummon);
}

View File

@ -16,6 +16,7 @@
*/
package quests.Q10294_SevenSignsToTheMonasteryOfSilence;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
@ -213,7 +214,7 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest
htmltext = "32821-02.html";
if (hasCheckedAllRightBooks(qs))
{
player.showQuestMovie(25);
playMovie(player, Movie.SSQ2_HOLY_BURIAL_GROUND_CLOSING);
}
break;
}
@ -226,7 +227,7 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest
htmltext = "32821-02.html";
if (hasCheckedAllRightBooks(qs))
{
player.showQuestMovie(25);
playMovie(player, Movie.SSQ2_HOLY_BURIAL_GROUND_CLOSING);
}
break;
}
@ -240,7 +241,7 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest
htmltext = "32821-02.html";
if (hasCheckedAllRightBooks(qs))
{
player.showQuestMovie(25);
playMovie(player, Movie.SSQ2_HOLY_BURIAL_GROUND_CLOSING);
}
break;
}
@ -254,7 +255,7 @@ public final class Q10294_SevenSignsToTheMonasteryOfSilence extends Quest
htmltext = "32821-02.html";
if (hasCheckedAllRightBooks(qs))
{
player.showQuestMovie(25);
playMovie(player, Movie.SSQ2_HOLY_BURIAL_GROUND_CLOSING);
}
break;
}

View File

@ -0,0 +1,85 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.enums;
/**
* This file contains all movies.
* @author St3eT
*/
public enum Movie
{
SC_LINDVIOR(1, true),
SC_ECHMUS_OPENING(2, true),
SC_ECHMUS_SUCCESS(3, true),
SC_ECHMUS_FAIL(4, true),
SC_BOSS_TIAT_OPENING(5, true),
SC_BOSS_TIAT_ENDING_SUCCES(6, true),
SC_BOSS_TIAT_ENDING_FAIL(7, true),
SSQ_SUSPICIOUS_DEATHS(8, true),
SSQ_DYING_MASSAGE(9, true),
SSQ_CONTRACT_OF_MAMMON(10, true),
SSQ_RITUAL_OF_PRIEST(11, true),
SSQ_SEALING_EMPEROR_1ST(12, true),
SSQ_SEALING_EMPEROR_2ND(13, true),
SSQ_EMBRYO(14, true),
SC_BOSS_FREYA_OPENING(15, false),
SC_BOSS_FREYA_PHASECH_A(16, true),
SC_BOSS_FREYA_PHASECH_B(17, true),
SC_BOSS_KEGOR_INTRUSION(18, false),
SC_BOSS_FREYA_ENDING_A(19, false),
SC_BOSS_FREYA_ENDING_B(20, false),
SC_BOSS_FREYA_FORCED_DEFEAT(21, true),
SC_BOSS_FREYA_DEFEAT(22, true),
SC_ICE_HEAVYKNIGHT_SPAWN(23, false),
SSQ2_HOLY_BURIAL_GROUND_OPENING(24, true),
SSQ2_HOLY_BURIAL_GROUND_CLOSING(25, true),
SSQ2_SOLINA_TOMB_OPENING(26, false),
SSQ2_SOLINA_TOMB_CLOSING(27, true),
SSQ2_ELYSS_NARRATION(28, false),
SSQ2_BOSS_OPENING(29, false),
SSQ2_BOSS_CLOSING(30, false),
LAND_KSERTH_A(1000, true),
LAND_KSERTH_B(1001, true),
LAND_UNDEAD_A(1002, true),
LAND_DISTRUCTION_A(1003, true),
LAND_ANNIHILATION_A(1004, true);
private final int _clientId;
private final boolean _isEscapable;
private Movie(int clientId, boolean isEscapable)
{
_clientId = clientId;
_isEscapable = isEscapable;
}
/**
* @return the client id.
*/
public int getClientId()
{
return _clientId;
}
/**
* @return {@code true} if movie can be escaped (skipped), {@code false} otherwise.
*/
public boolean isEscapable()
{
return _isEscapable;
}
}

View File

@ -207,6 +207,7 @@ import com.l2jmobius.gameserver.model.fishing.L2Fish;
import com.l2jmobius.gameserver.model.fishing.L2Fishing;
import com.l2jmobius.gameserver.model.holders.AdditionalSkillHolder;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.holders.MovieHolder;
import com.l2jmobius.gameserver.model.holders.PlayerEventHolder;
import com.l2jmobius.gameserver.model.holders.SellBuffHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
@ -801,7 +802,7 @@ public final class L2PcInstance extends L2Playable
private int _multiSocialTarget = 0;
private int _multiSociaAction = 0;
private int _movieId = 0;
private MovieHolder _movieHolder = null;
private String _adminConfirmCmd = null;
@ -10862,6 +10863,12 @@ public final class L2PcInstance extends L2Playable
}
TvTEvent.onTeleported(this);
// show movie if available
if (_movieHolder != null)
{
sendPacket(new ExStartScenePlayer(_movieHolder.getMovie()));
}
}
@Override
@ -13211,17 +13218,25 @@ public final class L2PcInstance extends L2Playable
}
}
public void showQuestMovie(int id)
public void playMovie(MovieHolder holder)
{
if (_movieId > 0)
if (getMovieHolder() != null)
{
return;
}
abortAttack();
abortCast();
// abortCast(); Confirmed in retail, playing a movie does not abort cast.
stopMove(null);
_movieId = id;
sendPacket(new ExStartScenePlayer(id));
setMovieHolder(holder);
if (!isTeleporting())
{
sendPacket(new ExStartScenePlayer(holder.getMovie()));
}
}
public void stopMovie()
{
setMovieHolder(null);
}
public boolean isAllowedToEnchantSkills()
@ -13586,17 +13601,14 @@ public final class L2PcInstance extends L2Playable
_fallingTimestamp = System.currentTimeMillis() + FALLING_VALIDATION_DELAY;
}
/**
* @return the _movieId
*/
public int getMovieId()
public MovieHolder getMovieHolder()
{
return _movieId;
return _movieHolder;
}
public void setMovieId(int id)
public void setMovieHolder(MovieHolder movie)
{
_movieId = id;
_movieHolder = movie;
}
/**
@ -13619,7 +13631,7 @@ public final class L2PcInstance extends L2Playable
@Override
public boolean isMovementDisabled()
{
return super.isMovementDisabled() || (_movieId > 0);
return super.isMovementDisabled() || (getMovieHolder() != null);
}
private void restoreUISettings()

View File

@ -38,11 +38,13 @@ import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.enums.QuestSound;
import com.l2jmobius.gameserver.instancemanager.CastleManager;
import com.l2jmobius.gameserver.instancemanager.FortManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
@ -106,7 +108,9 @@ import com.l2jmobius.gameserver.model.events.listeners.RunnableEventListener;
import com.l2jmobius.gameserver.model.events.returns.AbstractEventReturn;
import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.holders.MovieHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
import com.l2jmobius.gameserver.model.interfaces.IPositionable;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
@ -2884,4 +2888,47 @@ public abstract class AbstractScript extends ManagedScript
{
player.getRadar().removeAllMarkers();
}
/**
* Play scene for PlayerInstance.
* @param player the player
* @param movie the movie
*/
public void playMovie(L2PcInstance player, Movie movie)
{
new MovieHolder(Arrays.asList(player), movie);
}
/**
* Play scene for all PlayerInstance inside list.
* @param players list with PlayerInstance
* @param movie the movie
*/
public void playMovie(List<L2PcInstance> players, Movie movie)
{
new MovieHolder(players, movie);
}
/**
* Play scene for all PlayerInstance inside set.
* @param players set with PlayerInstance
* @param movie the movie
*/
public void playMovie(Set<L2PcInstance> players, Movie movie)
{
new MovieHolder(new ArrayList<>(players), movie);
}
/**
* Play scene for all PlayerInstance inside instance.
* @param world InstanceWorld object
* @param movie the movie
*/
public void playMovie(InstanceWorld world, Movie movie)
{
for (int objId : world.getAllowed())
{
playMovie(L2World.getInstance().getPlayer(objId), movie);
}
}
}

View File

@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.holders;
import java.util.List;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/**
* @author St3eT
*/
public final class MovieHolder
{
private final Movie _movie;
private final List<L2PcInstance> _players;
public MovieHolder(List<L2PcInstance> players, Movie movie)
{
_players = players;
_movie = movie;
getPlayers().forEach(p -> p.playMovie(this));
}
public Movie getMovie()
{
return _movie;
}
public List<L2PcInstance> getPlayers()
{
return _players;
}
}

View File

@ -17,7 +17,9 @@
package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.holders.MovieHolder;
import com.l2jmobius.gameserver.network.L2GameClient;
/**
@ -38,20 +40,21 @@ public final class EndScenePlayer implements IClientIncomingPacket
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if (activeChar == null)
if ((activeChar == null) || (_movieId == 0))
{
return;
}
if (_movieId == 0)
final MovieHolder movieHolder = activeChar.getMovieHolder();
if (movieHolder == null)
{
return;
}
if (activeChar.getMovieId() != _movieId)
final Movie movie = movieHolder.getMovie();
if ((movie.getClientId() != _movieId) || !movie.isEscapable())
{
LOGGER.warning("Player " + client + " sent EndScenePlayer with wrong movie id: " + _movieId);
return;
}
activeChar.setMovieId(0);
activeChar.stopMovie();
activeChar.setIsTeleporting(true, false); // avoid to get player removed from L2World
activeChar.decayMe();
activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());

View File

@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.enums.Movie;
import com.l2jmobius.gameserver.network.OutgoingPackets;
/**
@ -24,18 +25,19 @@ import com.l2jmobius.gameserver.network.OutgoingPackets;
*/
public class ExStartScenePlayer implements IClientOutgoingPacket
{
private final int _movieId;
private final Movie _movie;
public ExStartScenePlayer(int id)
public ExStartScenePlayer(Movie movie)
{
_movieId = id;
_movie = movie;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_START_SCENE_PLAYER.writeId(packet);
packet.writeD(_movieId);
packet.writeD(_movie.getClientId());
return true;
}
}