Adjustments for item enchant announcement.

Contributed by SmiDmi.
This commit is contained in:
MobiusDevelopment 2019-10-02 12:00:15 +00:00
parent f1def01a6b
commit c992b96637
4 changed files with 63 additions and 9 deletions

View File

@ -37,6 +37,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.EnchantResult;
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@ -229,14 +230,15 @@ public class RequestEnchantItem implements IClientIncomingPacket
// announce the success
final int minEnchantAnnounce = item.isArmor() ? 6 : 7;
final int maxEnchantAnnounce = item.isArmor() ? 0 : 15;
if ((item.getEnchantLevel() == minEnchantAnnounce) || (item.getEnchantLevel() == maxEnchantAnnounce))
final int maxEnchantAnnounce = item.isArmor() ? 0 : 30;
if ((item.getEnchantLevel() >= minEnchantAnnounce) || (item.getEnchantLevel() == maxEnchantAnnounce))
{
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_SUCCESSFULLY_ENCHANTED_A_S2_S3);
sm.addString(player.getName());
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
player.broadcastPacket(sm);
player.broadcastPacket(new ExItemAnnounce(item, player));
final Skill skill = CommonSkill.FIREWORK.getSkill();
if (skill != null)

View File

@ -0,0 +1,49 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author NviX
*/
public class ExItemAnnounce implements IClientOutgoingPacket
{
private final ItemInstance _item;
private final PlayerInstance _player;
public ExItemAnnounce(ItemInstance item, PlayerInstance player)
{
_item = item;
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_ITEM_ANNOUNCE.writeId(packet);
packet.writeC(0x00); // item icon
packet.writeString(_player.getName()); // name of player
packet.writeD(_item.getId()); // item id
packet.writeD(_item.getEnchantLevel()); // enchant level
packet.writeC(0x00); // name of item
return true;
}
}

View File

@ -230,7 +230,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
// announce the success
final int minEnchantAnnounce = item.isArmor() ? 6 : 7;
final int maxEnchantAnnounce = item.isArmor() ? 0 : 15;
final int maxEnchantAnnounce = item.isArmor() ? 0 : 30;
if ((item.getEnchantLevel() >= minEnchantAnnounce) || (item.getEnchantLevel() == maxEnchantAnnounce))
{
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_SUCCESSFULLY_ENCHANTED_A_S2_S3);
@ -238,7 +238,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
player.broadcastPacket(sm);
player.broadcastPacket(new ExItemAnnounce(item));
player.broadcastPacket(new ExItemAnnounce(item, player));
final Skill skill = CommonSkill.FIREWORK.getSkill();
if (skill != null)

View File

@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
@ -26,21 +27,23 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
public class ExItemAnnounce implements IClientOutgoingPacket
{
private final ItemInstance _item;
private final PlayerInstance _player;
public ExItemAnnounce(ItemInstance item)
public ExItemAnnounce(ItemInstance item, PlayerInstance player)
{
_item = item;
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_ITEM_ANNOUNCE.writeId(packet);
packet.writeC(0x00);
packet.writeString(_item.getName()); // name of item
packet.writeC(0x00); // item icon
packet.writeString(_player.getName()); // name of player
packet.writeD(_item.getId()); // item id
packet.writeD(_item.getEnchantLevel()); // enchant level
packet.writeC(0x00);
packet.writeC(0x00); // name of item
return true;
}
}