Addition of attribute system configuration file.

Contributed by facab.
This commit is contained in:
MobiusDevelopment
2019-05-09 11:17:02 +00:00
parent b66e9ca517
commit 3d9011a87d
82 changed files with 3543 additions and 1677 deletions

View File

@@ -0,0 +1,107 @@
##+-------+----------------+----------------+----------------+----------------+----------------+
##| Grade | Stone | Crystal | Stone-Super | Crystal-Super | Jewel |
##+-------+----------------+----------------+----------------+----------------+----------------+
##| | Weapon | Armor | Weapon | Armor | Weapon | Armor | Weapon | Armor | Weapon | Armor |
##+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+
##| S | 50% | 60% | 30% | 50% | 100% | 100% | 80% | 100% | 100% | 100% |
##+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+
##| S80 | 50% | 80% | 40% | 70% | 100% | 100% | 90% | 100% | 100% | 100% |
##+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+
##| S84 | 50% | 80% | 50% | 80% | 100% | 100% | 100% | 100% | 100% | 100% |
##+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+
##| R | 50% | 100% | 60% | 80% | 100% | 100% | 100% | 100% | 100% | 100% |
##+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+
##| R95 | 50% | 100% | 60% | 100% | 100% | 100% | 100% | 100% | 100% | 100% |
##+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+
##| R99 | 50% | 100% | 60% | 100% | 100% | 100% | 100% | 100% | 100% | 100% |
##+-------+--------+-------+--------+-------+--------+-------+--------+-------+--------+-------+
# ---------------------------------------------------------------------------
# Stone Chance
# ---------------------------------------------------------------------------
SWeaponStone = 50
S80WeaponStone = 50
S84WeaponStone = 50
RWeaponStone = 50
R95WeaponStone = 50
R99WeaponStone = 50
SArmorStone = 60
S80ArmorStone = 80
S84ArmorStone = 80
RArmorStone = 100
R95ArmorStone = 100
R99ArmorStone = 100
# ---------------------------------------------------------------------------
# Crystal Chance
# ---------------------------------------------------------------------------
SWeaponCrystal = 30
S80WeaponCrystal = 40
S84WeaponCrystal = 50
RWeaponCrystal = 60
R95WeaponCrystal = 60
R99WeaponCrystal = 60
SArmorCrystal = 50
S80ArmorCrystal = 70
S84ArmorCrystal = 80
RArmorCrystal = 80
R95ArmorCrystal = 100
R99ArmorCrystal = 100
# ---------------------------------------------------------------------------
# Stone-Super Chance
# ---------------------------------------------------------------------------
SWeaponStoneSuper = 100
S80WeaponStoneSuper = 100
S84WeaponStoneSuper = 100
RWeaponStoneSuper = 100
R95WeaponStoneSuper = 100
R99WeaponStoneSuper = 100
SArmorStoneSuper = 100
S80ArmorStoneSuper = 100
S84ArmorStoneSuper = 100
RArmorStoneSuper = 100
R95ArmorStoneSuper = 100
R99ArmorStoneSuper = 100
# ---------------------------------------------------------------------------
# Crystal-Super Chance
# ---------------------------------------------------------------------------
SWeaponCrystalSuper = 80
S80WeaponCrystalSuper = 90
S84WeaponCrystalSuper = 100
RWeaponCrystalSuper = 100
R95WeaponCrystalSuper = 100
R99WeaponCrystalSuper = 100
SArmorCrystalSuper = 100
S80ArmorCrystalSuper = 100
S84ArmorCrystalSuper = 100
RArmorCrystalSuper = 100
R95ArmorCrystalSuper = 100
R99ArmorCrystalSuper = 100
# ---------------------------------------------------------------------------
# Jewels Chance
# ---------------------------------------------------------------------------
SWeaponJewel = 100
S80WeaponJewel = 100
S84WeaponJewel = 100
RWeaponJewel = 100
R95WeaponJewel = 100
R99WeaponJewel = 100
SArmorJewel = 100
S80ArmorJewel = 100
S84ArmorJewel = 100
RArmorJewel = 100
R95ArmorJewel = 100
R99ArmorJewel = 100

View File

