Support for custom alchemy craft chances.
Thanks to teris1994.
This commit is contained in:
		| @@ -43,6 +43,7 @@ | ||||
| 						<xs:attribute type="xs:byte" name="level" use="required" /> | ||||
| 						<xs:attribute type="xs:byte" name="grade" use="required" /> | ||||
| 						<xs:attribute type="xs:byte" name="category" use="required" /> | ||||
| 						<xs:attribute type="xs:float" name="chance" use="optional" /> | ||||
| 					</xs:complexType> | ||||
| 				</xs:element> | ||||
| 			</xs:sequence> | ||||
|   | ||||
| @@ -32,6 +32,7 @@ public class AlchemyCraftData | ||||
| 	private final int _level; | ||||
| 	private final int _grade; | ||||
| 	private final int _category; | ||||
| 	private final float _chance; | ||||
| 	private Set<ItemHolder> _ingredients; | ||||
| 	private ItemHolder _productionSuccess; | ||||
| 	private ItemHolder _productionFailure; | ||||
| @@ -42,6 +43,7 @@ public class AlchemyCraftData | ||||
| 		_level = set.getInt("level"); | ||||
| 		_grade = set.getInt("grade"); | ||||
| 		_category = set.getInt("category"); | ||||
| 		_chance = set.getFloat("chance", 0); | ||||
| 	} | ||||
| 	 | ||||
| 	public int getId() | ||||
| @@ -59,6 +61,11 @@ public class AlchemyCraftData | ||||
| 		return _grade; | ||||
| 	} | ||||
| 	 | ||||
| 	public float getChance() | ||||
| 	{ | ||||
| 		return _chance; | ||||
| 	} | ||||
| 	 | ||||
| 	public int getCategory() | ||||
| 	{ | ||||
| 		return _category; | ||||
|   | ||||
| @@ -44,8 +44,8 @@ public class RequestAlchemyConversion implements IClientIncomingPacket | ||||
| 	private int _craftTimes; | ||||
| 	private int _skillId; | ||||
| 	private int _skillLevel; | ||||
| 	 | ||||
| 	// private final Set<ItemHolder> _ingredients = new HashSet<>(); | ||||
| 	 | ||||
| 	@Override | ||||
| 	public boolean read(GameClient client, PacketReader packet) | ||||
| 	{ | ||||
| @@ -110,27 +110,31 @@ public class RequestAlchemyConversion implements IClientIncomingPacket | ||||
| 		// } | ||||
| 		 | ||||
| 		// Chance based on grade. | ||||
| 		final int baseChance; | ||||
| 		final float baseChance; | ||||
| 		 | ||||
| 		// Custom XML chance value. | ||||
| 		final float customChance = data.getChance(); | ||||
| 		 | ||||
| 		switch (data.getGrade()) | ||||
| 		{ | ||||
| 			case 1: // Elementary | ||||
| 			{ | ||||
| 				baseChance = 100; | ||||
| 				baseChance = customChance > 0 ? customChance : 100; | ||||
| 				break; | ||||
| 			} | ||||
| 			case 2: // Intermediate | ||||
| 			{ | ||||
| 				baseChance = 80; | ||||
| 				baseChance = customChance > 0 ? customChance : 80; | ||||
| 				break; | ||||
| 			} | ||||
| 			case 3: // Advanced | ||||
| 			{ | ||||
| 				baseChance = 60; | ||||
| 				baseChance = customChance > 0 ? customChance : 60; | ||||
| 				break; | ||||
| 			} | ||||
| 			default: // Master | ||||
| 			{ | ||||
| 				baseChance = 50; | ||||
| 				baseChance = customChance > 0 ? customChance : 50; | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment