Cleanup for PlaySound, QuestList and TutorialCloseHtml serverpackets.

This commit is contained in:
MobiusDevelopment
2020-01-24 15:41:54 +00:00
parent 44f5fbdcef
commit 7307d8d53d
38 changed files with 171 additions and 145 deletions

View File

@@ -958,7 +958,7 @@ public class Antharas extends Quest
{
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
{
npc.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
if (!npc.getSpawn().is_customBossInstance())
{

View File

@@ -418,7 +418,7 @@ public class Baium extends Quest
@Override
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
{
npc.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
if (!npc.getSpawn().is_customBossInstance())
{

View File

@@ -146,7 +146,7 @@ public class Core extends Quest
public void spawnBoss(GrandBossInstance npc)
{
GrandBossManager.getInstance().addBoss(npc);
npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS01_A", npc));
// Spawn minions
Attackable mob;
Location spawnLocation;
@@ -223,11 +223,10 @@ public class Core extends Quest
final String name = npc.getName();
if (npcId == CORE)
{
final int objId = npc.getObjectId();
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, objId, npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new CreatureSay(objId, 0, name, "A fatal error has occurred."));
npc.broadcastPacket(new CreatureSay(objId, 0, name, "System is being shut down..."));
npc.broadcastPacket(new CreatureSay(objId, 0, name, "......"));
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, name, "A fatal error has occurred."));
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, name, "System is being shut down..."));
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, name, "......"));
_firstAttacked = false;
if (!npc.getSpawn().is_customBossInstance())

View File

@@ -102,7 +102,7 @@ public class DrChaos extends Quest
final NpcInstance golem = addSpawn(CHAOS_GOLEM, 94640, -112496, -3336, 0, false, 0);
_golemSpawned = 1;
startQuestTimer("6", 1000, golem, player);
player.sendPacket(new PlaySound(1, "Rm03_A", 0, 0, 0, 0, 0));
player.sendPacket(new PlaySound(1, "Rm03_A"));
}
break;
}

View File

