Limit for Expand Glorious Warrior's Magic Lamp (45483) skill.
This commit is contained in:
@@ -71,7 +71,7 @@ public class MagicLampData implements IXmlReader
|
||||
|
||||
public void addLampExp(Player player, double exp, boolean rateModifiers)
|
||||
{
|
||||
if (Config.ENABLE_MAGIC_LAMP)
|
||||
if (Config.ENABLE_MAGIC_LAMP && (player.getLampCount() < player.getMaxLampCount()))
|
||||
{
|
||||
final int lampExp = (int) (exp * (rateModifiers ? Config.MAGIC_LAMP_CHARGE_RATE * player.getStat().getMul(Stat.MAGIC_LAMP_EXP_RATE, 1) : 1));
|
||||
int calc = lampExp + player.getLampExp();
|
||||
|
@@ -1250,19 +1250,24 @@ public class Player extends Playable
|
||||
return getVariables().getInt(PlayerVariables.MAGIC_LAMP_EXP, 0);
|
||||
}
|
||||
|
||||
public int getLampCount()
|
||||
{
|
||||
return getVariables().getInt(PlayerVariables.MAGIC_LAMP_COUNT, 0);
|
||||
}
|
||||
|
||||
public void setLampExp(int exp)
|
||||
{
|
||||
getVariables().set(PlayerVariables.MAGIC_LAMP_EXP, exp);
|
||||
}
|
||||
|
||||
public int getLampCount()
|
||||
{
|
||||
return Math.min(getVariables().getInt(PlayerVariables.MAGIC_LAMP_COUNT, 0), getMaxLampCount());
|
||||
}
|
||||
|
||||
public void setLampCount(int count)
|
||||
{
|
||||
getVariables().set(PlayerVariables.MAGIC_LAMP_COUNT, count);
|
||||
getVariables().set(PlayerVariables.MAGIC_LAMP_COUNT, Math.min(count, getMaxLampCount()));
|
||||
}
|
||||
|
||||
public int getMaxLampCount()
|
||||
{
|
||||
return Config.MAGIC_LAMP_MAX_GAME_COUNT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.MagicLampData;
|
||||
import org.l2jmobius.gameserver.enums.LampMode;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.GreaterMagicLampHolder;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
@@ -47,31 +46,19 @@ public class ExMagicLampGameInfoUI implements IClientOutgoingPacket
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_MAGICLAMP_GAME_INFO.writeId(packet);
|
||||
packet.writeD(Config.MAGIC_LAMP_MAX_GAME_COUNT); // nMagicLampGameMaxCCount
|
||||
packet.writeD(_player.getMaxLampCount()); // nMagicLampGameMaxCCount
|
||||
packet.writeD(_count); // cMagicLampGameCCount
|
||||
switch (LampMode.getByMode(_mode))
|
||||
{
|
||||
case NORMAL:
|
||||
{
|
||||
packet.writeD(Config.MAGIC_LAMP_REWARD_COUNT);// cMagicLampCountPerGame
|
||||
break;
|
||||
}
|
||||
case GREATER:
|
||||
{
|
||||
packet.writeD(Config.MAGIC_LAMP_GREATER_REWARD_COUNT); // cMagicLampCountPerGame
|
||||
break;
|
||||
}
|
||||
}
|
||||
packet.writeD(_mode == 0 ? Config.MAGIC_LAMP_REWARD_COUNT : Config.MAGIC_LAMP_GREATER_REWARD_COUNT); // cMagicLampCountPerGame
|
||||
packet.writeD(_player.getLampCount()); // cMagicLampCount
|
||||
packet.writeC(_mode); // cGameMode
|
||||
final List<GreaterMagicLampHolder> greater = MagicLampData.getInstance().getGreaterLamps();
|
||||
packet.writeD(greater.size()); // costItemList
|
||||
greater.forEach(lamp ->
|
||||
for (GreaterMagicLampHolder lamp : greater)
|
||||
{
|
||||
packet.writeD(lamp.getItemId()); // nItemClassID
|
||||
packet.writeQ(lamp.getCount()); // nItemAmountPerGame
|
||||
packet.writeQ(_player.getInventory().getInventoryItemCount(lamp.getItemId(), -1)); // nItemAmount
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -112,13 +112,13 @@ public class ExMagicLampGameResult implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.EX_MAGICLAMP_GAME_RESULT.writeId(packet);
|
||||
packet.writeD(_reward.size()); // magicLampGameResult
|
||||
_reward.values().forEach(lamp ->
|
||||
for (MagicLampHolder lamp : _reward.values())
|
||||
{
|
||||
packet.writeC(lamp.getType().getGrade()); // cGradeNum
|
||||
packet.writeD(lamp.getCount()); // nRewardCount
|
||||
packet.writeQ(lamp.getExp()); // nEXP
|
||||
packet.writeQ(lamp.getSp()); // nSP
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user