Recipe additional chance and critical rate display.
Contributed by Index.
This commit is contained in:
		| @@ -20,6 +20,7 @@ import org.l2jmobius.commons.network.PacketWriter; | ||||
| import org.l2jmobius.gameserver.data.xml.RecipeData; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.holders.RecipeHolder; | ||||
| import org.l2jmobius.gameserver.model.stats.Stat; | ||||
| import org.l2jmobius.gameserver.network.OutgoingPackets; | ||||
| import org.l2jmobius.gameserver.network.PacketLogger; | ||||
|  | ||||
| @@ -29,6 +30,8 @@ public class RecipeItemMakeInfo implements IClientOutgoingPacket | ||||
| 	private final Player _player; | ||||
| 	private final Boolean _success; | ||||
| 	private final long _offeringMaximumAdena; | ||||
| 	private final double _craftRate; | ||||
| 	private final double _craftCritical; | ||||
| 	 | ||||
| 	public RecipeItemMakeInfo(int id, Player player, boolean success, long offeringMaximumAdena) | ||||
| 	{ | ||||
| @@ -36,6 +39,8 @@ public class RecipeItemMakeInfo implements IClientOutgoingPacket | ||||
| 		_player = player; | ||||
| 		_success = success; | ||||
| 		_offeringMaximumAdena = offeringMaximumAdena; | ||||
| 		_craftRate = _player.getStat().getValue(Stat.CRAFT_RATE, 0); | ||||
| 		_craftCritical = _player.getStat().getValue(Stat.CRAFTING_CRITICAL, 0); | ||||
| 	} | ||||
| 	 | ||||
| 	public RecipeItemMakeInfo(int id, Player player, boolean success) | ||||
| @@ -44,6 +49,8 @@ public class RecipeItemMakeInfo implements IClientOutgoingPacket | ||||
| 		_player = player; | ||||
| 		_success = success; | ||||
| 		_offeringMaximumAdena = 0; | ||||
| 		_craftRate = _player.getStat().getValue(Stat.CRAFT_RATE, 0); | ||||
| 		_craftCritical = _player.getStat().getValue(Stat.CRAFTING_CRITICAL, 0); | ||||
| 	} | ||||
| 	 | ||||
| 	public RecipeItemMakeInfo(int id, Player player, long offeringMaximumAdena) | ||||
| @@ -52,6 +59,8 @@ public class RecipeItemMakeInfo implements IClientOutgoingPacket | ||||
| 		_player = player; | ||||
| 		_success = null; | ||||
| 		_offeringMaximumAdena = offeringMaximumAdena; | ||||
| 		_craftRate = _player.getStat().getValue(Stat.CRAFT_RATE, 0); | ||||
| 		_craftCritical = _player.getStat().getValue(Stat.CRAFTING_CRITICAL, 0); | ||||
| 	} | ||||
| 	 | ||||
| 	public RecipeItemMakeInfo(int id, Player player) | ||||
| @@ -60,6 +69,8 @@ public class RecipeItemMakeInfo implements IClientOutgoingPacket | ||||
| 		_player = player; | ||||
| 		_success = null; | ||||
| 		_offeringMaximumAdena = 0; | ||||
| 		_craftRate = _player.getStat().getValue(Stat.CRAFT_RATE, 0); | ||||
| 		_craftCritical = _player.getStat().getValue(Stat.CRAFTING_CRITICAL, 0); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| @@ -76,6 +87,10 @@ public class RecipeItemMakeInfo implements IClientOutgoingPacket | ||||
| 			packet.writeD(_success == null ? -1 : (_success ? 1 : 0)); // item creation none/success/failed | ||||
| 			packet.writeC(_offeringMaximumAdena > 0 ? 1 : 0); // Show offering window. | ||||
| 			packet.writeQ(_offeringMaximumAdena); // Adena worth of items for maximum offering. | ||||
| 			packet.writeF(Math.min(_craftRate, 100.0)); | ||||
| 			packet.writeC(_craftCritical > 0 ? 1 : 0); | ||||
| 			packet.writeF(Math.min(_craftCritical, 100.0)); | ||||
| 			packet.writeC(0); // find me | ||||
| 			return true; | ||||
| 		} | ||||
| 		PacketLogger.info("Character: " + _player + ": Requested unexisting recipe with id = " + _id); | ||||
|   | ||||
| @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; | ||||
|  | ||||
| import org.l2jmobius.commons.network.PacketWriter; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.stats.Stat; | ||||
| import org.l2jmobius.gameserver.network.OutgoingPackets; | ||||
|  | ||||
| public class RecipeShopItemInfo implements IClientOutgoingPacket | ||||
| @@ -27,6 +28,8 @@ public class RecipeShopItemInfo implements IClientOutgoingPacket | ||||
| 	private final Boolean _success; | ||||
| 	private final long _manufacturePrice; | ||||
| 	private final long _offeringMaximumAdena; | ||||
| 	private final double _craftRate; | ||||
| 	private final double _craftCritical; | ||||
| 	 | ||||
| 	public RecipeShopItemInfo(Player manufacturer, int recipeId, boolean success, long manufacturePrice, long offeringMaximumAdena) | ||||
| 	{ | ||||
| @@ -35,6 +38,8 @@ public class RecipeShopItemInfo implements IClientOutgoingPacket | ||||
| 		_success = success; | ||||
| 		_manufacturePrice = manufacturePrice; | ||||
| 		_offeringMaximumAdena = offeringMaximumAdena; | ||||
| 		_craftRate = _manufacturer.getStat().getValue(Stat.CRAFT_RATE, 0); | ||||
| 		_craftCritical = _manufacturer.getStat().getValue(Stat.CRAFTING_CRITICAL, 0); | ||||
| 	} | ||||
| 	 | ||||
| 	public RecipeShopItemInfo(Player manufacturer, int recipeId, long manufacturePrice, long offeringMaximumAdena) | ||||
| @@ -44,6 +49,8 @@ public class RecipeShopItemInfo implements IClientOutgoingPacket | ||||
| 		_success = null; | ||||
| 		_manufacturePrice = manufacturePrice; | ||||
| 		_offeringMaximumAdena = offeringMaximumAdena; | ||||
| 		_craftRate = _manufacturer.getStat().getValue(Stat.CRAFT_RATE, 0); | ||||
| 		_craftCritical = _manufacturer.getStat().getValue(Stat.CRAFTING_CRITICAL, 0); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| @@ -58,6 +65,10 @@ public class RecipeShopItemInfo implements IClientOutgoingPacket | ||||
| 		packet.writeQ(_manufacturePrice); | ||||
| 		packet.writeC(_offeringMaximumAdena > 0 ? 1 : 0); // Trigger offering window if 1 | ||||
| 		packet.writeQ(_offeringMaximumAdena); | ||||
| 		packet.writeF(Math.min(_craftRate, 100.0)); | ||||
| 		packet.writeC(_craftCritical > 0 ? 1 : 0); | ||||
| 		packet.writeF(Math.min(_craftCritical, 100.0)); | ||||
| 		packet.writeC(0); // find me | ||||
| 		return true; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -20,17 +20,22 @@ import java.util.Map.Entry; | ||||
|  | ||||
| import org.l2jmobius.commons.network.PacketWriter; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.model.stats.Stat; | ||||
| import org.l2jmobius.gameserver.network.OutgoingPackets; | ||||
|  | ||||
| public class RecipeShopSellList implements IClientOutgoingPacket | ||||
| { | ||||
| 	private final Player _buyer; | ||||
| 	private final Player _manufacturer; | ||||
| 	private final double _craftRate; | ||||
| 	private final double _craftCritical; | ||||
| 	 | ||||
| 	public RecipeShopSellList(Player buyer, Player manufacturer) | ||||
| 	{ | ||||
| 		_buyer = buyer; | ||||
| 		_manufacturer = manufacturer; | ||||
| 		_craftRate = _manufacturer.getStat().getValue(Stat.CRAFT_RATE, 0); | ||||
| 		_craftCritical = _manufacturer.getStat().getValue(Stat.CRAFTING_CRITICAL, 0); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| @@ -53,6 +58,9 @@ public class RecipeShopSellList implements IClientOutgoingPacket | ||||
| 				packet.writeD(item.getKey()); | ||||
| 				packet.writeD(0); // CanCreate? | ||||
| 				packet.writeQ(item.getValue()); | ||||
| 				packet.writeF(Math.min(_craftRate, 100.0)); | ||||
| 				packet.writeC(_craftCritical > 0 ? 1 : 0); | ||||
| 				packet.writeF(Math.min(_craftCritical, 100.0)); | ||||
| 			} | ||||
| 		} | ||||
| 		return true; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment