Support for custom alchemy craft chances.

Thanks to teris1994.
This commit is contained in:
MobiusDevelopment
2022-09-16 09:17:43 +00:00
parent ad8a96d8d7
commit fa48574dc9
33 changed files with 198 additions and 66 deletions

View File

@@ -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;

View File

@@ -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;
}
}