diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/DailyMission.xml b/L2J_Mobius_5.0_Salvation/dist/game/data/DailyMission.xml index 27d1341869..80bf172d87 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/DailyMission.xml +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/DailyMission.xml @@ -1,3 +1,267 @@ + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java index 530f00e18c..bbf910ea3e 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java @@ -38,7 +38,7 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler { super(holder); _level = holder.getParams().getInt("level"); - _dualclass = holder.getParams().getBoolean("dualclass", false); + _dualclass = holder.isDualClassOnly(); } @Override @@ -73,6 +73,12 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler return false; } + @Override + public boolean isLevelUpMission() + { + return true; + } + @Override public void reset() { diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/DailyMission.xsd b/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/DailyMission.xsd index b201347d63..0e170cc345 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/DailyMission.xsd +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/DailyMission.xsd @@ -36,7 +36,7 @@ - + diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java index ad57fe1f9a..7854207c9d 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java @@ -27,10 +27,12 @@ import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; import org.l2jmobius.gameserver.enums.DailyMissionStatus; +import org.l2jmobius.gameserver.enums.SpecialItemType; import org.l2jmobius.gameserver.model.DailyMissionDataHolder; import org.l2jmobius.gameserver.model.DailyMissionPlayerEntry; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.events.ListenersContainer; +import org.l2jmobius.gameserver.model.holders.ItemHolder; /** * @author Sdw @@ -55,6 +57,11 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public abstract boolean isAvailable(PlayerInstance player); + public boolean isLevelUpMission() + { + return false; + } + public abstract void init(); public int getStatus(PlayerInstance player) @@ -96,7 +103,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public boolean requestReward(PlayerInstance player) { - if (isAvailable(player)) + if (isAvailable(player) || isLevelUpMission()) { giveRewards(player); @@ -113,7 +120,22 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer protected void giveRewards(PlayerInstance player) { - _holder.getRewards().forEach(i -> player.addItem("One Day Reward", i, player, true)); + for (ItemHolder reward : _holder.getRewards()) + { + if (reward.getId() == SpecialItemType.CLAN_REPUTATION.getClientId()) + { + player.getClan().addReputationScore((int) reward.getCount(), true); + } + else if (reward.getId() == SpecialItemType.FAME.getClientId()) + { + player.setFame(player.getFame() + (int) reward.getCount()); + player.broadcastUserInfo(); + } + else + { + player.addItem("Daily Reward", reward, player, true); + } + } } protected void storePlayerEntry(DailyMissionPlayerEntry entry) diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java index 91caa42a7e..4a4fc3eedd 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java @@ -163,6 +163,11 @@ public class DailyMissionDataHolder return (_handler != null) && _handler.getRecentlyCompleted(player); } + public boolean isLevelUpMission() + { + return (_handler != null) && _handler.isLevelUpMission(); + } + public void reset() { if (_handler != null) diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java index a96fcd36ea..dfbcaa2ec4 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -88,6 +88,8 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeLe import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryInfo; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryReset; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionReward; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo; import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct; @@ -424,8 +426,8 @@ public enum ExIncomingPackets implements IIncomingPackets EX_PLEDGE_CONTRIBUTION_INFO(0x13F, null, ConnectionState.IN_GAME), EX_PLEDGE_CONTRIBUTION_REWARD(0x140, null, ConnectionState.IN_GAME), EX_PLEDGE_LEVEL_UP(0x141, RequestExPledgeLevelUp::new, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_INFO(0x142, null, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_REWARD(0x143, null, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_INFO(0x142, RequestExPledgeMissionInfo::new, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_REWARD(0x143, RequestExPledgeMissionReward::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_INFO(0x144, RequestExPledgeMasteryInfo::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_SET(0x145, RequestExPledgeMasterySet::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_RESET(0x146, RequestExPledgeMasteryReset::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 20209223b9..21765e8735 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -624,9 +624,6 @@ public class EnterWorld implements IClientIncomingPacket { player.sendPacket(new ExWorldChatCnt(player)); } - // Removed used by new Clan system. - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - // player.sendPacket(new ExOneDayReceiveRewardList(player, true)); // Handle soulshots, disable all on EnterWorld player.sendPacket(new ExAutoSoulShot(0, true, 0)); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java deleted file mode 100644 index 466420076b..0000000000 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author UnAfraid - */ -public class RequestTodoList implements IClientIncomingPacket -{ - private int _tab; - @SuppressWarnings("unused") - private boolean _showAllLevels; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _tab = packet.readC(); // Daily Reward = 9, Event = 1, Instance Zone = 2 - _showAllLevels = packet.readC() == 1; // Disabled = 0, Enabled = 1 - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_tab) - { - // case 1: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - // case 2: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - case 9: // Daily Rewards - { - // Initial EW request should be false - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - break; - } - } - } -} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java similarity index 59% rename from L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java rename to L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java index d42954b0cc..db343a57e9 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java @@ -14,32 +14,37 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; /** - * @author Mobius - */ -public class RequestTodoListHTML implements IClientIncomingPacket + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class RequestExPledgeMissionInfo implements IClientIncomingPacket { - @SuppressWarnings("unused") - private int _tab; - @SuppressWarnings("unused") - private String _linkName; - @Override public boolean read(GameClient client, PacketReader packet) { - _tab = packet.readC(); - _linkName = packet.readS(); return true; } @Override public void run(GameClient client) { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); } } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java similarity index 73% rename from L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java rename to L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java index 4bbf0f209d..39022df25e 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java @@ -1,62 +1,63 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import java.util.Collection; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author Sdw - */ -public class RequestOneDayRewardReceive implements IClientIncomingPacket -{ - private int _id; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _id = packet.readH(); - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); - if ((reward == null) || reward.isEmpty()) - { - return; - } - - reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; + +/** + * @author Mobius + */ +public class RequestExPledgeMissionReward implements IClientIncomingPacket +{ + private int _id; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _id = packet.readD(); + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if ((player == null) || (player.getClan() == null)) + { + return; + } + + final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); + if ((reward == null) || reward.isEmpty()) + { + return; + } + + reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); + } +} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java deleted file mode 100644 index d07104667a..0000000000 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import java.time.LocalDate; -import java.util.Collection; -import java.util.Collections; -import java.util.function.Function; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; -import org.l2jmobius.gameserver.util.cron4j.Predictor; - -/** - * @author Sdw - */ -public class ExOneDayReceiveRewardList implements IClientOutgoingPacket -{ - final PlayerInstance _player; - private final Collection _rewards; - private static final Function _remainTime = pattern -> (new Predictor(pattern).nextMatchingTime() - System.currentTimeMillis()) / 1000; - - private final long _dayRemainTime; - private final long _weekRemainTime; - private final long _monthRemainTime; - - public ExOneDayReceiveRewardList(PlayerInstance player, boolean sendRewards) - { - _player = player; - _rewards = sendRewards ? DailyMissionData.getInstance().getDailyMissionData(player) : Collections.emptyList(); - _dayRemainTime = _remainTime.apply("30 6 * * *"); - _weekRemainTime = _remainTime.apply("30 6 * * 1"); - _monthRemainTime = _remainTime.apply("30 6 1 * *"); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_ONE_DAY_RECEIVE_REWARD_LIST.writeId(packet); - - packet.writeD((int) _dayRemainTime); - packet.writeD((int) _weekRemainTime); - packet.writeD((int) _monthRemainTime); - packet.writeC(0x17); - packet.writeD(_player.getClassId().getId()); - packet.writeD(LocalDate.now().getDayOfWeek().ordinal()); // Day of week - packet.writeD(_rewards.size()); - for (DailyMissionDataHolder reward : _rewards) - { - packet.writeH(reward.getId()); - packet.writeC(reward.getStatus(_player)); - packet.writeC(reward.getRequiredCompletions() > 1 ? 0x01 : 0x00); - packet.writeD(Math.min(reward.getProgress(_player), _player.getLevel())); - packet.writeD(reward.getRequiredCompletions()); - } - return true; - } -} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java new file mode 100644 index 0000000000..bb1b572fa9 --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java @@ -0,0 +1,94 @@ +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExPledgeMissionInfo implements IClientOutgoingPacket +{ + private final PlayerInstance _player; + private final Collection _rewards; + + public ExPledgeMissionInfo(PlayerInstance player) + { + _player = player; + _rewards = DailyMissionData.getInstance().getDailyMissionData(player); + } + + @Override + public boolean write(PacketWriter packet) + { + if (!DailyMissionData.getInstance().isAvailable() || (_player.getClan() == null)) + { + return true; + } + + OutgoingPackets.EX_PLEDGE_MISSION_INFO.writeId(packet); + + packet.writeD(_rewards.size()); + for (DailyMissionDataHolder reward : _rewards) + { + int progress = reward.getProgress(_player); + int status = reward.getStatus(_player); + + // TODO: Figure out this. + if (reward.isLevelUpMission()) + { + progress = 1; + if (status == 2) + { + if (reward.getRequiredCompletions() <= _player.getLevel()) + { + status = 3; + } + else + { + status = 1; + } + } + else + { + status = 0; + } + } + else if (status == 1) + { + status = 3; + } + else if (status == 3) + { + status = 2; + } + + packet.writeD(reward.getId()); + packet.writeD(progress); + packet.writeC(status); + } + + return true; + } +} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java similarity index 54% rename from L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java rename to L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java index a86a4998aa..34b29a6ba8 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java @@ -1,60 +1,50 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Sdw - */ -public class ExConnectedTimeAndGettableReward implements IClientOutgoingPacket -{ - private final int _oneDayRewardAvailableCount; - - public ExConnectedTimeAndGettableReward(PlayerInstance player) - { - _oneDayRewardAvailableCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_CONNECTED_TIME_AND_GETTABLE_REWARD.writeId(packet); - packet.writeD(0x00); - packet.writeD(_oneDayRewardAvailableCount); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - return true; - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class ExPledgeMissionRewardCount implements IClientOutgoingPacket +{ + private final int _doneMissionsCount; + private final int _availableMissionsCount; + + public ExPledgeMissionRewardCount(PlayerInstance player) + { + _doneMissionsCount = (int) DailyMissionData.getInstance().getDailyMissionData(player).stream().filter(d -> d.getRecentlyCompleted(player)).count(); + _availableMissionsCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_PLEDGE_MISSION_REWARD_COUNT.writeId(packet); + + packet.writeD(Math.min(_availableMissionsCount, _doneMissionsCount)); // Received missions rewards. + packet.writeD(_availableMissionsCount); // Available missions rewards. 18 - for noble, 20 - for honnorable noble. + + return true; + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/DailyMission.xml b/L2J_Mobius_5.5_EtinasFate/dist/game/data/DailyMission.xml index 27d1341869..80bf172d87 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/DailyMission.xml +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/DailyMission.xml @@ -1,3 +1,267 @@ + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java index 530f00e18c..bbf910ea3e 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java @@ -38,7 +38,7 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler { super(holder); _level = holder.getParams().getInt("level"); - _dualclass = holder.getParams().getBoolean("dualclass", false); + _dualclass = holder.isDualClassOnly(); } @Override @@ -73,6 +73,12 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler return false; } + @Override + public boolean isLevelUpMission() + { + return true; + } + @Override public void reset() { diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/DailyMission.xsd b/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/DailyMission.xsd index b201347d63..0e170cc345 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/DailyMission.xsd +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/DailyMission.xsd @@ -36,7 +36,7 @@ - + diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java index ad57fe1f9a..7854207c9d 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java @@ -27,10 +27,12 @@ import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; import org.l2jmobius.gameserver.enums.DailyMissionStatus; +import org.l2jmobius.gameserver.enums.SpecialItemType; import org.l2jmobius.gameserver.model.DailyMissionDataHolder; import org.l2jmobius.gameserver.model.DailyMissionPlayerEntry; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.events.ListenersContainer; +import org.l2jmobius.gameserver.model.holders.ItemHolder; /** * @author Sdw @@ -55,6 +57,11 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public abstract boolean isAvailable(PlayerInstance player); + public boolean isLevelUpMission() + { + return false; + } + public abstract void init(); public int getStatus(PlayerInstance player) @@ -96,7 +103,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public boolean requestReward(PlayerInstance player) { - if (isAvailable(player)) + if (isAvailable(player) || isLevelUpMission()) { giveRewards(player); @@ -113,7 +120,22 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer protected void giveRewards(PlayerInstance player) { - _holder.getRewards().forEach(i -> player.addItem("One Day Reward", i, player, true)); + for (ItemHolder reward : _holder.getRewards()) + { + if (reward.getId() == SpecialItemType.CLAN_REPUTATION.getClientId()) + { + player.getClan().addReputationScore((int) reward.getCount(), true); + } + else if (reward.getId() == SpecialItemType.FAME.getClientId()) + { + player.setFame(player.getFame() + (int) reward.getCount()); + player.broadcastUserInfo(); + } + else + { + player.addItem("Daily Reward", reward, player, true); + } + } } protected void storePlayerEntry(DailyMissionPlayerEntry entry) diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java index 91caa42a7e..4a4fc3eedd 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java @@ -163,6 +163,11 @@ public class DailyMissionDataHolder return (_handler != null) && _handler.getRecentlyCompleted(player); } + public boolean isLevelUpMission() + { + return (_handler != null) && _handler.isLevelUpMission(); + } + public void reset() { if (_handler != null) diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java index 2aafe98e50..81f6bbaf79 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -88,6 +88,8 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeLe import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryInfo; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryReset; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionReward; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo; import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct; @@ -424,8 +426,8 @@ public enum ExIncomingPackets implements IIncomingPackets EX_PLEDGE_CONTRIBUTION_INFO(0x13F, null, ConnectionState.IN_GAME), EX_PLEDGE_CONTRIBUTION_REWARD(0x140, null, ConnectionState.IN_GAME), EX_PLEDGE_LEVEL_UP(0x141, RequestExPledgeLevelUp::new, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_INFO(0x142, null, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_REWARD(0x143, null, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_INFO(0x142, RequestExPledgeMissionInfo::new, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_REWARD(0x143, RequestExPledgeMissionReward::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_INFO(0x144, RequestExPledgeMasteryInfo::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_SET(0x145, RequestExPledgeMasterySet::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_RESET(0x146, RequestExPledgeMasteryReset::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 14690861d1..2133836966 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -624,9 +624,6 @@ public class EnterWorld implements IClientIncomingPacket { player.sendPacket(new ExWorldChatCnt(player)); } - // Removed used by new Clan system. - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - // player.sendPacket(new ExOneDayReceiveRewardList(player, true)); // Handle soulshots, disable all on EnterWorld player.sendPacket(new ExAutoSoulShot(0, true, 0)); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java deleted file mode 100644 index 466420076b..0000000000 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author UnAfraid - */ -public class RequestTodoList implements IClientIncomingPacket -{ - private int _tab; - @SuppressWarnings("unused") - private boolean _showAllLevels; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _tab = packet.readC(); // Daily Reward = 9, Event = 1, Instance Zone = 2 - _showAllLevels = packet.readC() == 1; // Disabled = 0, Enabled = 1 - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_tab) - { - // case 1: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - // case 2: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - case 9: // Daily Rewards - { - // Initial EW request should be false - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - break; - } - } - } -} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java similarity index 59% rename from L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java rename to L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java index d42954b0cc..db343a57e9 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java @@ -14,32 +14,37 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; /** - * @author Mobius - */ -public class RequestTodoListHTML implements IClientIncomingPacket + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class RequestExPledgeMissionInfo implements IClientIncomingPacket { - @SuppressWarnings("unused") - private int _tab; - @SuppressWarnings("unused") - private String _linkName; - @Override public boolean read(GameClient client, PacketReader packet) { - _tab = packet.readC(); - _linkName = packet.readS(); return true; } @Override public void run(GameClient client) { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); } } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java similarity index 73% rename from L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java rename to L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java index 4bbf0f209d..39022df25e 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java @@ -1,62 +1,63 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import java.util.Collection; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author Sdw - */ -public class RequestOneDayRewardReceive implements IClientIncomingPacket -{ - private int _id; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _id = packet.readH(); - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); - if ((reward == null) || reward.isEmpty()) - { - return; - } - - reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; + +/** + * @author Mobius + */ +public class RequestExPledgeMissionReward implements IClientIncomingPacket +{ + private int _id; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _id = packet.readD(); + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if ((player == null) || (player.getClan() == null)) + { + return; + } + + final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); + if ((reward == null) || reward.isEmpty()) + { + return; + } + + reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java deleted file mode 100644 index d07104667a..0000000000 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import java.time.LocalDate; -import java.util.Collection; -import java.util.Collections; -import java.util.function.Function; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; -import org.l2jmobius.gameserver.util.cron4j.Predictor; - -/** - * @author Sdw - */ -public class ExOneDayReceiveRewardList implements IClientOutgoingPacket -{ - final PlayerInstance _player; - private final Collection _rewards; - private static final Function _remainTime = pattern -> (new Predictor(pattern).nextMatchingTime() - System.currentTimeMillis()) / 1000; - - private final long _dayRemainTime; - private final long _weekRemainTime; - private final long _monthRemainTime; - - public ExOneDayReceiveRewardList(PlayerInstance player, boolean sendRewards) - { - _player = player; - _rewards = sendRewards ? DailyMissionData.getInstance().getDailyMissionData(player) : Collections.emptyList(); - _dayRemainTime = _remainTime.apply("30 6 * * *"); - _weekRemainTime = _remainTime.apply("30 6 * * 1"); - _monthRemainTime = _remainTime.apply("30 6 1 * *"); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_ONE_DAY_RECEIVE_REWARD_LIST.writeId(packet); - - packet.writeD((int) _dayRemainTime); - packet.writeD((int) _weekRemainTime); - packet.writeD((int) _monthRemainTime); - packet.writeC(0x17); - packet.writeD(_player.getClassId().getId()); - packet.writeD(LocalDate.now().getDayOfWeek().ordinal()); // Day of week - packet.writeD(_rewards.size()); - for (DailyMissionDataHolder reward : _rewards) - { - packet.writeH(reward.getId()); - packet.writeC(reward.getStatus(_player)); - packet.writeC(reward.getRequiredCompletions() > 1 ? 0x01 : 0x00); - packet.writeD(Math.min(reward.getProgress(_player), _player.getLevel())); - packet.writeD(reward.getRequiredCompletions()); - } - return true; - } -} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java new file mode 100644 index 0000000000..bb1b572fa9 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java @@ -0,0 +1,94 @@ +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExPledgeMissionInfo implements IClientOutgoingPacket +{ + private final PlayerInstance _player; + private final Collection _rewards; + + public ExPledgeMissionInfo(PlayerInstance player) + { + _player = player; + _rewards = DailyMissionData.getInstance().getDailyMissionData(player); + } + + @Override + public boolean write(PacketWriter packet) + { + if (!DailyMissionData.getInstance().isAvailable() || (_player.getClan() == null)) + { + return true; + } + + OutgoingPackets.EX_PLEDGE_MISSION_INFO.writeId(packet); + + packet.writeD(_rewards.size()); + for (DailyMissionDataHolder reward : _rewards) + { + int progress = reward.getProgress(_player); + int status = reward.getStatus(_player); + + // TODO: Figure out this. + if (reward.isLevelUpMission()) + { + progress = 1; + if (status == 2) + { + if (reward.getRequiredCompletions() <= _player.getLevel()) + { + status = 3; + } + else + { + status = 1; + } + } + else + { + status = 0; + } + } + else if (status == 1) + { + status = 3; + } + else if (status == 3) + { + status = 2; + } + + packet.writeD(reward.getId()); + packet.writeD(progress); + packet.writeC(status); + } + + return true; + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java similarity index 54% rename from L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java rename to L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java index a86a4998aa..34b29a6ba8 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java @@ -1,60 +1,50 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Sdw - */ -public class ExConnectedTimeAndGettableReward implements IClientOutgoingPacket -{ - private final int _oneDayRewardAvailableCount; - - public ExConnectedTimeAndGettableReward(PlayerInstance player) - { - _oneDayRewardAvailableCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_CONNECTED_TIME_AND_GETTABLE_REWARD.writeId(packet); - packet.writeD(0x00); - packet.writeD(_oneDayRewardAvailableCount); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - return true; - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class ExPledgeMissionRewardCount implements IClientOutgoingPacket +{ + private final int _doneMissionsCount; + private final int _availableMissionsCount; + + public ExPledgeMissionRewardCount(PlayerInstance player) + { + _doneMissionsCount = (int) DailyMissionData.getInstance().getDailyMissionData(player).stream().filter(d -> d.getRecentlyCompleted(player)).count(); + _availableMissionsCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_PLEDGE_MISSION_REWARD_COUNT.writeId(packet); + + packet.writeD(Math.min(_availableMissionsCount, _doneMissionsCount)); // Received missions rewards. + packet.writeD(_availableMissionsCount); // Available missions rewards. 18 - for noble, 20 - for honnorable noble. + + return true; + } +} diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/DailyMission.xml b/L2J_Mobius_6.0_Fafurion/dist/game/data/DailyMission.xml index 27d1341869..48794360e9 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/DailyMission.xml +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/DailyMission.xml @@ -1,3 +1,861 @@ + + + + 85 + 255 + + + + + + + + + + + 23653,23654,23655,23656,23657,23658,23659,23660,23661,23662,23663,23664,23684,23685,23686 + 99 + 255 + + + + + + + + + + + + + + + + + + + 29218,29194,29212 + 99 + 255 + + + + + + + + + + + + + + + + + + + 29194,29212,29236,29237,26236 + 99 + 255 + + + + + + + + + + + 26124,26143 + 99 + 255 + + + + + + + + + + + + + + + + + + + 23465 + 99 + 255 + + + + + + + + + + + 19125,25892,25946,25956,25961,25922,25929,25983 + 99 + 255 + + + + + + + + + + 40 + 255 + + + + + + + + + + 40 + 255 + + + + + + + + + + + 26250 + 99 + 255 + + + + + + + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + + + + + + 1 + 255 + + + + + + + + + + 1 + 255 + + + + + + + + + + 1 + 255 + + + + + + + + + + 23704,23703,23696,24068 + 99 + 255 + + + + + + + + + + 29068,29028,29240,29367,29305,29319 + 99 + 255 + + + + + + + + + + 29068,29028,29240,29367,29305,29319 + 99 + 255 + + + + + + + + + + 29068,29028,29240,29367,29305,29319 + 99 + 255 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java index 530f00e18c..bbf910ea3e 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java @@ -38,7 +38,7 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler { super(holder); _level = holder.getParams().getInt("level"); - _dualclass = holder.getParams().getBoolean("dualclass", false); + _dualclass = holder.isDualClassOnly(); } @Override @@ -73,6 +73,12 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler return false; } + @Override + public boolean isLevelUpMission() + { + return true; + } + @Override public void reset() { diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/DailyMission.xsd b/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/DailyMission.xsd index b201347d63..0e170cc345 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/DailyMission.xsd +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/DailyMission.xsd @@ -36,7 +36,7 @@ - + diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java index ad57fe1f9a..7854207c9d 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java @@ -27,10 +27,12 @@ import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; import org.l2jmobius.gameserver.enums.DailyMissionStatus; +import org.l2jmobius.gameserver.enums.SpecialItemType; import org.l2jmobius.gameserver.model.DailyMissionDataHolder; import org.l2jmobius.gameserver.model.DailyMissionPlayerEntry; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.events.ListenersContainer; +import org.l2jmobius.gameserver.model.holders.ItemHolder; /** * @author Sdw @@ -55,6 +57,11 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public abstract boolean isAvailable(PlayerInstance player); + public boolean isLevelUpMission() + { + return false; + } + public abstract void init(); public int getStatus(PlayerInstance player) @@ -96,7 +103,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public boolean requestReward(PlayerInstance player) { - if (isAvailable(player)) + if (isAvailable(player) || isLevelUpMission()) { giveRewards(player); @@ -113,7 +120,22 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer protected void giveRewards(PlayerInstance player) { - _holder.getRewards().forEach(i -> player.addItem("One Day Reward", i, player, true)); + for (ItemHolder reward : _holder.getRewards()) + { + if (reward.getId() == SpecialItemType.CLAN_REPUTATION.getClientId()) + { + player.getClan().addReputationScore((int) reward.getCount(), true); + } + else if (reward.getId() == SpecialItemType.FAME.getClientId()) + { + player.setFame(player.getFame() + (int) reward.getCount()); + player.broadcastUserInfo(); + } + else + { + player.addItem("Daily Reward", reward, player, true); + } + } } protected void storePlayerEntry(DailyMissionPlayerEntry entry) diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java index 91caa42a7e..4a4fc3eedd 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java @@ -163,6 +163,11 @@ public class DailyMissionDataHolder return (_handler != null) && _handler.getRecentlyCompleted(player); } + public boolean isLevelUpMission() + { + return (_handler != null) && _handler.isLevelUpMission(); + } + public void reset() { if (_handler != null) diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java index 969b456d93..e78635577a 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -89,6 +89,8 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeLe import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryInfo; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryReset; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionReward; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo; import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct; @@ -425,8 +427,8 @@ public enum ExIncomingPackets implements IIncomingPackets EX_PLEDGE_CONTRIBUTION_INFO(0x13F, null, ConnectionState.IN_GAME), EX_PLEDGE_CONTRIBUTION_REWARD(0x140, null, ConnectionState.IN_GAME), EX_PLEDGE_LEVEL_UP(0x141, RequestExPledgeLevelUp::new, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_INFO(0x142, null, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_REWARD(0x143, null, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_INFO(0x142, RequestExPledgeMissionInfo::new, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_REWARD(0x143, RequestExPledgeMissionReward::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_INFO(0x144, RequestExPledgeMasteryInfo::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_SET(0x145, RequestExPledgeMasterySet::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_RESET(0x146, RequestExPledgeMasteryReset::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 14690861d1..2133836966 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -624,9 +624,6 @@ public class EnterWorld implements IClientIncomingPacket { player.sendPacket(new ExWorldChatCnt(player)); } - // Removed used by new Clan system. - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - // player.sendPacket(new ExOneDayReceiveRewardList(player, true)); // Handle soulshots, disable all on EnterWorld player.sendPacket(new ExAutoSoulShot(0, true, 0)); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java deleted file mode 100644 index 466420076b..0000000000 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author UnAfraid - */ -public class RequestTodoList implements IClientIncomingPacket -{ - private int _tab; - @SuppressWarnings("unused") - private boolean _showAllLevels; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _tab = packet.readC(); // Daily Reward = 9, Event = 1, Instance Zone = 2 - _showAllLevels = packet.readC() == 1; // Disabled = 0, Enabled = 1 - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_tab) - { - // case 1: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - // case 2: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - case 9: // Daily Rewards - { - // Initial EW request should be false - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - break; - } - } - } -} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java similarity index 59% rename from L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java rename to L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java index d42954b0cc..db343a57e9 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java @@ -14,32 +14,37 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; /** - * @author Mobius - */ -public class RequestTodoListHTML implements IClientIncomingPacket + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class RequestExPledgeMissionInfo implements IClientIncomingPacket { - @SuppressWarnings("unused") - private int _tab; - @SuppressWarnings("unused") - private String _linkName; - @Override public boolean read(GameClient client, PacketReader packet) { - _tab = packet.readC(); - _linkName = packet.readS(); return true; } @Override public void run(GameClient client) { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java similarity index 73% rename from L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java rename to L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java index 4bbf0f209d..39022df25e 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java @@ -1,62 +1,63 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import java.util.Collection; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author Sdw - */ -public class RequestOneDayRewardReceive implements IClientIncomingPacket -{ - private int _id; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _id = packet.readH(); - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); - if ((reward == null) || reward.isEmpty()) - { - return; - } - - reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; + +/** + * @author Mobius + */ +public class RequestExPledgeMissionReward implements IClientIncomingPacket +{ + private int _id; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _id = packet.readD(); + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if ((player == null) || (player.getClan() == null)) + { + return; + } + + final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); + if ((reward == null) || reward.isEmpty()) + { + return; + } + + reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); + } +} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java deleted file mode 100644 index 3f53580346..0000000000 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import java.time.LocalDate; -import java.util.Collection; -import java.util.Collections; -import java.util.function.Function; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; -import org.l2jmobius.gameserver.util.cron4j.Predictor; - -/** - * @author Sdw - */ -public class ExOneDayReceiveRewardList implements IClientOutgoingPacket -{ - final PlayerInstance _player; - private final Collection _rewards; - private static final Function _remainTime = pattern -> (new Predictor(pattern).nextMatchingTime() - System.currentTimeMillis()) / 1000; - - private final long _dayRemainTime; - private final long _weekRemainTime; - private final long _monthRemainTime; - - public ExOneDayReceiveRewardList(PlayerInstance player, boolean sendRewards) - { - _player = player; - _rewards = sendRewards ? DailyMissionData.getInstance().getDailyMissionData(player) : Collections.emptyList(); - _dayRemainTime = _remainTime.apply("30 6 * * *"); - _weekRemainTime = _remainTime.apply("30 6 * * 1"); - _monthRemainTime = _remainTime.apply("30 6 1 * *"); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_ONE_DAY_RECEIVE_REWARD_LIST.writeId(packet); - - packet.writeD((int) _dayRemainTime); - packet.writeD((int) _weekRemainTime); - packet.writeD((int) _monthRemainTime); - packet.writeC(0x17); - packet.writeD(_player.getClassId().getId()); - packet.writeD(LocalDate.now().getDayOfWeek().ordinal()); // Day of week - packet.writeD(_rewards.size()); - for (DailyMissionDataHolder reward : _rewards) - { - packet.writeH(reward.getId()); - int status = reward.getStatus(_player); - packet.writeC(status); - packet.writeC(reward.getRequiredCompletions() > 1 ? 0x01 : 0x00); - packet.writeD(reward.getParams().getInt("level", -1) == -1 ? (status == 1 ? 0 : reward.getProgress(_player)) : _player.getLevel()); - packet.writeD(reward.getRequiredCompletions()); - } - return true; - } -} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java new file mode 100644 index 0000000000..bb1b572fa9 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java @@ -0,0 +1,94 @@ +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExPledgeMissionInfo implements IClientOutgoingPacket +{ + private final PlayerInstance _player; + private final Collection _rewards; + + public ExPledgeMissionInfo(PlayerInstance player) + { + _player = player; + _rewards = DailyMissionData.getInstance().getDailyMissionData(player); + } + + @Override + public boolean write(PacketWriter packet) + { + if (!DailyMissionData.getInstance().isAvailable() || (_player.getClan() == null)) + { + return true; + } + + OutgoingPackets.EX_PLEDGE_MISSION_INFO.writeId(packet); + + packet.writeD(_rewards.size()); + for (DailyMissionDataHolder reward : _rewards) + { + int progress = reward.getProgress(_player); + int status = reward.getStatus(_player); + + // TODO: Figure out this. + if (reward.isLevelUpMission()) + { + progress = 1; + if (status == 2) + { + if (reward.getRequiredCompletions() <= _player.getLevel()) + { + status = 3; + } + else + { + status = 1; + } + } + else + { + status = 0; + } + } + else if (status == 1) + { + status = 3; + } + else if (status == 3) + { + status = 2; + } + + packet.writeD(reward.getId()); + packet.writeD(progress); + packet.writeC(status); + } + + return true; + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java similarity index 54% rename from L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java rename to L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java index a86a4998aa..34b29a6ba8 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java @@ -1,60 +1,50 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Sdw - */ -public class ExConnectedTimeAndGettableReward implements IClientOutgoingPacket -{ - private final int _oneDayRewardAvailableCount; - - public ExConnectedTimeAndGettableReward(PlayerInstance player) - { - _oneDayRewardAvailableCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_CONNECTED_TIME_AND_GETTABLE_REWARD.writeId(packet); - packet.writeD(0x00); - packet.writeD(_oneDayRewardAvailableCount); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - return true; - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class ExPledgeMissionRewardCount implements IClientOutgoingPacket +{ + private final int _doneMissionsCount; + private final int _availableMissionsCount; + + public ExPledgeMissionRewardCount(PlayerInstance player) + { + _doneMissionsCount = (int) DailyMissionData.getInstance().getDailyMissionData(player).stream().filter(d -> d.getRecentlyCompleted(player)).count(); + _availableMissionsCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_PLEDGE_MISSION_REWARD_COUNT.writeId(packet); + + packet.writeD(Math.min(_availableMissionsCount, _doneMissionsCount)); // Received missions rewards. + packet.writeD(_availableMissionsCount); // Available missions rewards. 18 - for noble, 20 - for honnorable noble. + + return true; + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/DailyMission.xml b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/DailyMission.xml index 27d1341869..48794360e9 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/DailyMission.xml +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/DailyMission.xml @@ -1,3 +1,861 @@ + + + + 85 + 255 + + + + + + + + + + + 23653,23654,23655,23656,23657,23658,23659,23660,23661,23662,23663,23664,23684,23685,23686 + 99 + 255 + + + + + + + + + + + + + + + + + + + 29218,29194,29212 + 99 + 255 + + + + + + + + + + + + + + + + + + + 29194,29212,29236,29237,26236 + 99 + 255 + + + + + + + + + + + 26124,26143 + 99 + 255 + + + + + + + + + + + + + + + + + + + 23465 + 99 + 255 + + + + + + + + + + + 19125,25892,25946,25956,25961,25922,25929,25983 + 99 + 255 + + + + + + + + + + 40 + 255 + + + + + + + + + + 40 + 255 + + + + + + + + + + + 26250 + 99 + 255 + + + + + + + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + + + + + 99 + + + + + + + + + + + 100 + + + + + + + + + + + 101 + + + + + + + + + + + 102 + + + + + + + + + + + 103 + + + + + + + + + + + 104 + + + + + + + + + + + 105 + + + + + + + + + + + 106 + + + + + + + + + + + 107 + + + + + + + + + + + 108 + + + + + + + + + + + 109 + + + + + + + + + + + 110 + + + + + + + + + + + + 1 + 255 + + + + + + + + + + 1 + 255 + + + + + + + + + + 1 + 255 + + + + + + + + + + 23704,23703,23696,24068 + 99 + 255 + + + + + + + + + + 29068,29028,29240,29367,29305,29319 + 99 + 255 + + + + + + + + + + 29068,29028,29240,29367,29305,29319 + 99 + 255 + + + + + + + + + + 29068,29028,29240,29367,29305,29319 + 99 + 255 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java index 530f00e18c..bbf910ea3e 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/dailymissionhandlers/LevelDailyMissionHandler.java @@ -38,7 +38,7 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler { super(holder); _level = holder.getParams().getInt("level"); - _dualclass = holder.getParams().getBoolean("dualclass", false); + _dualclass = holder.isDualClassOnly(); } @Override @@ -73,6 +73,12 @@ public class LevelDailyMissionHandler extends AbstractDailyMissionHandler return false; } + @Override + public boolean isLevelUpMission() + { + return true; + } + @Override public void reset() { diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/DailyMission.xsd b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/DailyMission.xsd index b201347d63..0e170cc345 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/DailyMission.xsd +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/DailyMission.xsd @@ -36,7 +36,7 @@ - + diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java index ad57fe1f9a..7854207c9d 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java @@ -27,10 +27,12 @@ import java.util.logging.Logger; import org.l2jmobius.commons.database.DatabaseFactory; import org.l2jmobius.gameserver.enums.DailyMissionStatus; +import org.l2jmobius.gameserver.enums.SpecialItemType; import org.l2jmobius.gameserver.model.DailyMissionDataHolder; import org.l2jmobius.gameserver.model.DailyMissionPlayerEntry; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.events.ListenersContainer; +import org.l2jmobius.gameserver.model.holders.ItemHolder; /** * @author Sdw @@ -55,6 +57,11 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public abstract boolean isAvailable(PlayerInstance player); + public boolean isLevelUpMission() + { + return false; + } + public abstract void init(); public int getStatus(PlayerInstance player) @@ -96,7 +103,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer public boolean requestReward(PlayerInstance player) { - if (isAvailable(player)) + if (isAvailable(player) || isLevelUpMission()) { giveRewards(player); @@ -113,7 +120,22 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer protected void giveRewards(PlayerInstance player) { - _holder.getRewards().forEach(i -> player.addItem("One Day Reward", i, player, true)); + for (ItemHolder reward : _holder.getRewards()) + { + if (reward.getId() == SpecialItemType.CLAN_REPUTATION.getClientId()) + { + player.getClan().addReputationScore((int) reward.getCount(), true); + } + else if (reward.getId() == SpecialItemType.FAME.getClientId()) + { + player.setFame(player.getFame() + (int) reward.getCount()); + player.broadcastUserInfo(); + } + else + { + player.addItem("Daily Reward", reward, player, true); + } + } } protected void storePlayerEntry(DailyMissionPlayerEntry entry) diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java index 91caa42a7e..4a4fc3eedd 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/DailyMissionDataHolder.java @@ -163,6 +163,11 @@ public class DailyMissionDataHolder return (_handler != null) && _handler.getRecentlyCompleted(player); } + public boolean isLevelUpMission() + { + return (_handler != null) && _handler.isLevelUpMission(); + } + public void reset() { if (_handler != null) diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java index cf6eba50c6..0cd9d2c13e 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -90,6 +90,8 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeLe import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryInfo; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasteryReset; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMissionReward; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate; import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo; import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct; @@ -431,8 +433,8 @@ public enum ExIncomingPackets implements IIncomingPackets EX_PLEDGE_CONTRIBUTION_INFO(0x13E, null, ConnectionState.IN_GAME), EX_PLEDGE_CONTRIBUTION_REWARD(0x13F, null, ConnectionState.IN_GAME), EX_PLEDGE_LEVEL_UP(0x140, RequestExPledgeLevelUp::new, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_INFO(0x141, null, ConnectionState.IN_GAME), - EX_PLEDGE_MISSION_REWARD(0x142, null, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_INFO(0x141, RequestExPledgeMissionInfo::new, ConnectionState.IN_GAME), + EX_PLEDGE_MISSION_REWARD(0x142, RequestExPledgeMissionReward::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_INFO(0x143, RequestExPledgeMasteryInfo::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_SET(0x144, RequestExPledgeMasterySet::new, ConnectionState.IN_GAME), EX_PLEDGE_MASTERY_RESET(0x145, RequestExPledgeMasteryReset::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 9f95cd92db..4c22b5f7f2 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -626,9 +626,6 @@ public class EnterWorld implements IClientIncomingPacket { player.sendPacket(new ExWorldChatCnt(player)); } - // Removed used by new Clan system. - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - // player.sendPacket(new ExOneDayReceiveRewardList(player, true)); // Handle soulshots, disable all on EnterWorld player.sendPacket(new ExAutoSoulShot(0, true, 0)); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java deleted file mode 100644 index 466420076b..0000000000 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoList.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author UnAfraid - */ -public class RequestTodoList implements IClientIncomingPacket -{ - private int _tab; - @SuppressWarnings("unused") - private boolean _showAllLevels; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _tab = packet.readC(); // Daily Reward = 9, Event = 1, Instance Zone = 2 - _showAllLevels = packet.readC() == 1; // Disabled = 0, Enabled = 1 - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - switch (_tab) - { - // case 1: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - // case 2: - // { - // player.sendPacket(new ExTodoListInzone()); - // break; - // } - case 9: // Daily Rewards - { - // Initial EW request should be false - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - break; - } - } - } -} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java similarity index 59% rename from L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java rename to L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java index d42954b0cc..db343a57e9 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestTodoListHTML.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionInfo.java @@ -14,32 +14,37 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; /** - * @author Mobius - */ -public class RequestTodoListHTML implements IClientIncomingPacket + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class RequestExPledgeMissionInfo implements IClientIncomingPacket { - @SuppressWarnings("unused") - private int _tab; - @SuppressWarnings("unused") - private String _linkName; - @Override public boolean read(GameClient client, PacketReader packet) { - _tab = packet.readC(); - _linkName = packet.readS(); return true; } @Override public void run(GameClient client) { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java similarity index 73% rename from L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java rename to L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java index 4bbf0f209d..39022df25e 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/dailymission/RequestOneDayRewardReceive.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/pledgeV2/RequestExPledgeMissionReward.java @@ -1,62 +1,63 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.clientpackets.dailymission; - -import java.util.Collection; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import org.l2jmobius.gameserver.network.serverpackets.dailymission.ExOneDayReceiveRewardList; - -/** - * @author Sdw - */ -public class RequestOneDayRewardReceive implements IClientIncomingPacket -{ - private int _id; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _id = packet.readH(); - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); - if ((reward == null) || reward.isEmpty()) - { - return; - } - - reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); - // player.sendPacket(new ExConnectedTimeAndGettableReward(player)); - player.sendPacket(new ExOneDayReceiveRewardList(player, true)); - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.clientpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionInfo; +import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeMissionRewardCount; + +/** + * @author Mobius + */ +public class RequestExPledgeMissionReward implements IClientIncomingPacket +{ + private int _id; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _id = packet.readD(); + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if ((player == null) || (player.getClan() == null)) + { + return; + } + + final Collection reward = DailyMissionData.getInstance().getDailyMissionData(_id); + if ((reward == null) || reward.isEmpty()) + { + return; + } + + reward.stream().filter(o -> o.isDisplayable(player)).forEach(r -> r.requestReward(player)); + client.sendPacket(new ExPledgeMissionRewardCount(player)); + client.sendPacket(new ExPledgeMissionInfo(player)); + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java deleted file mode 100644 index 3f53580346..0000000000 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExOneDayReceiveRewardList.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import java.time.LocalDate; -import java.util.Collection; -import java.util.Collections; -import java.util.function.Function; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.DailyMissionDataHolder; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; -import org.l2jmobius.gameserver.util.cron4j.Predictor; - -/** - * @author Sdw - */ -public class ExOneDayReceiveRewardList implements IClientOutgoingPacket -{ - final PlayerInstance _player; - private final Collection _rewards; - private static final Function _remainTime = pattern -> (new Predictor(pattern).nextMatchingTime() - System.currentTimeMillis()) / 1000; - - private final long _dayRemainTime; - private final long _weekRemainTime; - private final long _monthRemainTime; - - public ExOneDayReceiveRewardList(PlayerInstance player, boolean sendRewards) - { - _player = player; - _rewards = sendRewards ? DailyMissionData.getInstance().getDailyMissionData(player) : Collections.emptyList(); - _dayRemainTime = _remainTime.apply("30 6 * * *"); - _weekRemainTime = _remainTime.apply("30 6 * * 1"); - _monthRemainTime = _remainTime.apply("30 6 1 * *"); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_ONE_DAY_RECEIVE_REWARD_LIST.writeId(packet); - - packet.writeD((int) _dayRemainTime); - packet.writeD((int) _weekRemainTime); - packet.writeD((int) _monthRemainTime); - packet.writeC(0x17); - packet.writeD(_player.getClassId().getId()); - packet.writeD(LocalDate.now().getDayOfWeek().ordinal()); // Day of week - packet.writeD(_rewards.size()); - for (DailyMissionDataHolder reward : _rewards) - { - packet.writeH(reward.getId()); - int status = reward.getStatus(_player); - packet.writeC(status); - packet.writeC(reward.getRequiredCompletions() > 1 ? 0x01 : 0x00); - packet.writeD(reward.getParams().getInt("level", -1) == -1 ? (status == 1 ? 0 : reward.getProgress(_player)) : _player.getLevel()); - packet.writeD(reward.getRequiredCompletions()); - } - return true; - } -} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java new file mode 100644 index 0000000000..bb1b572fa9 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionInfo.java @@ -0,0 +1,94 @@ +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import java.util.Collection; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.DailyMissionDataHolder; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExPledgeMissionInfo implements IClientOutgoingPacket +{ + private final PlayerInstance _player; + private final Collection _rewards; + + public ExPledgeMissionInfo(PlayerInstance player) + { + _player = player; + _rewards = DailyMissionData.getInstance().getDailyMissionData(player); + } + + @Override + public boolean write(PacketWriter packet) + { + if (!DailyMissionData.getInstance().isAvailable() || (_player.getClan() == null)) + { + return true; + } + + OutgoingPackets.EX_PLEDGE_MISSION_INFO.writeId(packet); + + packet.writeD(_rewards.size()); + for (DailyMissionDataHolder reward : _rewards) + { + int progress = reward.getProgress(_player); + int status = reward.getStatus(_player); + + // TODO: Figure out this. + if (reward.isLevelUpMission()) + { + progress = 1; + if (status == 2) + { + if (reward.getRequiredCompletions() <= _player.getLevel()) + { + status = 3; + } + else + { + status = 1; + } + } + else + { + status = 0; + } + } + else if (status == 1) + { + status = 3; + } + else if (status == 3) + { + status = 2; + } + + packet.writeD(reward.getId()); + packet.writeD(progress); + packet.writeC(status); + } + + return true; + } +} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java similarity index 54% rename from L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java rename to L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java index a86a4998aa..34b29a6ba8 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/dailymission/ExConnectedTimeAndGettableReward.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/pledgeV2/ExPledgeMissionRewardCount.java @@ -1,60 +1,50 @@ -/* - * 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 . - */ -package org.l2jmobius.gameserver.network.serverpackets.dailymission; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.OutgoingPackets; -import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Sdw - */ -public class ExConnectedTimeAndGettableReward implements IClientOutgoingPacket -{ - private final int _oneDayRewardAvailableCount; - - public ExConnectedTimeAndGettableReward(PlayerInstance player) - { - _oneDayRewardAvailableCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); - } - - @Override - public boolean write(PacketWriter packet) - { - if (!DailyMissionData.getInstance().isAvailable()) - { - return true; - } - - OutgoingPackets.EX_CONNECTED_TIME_AND_GETTABLE_REWARD.writeId(packet); - packet.writeD(0x00); - packet.writeD(_oneDayRewardAvailableCount); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - packet.writeD(0x00); - return true; - } -} +/* + * 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 . + */ +package org.l2jmobius.gameserver.network.serverpackets.pledgeV2; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.data.xml.impl.DailyMissionData; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Bonux (bonuxq@gmail.com) + * @date 29.09.2019 + **/ +public class ExPledgeMissionRewardCount implements IClientOutgoingPacket +{ + private final int _doneMissionsCount; + private final int _availableMissionsCount; + + public ExPledgeMissionRewardCount(PlayerInstance player) + { + _doneMissionsCount = (int) DailyMissionData.getInstance().getDailyMissionData(player).stream().filter(d -> d.getRecentlyCompleted(player)).count(); + _availableMissionsCount = DailyMissionData.getInstance().getDailyMissionData(player).size(); + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_PLEDGE_MISSION_REWARD_COUNT.writeId(packet); + + packet.writeD(Math.min(_availableMissionsCount, _doneMissionsCount)); // Received missions rewards. + packet.writeD(_availableMissionsCount); // Available missions rewards. 18 - for noble, 20 - for honnorable noble. + + return true; + } +}