Updated pledge bonus packets.

This commit is contained in:
MobiusDev
2018-09-07 13:23:49 +00:00
parent b0363b3021
commit 3b0f521bf9
2 changed files with 12 additions and 36 deletions

View File

@@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.network.serverpackets.pledgebonus;
import java.util.Comparator;
import java.util.logging.Logger;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
@@ -27,49 +26,24 @@ import com.l2jmobius.gameserver.network.OutgoingPackets;
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author UnAfraid
* @author Mobius
*/
public class ExPledgeBonusList implements IClientOutgoingPacket
{
private static final Logger LOGGER = Logger.getLogger(ExPledgeBonusList.class.getName());
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_BONUS_LIST.writeId(packet);
for (ClanRewardType type : ClanRewardType.values())
packet.writeC(0x00); // 140
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.MEMBERS_ONLINE).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
{
ClanRewardData.getInstance().getClanRewardBonuses(type).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
{
switch (type)
{
case MEMBERS_ONLINE:
{
if (bonus.getSkillReward() == null)
{
LOGGER.warning("Missing clan reward skill for reward level: " + bonus.getLevel());
packet.writeD(0);
return;
}
packet.writeD(bonus.getSkillReward().getSkillId());
break;
}
case HUNTING_MONSTERS:
{
if (bonus.getItemReward() == null)
{
LOGGER.warning("Missing clan reward skill for reward level: " + bonus.getLevel());
packet.writeD(0);
return;
}
packet.writeD(bonus.getItemReward().getId());
break;
}
}
});
}
packet.writeC(0x01); // 140
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.HUNTING_MONSTERS).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
{
packet.writeD(bonus.getItemReward().getId());
});
return true;
}
}

View File

@@ -82,6 +82,7 @@ public class ExPledgeBonusOpen implements IClientOutgoingPacket
// Members online bonus
packet.writeD(highestMembersOnlineBonus.getRequiredAmount());
packet.writeD(clan.getMaxOnlineMembers());
packet.writeC(0x00); // 140
packet.writeD(membersOnlineBonus != null ? highestMembersOnlineBonus.getSkillReward().getSkillId() : 0x00);
packet.writeC(membersOnlineBonus != null ? membersOnlineBonus.getLevel() : 0x00);
packet.writeC(membersOnlineBonus != null ? 0x01 : 0x00);
@@ -89,6 +90,7 @@ public class ExPledgeBonusOpen implements IClientOutgoingPacket
// Hunting bonus
packet.writeD(highestHuntingBonus.getRequiredAmount());
packet.writeD(clan.getHuntingPoints());
packet.writeC(0x00); // 140
packet.writeD(huntingBonus != null ? highestHuntingBonus.getItemReward().getId() : 0x00);
packet.writeC(huntingBonus != null ? huntingBonus.getLevel() : 0x00);
packet.writeC(huntingBonus != null ? 0x01 : 0x00);