Addition of Movie enum.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
@@ -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()
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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());
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user