Addition of missing ExItemAnnounce work.

This commit is contained in:
MobiusDevelopment 2019-11-30 16:30:25 +00:00
parent d0491ccd9e
commit c67f9f5425
10 changed files with 164 additions and 12 deletions

View File

@ -41,6 +41,7 @@ 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;
import org.l2jmobius.gameserver.util.Broadcast;
import org.l2jmobius.gameserver.util.Util;
public class RequestEnchantItem implements IClientIncomingPacket
@ -237,7 +238,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
player.broadcastPacket(sm);
player.broadcastPacket(new ExItemAnnounce(item, player));
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(item, player));
final Skill skill = CommonSkill.FIREWORK.getSkill();
if (skill != null)

View File

@ -41,6 +41,7 @@ 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;
import org.l2jmobius.gameserver.util.Broadcast;
import org.l2jmobius.gameserver.util.Util;
public class RequestEnchantItem implements IClientIncomingPacket
@ -237,7 +238,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
player.broadcastPacket(sm);
player.broadcastPacket(new ExItemAnnounce(item, player));
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(item, player));
final Skill skill = CommonSkill.FIREWORK.getSkill();
if (skill != null)

View File

@ -356,6 +356,22 @@ EnchantBlackList = 7816,7817,7818,7819,7820,7821,7822,7823,7824,7825,7826,7827,7
# Default: True
DisableOverEnchanting = True
# Minimum armor enchant announce.
# Default: 6
MinimumArmorEnchantAnnounce = 6
# Minimum weapon enchant announce.
# Default: 7
MinimumWeaponEnchantAnnounce = 7
# Maximum armor enchant announce.
# Default: 30
MaximumArmorEnchantAnnounce = 30
# Maximum weapon enchant announce.
# Default: 30
MaximumWeaponEnchantAnnounce = 30
# ---------------------------------------------------------------------------
# Augmenting

View File

@ -788,6 +788,11 @@ public class Config
public static int[] ENCHANT_BLACKLIST;
public static boolean DISABLE_OVER_ENCHANTING;
public static int MIN_ARMOR_ENCHANT_ANNOUNCE;
public static int MIN_WEAPON_ENCHANT_ANNOUNCE;
public static int MAX_ARMOR_ENCHANT_ANNOUNCE;
public static int MAX_WEAPON_ENCHANT_ANNOUNCE;
public static int[] AUGMENTATION_BLACKLIST;
public static boolean ALT_ALLOW_AUGMENT_PVP_ITEMS;
public static boolean ALT_ALLOW_AUGMENT_TRADE;
@ -1681,14 +1686,17 @@ public class Config
}
Arrays.sort(ENCHANT_BLACKLIST);
DISABLE_OVER_ENCHANTING = Character.getBoolean("DisableOverEnchanting", true);
MIN_ARMOR_ENCHANT_ANNOUNCE = Character.getInt("MinimumArmorEnchantAnnounce", 6);
MIN_WEAPON_ENCHANT_ANNOUNCE = Character.getInt("MinimumWeaponEnchantAnnounce", 7);
MAX_ARMOR_ENCHANT_ANNOUNCE = Character.getInt("MaximumArmorEnchantAnnounce", 30);
MAX_WEAPON_ENCHANT_ANNOUNCE = Character.getInt("MaximumWeaponEnchantAnnounce", 30);
String[] array = Character.getString("AugmentationBlackList", "6656,6657,6658,6659,6660,6661,6662,8191,10170,10314,13740,13741,13742,13743,13744,13745,13746,13747,13748,14592,14593,14594,14595,14596,14597,14598,14599,14600,14664,14665,14666,14667,14668,14669,14670,14671,14672,14801,14802,14803,14804,14805,14806,14807,14808,14809,15282,15283,15284,15285,15286,15287,15288,15289,15290,15291,15292,15293,15294,15295,15296,15297,15298,15299,16025,16026,21712,22173,22174,22175").split(",");
AUGMENTATION_BLACKLIST = new int[array.length];
for (int i = 0; i < array.length; i++)
{
AUGMENTATION_BLACKLIST[i] = Integer.parseInt(array[i]);
}
Arrays.sort(AUGMENTATION_BLACKLIST);
ALT_ALLOW_AUGMENT_PVP_ITEMS = Character.getBoolean("AltAllowAugmentPvPItems", false);
ALT_ALLOW_AUGMENT_TRADE = Character.getBoolean("AltAllowAugmentTrade", false);

View File