@@ -1232,7 +1232,7 @@ public class Frintezza extends Quest
if (npc.isDead())
{
_onMorph = 1;
_zone.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
_zone.broadcastPacket(new PlaySound(1, "BS01_D", npc));
startQuestTimer("attack_stop", 0, _frintezza, null);
startQuestTimer("stop_pc", 0, npc, null);

View File

@@ -234,7 +234,7 @@ public class Orfen extends Quest
{
if (npc.getNpcId() == ORFEN)
{
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
if (!npc.getSpawn().is_customBossInstance())
{

View File

@@ -150,7 +150,7 @@ public class QueenAnt extends Quest
private void spawnBoss(GrandBossInstance npc)
{
startQuestTimer("ACTION", 10000, npc, null, true);
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
startQuestTimer("SPAWN_ROYAL", 1000, npc, null);
startQuestTimer("NURSES_SPAWN", 1000, npc, null);
startQuestTimer("CHECK_MINIONS_ZONE", 30000, npc, null, true);
@@ -365,7 +365,7 @@ public class QueenAnt extends Quest
if (npcId == QUEEN)
{
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
if (!npc.getSpawn().is_customBossInstance())
{

View File

@@ -599,7 +599,7 @@ public class Valakas extends Quest
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
{
npc.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 2000, 130, -1, 0));
npc.broadcastPacket(new PlaySound(1, "B03_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "B03_D", npc));
startQuestTimer("1111", 500, npc, null);
if (!npc.getSpawn().is_customBossInstance())
@@ -969,7 +969,7 @@ public class Valakas extends Quest
{
if ((obj instanceof PlayerInstance) && Util.checkIfInRange(10000, npc, obj, true))
{
((Creature) obj).sendPacket(new PlaySound(1, "B03_A", 1, npc.getObjectId(), 212852, -114842, -1632));
((Creature) obj).sendPacket(new PlaySound(1, "B03_A", npc));
((Creature) obj).sendPacket(new SocialAction(npc.getObjectId(), 3));
}
}

View File

@@ -205,7 +205,7 @@ public class Zaken extends Quest
}
GrandBossManager.getInstance().addBoss(npc);
npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS01_A", npc));
_ai0 = 0;
_ai1 = npc.getX();
_ai2 = npc.getY();
@@ -857,7 +857,7 @@ public class Zaken extends Quest
if (npcId == ZAKEN)
{
npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
if (!npc.getSpawn().is_customBossInstance())
{

View File

@@ -125,7 +125,7 @@ public class Q635_InTheDimensionalRift extends Quest
qs.exitQuest(true);
htmltext = "1.htm";
}
else if (player.getAllActiveQuests().length > MAX_QUEST)
else if (player.getAllActiveQuests().size() > MAX_QUEST)
{
qs.exitQuest(true);
htmltext = "1a.htm";

View File

@@ -429,7 +429,7 @@ public class OracleTeleport extends Quest
htmltext = "1.htm";
st.exitQuest(true);
}
else if (player.getAllActiveQuests().length >= 25)
else if (player.getAllActiveQuests().size() >= 25)
{
htmltext = "1a.htm";
st.exitQuest(true);
@@ -452,7 +452,7 @@ public class OracleTeleport extends Quest
htmltext = "ziggurat_lowlevel.htm";
st.exitQuest(true);
}
else if (player.getAllActiveQuests().length >= 25)
else if (player.getAllActiveQuests().size() >= 25)
{
player.sendPacket(SystemMessageId.TOO_MANY_QUESTS);
st.exitQuest(true);

View File

@@ -792,7 +792,7 @@ public class AdminEffects implements IAdminCommandHandler
private void playAdminSound(PlayerInstance activeChar, String sound)
{
final PlaySound snd = new PlaySound(1, sound, 0, 0, 0, 0, 0);
final PlaySound snd = new PlaySound(1, sound);
activeChar.sendPacket(snd);
activeChar.broadcastPacket(snd);
BuilderUtil.sendSysMessage(activeChar, "Playing " + sound + ".");

View File

@@ -443,7 +443,7 @@ public class AdminEventEngine implements IAdminCommandHandler
muestraNpcConInfoAPlayers(activeChar, GameEvent.id);
final PlaySound snd = new PlaySound(1, "B03_F", 0, 0, 0, 0, 0);
final PlaySound snd = new PlaySound(1, "B03_F");
activeChar.sendPacket(snd);
activeChar.broadcastPacket(snd);

View File

@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.handler.admincommandhandlers;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.entity.MonsterRace;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -99,11 +100,11 @@ public class AdminMonsterRace implements IAdminCommandHandler
sm.addNumber(0);
activeChar.sendPacket(sm);
final PlaySound sRace = new PlaySound(1, "S_Race", 0, 0, 0, 0, 0);
final PlaySound sRace = new PlaySound(1, "S_Race");
activeChar.sendPacket(sRace);
activeChar.broadcastPacket(sRace);
final PlaySound sRace2 = new PlaySound(0, "ItemSound2.race_start", 1, 121209259, 12125, 182487, -3559);
final PlaySound sRace2 = new PlaySound(0, "ItemSound2.race_start", true, 121209259, new Location(12125, 182487, -3559), 0);
activeChar.sendPacket(sRace2);
activeChar.broadcastPacket(sRace2);

View File

@@ -128,7 +128,7 @@ public class ItemsOnGroundManager
}
item.getPosition().setWorldPosition(result.getInt(5), result.getInt(6), result.getInt(7));
item.getPosition().setWorldRegion(World.getInstance().getRegion(item.getPosition().getWorldPosition()));
item.getPosition().setWorldRegion(World.getInstance().getRegion(item.getLocation()));
item.getPosition().getWorldRegion().addVisibleObject(item);
item.setDropTime(result.getLong(8));
item.setProtected(result.getLong(8) == -1);

View File

@@ -98,7 +98,7 @@ public class QuestManager
{
for (Quest q : getQuests().values())
{
if (q.getQuestIntId() == questId)
if (q.getQuestId() == questId)
{
return q;
}
@@ -112,7 +112,7 @@ public class QuestManager
{
LOGGER.info("Replaced: " + newQuest.getName() + " with a new version.");
}
else if (newQuest.getQuestIntId() > 0)
else if (newQuest.getQuestId() > 0)
{
_questCount++;
}

View File

@@ -674,12 +674,12 @@ public class CursedWeapon
{
if (_isActivated && (_player != null))
{
return _player.getPosition().getWorldPosition();
return _player.getLocation();
}
if (_isDropped && (_item != null))
{
return _item.getPosition().getWorldPosition();
return _item.getLocation();
}
return null;

View File

@@ -103,7 +103,7 @@ public class Fishing implements Runnable
final ExFishingStartCombat efsc = new ExFishingStartCombat(_fisher, _time, _fishMaxHp, _mode, _lureType, _deceptiveMode);
_fisher.broadcastPacket(efsc);
_fisher.sendPacket(new PlaySound(1, "SF_S_01", 0, 0, 0, 0, 0));
_fisher.sendPacket(new PlaySound(1, "SF_S_01"));
// Succeeded in getting a bite
_fisher.sendPacket(SystemMessageId.GOT_A_BITE);

View File

@@ -20,6 +20,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class Location
{
public static final Location DUMMY_LOC = new Location(0, 0, 0);
protected int _x;
protected int _y;
protected int _z;

View File

@@ -386,10 +386,14 @@ public abstract class WorldObject
{
_position = new ObjectPosition(this);
}
return _position;
}
public Location getLocation()
{
return getPosition().getWorldPosition();
}
/**
* @return reference to region this object is in
*/

View File

@@ -581,7 +581,7 @@ public class BoatInstance extends Creature
{
sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess10_1);
}
ps = new PlaySound(0, "itemsound.ship_arrival_departure", 1, getObjectId(), getX(), getY(), getZ());
ps = new PlaySound(0, "itemsound.ship_arrival_departure", this);
if ((knownPlayers == null) || knownPlayers.isEmpty())
{
return;
@@ -605,7 +605,7 @@ public class BoatInstance extends Creature
{
sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess5_1);
}
ps = new PlaySound(0, "itemsound.ship_5min", 1, getObjectId(), getX(), getY(), getZ());
ps = new PlaySound(0, "itemsound.ship_5min", this);
if ((knownPlayers == null) || knownPlayers.isEmpty())
{
return;
@@ -627,7 +627,7 @@ public class BoatInstance extends Creature
{
sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmess1_1);
}
ps = new PlaySound(0, "itemsound.ship_1min", 1, getObjectId(), getX(), getY(), getZ());
ps = new PlaySound(0, "itemsound.ship_1min", this);
if ((knownPlayers == null) || knownPlayers.isEmpty())
{
return;
@@ -669,7 +669,7 @@ public class BoatInstance extends Creature
{
sm = new CreatureSay(0, Say2.SHOUT, _t2.npc1, _t2.sysmessb_1);
}
ps = new PlaySound(0, "itemsound.ship_arrival_departure", 1, getObjectId(), getX(), getY(), getZ());
ps = new PlaySound(0, "itemsound.ship_arrival_departure", this);
for (PlayerInstance player : knownPlayers)
{
player.sendPacket(sm);

View File

@@ -1814,7 +1814,7 @@ public class NpcInstance extends Creature
}
else
{
if ((player.getWeightPenalty() >= 3) && (q.getQuestIntId() >= 1) && (q.getQuestIntId() < 1000))
if ((player.getWeightPenalty() >= 3) && (q.getQuestId() >= 1) && (q.getQuestId() < 1000))
{
player.sendPacket(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT);
return;
@@ -1822,10 +1822,10 @@ public class NpcInstance extends Creature
if (qs == null)
{
if ((q.getQuestIntId() >= 1) && (q.getQuestIntId() < 20000))
if ((q.getQuestId() >= 1) && (q.getQuestId() < 20000))
{
final Quest[] questList = player.getAllActiveQuests();
if (questList.length >= 25) // if too many ongoing quests, don't show window and send message
final List<Quest> questList = player.getAllActiveQuests();
if (questList.size() >= 25) // if too many ongoing quests, don't show window and send message
{
player.sendMessage("You have too many quests, cannot register");
return;
@@ -1886,7 +1886,7 @@ public class NpcInstance extends Creature
{
for (QuestState x : awaits)
{
if (!options.contains(x.getQuest()) && (x.getQuest().getQuestIntId() > 0) && (x.getQuest().getQuestIntId() < 1000))
if (!options.contains(x.getQuest()) && (x.getQuest().getQuestId() > 0) && (x.getQuest().getQuestId() < 1000))
{
options.add(x.getQuest());
}
@@ -1897,7 +1897,7 @@ public class NpcInstance extends Creature
{
for (Quest x : starts)
{
if (!options.contains(x) && (x.getQuestIntId() > 0) && (x.getQuestIntId() < 1000))
if (!options.contains(x) && (x.getQuestId() > 0) && (x.getQuestId() < 1000))
{
options.add(x);
}

View File

@@ -1598,11 +1598,10 @@ public class PlayerInstance extends Playable
}
/**
* Return a table containing all Quest in progress from the table _quests.<BR>
* <BR>
* Return a list containing all Quest in progress from the table _quests.
* @return the all active quests
*/
public Quest[] getAllActiveQuests()
public List<Quest> getAllActiveQuests()
{
final List<Quest> quests = new ArrayList<>();
@@ -1610,7 +1609,7 @@ public class PlayerInstance extends Playable
{
if (qs != null)
{
if (qs.getQuest().getQuestIntId() >= 1999)
if (qs.getQuest().getQuestId() >= 1999)
{
continue;
}
@@ -1629,7 +1628,7 @@ public class PlayerInstance extends Playable
}
}
return quests.toArray(new Quest[quests.size()]);
return quests;
}
/**
@@ -1794,7 +1793,7 @@ public class PlayerInstance extends Playable
{
for (QuestState state : states)
{
if ((state.getQuest().getQuestIntId() == qs.getQuest().getQuestIntId()) && !qs.isCompleted())
if ((state.getQuest().getQuestId() == qs.getQuest().getQuestId()) && !qs.isCompleted())
{
if (qs.getQuest().notifyEvent(event, npc, this))
{
@@ -1804,7 +1803,7 @@ public class PlayerInstance extends Playable
retval = qs;
}
}
sendPacket(new QuestList());
sendPacket(new QuestList(this));
}
}
}
@@ -6326,7 +6325,7 @@ public class PlayerInstance extends Playable
{
if (!(pk._teamNameTvT.equals(_teamNameTvT)))
{
final PlaySound ps = new PlaySound(0, "ItemSound.quest_itemget", 1, getObjectId(), getX(), getY(), getZ());
final PlaySound ps = new PlaySound(0, "ItemSound.quest_itemget", this);
_countTvTdies++;
pk._countTvTkills++;
pk.setTitle("Kills: " + pk._countTvTkills);
@@ -6381,7 +6380,7 @@ public class PlayerInstance extends Playable
if (DM.isTeleport() || DM.is_started())
{
pk._countDMkills++;
final PlaySound ps = new PlaySound(0, "ItemSound.quest_itemget", 1, getObjectId(), getX(), getY(), getZ());
final PlaySound ps = new PlaySound(0, "ItemSound.quest_itemget", this);
pk.setTitle("Kills: " + pk._countDMkills);
pk.sendPacket(ps);
pk.broadcastUserInfo();

View File

@@ -21,6 +21,7 @@ import java.util.List;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.gameserver.idfactory.IdFactory;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.knownlist.RaceManagerKnownList;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.entity.MonsterRace;
@@ -223,9 +224,9 @@ public class RaceManagerInstance extends NpcInstance
final MonsterRace race = MonsterRace.getInstance();
if (_state == STARTING_RACE)
{
final PlaySound sRace = new PlaySound(1, "S_Race", 0, 0, 0, 0, 0);
final PlaySound sRace = new PlaySound(1, "S_Race");
broadcast(sRace);
final PlaySound sRace2 = new PlaySound(0, "ItemSound2.race_start", 1, 121209259, 12125, 182487, -3559);
final PlaySound sRace2 = new PlaySound(0, "ItemSound2.race_start", true, 121209259, new Location(12125, 182487, -3559), 0);
broadcast(sRace2);
_packet = new MonRaceInfo(_codes[1][0], _codes[1][1], race.getMonsters(), race.getSpeeds());
sendMonsterInfo();

View File

@@ -178,7 +178,7 @@ public class PlayerKnownList extends PlayableKnownList
final PlayerInstance otherPlayer = (PlayerInstance) object;
if (otherPlayer.isInBoat())
{
otherPlayer.getPosition().setWorldPosition(otherPlayer.getBoat().getPosition().getWorldPosition());
otherPlayer.getPosition().setWorldPosition(otherPlayer.getBoat().getLocation());
activeChar.sendPacket(new CharInfo(otherPlayer));
final int relation = otherPlayer.getRelation(activeChar);

View File

@@ -509,7 +509,7 @@ public class Duel
}
// play sound
final PlaySound ps = new PlaySound(1, "B04_S01", 0, 0, 0, 0, 0);
final PlaySound ps = new PlaySound(1, "B04_S01");
broadcastToTeam1(ps);
broadcastToTeam2(ps);

View File

@@ -679,7 +679,7 @@ public class Castle
clan.setHasCastle(_castleId); // Set has castle flag for new owner
Announcements.getInstance().announceToAll(clan.getName() + " has taken " + getName() + " castle!");
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
clan.broadcastToOnlineMembers(new PlaySound(1, "Siege_Victory", 0, 0, 0, 0, 0));
clan.broadcastToOnlineMembers(new PlaySound(1, "Siege_Victory"));
// give crowns
CrownManager.getInstance().checkCrowns(clan);

View File

@@ -496,7 +496,7 @@ public class Fort
clan.setHasFort(_fortId); // Set has fort flag for new owner
Announcements.getInstance().announceToAll(clan.getName() + " has taken " + getName() + " fort!");
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
clan.broadcastToOnlineMembers(new PlaySound(1, "Siege_Victory", 0, 0, 0, 0, 0));
clan.broadcastToOnlineMembers(new PlaySound(1, "Siege_Victory"));
}
}
catch (Exception e)

View File

@@ -241,7 +241,7 @@ public class Quest extends ManagedScript
* Return ID of the quest
* @return int
*/
public int getQuestIntId()
public int getQuestId()
{
return _questId;
}

View File

@@ -174,8 +174,7 @@ public class QuestState
_state = state;
Quest.updateQuestInDb(this);
final QuestList ql = new QuestList();
_player.sendPacket(ql);
_player.sendPacket(new QuestList(_player));
return state;
}
@@ -341,10 +340,9 @@ public class QuestState
}
// send a packet to the client to inform it of the quest progress (step change)
final QuestList ql = new QuestList();
_player.sendPacket(ql);
_player.sendPacket(new QuestList(_player));
final int questId = getQuest().getQuestIntId();
final int questId = getQuest().getQuestId();
if ((questId > 0) && (questId < 999) && (cond > 0))
{
@@ -553,7 +551,7 @@ public class QuestState
return;
}
final int questId = getQuest().getQuestIntId();
final int questId = getQuest().getQuestId();
// If item for reward is gold (ID=57), modify count with rate for quest reward
if ((itemId == 57) && ((questId < 217) || (questId > 233)) && ((questId < 401) || (questId > 418)))
@@ -1239,7 +1237,7 @@ public class QuestState
public void playTutorialVoice(String voice)
{
_player.sendPacket(new PlaySound(2, voice, 0, 0, _player.getX(), _player.getY(), _player.getZ()));
_player.sendPacket(new PlaySound(2, voice, false, 0, _player.getLocation(), 0));
}
public void showTutorialHTML(String html)
@@ -1256,7 +1254,7 @@ public class QuestState
public void closeTutorialHtml()
{
_player.sendPacket(new TutorialCloseHtml());
_player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
}
public void onTutorialClientEvent(int number)

View File

@@ -156,7 +156,7 @@ public class EnterWorld extends GameClientPacket
EnterGM(player);
Quest.playerEnter(player);
player.sendPacket(new QuestList());
player.sendPacket(new QuestList(player));
if (Config.ENABLE_COMMUNITY_BOARD)
{

View File

@@ -64,7 +64,7 @@ public class RequestQuestAbort extends GameClientPacket
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
sm.addString("Quest aborted.");
player.sendPacket(sm);
final QuestList ql = new QuestList();
final QuestList ql = new QuestList(player);
player.sendPacket(ql);
}
}

View File

@@ -16,6 +16,7 @@
*/
package org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.serverpackets.QuestList;
public class RequestQuestList extends GameClientPacket
@@ -23,13 +24,17 @@ public class RequestQuestList extends GameClientPacket
@Override
protected void readImpl()
{
// trigger
}
@Override
protected void runImpl()
{
final QuestList ql = new QuestList();
sendPacket(ql);
final PlayerInstance player = getClient().getPlayer();
if (player == null)
{
return;
}
player.sendPacket(new QuestList(player));
}
}

View File

@@ -133,7 +133,7 @@ public class RequestRecordInfo extends GameClientPacket
if (otherPlayer.isInBoat())
{
otherPlayer.getPosition().setWorldPosition(otherPlayer.getBoat().getPosition().getWorldPosition());
otherPlayer.getPosition().setWorldPosition(otherPlayer.getBoat().getLocation());
player.sendPacket(new CharInfo(otherPlayer));
final int relation = otherPlayer.getRelation(player);

View File

@@ -16,6 +16,8 @@
*/
package org.l2jmobius.gameserver.network.serverpackets;
import java.util.List;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState;
@@ -39,24 +41,13 @@ public class GMViewQuestList extends GameServerPacket
writeC(0x93);
writeS(_player.getName());
final Quest[] questList = _player.getAllActiveQuests();
if (questList.length == 0)
{
writeC(0);
writeH(0);
writeH(0);
return;
}
writeH(questList.length); // quest count
final List<Quest> questList = _player.getAllActiveQuests();
writeH(questList.size()); // quest count
for (Quest q : questList)
{
writeD(q.getQuestIntId());
writeD(q.getQuestId());
final QuestState qs = _player.getQuestState(q.getName());
if (qs == null)
{
writeD(0);

View File

@@ -16,51 +16,93 @@
*/
package org.l2jmobius.gameserver.network.serverpackets;
/**
* @version $Revision: 1.1.6.2 $ $Date: 2005/03/27 15:29:39 $
*/
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.WorldObject;
public class PlaySound extends GameServerPacket
{
private final int _unknown1;
private final int _unknown;
private final String _soundFile;
private final int _unknown3;
private final int _unknown4;
private final int _unknown5;
private final int _unknown6;
private final int _unknown7;
private final boolean _isObject;
private final int _objectId;
private final Location _loc;
private final int _duration;
/**
* Used for static sound.
* @param soundFile : The name of the sound file.
*/
public PlaySound(String soundFile)
{
_unknown1 = 0;
_unknown = 0;
_soundFile = soundFile;
_unknown3 = 0;
_unknown4 = 0;
_unknown5 = 0;
_unknown6 = 0;
_unknown7 = 0;
_isObject = false;
_objectId = 0;
_loc = Location.DUMMY_LOC;
_duration = 0;
}
public PlaySound(int unknown1, String soundFile, int unknown3, int unknown4, int unknown5, int unknown6, int unknown7)
/**
* Used for static sound.
* @param unknown : Unknown parameter. Seems linked to sound names with dots (.), tutorials, sieges/bosses.
* @param soundFile : The name of the sound file.
*/
public PlaySound(int unknown, String soundFile)
{
_unknown1 = unknown1;
_unknown = unknown;
_soundFile = soundFile;
_unknown3 = unknown3;
_unknown4 = unknown4;
_unknown5 = unknown5;
_unknown6 = unknown6;
_unknown7 = unknown7;
_isObject = false;
_objectId = 0;
_loc = Location.DUMMY_LOC;
_duration = 0;
}
/**
* Play the sound file in the client. We use a {@link WorldObject} as parameter, notably to find the position of the sound.
* @param unknown
* @param soundFile : The name of the sound file.
* @param object : The object to use.
*/
public PlaySound(int unknown, String soundFile, WorldObject object)
{
_unknown = unknown;
_soundFile = soundFile;
_isObject = true;
_objectId = object.getObjectId();
_loc = object.getLocation();
_duration = 0;
}
/**
* Play the sound file in the client. All parameters can be set.
* @param unknown
* @param soundFile : The name of the sound file.
* @param isObject - true, if sound file calls someone else, but not character
* @param objectId - object ID of caller. 0 - for quest, tutorial, etc.
* @param loc - Location of object
* @param duration - playing time
*/
public PlaySound(int unknown, String soundFile, boolean isObject, int objectId, Location loc, int duration)
{
_unknown = unknown;
_soundFile = soundFile;
_isObject = isObject;
_objectId = objectId;
_loc = loc;
_duration = duration;
}
@Override
protected final void writeImpl()
{
writeC(0x98);
writeD(_unknown1); // unknown 0 for quest and ship;
writeD(_unknown);
writeS(_soundFile);
writeD(_unknown3); // unknown 0 for quest; 1 for ship;
writeD(_unknown4); // 0 for quest; objectId of ship
writeD(_unknown5); // x
writeD(_unknown6); // y
writeD(_unknown7); // z
writeD(_isObject ? 1 : 0);
writeD(_objectId);
writeD(_loc.getX());
writeD(_loc.getY());
writeD(_loc.getZ());
writeD(_duration);
}
}

View File

@@ -16,54 +16,32 @@
*/
package org.l2jmobius.gameserver.network.serverpackets;
import java.util.List;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState;
/**
* sample for rev 377: 98 05 00 number of quests ff 00 00 00 0a 01 00 00 39 01 00 00 04 01 00 00 a2 00 00 00 format h (d) h (dddh) rev 377 format h (dd) h (dddd) rev 417
* @version $Revision: 1.4.2.2.2.2 $ $Date: 2005/02/10 16:44:28 $
*/
public class QuestList extends GameServerPacket
{
private Quest[] _quests;
private PlayerInstance _player;
private final List<Quest> _quests;
private final PlayerInstance _activeChar;
@Override
public void runImpl()
public QuestList(PlayerInstance player)
{
if ((getClient() != null) && (getClient().getPlayer() != null))
{
_player = getClient().getPlayer();
_quests = _player.getAllActiveQuests();
}
_activeChar = player;
_quests = player.getAllActiveQuests();
}
@Override
protected final void writeImpl()
{
/**
* This text was wrote by XaKa QuestList packet structure: { 1 byte - 0x80 2 byte - Number of Quests for Quest in AvailibleQuests { 4 byte - Quest ID 4 byte - Quest Status } } NOTE: The following special constructs are true for the 4-byte Quest Status: If the most significant bit is 0, this
* means that no progress-step got skipped. In this case, merely passing the rank of the latest step gets the client to mark it as current and mark all previous steps as complete. If the most significant bit is 1, it means that some steps may have been skipped. In that case, each bit
* represents a quest step (max 30) with 0 indicating that it was skipped and 1 indicating that it either got completed or is currently active (the client will automatically assume the largest step as active and all smaller ones as completed). For example, the following bit sequences will
* yield the same results: 1000 0000 0000 0000 0000 0011 1111 1111: Indicates some steps may be skipped but each of the first 10 steps did not get skipped and current step is the 10th. 0000 0000 0000 0000 0000 0000 0000 1010: Indicates that no steps were skipped and current is the 10th. It
* is speculated that the latter will be processed faster by the client, so it is preferred when no steps have been skipped. However, the sequence "1000 0000 0000 0000 0000 0010 1101 1111" indicates that the current step is the 10th but the 6th and 9th are not to be shown at all (not
* completed, either).
*/
if ((_quests == null) || (_quests.length == 0))
{
writeC(0x80);
writeH(0);
writeH(0);
return;
}
writeC(0x80);
writeH(_quests.length);
writeH(_quests.size());
for (Quest q : _quests)
{
writeD(q.getQuestIntId());
final QuestState qs = _player.getQuestState(q.getName());
writeD(q.getQuestId());
final QuestState qs = _activeChar.getQuestState(q.getName());
if (qs == null)
{
writeD(0);

View File

@@ -18,6 +18,12 @@ package org.l2jmobius.gameserver.network.serverpackets;
public class TutorialCloseHtml extends GameServerPacket
{
public static final TutorialCloseHtml STATIC_PACKET = new TutorialCloseHtml();
private TutorialCloseHtml()
{
}
@Override
protected void writeImpl()
{