Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
package l2p.gameserver.network.serverpackets;
import l2p.gameserver.model.dynamicquest.DynamicQuestParticipant;
import l2p.gameserver.model.dynamicquest.DynamicQuestTask;
import l2p.gameserver.model.dynamicquest.DynamicQuest.DynamicQuestState;
import l2p.gameserver.network.serverpackets.components.Opcode;
import java.util.Collection;
import java.util.Collections;
public class ExDynamicQuest extends L2GameServerPacket
{
private final DynamicQuestInfo _questInfo;
public ExDynamicQuest(DynamicQuestInfo questInfo)
{
_questInfo = questInfo;
}
@Override
protected void writeImpl()
{
writeEx(Opcode.ExDynamicQuest);
writeC(_questInfo.questType); // isCampaign
writeC(_questInfo._subType); // subType
writeD(_questInfo.questId); // campaignId
writeD(_questInfo.step); // step
_questInfo.write(this);
}
public static class DynamicQuestInfo
{
// Base class, subType = 0 - start, subType = 1 - end quest
public int questType;
public int questId;
public int step;
private int _subType;
public DynamicQuestInfo(int subType)
{
_subType = subType;
}
public void write(ExDynamicQuest packet)
{}
}
public static class StartedQuest extends DynamicQuestInfo
{
private DynamicQuestState _state;
private int _remainingTime;
private int _participantsCount;
private Collection<DynamicQuestTask> _tasks = Collections.emptyList();
public StartedQuest(DynamicQuestState state, int remainingTime, int participantsCount, Collection<DynamicQuestTask> tasks)
{
super(2);
_state = state;
_remainingTime = remainingTime;
_participantsCount = participantsCount;
_tasks = tasks;
}
@Override
public void write(ExDynamicQuest packet)
{
packet.writeC(_state.ordinal());
packet.writeD(_remainingTime);
if (questType == 1) // zone quest
packet.writeD(_participantsCount);
packet.writeD(_tasks.size());
for (DynamicQuestTask task : _tasks)
{
packet.writeD(task.getTaskId());
packet.writeD(task.getCurrentPoints());
packet.writeD(task.getMaxPoints());
}
}
}
public static class ScoreBoardInfo extends DynamicQuestInfo
{
private final int _remainingTime;
private final int _friendsCount;
private final Collection<DynamicQuestParticipant> _participants;
public ScoreBoardInfo(int remainingTime, int friendsCount, Collection<DynamicQuestParticipant> participants)
{
super(3);
_remainingTime = remainingTime;
_friendsCount = friendsCount;
_participants = participants;
}
@Override
public void write(ExDynamicQuest packet)
{
if (questType == 1)
{
packet.writeD(_remainingTime); // remaining time
packet.writeD(_friendsCount); // party members count
packet.writeD(_participants.size()); // participants size
for (DynamicQuestParticipant participant : _participants)
{
packet.writeS(participant.getName());
packet.writeD(participant.getCurrentPoints());// current points
packet.writeD(participant.getAdditionalPoints()); // additional
packet.writeD(participant.getCurrentPoints() + participant.getAdditionalPoints()); // total
}
}
else
{
packet.writeD(_participants.size()); // participants size
for (DynamicQuestParticipant participant : _participants)
packet.writeS(participant.getName()); // name
}
}
}
}
package l2p.gameserver.network.serverpackets;
import l2p.gameserver.model.Player;
import l2p.gameserver.network.serverpackets.components.NpcString;
import l2p.gameserver.network.serverpackets.components.Opcode;
public class ExSendUIEvent extends NpcStringContainer
{
public static final int STYLE_TIMER_SHOW = 0;
public static final int STYLE_TIMER_HIDE = 1;
public static final int STYLE_BALLISTA_CHARGE = 2;
public static final int STYLE_COUNTER = 3;
public static final int STYLE_GP_TIMER = 4;
public static final int STYLE_PROGRESS_BAR = 5;
public static final int STYLE_TEMPERATURE_1 = 6;
public static final int STYLE_TEMPERATURE_2 = 7;
public static final int STYLE_CLAN_PROGRESS_BAR = 8;
public static final int MODE_NONE = -1;
public static final int MODE_REMAINING = 0;
public static final int MODE_ELAPSED = 1;
private int _objectId;
private int _style;
private int _mode;
private int _value1;
private int _value2;
private int _sysStringId1;
private int _sysStringId2;
public ExSendUIEvent(Player player, int style, int mode, int value1, int value2, String... params)
{
this(player, style, mode, value1, value2, 0, 0, NpcString.NONE, params);
}
public ExSendUIEvent(Player player, int style, int mode, int value1, int value2, NpcString npcString, String... params)
{
this(player, style, mode, value1, value2, 0, 0, npcString, params);
}
public ExSendUIEvent(Player player, int style, int mode, int value1, int value2, int sysStringId1, int sysStringId2, NpcString npcString, String... params)
{
super(npcString, params);
_objectId = player != null ? player.getObjectId() : 0;
_style = style;
_mode = mode;
_value1 = value1;
_value2 = value2;
_sysStringId1 = sysStringId1;
_sysStringId2 = sysStringId2;
}
@Override
protected void writeImpl()
{
writeEx(Opcode.ExSendUIEvent);
writeD(_objectId);
writeD(_style); // ID timer (any style)
writeD(0x00); // unknown
writeD(0x00); // unknown
writeS(String.valueOf(_mode)); // Name indicator
if (_mode >= 0 && _style < 6)
{
writeS(String.valueOf(_value1 / 60)); // timer starting minute(s)
writeS(String.valueOf(_value1 % 60)); // timer starting second(s)
writeS(String.valueOf(_value2 / 60)); // timer length minute(s) (timer will disappear 10 seconds before it ends)
writeS(String.valueOf(_value2 % 60)); // timer length second(s) (timer will disappear 10 seconds before it ends)
}
else
{
writeS(String.valueOf(_value1));
writeS(String.valueOf(_value2));
writeS(String.valueOf(_sysStringId1));
writeS(String.valueOf(_sysStringId2));
}
writeElements();
}
}