@ -37,9 +37,11 @@ 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;
import org.l2jmobius.gameserver.util.Broadcast;
import org.l2jmobius.gameserver.util.Util;
public class RequestEnchantItem implements IClientIncomingPacket
@ -228,15 +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))
if ((item.getEnchantLevel() >= (item.isArmor() ? Config.MIN_ARMOR_ENCHANT_ANNOUNCE : Config.MIN_WEAPON_ENCHANT_ANNOUNCE)) //
&& (item.getEnchantLevel() <= (item.isArmor() ? Config.MAX_ARMOR_ENCHANT_ANNOUNCE : Config.MAX_WEAPON_ENCHANT_ANNOUNCE)))
{
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);
Broadcast.toAllOnlinePlayers(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

@ -356,6 +356,22 @@ EnchantBlackList = 7816,7817,7818,7819,7820,7821,7822,7823,7824,7825,7826,7827,7
# Default: True
DisableOverEnchanting = True
# Minimum armor enchant announce.
# Default: 6
MinimumArmorEnchantAnnounce = 6
# Minimum weapon enchant announce.
# Default: 7
MinimumWeaponEnchantAnnounce = 7
# Maximum armor enchant announce.
# Default: 30
MaximumArmorEnchantAnnounce = 30
# Maximum weapon enchant announce.
# Default: 30
MaximumWeaponEnchantAnnounce = 30
# ---------------------------------------------------------------------------
# Augmenting

View File

@ -787,6 +787,11 @@ public class Config
public static int[] ENCHANT_BLACKLIST;
public static boolean DISABLE_OVER_ENCHANTING;
public static int MIN_ARMOR_ENCHANT_ANNOUNCE;
public static int MIN_WEAPON_ENCHANT_ANNOUNCE;
public static int MAX_ARMOR_ENCHANT_ANNOUNCE;
public static int MAX_WEAPON_ENCHANT_ANNOUNCE;
public static int[] AUGMENTATION_BLACKLIST;
public static boolean ALT_ALLOW_AUGMENT_PVP_ITEMS;
public static boolean ALT_ALLOW_AUGMENT_TRADE;
@ -1680,14 +1685,17 @@ public class Config
}
Arrays.sort(ENCHANT_BLACKLIST);
DISABLE_OVER_ENCHANTING = Character.getBoolean("DisableOverEnchanting", true);
MIN_ARMOR_ENCHANT_ANNOUNCE = Character.getInt("MinimumArmorEnchantAnnounce", 6);
MIN_WEAPON_ENCHANT_ANNOUNCE = Character.getInt("MinimumWeaponEnchantAnnounce", 7);
MAX_ARMOR_ENCHANT_ANNOUNCE = Character.getInt("MaximumArmorEnchantAnnounce", 30);
MAX_WEAPON_ENCHANT_ANNOUNCE = Character.getInt("MaximumWeaponEnchantAnnounce", 30);
String[] array = Character.getString("AugmentationBlackList", "6656,6657,6658,6659,6660,6661,6662,8191,10170,10314,13740,13741,13742,13743,13744,13745,13746,13747,13748,14592,14593,14594,14595,14596,14597,14598,14599,14600,14664,14665,14666,14667,14668,14669,14670,14671,14672,14801,14802,14803,14804,14805,14806,14807,14808,14809,15282,15283,15284,15285,15286,15287,15288,15289,15290,15291,15292,15293,15294,15295,15296,15297,15298,15299,16025,16026,21712,22173,22174,22175").split(",");
AUGMENTATION_BLACKLIST = new int[array.length];
for (int i = 0; i < array.length; i++)
{
AUGMENTATION_BLACKLIST[i] = Integer.parseInt(array[i]);
}
Arrays.sort(AUGMENTATION_BLACKLIST);
ALT_ALLOW_AUGMENT_PVP_ITEMS = Character.getBoolean("AltAllowAugmentPvPItems", false);
ALT_ALLOW_AUGMENT_TRADE = Character.getBoolean("AltAllowAugmentTrade", false);

View File

@ -37,9 +37,11 @@ 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;
import org.l2jmobius.gameserver.util.Broadcast;
import org.l2jmobius.gameserver.util.Util;
public class RequestEnchantItem implements IClientIncomingPacket
@ -228,15 +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))
if ((item.getEnchantLevel() >= (item.isArmor() ? Config.MIN_ARMOR_ENCHANT_ANNOUNCE : Config.MIN_WEAPON_ENCHANT_ANNOUNCE)) //
&& (item.getEnchantLevel() <= (item.isArmor() ? Config.MAX_ARMOR_ENCHANT_ANNOUNCE : Config.MAX_WEAPON_ENCHANT_ANNOUNCE)))
{
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);
Broadcast.toAllOnlinePlayers(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;
}
}