@@ -428,14 +428,6 @@ MentorPenaltyForMenteeLeave = 2
# ---------------------------------------------------------------------------
# Enchanting
# ---------------------------------------------------------------------------
# This controls the chance an item has to break if it is enchanted.
# This chance is in %, so if you set this to 100%, enchants will always succeed.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
EnchantChanceElementStone = 50
EnchantChanceElementCrystal = 30
EnchantChanceElementJewel = 20
EnchantChanceElementEnergy = 10
# List of non-enchantable items.
# Currently apprentice, travelers weapons and Pailaka items
# Default: 7816,7817,7818,7819,7820,7821,7822,7823,7824,7825,7826,7827,7828,7829,7830,7831,13293,13294,13296

View File

@@ -269,26 +269,6 @@ public class AdminAdmin implements IAdminCommandHandler
Config.RATE_SPOIL_DROP_CHANCE_MULTIPLIER = Float.valueOf(pValue);
break;
}
case "EnchantChanceElementStone":
{
Config.ENCHANT_CHANCE_ELEMENT_STONE = Float.valueOf(pValue);
break;
}
case "EnchantChanceElementCrystal":
{
Config.ENCHANT_CHANCE_ELEMENT_CRYSTAL = Float.valueOf(pValue);
break;
}
case "EnchantChanceElementJewel":
{
Config.ENCHANT_CHANCE_ELEMENT_JEWEL = Float.valueOf(pValue);
break;
}
case "EnchantChanceElementEnergy":
{
Config.ENCHANT_CHANCE_ELEMENT_ENERGY = Float.valueOf(pValue);
break;
}
}
BuilderUtil.sendSysMessage(activeChar, "Config parameter " + pName + " set to " + pValue);
}
@@ -465,11 +445,6 @@ public class AdminAdmin implements IAdminCommandHandler
replyMSG.append("<tr><td><font color=\"LEVEL\">Rate SP</font> = " + Config.RATE_SP + "</td><td><edit var=\"param2\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateSp $param2\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
replyMSG.append("<tr><td><font color=\"LEVEL\">Rate Drop Spoil</font> = " + Config.RATE_SPOIL_DROP_CHANCE_MULTIPLIER + "</td><td><edit var=\"param4\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig RateDropSpoil $param4\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
replyMSG.append("<tr><td width=140></td><td width=40></td><td width=40></td></tr>");
replyMSG.append("<tr><td><font color=\"00AA00\">Enchant:</font></td><td></td><td></td></tr>");
replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Stone</font> = " + Config.ENCHANT_CHANCE_ELEMENT_STONE + "</td><td><edit var=\"param8\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementStone $param8\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Crystal</font> = " + Config.ENCHANT_CHANCE_ELEMENT_CRYSTAL + "</td><td><edit var=\"param9\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementCrystal $param9\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Jewel</font> = " + Config.ENCHANT_CHANCE_ELEMENT_JEWEL + "</td><td><edit var=\"param10\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementJewel $param10\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
replyMSG.append("<tr><td><font color=\"LEVEL\">Enchant Element Energy</font> = " + Config.ENCHANT_CHANCE_ELEMENT_ENERGY + "</td><td><edit var=\"param11\" width=40 height=15></td><td><button value=\"Set\" action=\"bypass -h admin_setconfig EnchantChanceElementEnergy $param11\" width=40 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
replyMSG.append("</table></body></html>");
adminReply.setHtml(replyMSG.toString());

View File

@@ -805,10 +805,6 @@ public final class Config
public static IdFactoryType IDFACTORY_TYPE;
public static boolean BAD_ID_CHECKING;
public static double ENCHANT_CHANCE_ELEMENT_STONE;
public static double ENCHANT_CHANCE_ELEMENT_CRYSTAL;
public static double ENCHANT_CHANCE_ELEMENT_JEWEL;
public static double ENCHANT_CHANCE_ELEMENT_ENERGY;
public static int[] ENCHANT_BLACKLIST;
public static boolean DISABLE_OVER_ENCHANTING;
public static int[] AUGMENTATION_BLACKLIST;
@@ -947,6 +943,77 @@ public final class Config
public static int OBSTACLE_MULTIPLIER;
public static int MAX_ITERATIONS;
/** Attribute System */
public static int S_WEAPON_STONE;
public static int S80_WEAPON_STONE;
public static int S84_WEAPON_STONE;
public static int R_WEAPON_STONE;
public static int R95_WEAPON_STONE;
public static int R99_WEAPON_STONE;
public static int S_ARMOR_STONE;
public static int S80_ARMOR_STONE;
public static int S84_ARMOR_STONE;
public static int R_ARMOR_STONE;
public static int R95_ARMOR_STONE;
public static int R99_ARMOR_STONE;
public static int S_WEAPON_CRYSTAL;
public static int S80_WEAPON_CRYSTAL;
public static int S84_WEAPON_CRYSTAL;
public static int R_WEAPON_CRYSTAL;
public static int R95_WEAPON_CRYSTAL;
public static int R99_WEAPON_CRYSTAL;
public static int S_ARMOR_CRYSTAL;
public static int S80_ARMOR_CRYSTAL;
public static int S84_ARMOR_CRYSTAL;
public static int R_ARMOR_CRYSTAL;
public static int R95_ARMOR_CRYSTAL;
public static int R99_ARMOR_CRYSTAL;
public static int S_WEAPON_STONE_SUPER;
public static int S80_WEAPON_STONE_SUPER;
public static int S84_WEAPON_STONE_SUPER;
public static int R_WEAPON_STONE_SUPER;
public static int R95_WEAPON_STONE_SUPER;
public static int R99_WEAPON_STONE_SUPER;
public static int S_ARMOR_STONE_SUPER;
public static int S80_ARMOR_STONE_SUPER;
public static int S84_ARMOR_STONE_SUPER;
public static int R_ARMOR_STONE_SUPER;
public static int R95_ARMOR_STONE_SUPER;
public static int R99_ARMOR_STONE_SUPER;
public static int S_WEAPON_CRYSTAL_SUPER;
public static int S80_WEAPON_CRYSTAL_SUPER;
public static int S84_WEAPON_CRYSTAL_SUPER;
public static int R_WEAPON_CRYSTAL_SUPER;
public static int R95_WEAPON_CRYSTAL_SUPER;
public static int R99_WEAPON_CRYSTAL_SUPER;
public static int S_ARMOR_CRYSTAL_SUPER;
public static int S80_ARMOR_CRYSTAL_SUPER;
public static int S84_ARMOR_CRYSTAL_SUPER;
public static int R_ARMOR_CRYSTAL_SUPER;
public static int R95_ARMOR_CRYSTAL_SUPER;
public static int R99_ARMOR_CRYSTAL_SUPER;
public static int S_WEAPON_JEWEL;
public static int S80_WEAPON_JEWEL;
public static int S84_WEAPON_JEWEL;
public static int R_WEAPON_JEWEL;
public static int R95_WEAPON_JEWEL;
public static int R99_WEAPON_JEWEL;
public static int S_ARMOR_JEWEL;
public static int S80_ARMOR_JEWEL;
public static int S84_ARMOR_JEWEL;
public static int R_ARMOR_JEWEL;
public static int R95_ARMOR_JEWEL;
public static int R99_ARMOR_JEWEL;
// --------------------------------------------------
// Custom Settings
// --------------------------------------------------
@@ -1430,8 +1497,9 @@ public final class Config
ALLOW_WYVERN_DURING_SIEGE = Feature.getBoolean("AllowRideWyvernDuringSiege", true);
ALLOW_MOUNTS_DURING_SIEGE = Feature.getBoolean("AllowRideMountsDuringSiege", false);
// Load Attandance config file (if exists)
// Load Attendance config file (if exists)
final PropertiesParser Attandance = new PropertiesParser(ATTENDANCE_CONFIG_FILE);
ENABLE_ATTENDANCE_REWARDS = Attandance.getBoolean("EnableAttendanceRewards", false);
PREMIUM_ONLY_ATTENDANCE_REWARDS = Attandance.getBoolean("PremiumOnlyAttendanceRewards", false);
ATTENDANCE_REWARDS_SHARE_ACCOUNT = Attandance.getBoolean("AttendanceRewardsShareAccount", false);
@@ -1605,10 +1673,6 @@ public final class Config
ALT_FREIGHT_PRICE = Character.getInt("FreightPrice", 1000);
MENTOR_PENALTY_FOR_MENTEE_COMPLETE = Character.getInt("MentorPenaltyForMenteeComplete", 1) * 24 * 60 * 60 * 1000;
MENTOR_PENALTY_FOR_MENTEE_COMPLETE = Character.getInt("MentorPenaltyForMenteeLeave", 2) * 24 * 60 * 60 * 1000;
ENCHANT_CHANCE_ELEMENT_STONE = Character.getDouble("EnchantChanceElementStone", 50);
ENCHANT_CHANCE_ELEMENT_CRYSTAL = Character.getDouble("EnchantChanceElementCrystal", 30);
ENCHANT_CHANCE_ELEMENT_JEWEL = Character.getDouble("EnchantChanceElementJewel", 20);
ENCHANT_CHANCE_ELEMENT_ENERGY = Character.getDouble("EnchantChanceElementEnergy", 10);
final String[] notenchantable = Character.getString("EnchantBlackList", "7816,7817,7818,7819,7820,7821,7822,7823,7824,7825,7826,7827,7828,7829,7830,7831,13293,13294,13296").split(",");
ENCHANT_BLACKLIST = new int[notenchantable.length];
for (int i = 0; i < notenchantable.length; i++)

View File

@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
@@ -84,6 +85,18 @@ public final class Elementals
// TODO: Higher stones
};
/* @formatter:off */
private static final int[][] CHANCE_TABLE =
{
{Config.S_WEAPON_STONE, Config.S_ARMOR_STONE, Config.S_WEAPON_CRYSTAL, Config.S_ARMOR_CRYSTAL, Config.S_WEAPON_STONE_SUPER, Config.S_ARMOR_STONE_SUPER, Config.S_WEAPON_JEWEL, Config.S_ARMOR_JEWEL},
{Config.S80_WEAPON_STONE, Config.S80_ARMOR_STONE, Config.S80_WEAPON_CRYSTAL, Config.S80_ARMOR_CRYSTAL, Config.S80_WEAPON_STONE_SUPER, Config.S80_ARMOR_STONE_SUPER, Config.S80_WEAPON_JEWEL, Config.S80_ARMOR_JEWEL},
{Config.S84_WEAPON_STONE, Config.S84_ARMOR_STONE, Config.S84_WEAPON_CRYSTAL, Config.S84_ARMOR_CRYSTAL, Config.S84_WEAPON_STONE_SUPER, Config.S84_ARMOR_STONE_SUPER, Config.S84_WEAPON_JEWEL, Config.S84_ARMOR_JEWEL},
{Config.R_WEAPON_STONE, Config.R_ARMOR_STONE, Config.R_WEAPON_CRYSTAL, Config.R_ARMOR_CRYSTAL, Config.R_WEAPON_STONE_SUPER, Config.R_ARMOR_STONE_SUPER, Config.R_WEAPON_JEWEL, Config.R_ARMOR_JEWEL},
{Config.R95_WEAPON_STONE, Config.R95_ARMOR_STONE, Config.R95_WEAPON_CRYSTAL, Config.R95_ARMOR_CRYSTAL, Config.R95_WEAPON_STONE_SUPER, Config.R95_ARMOR_STONE_SUPER, Config.R95_WEAPON_JEWEL, Config.R95_ARMOR_JEWEL},
{Config.R99_WEAPON_STONE, Config.R99_ARMOR_STONE, Config.R99_WEAPON_CRYSTAL, Config.R99_ARMOR_CRYSTAL, Config.R99_WEAPON_STONE_SUPER, Config.R99_ARMOR_STONE_SUPER, Config.R99_WEAPON_JEWEL, Config.R99_ARMOR_JEWEL},
};
/* @formatter:on */
public enum ElementalItemType
{
Stone(3),
@@ -289,128 +302,111 @@ public final class Elementals
return -1;
}
public static boolean isElementableWithStone(ItemInstance targetItem, int stoneId)
{
return targetItem.isElementable();
}
/* @formatter:off */
// +-------+----------------+----------------+----------------+----------------+
// | Grade | Stone | Crystal | Stone-Super | Crystal-Super |
// +-------+----------------+----------------+----------------+----------------+
// | | Weapon | Armor | Weapon | Armor | Weapon | Armor | Weapon | Armor |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | S | 50% | 60% | 30% | 50% | 100% | 100% | 80% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | S80 | 50% | 80% | 40% | 70% | 100% | 100% | 90% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | S84 | 50% | 80% | 50% | 80% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | R | 50% | 100% | 60% | 80% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | R95 | 50% | 100% | 60% | 100% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
// | R99 | 50% | 100% | 60% | 100% | 100% | 100% | 100% | 100% |
// +-------+--------+-------+--------+-------+--------+-------+--------+-------+
/* @formatter:on */
public static boolean isSuccess(ItemInstance item, int stoneId)
{
switch (Elementals.getItemElemental(stoneId)._type)
int row = -1;
int column = -1;
switch (item.getItem().getCrystalType())
{
case S:
{
row = 0;
break;
}
case S80:
{
row = 1;
break;
}
case S84:
{
row = 2;
break;
}
case R:
{
row = 3;
break;
}
case R95:
{
row = 4;
break;
}
case R99:
{
row = 5;
break;
}
}
switch (TABLE.get(stoneId)._type)
{
case Stone:
{
if (item.isWeapon())
{
return Rnd.get(100) < 50;
column = 0;
}
switch (item.getItem().getCrystalType())
else // isArmor = true
{
case S:
{
return Rnd.get(100) < 60;
}
case S80:
case S84:
{
return Rnd.get(100) < 80;
}
default:
{
return true;
}
column = 1;
}
break;
}
case Crystal:
{
if (item.isWeapon())
{
switch (item.getItem().getCrystalType())
{
case S:
{
return Rnd.get(100) < 30;
}
case S80:
{
return Rnd.get(100) < 40;
}
case S84:
{
return Rnd.get(100) < 50;
}
default:
{
return Rnd.get(100) < 60;
}
}
column = 2;
}
switch (item.getItem().getCrystalType())
else // isArmor = true
{
case S:
{
return Rnd.get(100) < 50;
}
case S80:
{
return Rnd.get(100) < 70;
}
case S84:
case R:
{
return Rnd.get(100) < 80;
}
default:
{
return true;
}
column = 3;
}
break;
}
case StoneSuper:
{
if (item.isWeapon())
{
column = 4;
}
else // isArmor = true
{
column = 5;
}
break;
}
case CrystalSuper:
{
if (item.isWeapon())
{
switch (item.getItem().getCrystalType())
{
case S:
{
return Rnd.get(100) < 80;
}
case S80:
{
return Rnd.get(100) < 90;
}
default:
{
return true;
}
}
column = 6;
}
return true;
else // isArmor = true
{
column = 7;
}
break;
}
case Jewel:
{
if (item.isWeapon())
{
column = 8;
}
else // isArmor = true
{
column = 9;
}
break;
}
}
// Super stones have 100% so will end here.
// Patch notes do not have info about jewels chance so 100% for now, till l2wiki update, energy are not used.
if ((row != -1) && (column != -1))
{
return Rnd.get(100) < CHANCE_TABLE[row][column];
}
return true;
}
}

View File

@@ -103,7 +103,7 @@ public class RequestExEnchantItemAttribute implements IClientIncomingPacket
return;
}
if (!Elementals.isElementableWithStone(item, stone.getItem().getId()))
if (!item.isElementable())
{
client.sendPacket(SystemMessageId.ELEMENTAL_POWER_ENHANCER_USAGE_REQUIREMENT_IS_NOT_SUFFICIENT);
player.removeRequest(request.getClass());

View File

@@ -51,7 +51,7 @@ public class ExChooseInventoryAttributeItem implements IClientOutgoingPacket
// Register only items that can be put an attribute stone/crystal
for (ItemInstance item : player.getInventory().getItems())
{
if (Elementals.isElementableWithStone(item, stone.getId()))
if (item.isElementable())
{
_items.add(item.getObjectId());
}