SHOW:
|
|
- or go back to the newest paste.
| 1 | diff --git a/trunk_398 Limpa/config/EnchantSystem.properties b/trunk_398 Limpa/config/EnchantSystem.properties | |
| 2 | new file mode 100644 | |
| 3 | index 0000000..2bf801d | |
| 4 | --- /dev/null | |
| 5 | +++ b/trunk_398 Limpa/config/EnchantSystem.properties | |
| 6 | @@ -0,0 +1,100 @@ | |
| 7 | +#============================================================# | |
| 8 | +# ENCHANT SETTINGS # | |
| 9 | +#============================================================# | |
| 10 | +# ---------------------------------------------- | |
| 11 | +# Special Enchanting System - | |
| 12 | +# ---------------------------------------------- | |
| 13 | +# Chance enchanting presented as a series of pairs of numbers where the first | |
| 14 | +# Indicates the number of levels, and the second chance of successful enchanting. | |
| 15 | +# Also have the option of limiting the maximum level of echanting | |
| 16 | +# For weapons / armor / jewelry. | |
| 17 | +# If you have a maximum level of grinding 50 and you do not want | |
| 18 | +# Give all the chances for each level (from 1 to 50) then | |
| 19 | +# You can specify for example: | |
| 20 | +# NormalWeaponEnchantLevel = 1,50; 2,50; 3,50; 4,75; 5,50; | |
| 21 | +# Example: 5,92; = if you enchant weapon to +5 you have 92% to success. | |
| 22 | +# ---------------------------------------------- | |
| 23 | +# CHANCE FOR NORMAL SCROLLS - | |
| 24 | +# ---------------------------------------------- | |
| 25 | +# Weapon | |
| 26 | +NormalWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52; | |
| 27 | +# Armor | |
| 28 | +NormalArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52; | |
| 29 | +# Jewel | |
| 30 | +NormalJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52; | |
| 31 | + | |
| 32 | +# ---------------------------------------------- | |
| 33 | +# CHANCE FOR BLESSEDS SCROLLS - | |
| 34 | +# ---------------------------------------------- | |
| 35 | +# Weapon | |
| 36 | +BlessWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52; | |
| 37 | +# Armor | |
| 38 | +BlessArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52; | |
| 39 | +# Jewel | |
| 40 | +BlessJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,52;6,52;7,52;8,52;9,52;10,52;11,52;12,52;13,52;14,52;15,52;16,52; | |
| 41 | + | |
| 42 | +# --------------------------------------------- | |
| 43 | +# CHANCE FOR CRYSTALS SCROLLS - | |
| 44 | +# --------------------------------------------- | |
| 45 | +# Weapon | |
| 46 | +CrystalWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100; | |
| 47 | +# Armor | |
| 48 | +CrystalArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100; | |
| 49 | +# Jewel | |
| 50 | +CrystalJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100; | |
| 51 | + | |
| 52 | +# --------------------------------------------- | |
| 53 | +# CHANCE FOR DONATOR SCROLLS - | |
| 54 | +# --------------------------------------------- | |
| 55 | +# Weapon | |
| 56 | +DonatorWeaponEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;17,100;18,100;19,100;20,100;21,80;22,60;23,40;24,20;25,10; | |
| 57 | +# Armor | |
| 58 | +DonatorArmorEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;17,100;18,100;19,100;20,100;21,80;22,60;23,40;24,20;25,10; | |
| 59 | +# Jewel | |
| 60 | +DonatorJewelryEnchantLevel = 1,100;2,100;3,100;4,100;5,100;6,100;7,100;8,100;9,100;10,100;11,100;12,100;13,100;14,100;15,100;16,100;17,100;18,100;19,100;20,100;21,80;22,60;23,40;24,20;25,10; | |
| 61 | + | |
| 62 | +# On / off enchant hero weapons | |
| 63 | +EnableEnchantHeroWeapons = False | |
| 64 | + | |
| 65 | +# Scroll em um so slot | |
| 66 | +ScrollStackable = True | |
| 67 | + | |
| 68 | +# Safe enchant | |
| 69 | +EnchantSafeMax = 4 | |
| 70 | +EnchantSafeMaxFull = 4 | |
| 71 | + | |
| 72 | +# Max enchant Settings by scrolls. | |
| 73 | +EnchantWeaponMax=16 | |
| 74 | +EnchantArmorMax=16 | |
| 75 | +EnchantJewelryMax=16 | |
| 76 | + | |
| 77 | +# Blessed Limit | |
| 78 | +BlessedEnchantWeaponMax = 16 | |
| 79 | +BlessedEnchantArmorMax = 16 | |
| 80 | +BlessedEnchantJewelryMax = 16 | |
| 81 | + | |
| 82 | +# Enchant after break with blessed scroll. | |
| 83 | +BreakEnchant = 4 | |
| 84 | + | |
| 85 | +# Crystal Limits | |
| 86 | +CrystalEnchantMin = 4 | |
| 87 | +CrystalEnchantWeaponMax = 16 | |
| 88 | +CrystalEnchantArmorMax = 16 | |
| 89 | +CrystalEnchantJewelryMax = 16 | |
| 90 | + | |
| 91 | +# Donator Enchant Limits | |
| 92 | +DonatorEnchantMin = 4 | |
| 93 | +DonatorEnchantWeaponMax = 20 | |
| 94 | +DonatorEnchantArmorMax = 20 | |
| 95 | +DonatorEnchantJewelryMax = 20 | |
| 96 | +DonatorBreakEnchant = 20 | |
| 97 | + | |
| 98 | +# Se true quando enchant falhar, ira perder o enchant atual e reduzira 1 enchant no equipament | |
| 99 | +# se false o enchant falha, mas nao reduzira enchant no equipament, permanecera o mesmo enchant | |
| 100 | +DonatorDecreaseEnchant = True | |
| 101 | + | |
| 102 | +# Id donator scroll weapon | |
| 103 | +IdEnchantDonatorWeapon = 9506 | |
| 104 | + | |
| 105 | +# Id donator scroll armor | |
| 106 | +IdEnchantDonatorArmor = 9507 | |
| 107 | + | |
| 108 | +#Debug, mostrar erros no console caso tenha. | |
| 109 | +#Debug = False | |
| 110 | diff --git a/trunk_398 Limpa/config/players.properties b/trunk_398 Limpa/config/players.properties | |
| 111 | index 79b2515..bb953d5 100644 | |
| 112 | --- a/trunk_398 Limpa/config/players.properties | |
| 113 | +++ b/trunk_398 Limpa/config/players.properties | |
| 114 | @@ -78,18 +78,6 @@ | |
| 115 | EnchantChanceNonMagicWeapon = 0.7 | |
| 116 | EnchantChanceNonMagicWeapon15Plus = 0.35 | |
| 117 | ||
| 118 | -# % chance of success to enchant an armor part (both jewelry or armor) | |
| 119 | -EnchantChanceArmor = 0.66 | |
| 120 | - | |
| 121 | -# Enchant limit [default = 0] | |
| 122 | -EnchantMaxWeapon = 0 | |
| 123 | -EnchantMaxArmor = 0 | |
| 124 | - | |
| 125 | -# if EnchantSafeMax is set to for ex '8' the item will be safly enchanted to '8' regardless of enchant chance(default = 3 for EnchantSafeMax and default = 4 for EnchantSafeMaxFull) | |
| 126 | -# EnchantSafeMaxFull is for full body armor (upper and lower), value should be > 0. | |
| 127 | -EnchantSafeMax = 3 | |
| 128 | -EnchantSafeMaxFull = 4 | |
| 129 | - | |
| 130 | #============================================================= | |
| 131 | # Augmentations | |
| 132 | #============================================================= | |
| 133 | diff --git a/trunk_398 Limpa/java/net/sf/l2j/Config.java b/trunk_398 Limpa/java/net/sf/l2j/Config.java | |
| 134 | index a2139f4..f844cc0 100644 | |
| 135 | --- a/trunk_398 Limpa/java/net/sf/l2j/Config.java | |
| 136 | +++ b/trunk_398 Limpa/java/net/sf/l2j/Config.java | |
| 137 | @@ -35,7 +35,7 @@ | |
| 138 | public static final String PLAYERS_FILE = "./config/players.properties"; | |
| 139 | public static final String SERVER_FILE = "./config/server.properties"; | |
| 140 | public static final String SIEGE_FILE = "./config/siege.properties"; | |
| 141 | - | |
| 142 | + public static final String ENCHANTCONFIG = "./config/EnchantSystem.properties"; | |
| 143 | // -------------------------------------------------- | |
| 144 | // Clans settings | |
| 145 | // -------------------------------------------------- | |
| 146 | @@ -367,6 +367,40 @@ | |
| 147 | public static int ENCHANT_MAX_ARMOR; | |
| 148 | public static int ENCHANT_SAFE_MAX; | |
| 149 | public static int ENCHANT_SAFE_MAX_FULL; | |
| 150 | + public static int ENCHANT_WEAPON_MAX; | |
| 151 | + public static int ENCHANT_ARMOR_MAX; | |
| 152 | + public static int ENCHANT_JEWELRY_MAX; | |
| 153 | + public static int BLESSED_ENCHANT_WEAPON_MAX; | |
| 154 | + public static int BLESSED_ENCHANT_ARMOR_MAX; | |
| 155 | + public static int BLESSED_ENCHANT_JEWELRY_MAX; | |
| 156 | + public static int BREAK_ENCHANT; | |
| 157 | + public static int CRYSTAL_ENCHANT_MIN; | |
| 158 | + public static int CRYSTAL_ENCHANT_WEAPON_MAX; | |
| 159 | + public static int CRYSTAL_ENCHANT_ARMOR_MAX; | |
| 160 | + public static int CRYSTAL_ENCHANT_JEWELRY_MAX; | |
| 161 | + public static int DONATOR_ENCHANT_MIN; | |
| 162 | + public static int DONATOR_ENCHANT_WEAPON_MAX; | |
| 163 | + public static int DONATOR_ENCHANT_ARMOR_MAX; | |
| 164 | + public static int DONATOR_ENCHANT_JEWELRY_MAX; | |
| 165 | + public static boolean DONATOR_DECREASE_ENCHANT; | |
| 166 | + public static int GOLD_WEAPON; | |
| 167 | + public static int GOLD_ARMOR; | |
| 168 | + public static boolean SCROLL_STACKABLE; | |
| 169 | + public static boolean ENCHANT_HERO_WEAPON; | |
| 170 | + public static HashMap<Integer, Integer> NORMAL_WEAPON_ENCHANT_LEVEL = new HashMap<>(); | |
| 171 | + public static HashMap<Integer, Integer> BLESS_WEAPON_ENCHANT_LEVEL = new HashMap<>(); | |
| 172 | + public static HashMap<Integer, Integer> CRYSTAL_WEAPON_ENCHANT_LEVEL = new HashMap<>(); | |
| 173 | + public static HashMap<Integer, Integer> DONATOR_WEAPON_ENCHANT_LEVEL = new HashMap<>(); | |
| 174 | + public static HashMap<Integer, Integer> NORMAL_ARMOR_ENCHANT_LEVEL = new HashMap<>(); | |
| 175 | + public static HashMap<Integer, Integer> BLESS_ARMOR_ENCHANT_LEVEL = new HashMap<>(); | |
| 176 | + public static HashMap<Integer, Integer> CRYSTAL_ARMOR_ENCHANT_LEVEL = new HashMap<>(); | |
| 177 | + public static HashMap<Integer, Integer> DONATOR_ARMOR_ENCHANT_LEVEL = new HashMap<>(); | |
| 178 | + public static HashMap<Integer, Integer> NORMAL_JEWELRY_ENCHANT_LEVEL = new HashMap<>(); | |
| 179 | + public static HashMap<Integer, Integer> BLESS_JEWELRY_ENCHANT_LEVEL = new HashMap<>(); | |
| 180 | + public static HashMap<Integer, Integer> CRYSTAL_JEWELRY_ENCHANT_LEVEL = new HashMap<>(); | |
| 181 | + public static HashMap<Integer, Integer> DONATOR_JEWELRY_ENCHANT_LEVEL = new HashMap<>(); | |
| 182 | + public static boolean DEBUG; | |
| 183 | + | |
| 184 | ||
| 185 | /** Augmentations */ | |
| 186 | public static int AUGMENTATION_NG_SKILL_CHANCE; | |
| 187 | @@ -989,11 +1023,6 @@ | |
| 188 | ENCHANT_CHANCE_WEAPON_MAGIC_15PLUS = players.getProperty("EnchantChanceMagicWeapon15Plus", 0.2);
| |
| 189 | ENCHANT_CHANCE_WEAPON_NONMAGIC = players.getProperty("EnchantChanceNonMagicWeapon", 0.7);
| |
| 190 | ENCHANT_CHANCE_WEAPON_NONMAGIC_15PLUS = players.getProperty("EnchantChanceNonMagicWeapon15Plus", 0.35);
| |
| 191 | - ENCHANT_CHANCE_ARMOR = players.getProperty("EnchantChanceArmor", 0.66);
| |
| 192 | - ENCHANT_MAX_WEAPON = players.getProperty("EnchantMaxWeapon", 0);
| |
| 193 | - ENCHANT_MAX_ARMOR = players.getProperty("EnchantMaxArmor", 0);
| |
| 194 | - ENCHANT_SAFE_MAX = players.getProperty("EnchantSafeMax", 3);
| |
| 195 | - ENCHANT_SAFE_MAX_FULL = players.getProperty("EnchantSafeMaxFull", 4);
| |
| 196 | ||
| 197 | AUGMENTATION_NG_SKILL_CHANCE = players.getProperty("AugmentationNGSkillChance", 15);
| |
| 198 | AUGMENTATION_NG_GLOW_CHANCE = players.getProperty("AugmentationNGGlowChance", 0);
| |
| 199 | @@ -1078,7 +1107,371 @@ | |
| 200 | MAX_BUFFS_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
| |
| 201 | STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
| |
| 202 | } | |
| 203 | - | |
| 204 | + /** | |
| 205 | + * config enchant novo. | |
| 206 | + */ | |
| 207 | + private static final void loadEnchantSystemConfig() | |
| 208 | + {
| |
| 209 | + final ExProperties enchant = initProperties(ENCHANTCONFIG); | |
| 210 | + DEBUG = enchant.getProperty("Debug", false);
| |
| 211 | + String[] propertySplit = enchant.getProperty("NormalWeaponEnchantLevel", "").split(";");
| |
| 212 | + for (String readData : propertySplit) | |
| 213 | + {
| |
| 214 | + String[] writeData = readData.split(",");
| |
| 215 | + if (writeData.length != 2) | |
| 216 | + {
| |
| 217 | + LOGGER.info("invalid config property");
| |
| 218 | + } | |
| 219 | + else | |
| 220 | + {
| |
| 221 | + try | |
| 222 | + {
| |
| 223 | + NORMAL_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 224 | + } | |
| 225 | + catch (NumberFormatException nfe) | |
| 226 | + {
| |
| 227 | + if (DEBUG) | |
| 228 | + {
| |
| 229 | + nfe.printStackTrace(); | |
| 230 | + } | |
| 231 | + if (!readData.equals(""))
| |
| 232 | + {
| |
| 233 | + LOGGER.info("invalid config property");
| |
| 234 | + } | |
| 235 | + } | |
| 236 | + } | |
| 237 | + } | |
| 238 | + propertySplit = enchant.getProperty("BlessWeaponEnchantLevel", "").split(";");
| |
| 239 | + for (String readData : propertySplit) | |
| 240 | + {
| |
| 241 | + String[] writeData = readData.split(",");
| |
| 242 | + if (writeData.length != 2) | |
| 243 | + {
| |
| 244 | + LOGGER.info("invalid config property");
| |
| 245 | + } | |
| 246 | + else | |
| 247 | + {
| |
| 248 | + try | |
| 249 | + {
| |
| 250 | + BLESS_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 251 | + } | |
| 252 | + catch (NumberFormatException nfe) | |
| 253 | + {
| |
| 254 | + if (DEBUG) | |
| 255 | + {
| |
| 256 | + nfe.printStackTrace(); | |
| 257 | + } | |
| 258 | + if (!readData.equals(""))
| |
| 259 | + {
| |
| 260 | + LOGGER.info("invalid config property");
| |
| 261 | + } | |
| 262 | + } | |
| 263 | + } | |
| 264 | + } | |
| 265 | + propertySplit = enchant.getProperty("CrystalWeaponEnchantLevel", "").split(";");
| |
| 266 | + for (String readData : propertySplit) | |
| 267 | + {
| |
| 268 | + String[] writeData = readData.split(",");
| |
| 269 | + if (writeData.length != 2) | |
| 270 | + {
| |
| 271 | + LOGGER.info("invalid config property");
| |
| 272 | + } | |
| 273 | + else | |
| 274 | + {
| |
| 275 | + try | |
| 276 | + {
| |
| 277 | + CRYSTAL_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 278 | + } | |
| 279 | + catch (NumberFormatException nfe) | |
| 280 | + {
| |
| 281 | + if (DEBUG) | |
| 282 | + {
| |
| 283 | + nfe.printStackTrace(); | |
| 284 | + } | |
| 285 | + if (!readData.equals(""))
| |
| 286 | + {
| |
| 287 | + LOGGER.info("invalid config property");
| |
| 288 | + } | |
| 289 | + } | |
| 290 | + } | |
| 291 | + } | |
| 292 | + propertySplit = enchant.getProperty("DonatorWeaponEnchantLevel", "").split(";");
| |
| 293 | + for (String readData : propertySplit) | |
| 294 | + {
| |
| 295 | + String[] writeData = readData.split(",");
| |
| 296 | + if (writeData.length != 2) | |
| 297 | + {
| |
| 298 | + System.out.println("invalid config property");
| |
| 299 | + } | |
| 300 | + else | |
| 301 | + {
| |
| 302 | + try | |
| 303 | + {
| |
| 304 | + DONATOR_WEAPON_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 305 | + } | |
| 306 | + catch (NumberFormatException nfe) | |
| 307 | + {
| |
| 308 | + if (DEBUG) | |
| 309 | + {
| |
| 310 | + nfe.printStackTrace(); | |
| 311 | + } | |
| 312 | + if (!readData.equals(""))
| |
| 313 | + {
| |
| 314 | + System.out.println("invalid config property");
| |
| 315 | + } | |
| 316 | + } | |
| 317 | + } | |
| 318 | + } | |
| 319 | + propertySplit = enchant.getProperty("NormalArmorEnchantLevel", "").split(";");
| |
| 320 | + for (String readData : propertySplit) | |
| 321 | + {
| |
| 322 | + String[] writeData = readData.split(",");
| |
| 323 | + if (writeData.length != 2) | |
| 324 | + {
| |
| 325 | + LOGGER.info("invalid config property");
| |
| 326 | + } | |
| 327 | + else | |
| 328 | + {
| |
| 329 | + try | |
| 330 | + {
| |
| 331 | + NORMAL_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 332 | + } | |
| 333 | + catch (NumberFormatException nfe) | |
| 334 | + {
| |
| 335 | + if (DEBUG) | |
| 336 | + {
| |
| 337 | + nfe.printStackTrace(); | |
| 338 | + } | |
| 339 | + if (!readData.equals(""))
| |
| 340 | + {
| |
| 341 | + LOGGER.info("invalid config property");
| |
| 342 | + } | |
| 343 | + } | |
| 344 | + } | |
| 345 | + } | |
| 346 | + propertySplit = enchant.getProperty("BlessArmorEnchantLevel", "").split(";");
| |
| 347 | + for (String readData : propertySplit) | |
| 348 | + {
| |
| 349 | + String[] writeData = readData.split(",");
| |
| 350 | + if (writeData.length != 2) | |
| 351 | + {
| |
| 352 | + LOGGER.info("invalid config property");
| |
| 353 | + } | |
| 354 | + else | |
| 355 | + {
| |
| 356 | + try | |
| 357 | + {
| |
| 358 | + BLESS_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 359 | + } | |
| 360 | + catch (NumberFormatException nfe) | |
| 361 | + {
| |
| 362 | + if (DEBUG) | |
| 363 | + {
| |
| 364 | + nfe.printStackTrace(); | |
| 365 | + } | |
| 366 | + if (!readData.equals(""))
| |
| 367 | + {
| |
| 368 | + LOGGER.info("invalid config property");
| |
| 369 | + } | |
| 370 | + } | |
| 371 | + } | |
| 372 | + } | |
| 373 | + propertySplit = enchant.getProperty("CrystalArmorEnchantLevel", "").split(";");
| |
| 374 | + for (String readData : propertySplit) | |
| 375 | + {
| |
| 376 | + String[] writeData = readData.split(",");
| |
| 377 | + if (writeData.length != 2) | |
| 378 | + {
| |
| 379 | + LOGGER.info("invalid config property");
| |
| 380 | + } | |
| 381 | + else | |
| 382 | + {
| |
| 383 | + try | |
| 384 | + {
| |
| 385 | + CRYSTAL_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 386 | + } | |
| 387 | + catch (NumberFormatException nfe) | |
| 388 | + {
| |
| 389 | + if (DEBUG) | |
| 390 | + {
| |
| 391 | + nfe.printStackTrace(); | |
| 392 | + } | |
| 393 | + if (!readData.equals(""))
| |
| 394 | + {
| |
| 395 | + LOGGER.info("invalid config property");
| |
| 396 | + } | |
| 397 | + } | |
| 398 | + } | |
| 399 | + } | |
| 400 | + propertySplit = enchant.getProperty("DonatorArmorEnchantLevel", "").split(";");
| |
| 401 | + for (String readData : propertySplit) | |
| 402 | + {
| |
| 403 | + String[] writeData = readData.split(",");
| |
| 404 | + if (writeData.length != 2) | |
| 405 | + {
| |
| 406 | + System.out.println("invalid config property");
| |
| 407 | + } | |
| 408 | + else | |
| 409 | + {
| |
| 410 | + try | |
| 411 | + {
| |
| 412 | + DONATOR_ARMOR_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 413 | + } | |
| 414 | + catch (NumberFormatException nfe) | |
| 415 | + {
| |
| 416 | + if (DEBUG) | |
| 417 | + {
| |
| 418 | + nfe.printStackTrace(); | |
| 419 | + } | |
| 420 | + if (!readData.equals(""))
| |
| 421 | + {
| |
| 422 | + System.out.println("invalid config property");
| |
| 423 | + } | |
| 424 | + } | |
| 425 | + } | |
| 426 | + } | |
| 427 | + propertySplit = enchant.getProperty("NormalJewelryEnchantLevel", "").split(";");
| |
| 428 | + for (String readData : propertySplit) | |
| 429 | + {
| |
| 430 | + String[] writeData = readData.split(",");
| |
| 431 | + if (writeData.length != 2) | |
| 432 | + {
| |
| 433 | + LOGGER.info("invalid config property");
| |
| 434 | + } | |
| 435 | + else | |
| 436 | + {
| |
| 437 | + try | |
| 438 | + {
| |
| 439 | + NORMAL_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 440 | + } | |
| 441 | + catch (NumberFormatException nfe) | |
| 442 | + {
| |
| 443 | + if (DEBUG) | |
| 444 | + {
| |
| 445 | + nfe.printStackTrace(); | |
| 446 | + } | |
| 447 | + if (!readData.equals(""))
| |
| 448 | + {
| |
| 449 | + LOGGER.info("invalid config property");
| |
| 450 | + } | |
| 451 | + } | |
| 452 | + } | |
| 453 | + } | |
| 454 | + propertySplit = enchant.getProperty("BlessJewelryEnchantLevel", "").split(";");
| |
| 455 | + for (String readData : propertySplit) | |
| 456 | + {
| |
| 457 | + String[] writeData = readData.split(",");
| |
| 458 | + if (writeData.length != 2) | |
| 459 | + {
| |
| 460 | + LOGGER.info("invalid config property");
| |
| 461 | + } | |
| 462 | + else | |
| 463 | + {
| |
| 464 | + try | |
| 465 | + {
| |
| 466 | + BLESS_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 467 | + } | |
| 468 | + catch (NumberFormatException nfe) | |
| 469 | + {
| |
| 470 | + if (DEBUG) | |
| 471 | + {
| |
| 472 | + nfe.printStackTrace(); | |
| 473 | + } | |
| 474 | + if (!readData.equals(""))
| |
| 475 | + {
| |
| 476 | + LOGGER.info("invalid config property");
| |
| 477 | + } | |
| 478 | + } | |
| 479 | + } | |
| 480 | + } | |
| 481 | + propertySplit = enchant.getProperty("CrystalJewelryEnchantLevel", "").split(";");
| |
| 482 | + for (String readData : propertySplit) | |
| 483 | + {
| |
| 484 | + String[] writeData = readData.split(",");
| |
| 485 | + if (writeData.length != 2) | |
| 486 | + {
| |
| 487 | + LOGGER.info("invalid config property");
| |
| 488 | + } | |
| 489 | + else | |
| 490 | + {
| |
| 491 | + try | |
| 492 | + {
| |
| 493 | + CRYSTAL_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 494 | + } | |
| 495 | + catch (NumberFormatException nfe) | |
| 496 | + {
| |
| 497 | + if (DEBUG) | |
| 498 | + {
| |
| 499 | + nfe.printStackTrace(); | |
| 500 | + } | |
| 501 | + if (!readData.equals(""))
| |
| 502 | + {
| |
| 503 | + LOGGER.info("invalid config property");
| |
| 504 | + } | |
| 505 | + } | |
| 506 | + } | |
| 507 | + } | |
| 508 | + propertySplit = enchant.getProperty("DonatorJewelryEnchantLevel", "").split(";");
| |
| 509 | + for (String readData : propertySplit) | |
| 510 | + {
| |
| 511 | + String[] writeData = readData.split(",");
| |
| 512 | + if (writeData.length != 2) | |
| 513 | + {
| |
| 514 | + System.out.println("invalid config property");
| |
| 515 | + } | |
| 516 | + else | |
| 517 | + {
| |
| 518 | + try | |
| 519 | + {
| |
| 520 | + DONATOR_JEWELRY_ENCHANT_LEVEL.put(Integer.valueOf(Integer.parseInt(writeData[0])), Integer.valueOf(Integer.parseInt(writeData[1]))); | |
| 521 | + } | |
| 522 | + catch (NumberFormatException nfe) | |
| 523 | + {
| |
| 524 | + if (DEBUG) | |
| 525 | + {
| |
| 526 | + nfe.printStackTrace(); | |
| 527 | + } | |
| 528 | + if (!readData.equals(""))
| |
| 529 | + {
| |
| 530 | + System.out.println("invalid config property");
| |
| 531 | + } | |
| 532 | + } | |
| 533 | + } | |
| 534 | + } | |
| 535 | + ENCHANT_HERO_WEAPON = Boolean.parseBoolean(enchant.getProperty("EnableEnchantHeroWeapons", "False"));
| |
| 536 | + | |
| 537 | + GOLD_WEAPON = Integer.parseInt(enchant.getProperty("IdEnchantDonatorWeapon", "10010"));
| |
| 538 | + | |
| 539 | + GOLD_ARMOR = Integer.parseInt(enchant.getProperty("IdEnchantDonatorArmor", "10011"));
| |
| 540 | + | |
| 541 | + ENCHANT_SAFE_MAX = Integer.parseInt(enchant.getProperty("EnchantSafeMax", "3"));
| |
| 542 | + | |
| 543 | + ENCHANT_SAFE_MAX_FULL = Integer.parseInt(enchant.getProperty("EnchantSafeMaxFull", "4"));
| |
| 544 | + | |
| 545 | + SCROLL_STACKABLE = Boolean.parseBoolean(enchant.getProperty("ScrollStackable", "False"));
| |
| 546 | + | |
| 547 | + ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("EnchantWeaponMax", "25"));
| |
| 548 | + ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("EnchantArmorMax", "25"));
| |
| 549 | + ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("EnchantJewelryMax", "25"));
| |
| 550 | + | |
| 551 | + BLESSED_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantWeaponMax", "25"));
| |
| 552 | + BLESSED_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantArmorMax", "25"));
| |
| 553 | + BLESSED_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("BlessedEnchantJewelryMax", "25"));
| |
| 554 | + | |
| 555 | + BREAK_ENCHANT = Integer.valueOf(enchant.getProperty("BreakEnchant", "0")).intValue();
| |
| 556 | + | |
| 557 | + CRYSTAL_ENCHANT_MIN = Integer.parseInt(enchant.getProperty("CrystalEnchantMin", "20"));
| |
| 558 | + CRYSTAL_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantWeaponMax", "25"));
| |
| 559 | + CRYSTAL_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantArmorMax", "25"));
| |
| 560 | + CRYSTAL_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("CrystalEnchantJewelryMax", "25"));
| |
| 561 | + | |
| 562 | + DONATOR_ENCHANT_MIN = Integer.parseInt(enchant.getProperty("DonatorEnchantMin", "20"));
| |
| 563 | + DONATOR_ENCHANT_WEAPON_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantWeaponMax", "25"));
| |
| 564 | + DONATOR_ENCHANT_ARMOR_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantArmorMax", "25"));
| |
| 565 | + DONATOR_ENCHANT_JEWELRY_MAX = Integer.parseInt(enchant.getProperty("DonatorEnchantJewelryMax", "25"));
| |
| 566 | + DONATOR_DECREASE_ENCHANT = Boolean.valueOf(enchant.getProperty("DonatorDecreaseEnchant", "false")).booleanValue();
| |
| 567 | + | |
| 568 | + } | |
| 569 | /** | |
| 570 | * Loads siege settings. | |
| 571 | */ | |
| 572 | @@ -1293,6 +1686,9 @@ | |
| 573 | // siege settings | |
| 574 | loadSieges(); | |
| 575 | ||
| 576 | + // enchant settings new | |
| 577 | + loadEnchantSystemConfig(); | |
| 578 | + | |
| 579 | // server settings | |
| 580 | loadServer(); | |
| 581 | } | |
| 582 | diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/BaseExtender.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/BaseExtender.java | |
| 583 | new file mode 100644 | |
| 584 | index 0000000..9ac6d05 | |
| 585 | --- /dev/null | |
| 586 | +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/BaseExtender.java | |
| 587 | @@ -0,0 +1,103 @@ | |
| 588 | +package net.sf.l2j.gameserver.model.item.instance; | |
| 589 | + | |
| 590 | +import net.sf.l2j.gameserver.model.WorldObject; | |
| 591 | + | |
| 592 | +public class BaseExtender | |
| 593 | +{
| |
| 594 | + protected WorldObject _owner; | |
| 595 | + | |
| 596 | + public static enum EventType | |
| 597 | + {
| |
| 598 | + LOAD("load"),
| |
| 599 | + STORE("store"),
| |
| 600 | + CAST("cast"),
| |
| 601 | + ATTACK("attack"),
| |
| 602 | + CRAFT("craft"),
| |
| 603 | + ENCHANT("enchant"),
| |
| 604 | + SPAWN("spawn"),
| |
| 605 | + DELETE("delete"),
| |
| 606 | + SETOWNER("setwoner"),
| |
| 607 | + DROP("drop"),
| |
| 608 | + DIE("die"),
| |
| 609 | + REVIVE("revive"),
| |
| 610 | + SETINTENTION("setintention");
| |
| 611 | + | |
| 612 | + public final String name; | |
| 613 | + | |
| 614 | + private EventType(String name) | |
| 615 | + {
| |
| 616 | + this.name = name; | |
| 617 | + } | |
| 618 | + } | |
| 619 | + | |
| 620 | + public static boolean canCreateFor(WorldObject object) | |
| 621 | + {
| |
| 622 | + return true; | |
| 623 | + } | |
| 624 | + | |
| 625 | + private BaseExtender _next = null; | |
| 626 | + | |
| 627 | + public BaseExtender(WorldObject owner) | |
| 628 | + {
| |
| 629 | + _owner = owner; | |
| 630 | + } | |
| 631 | + | |
| 632 | + public WorldObject getOwner() | |
| 633 | + {
| |
| 634 | + return _owner; | |
| 635 | + } | |
| 636 | + | |
| 637 | + public Object onEvent(String event, Object... params) | |
| 638 | + {
| |
| 639 | + if (_next == null) | |
| 640 | + {
| |
| 641 | + return null; | |
| 642 | + } | |
| 643 | + return _next.onEvent(event, params); | |
| 644 | + } | |
| 645 | + | |
| 646 | + public BaseExtender getExtender(String simpleClassName) | |
| 647 | + {
| |
| 648 | + if (getClass().getSimpleName().compareTo(simpleClassName) == 0) | |
| 649 | + {
| |
| 650 | + return this; | |
| 651 | + } | |
| 652 | + if (_next != null) | |
| 653 | + {
| |
| 654 | + return _next.getExtender(simpleClassName); | |
| 655 | + } | |
| 656 | + return null; | |
| 657 | + } | |
| 658 | + | |
| 659 | + public void removeExtender(BaseExtender ext) | |
| 660 | + {
| |
| 661 | + if (_next != null) | |
| 662 | + {
| |
| 663 | + if (_next == ext) | |
| 664 | + {
| |
| 665 | + _next = _next._next; | |
| 666 | + } | |
| 667 | + else | |
| 668 | + {
| |
| 669 | + _next.removeExtender(ext); | |
| 670 | + } | |
| 671 | + } | |
| 672 | + } | |
| 673 | + | |
| 674 | + public BaseExtender getNextExtender() | |
| 675 | + {
| |
| 676 | + return _next; | |
| 677 | + } | |
| 678 | + | |
| 679 | + public void addExtender(BaseExtender newExtender) | |
| 680 | + {
| |
| 681 | + if (_next == null) | |
| 682 | + {
| |
| 683 | + _next = newExtender; | |
| 684 | + } | |
| 685 | + else | |
| 686 | + {
| |
| 687 | + _next.addExtender(newExtender); | |
| 688 | + } | |
| 689 | + } | |
| 690 | +} | |
| 691 | diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java | |
| 692 | index 4fe230e..7a9d730 100644 | |
| 693 | --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java | |
| 694 | +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/model/item/instance/ItemInstance.java | |
| 695 | @@ -1270,7 +1270,16 @@ | |
| 696 | {
| |
| 697 | _shotsMask = 0; | |
| 698 | } | |
| 699 | + private final BaseExtender _extender = null; | |
| 700 | ||
| 701 | + public Object fireEvent(String event, Object... params) | |
| 702 | + {
| |
| 703 | + if (_extender == null) | |
| 704 | + {
| |
| 705 | + return null; | |
| 706 | + } | |
| 707 | + return _extender.onEvent(event, params); | |
| 708 | + } | |
| 709 | @Override | |
| 710 | public int compareTo(ItemInstance item) | |
| 711 | {
| |
| 712 | @@ -1280,4 +1289,13 @@ | |
| 713 | ||
| 714 | return Integer.compare(item.getObjectId(), getObjectId()); | |
| 715 | } | |
| 716 | + | |
| 717 | + public int getEquipSlot() | |
| 718 | + {
| |
| 719 | + if ((Config.DEBUG) && (_loc != ItemLocation.PAPERDOLL) && (_loc != ItemLocation.PET_EQUIP) && (_loc != ItemLocation.FREIGHT)) | |
| 720 | + {
| |
| 721 | + throw new AssertionError(); | |
| 722 | + } | |
| 723 | + return _locData; | |
| 724 | + } | |
| 725 | } | |
| 726 | \ No newline at end of file | |
| 727 | diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java | |
| 728 | index 50bda20..b094654 100644 | |
| 729 | --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java | |
| 730 | +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java | |
| 731 | @@ -2,27 +2,91 @@ | |
| 732 | +package net.sf.l2j.gameserver.network.clientpackets; | |
| 733 | + | |
| 734 | +import net.sf.l2j.commons.random.Rnd; | |
| 735 | + | |
| 736 | +import net.sf.l2j.Config; | |
| 737 | +import net.sf.l2j.gameserver.enums.StatusType; | |
| 738 | +import net.sf.l2j.gameserver.enums.items.ItemLocation; | |
| 739 | +import net.sf.l2j.gameserver.model.World; | |
| 740 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 741 | +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
| 742 | +import net.sf.l2j.gameserver.model.olympiad.OlympiadManager; | |
| 743 | +import net.sf.l2j.gameserver.network.SystemMessageId; | |
| 744 | +import net.sf.l2j.gameserver.network.serverpackets.EnchantResult; | |
| 745 | +import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate; | |
| 746 | +import net.sf.l2j.gameserver.network.serverpackets.ItemList; | |
| 747 | +import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate; | |
| 748 | +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; | |
| 749 | + | |
| 750 | +public final class RequestEnchantItem extends L2GameClientPacket | |
| 751 | +{
| |
| 752 | + private static final int[] DONATOR_WEAPON_SCROLL = | |
| 753 | + {
| |
| 754 | + Config.GOLD_WEAPON | |
| 755 | + }; | |
| 756 | + private static final int[] DONATOR_ARMOR_SCROLL = | |
| 757 | + {
| |
| 758 | + Config.GOLD_ARMOR | |
| 759 | + }; | |
| 760 | + private static final int[] CRYSTAL_SCROLLS = | |
| 761 | + {
| |
| 762 | + 731, | |
| 763 | + 732, | |
| 764 | + 949, | |
| 765 | + 950, | |
| 766 | + 953, | |
| 767 | + 954, | |
| 768 | + 957, | |
| 769 | + 958, | |
| 770 | + 961, | |
| 771 | + 962 | |
| 772 | + }; | |
| 773 | + private static final int[] NORMAL_WEAPON_SCROLLS = | |
| 774 | + {
| |
| 775 | + 729, | |
| 776 | + 947, | |
| 777 | + 951, | |
| 778 | + 955, | |
| 779 | + 959 | |
| 780 | + }; | |
| 781 | + private static final int[] BLESSED_WEAPON_SCROLLS = | |
| 782 | + {
| |
| 783 | + 6569, | |
| 784 | + 6571, | |
| 785 | + 6573, | |
| 786 | + 6575, | |
| 787 | + 6577 | |
| 788 | + }; | |
| 789 | + private static final int[] CRYSTAL_WEAPON_SCROLLS = | |
| 790 | + {
| |
| 791 | + 731, | |
| 792 | + 949, | |
| 793 | + 953, | |
| 794 | + 957, | |
| 795 | + 961 | |
| 796 | + }; | |
| 797 | + private static final int[] NORMAL_ARMOR_SCROLLS = | |
| 798 | + {
| |
| 799 | + 730, | |
| 800 | + 948, | |
| 801 | + 952, | |
| 802 | + 956, | |
| 803 | + 960 | |
| 804 | + }; | |
| 805 | + private static final int[] BLESSED_ARMOR_SCROLLS = | |
| 806 | + {
| |
| 807 | + 6570, | |
| 808 | + 6572, | |
| 809 | + 6574, | |
| 810 | + 6576, | |
| 811 | + 6578 | |
| 812 | + }; | |
| 813 | + private static final int[] CRYSTAL_ARMOR_SCROLLS = | |
| 814 | + {
| |
| 815 | + 732, | |
| 816 | + 950, | |
| 817 | + 954, | |
| 818 | + 958, | |
| 819 | + 962 | |
| 820 | + }; | |
| 821 | + private int _objectId; | |
| 822 | + | |
| 823 | + @Override | |
| 824 | + protected void readImpl() | |
| 825 | + {
| |
| 826 | + _objectId = readD(); | |
| 827 | + } | |
| 828 | + @Override | |
| 829 | + protected void runImpl() | |
| 830 | + {
| |
| 831 | + Player activeChar = getClient().getPlayer(); | |
| 832 | + if ((activeChar == null) || (_objectId == 0)) | |
| 833 | + {
| |
| 834 | + return; | |
| 835 | + } | |
| 836 | + if (activeChar.getActiveTradeList() != null) | |
| 837 | + {
| |
| 838 | + activeChar.cancelActiveTrade(); | |
| 839 | + activeChar.sendMessage("Your trade canceled");
| |
| 840 | + return; | |
| 841 | + } | |
| 842 | + if (activeChar.isProcessingTransaction()) | |
| 843 | + {
| |
| 844 | + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION); | |
| 845 | + activeChar.setActiveEnchantItem(null); | |
| 846 | + return; | |
| 847 | + } | |
| 848 | + if (!activeChar.isOnline()) | |
| 849 | + {
| |
| 850 | + activeChar.setActiveEnchantItem(null); | |
| 851 | + return; | |
| 852 | + } | |
| 853 | + if ((activeChar.isInOlympiadMode()) || (OlympiadManager.getInstance().isRegistered(activeChar))) | |
| 854 | + {
| |
| 855 | + activeChar.sendMessage("[Olympiad]: Voce nao pode fazer isso!!");
| |
| 856 | + return; | |
| 857 | + } | |
| 858 | + if (!activeChar.isOnline()) | |
| 859 | + {
| |
| 860 | + activeChar.setActiveEnchantItem(null); | |
| 861 | + return; | |
| 862 | + } | |
| 863 | + ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId); | |
| 864 | + ItemInstance scroll = activeChar.getActiveEnchantItem(); | |
| 865 | + activeChar.setActiveEnchantItem(null); | |
| 866 | + if ((item == null) || (scroll == null)) | |
| 867 | + {
| |
| 868 | + activeChar.setActiveEnchantItem(null); | |
| 869 | + return; | |
| 870 | + } | |
| 871 | + if ((!Config.ENCHANT_HERO_WEAPON) && (item.getItemId() >= 6611) && (item.getItemId() <= 6621)) | |
| 872 | + {
| |
| 873 | + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION); | |
| 874 | + activeChar.setActiveEnchantItem(null); | |
| 875 | + return; | |
| 876 | + } | |
| 877 | + int itemType2 = item.getItem().getType2(); | |
| 878 | + boolean enchantItem = false; | |
| 879 | + boolean blessedScroll = false; | |
| 880 | + boolean crystalScroll = false; | |
| 881 | + boolean donatorScroll = false; | |
| 882 | + int crystalId = 0; | |
| 883 | + switch (item.getItem().getCrystalType()) | |
| 884 | + {
| |
| 885 | + case A: | |
| 886 | + crystalId = 1461; | |
| 887 | + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0)) | |
| 888 | + {
| |
| 889 | + enchantItem = true; | |
| 890 | + } | |
| 891 | + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2))) | |
| 892 | + {
| |
| 893 | + enchantItem = true; | |
| 894 | + } | |
| 895 | + switch (scroll.getItemId()) | |
| 896 | + {
| |
| 897 | + case 729: | |
| 898 | + case 731: | |
| 899 | + case 6569: | |
| 900 | + if (itemType2 == 0) | |
| 901 | + {
| |
| 902 | + enchantItem = true; | |
| 903 | + } | |
| 904 | + break; | |
| 905 | + case 730: | |
| 906 | + case 732: | |
| 907 | + case 6570: | |
| 908 | + if ((itemType2 == 1) || (itemType2 == 2)) | |
| 909 | + {
| |
| 910 | + enchantItem = true; | |
| 911 | + } | |
| 912 | + break; | |
| 913 | + } | |
| 914 | + break; | |
| 915 | + case B: | |
| 916 | + crystalId = 1460; | |
| 917 | + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0)) | |
| 918 | + {
| |
| 919 | + enchantItem = true; | |
| 920 | + } | |
| 921 | + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2))) | |
| 922 | + {
| |
| 923 | + enchantItem = true; | |
| 924 | + } | |
| 925 | + switch (scroll.getItemId()) | |
| 926 | + {
| |
| 927 | + case 947: | |
| 928 | + case 949: | |
| 929 | + case 6571: | |
| 930 | + if (itemType2 == 0) | |
| 931 | + {
| |
| 932 | + enchantItem = true; | |
| 933 | + } | |
| 934 | + break; | |
| 935 | + case 948: | |
| 936 | + case 950: | |
| 937 | + case 6572: | |
| 938 | + if ((itemType2 == 1) || (itemType2 == 2)) | |
| 939 | + {
| |
| 940 | + enchantItem = true; | |
| 941 | + } | |
| 942 | + break; | |
| 943 | + } | |
| 944 | + break; | |
| 945 | + case C: | |
| 946 | + crystalId = 1459; | |
| 947 | + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0)) | |
| 948 | + {
| |
| 949 | + enchantItem = true; | |
| 950 | + } | |
| 951 | + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2))) | |
| 952 | + {
| |
| 953 | + enchantItem = true; | |
| 954 | + } | |
| 955 | + switch (scroll.getItemId()) | |
| 956 | + {
| |
| 957 | + case 951: | |
| 958 | + case 953: | |
| 959 | + case 6573: | |
| 960 | + if (itemType2 == 0) | |
| 961 | + {
| |
| 962 | + enchantItem = true; | |
| 963 | + } | |
| 964 | + break; | |
| 965 | + case 952: | |
| 966 | + case 954: | |
| 967 | + case 6574: | |
| 968 | + if ((itemType2 == 1) || (itemType2 == 2)) | |
| 969 | + {
| |
| 970 | + enchantItem = true; | |
| 971 | + } | |
| 972 | + break; | |
| 973 | + } | |
| 974 | + break; | |
| 975 | + case D: | |
| 976 | + crystalId = 1458; | |
| 977 | + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0)) | |
| 978 | + {
| |
| 979 | + enchantItem = true; | |
| 980 | + } | |
| 981 | + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2))) | |
| 982 | + {
| |
| 983 | + enchantItem = true; | |
| 984 | + } | |
| 985 | + switch (scroll.getItemId()) | |
| 986 | + {
| |
| 987 | + case 955: | |
| 988 | + case 957: | |
| 989 | + case 6575: | |
| 990 | + if (itemType2 == 0) | |
| 991 | + {
| |
| 992 | + enchantItem = true; | |
| 993 | + } | |
| 994 | + break; | |
| 995 | + case 956: | |
| 996 | + case 958: | |
| 997 | + case 6576: | |
| 998 | + if ((itemType2 == 1) || (itemType2 == 2)) | |
| 999 | + {
| |
| 1000 | + enchantItem = true; | |
| 1001 | + } | |
| 1002 | + break; | |
| 1003 | + } | |
| 1004 | + break; | |
| 1005 | + case S: | |
| 1006 | + crystalId = 1462; | |
| 1007 | + if ((scroll.getItemId() == Config.GOLD_WEAPON) && (itemType2 == 0)) | |
| 1008 | + {
| |
| 1009 | + enchantItem = true; | |
| 1010 | + } | |
| 1011 | + else if ((scroll.getItemId() == Config.GOLD_ARMOR) && ((itemType2 == 1) || (itemType2 == 2))) | |
| 1012 | + {
| |
| 1013 | + enchantItem = true; | |
| 1014 | + } | |
| 1015 | + switch (scroll.getItemId()) | |
| 1016 | + {
| |
| 1017 | + case 959: | |
| 1018 | + case 961: | |
| 1019 | + case 6577: | |
| 1020 | + if (itemType2 == 0) | |
| 1021 | + {
| |
| 1022 | + enchantItem = true; | |
| 1023 | + } | |
| 1024 | + break; | |
| 1025 | + case 960: | |
| 1026 | + case 962: | |
| 1027 | + case 6578: | |
| 1028 | + if ((itemType2 == 1) || (itemType2 == 2)) | |
| 1029 | + {
| |
| 1030 | + enchantItem = true; | |
| 1031 | + } | |
| 1032 | + break; | |
| 1033 | + } | |
| 1034 | + break; | |
| 1035 | + } | |
| 1036 | + if (!enchantItem) | |
| 1037 | + {
| |
| 1038 | + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION); | |
| 1039 | + return; | |
| 1040 | + } | |
| 1041 | + if ((scroll.getItemId() >= 6569) && (scroll.getItemId() <= 6578)) | |
| 1042 | + {
| |
| 1043 | + blessedScroll = true; | |
| 1044 | + } | |
| 1045 | + else if ((scroll.getItemId() == Config.GOLD_WEAPON) || (scroll.getItemId() == Config.GOLD_ARMOR)) | |
| 1046 | + {
| |
| 1047 | + donatorScroll = true; | |
| 1048 | + } | |
| 1049 | + else | |
| 1050 | + {
| |
| 1051 | + for (int crystalscroll : CRYSTAL_SCROLLS) | |
| 1052 | + {
| |
| 1053 | + if (scroll.getItemId() == crystalscroll) | |
| 1054 | + {
| |
| 1055 | + crystalScroll = true; | |
| 1056 | + break; | |
| 1057 | + } | |
| 1058 | + } | |
| 1059 | + } | |
| 1060 | + int chance = 0; | |
| 1061 | + int maxEnchantLevel = 0; | |
| 1062 | + int minEnchantLevel = 0; | |
| 1063 | + int nextEnchantLevel = item.getEnchantLevel() + 1; | |
| 1064 | + if (item.getItem().getType2() == 0) | |
| 1065 | + {
| |
| 1066 | + if (blessedScroll) | |
| 1067 | + {
| |
| 1068 | + for (int blessedweaponscroll : BLESSED_WEAPON_SCROLLS) | |
| 1069 | + {
| |
| 1070 | + if (scroll.getItemId() == blessedweaponscroll) | |
| 1071 | + {
| |
| 1072 | + if (item.getEnchantLevel() >= Config.BLESS_WEAPON_ENCHANT_LEVEL.size()) | |
| 1073 | + {
| |
| 1074 | + chance = Config.BLESS_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_WEAPON_ENCHANT_LEVEL.size())).intValue(); | |
| 1075 | + } | |
| 1076 | + else | |
| 1077 | + {
| |
| 1078 | + chance = Config.BLESS_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1079 | + } | |
| 1080 | + maxEnchantLevel = Config.BLESSED_ENCHANT_WEAPON_MAX; | |
| 1081 | + break; | |
| 1082 | + } | |
| 1083 | + } | |
| 1084 | + } | |
| 1085 | + else if (crystalScroll) | |
| 1086 | + {
| |
| 1087 | + for (int crystalweaponscroll : CRYSTAL_WEAPON_SCROLLS) | |
| 1088 | + {
| |
| 1089 | + if (scroll.getItemId() == crystalweaponscroll) | |
| 1090 | + {
| |
| 1091 | + if (item.getEnchantLevel() >= Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.size()) | |
| 1092 | + {
| |
| 1093 | + chance = Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.size())).intValue(); | |
| 1094 | + } | |
| 1095 | + else | |
| 1096 | + {
| |
| 1097 | + chance = Config.CRYSTAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1098 | + } | |
| 1099 | + minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN; | |
| 1100 | + maxEnchantLevel = Config.CRYSTAL_ENCHANT_WEAPON_MAX; | |
| 1101 | + break; | |
| 1102 | + } | |
| 1103 | + } | |
| 1104 | + } | |
| 1105 | + else if (donatorScroll) | |
| 1106 | + {
| |
| 1107 | + for (int donateweaponscroll : DONATOR_WEAPON_SCROLL) | |
| 1108 | + {
| |
| 1109 | + if (scroll.getItemId() == donateweaponscroll) | |
| 1110 | + {
| |
| 1111 | + if (item.getEnchantLevel() >= Config.DONATOR_WEAPON_ENCHANT_LEVEL.size()) | |
| 1112 | + {
| |
| 1113 | + chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_WEAPON_ENCHANT_LEVEL.size())).intValue(); | |
| 1114 | + } | |
| 1115 | + else | |
| 1116 | + {
| |
| 1117 | + chance = Config.DONATOR_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1118 | + } | |
| 1119 | + minEnchantLevel = Config.DONATOR_ENCHANT_MIN; | |
| 1120 | + maxEnchantLevel = Config.DONATOR_ENCHANT_WEAPON_MAX; | |
| 1121 | + break; | |
| 1122 | + } | |
| 1123 | + } | |
| 1124 | + } | |
| 1125 | + else | |
| 1126 | + {
| |
| 1127 | + for (int normalweaponscroll : NORMAL_WEAPON_SCROLLS) | |
| 1128 | + {
| |
| 1129 | + if (scroll.getItemId() == normalweaponscroll) | |
| 1130 | + {
| |
| 1131 | + if (item.getEnchantLevel() >= Config.NORMAL_WEAPON_ENCHANT_LEVEL.size()) | |
| 1132 | + {
| |
| 1133 | + chance = Config.NORMAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_WEAPON_ENCHANT_LEVEL.size())).intValue(); | |
| 1134 | + } | |
| 1135 | + else | |
| 1136 | + {
| |
| 1137 | + chance = Config.NORMAL_WEAPON_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1138 | + } | |
| 1139 | + maxEnchantLevel = Config.ENCHANT_WEAPON_MAX; | |
| 1140 | + break; | |
| 1141 | + } | |
| 1142 | + } | |
| 1143 | + } | |
| 1144 | + } | |
| 1145 | + else if (item.getItem().getType2() == 1) | |
| 1146 | + {
| |
| 1147 | + if (blessedScroll) | |
| 1148 | + {
| |
| 1149 | + for (int blessedarmorscroll : BLESSED_ARMOR_SCROLLS) | |
| 1150 | + {
| |
| 1151 | + if (scroll.getItemId() == blessedarmorscroll) | |
| 1152 | + {
| |
| 1153 | + if (item.getEnchantLevel() >= Config.BLESS_ARMOR_ENCHANT_LEVEL.size()) | |
| 1154 | + {
| |
| 1155 | + chance = Config.BLESS_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_ARMOR_ENCHANT_LEVEL.size())).intValue(); | |
| 1156 | + } | |
| 1157 | + else | |
| 1158 | + {
| |
| 1159 | + chance = Config.BLESS_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1160 | + } | |
| 1161 | + maxEnchantLevel = Config.BLESSED_ENCHANT_ARMOR_MAX; | |
| 1162 | + break; | |
| 1163 | + } | |
| 1164 | + } | |
| 1165 | + } | |
| 1166 | + else if (crystalScroll) | |
| 1167 | + {
| |
| 1168 | + for (int crystalarmorscroll : CRYSTAL_ARMOR_SCROLLS) | |
| 1169 | + {
| |
| 1170 | + if (scroll.getItemId() == crystalarmorscroll) | |
| 1171 | + {
| |
| 1172 | + if (item.getEnchantLevel() >= Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.size()) | |
| 1173 | + {
| |
| 1174 | + chance = Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.size())).intValue(); | |
| 1175 | + } | |
| 1176 | + else | |
| 1177 | + {
| |
| 1178 | + chance = Config.CRYSTAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1179 | + } | |
| 1180 | + minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN; | |
| 1181 | + maxEnchantLevel = Config.CRYSTAL_ENCHANT_ARMOR_MAX; | |
| 1182 | + break; | |
| 1183 | + } | |
| 1184 | + } | |
| 1185 | + } | |
| 1186 | + else if (donatorScroll) | |
| 1187 | + {
| |
| 1188 | + for (int donatorarmorscroll : DONATOR_ARMOR_SCROLL) | |
| 1189 | + {
| |
| 1190 | + if (scroll.getItemId() == donatorarmorscroll) | |
| 1191 | + {
| |
| 1192 | + if (item.getEnchantLevel() >= Config.DONATOR_ARMOR_ENCHANT_LEVEL.size()) | |
| 1193 | + {
| |
| 1194 | + chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_ARMOR_ENCHANT_LEVEL.size())).intValue(); | |
| 1195 | + } | |
| 1196 | + else | |
| 1197 | + {
| |
| 1198 | + chance = Config.DONATOR_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1199 | + } | |
| 1200 | + minEnchantLevel = Config.DONATOR_ENCHANT_MIN; | |
| 1201 | + maxEnchantLevel = Config.DONATOR_ENCHANT_ARMOR_MAX; | |
| 1202 | + break; | |
| 1203 | + } | |
| 1204 | + } | |
| 1205 | + } | |
| 1206 | + else | |
| 1207 | + {
| |
| 1208 | + for (int normalarmorscroll : NORMAL_ARMOR_SCROLLS) | |
| 1209 | + {
| |
| 1210 | + if (scroll.getItemId() == normalarmorscroll) | |
| 1211 | + {
| |
| 1212 | + if (item.getEnchantLevel() >= Config.NORMAL_ARMOR_ENCHANT_LEVEL.size()) | |
| 1213 | + {
| |
| 1214 | + chance = Config.NORMAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_ARMOR_ENCHANT_LEVEL.size())).intValue(); | |
| 1215 | + } | |
| 1216 | + else | |
| 1217 | + {
| |
| 1218 | + chance = Config.NORMAL_ARMOR_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1219 | + } | |
| 1220 | + maxEnchantLevel = Config.ENCHANT_ARMOR_MAX; | |
| 1221 | + break; | |
| 1222 | + } | |
| 1223 | + } | |
| 1224 | + } | |
| 1225 | + } | |
| 1226 | + else if (item.getItem().getType2() == 2) | |
| 1227 | + {
| |
| 1228 | + if (blessedScroll) | |
| 1229 | + {
| |
| 1230 | + for (int blessedjewelscroll : BLESSED_ARMOR_SCROLLS) | |
| 1231 | + {
| |
| 1232 | + if (scroll.getItemId() == blessedjewelscroll) | |
| 1233 | + {
| |
| 1234 | + if (item.getEnchantLevel() >= Config.BLESS_JEWELRY_ENCHANT_LEVEL.size()) | |
| 1235 | + {
| |
| 1236 | + chance = Config.BLESS_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.BLESS_JEWELRY_ENCHANT_LEVEL.size())).intValue(); | |
| 1237 | + } | |
| 1238 | + else | |
| 1239 | + {
| |
| 1240 | + chance = Config.BLESS_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1241 | + } | |
| 1242 | + maxEnchantLevel = Config.BLESSED_ENCHANT_JEWELRY_MAX; | |
| 1243 | + break; | |
| 1244 | + } | |
| 1245 | + } | |
| 1246 | + } | |
| 1247 | + else if (crystalScroll) | |
| 1248 | + {
| |
| 1249 | + for (int crystaljewelscroll : CRYSTAL_ARMOR_SCROLLS) | |
| 1250 | + {
| |
| 1251 | + if (scroll.getItemId() == crystaljewelscroll) | |
| 1252 | + {
| |
| 1253 | + if (item.getEnchantLevel() >= Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.size()) | |
| 1254 | + {
| |
| 1255 | + chance = Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.size())).intValue(); | |
| 1256 | + } | |
| 1257 | + else | |
| 1258 | + {
| |
| 1259 | + chance = Config.CRYSTAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1260 | + } | |
| 1261 | + minEnchantLevel = Config.CRYSTAL_ENCHANT_MIN; | |
| 1262 | + maxEnchantLevel = Config.CRYSTAL_ENCHANT_JEWELRY_MAX; | |
| 1263 | + | |
| 1264 | + break; | |
| 1265 | + } | |
| 1266 | + } | |
| 1267 | + } | |
| 1268 | + else if (donatorScroll) | |
| 1269 | + {
| |
| 1270 | + for (int donatorjewelscroll : DONATOR_ARMOR_SCROLL) | |
| 1271 | + {
| |
| 1272 | + if (scroll.getItemId() == donatorjewelscroll) | |
| 1273 | + {
| |
| 1274 | + if (item.getEnchantLevel() >= Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size()) | |
| 1275 | + {
| |
| 1276 | + chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.DONATOR_JEWELRY_ENCHANT_LEVEL.size())).intValue(); | |
| 1277 | + } | |
| 1278 | + else | |
| 1279 | + {
| |
| 1280 | + chance = Config.DONATOR_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1281 | + } | |
| 1282 | + minEnchantLevel = Config.DONATOR_ENCHANT_MIN; | |
| 1283 | + maxEnchantLevel = Config.DONATOR_ENCHANT_JEWELRY_MAX; | |
| 1284 | + break; | |
| 1285 | + } | |
| 1286 | + } | |
| 1287 | + } | |
| 1288 | + else | |
| 1289 | + {
| |
| 1290 | + for (int normaljewelscroll : NORMAL_ARMOR_SCROLLS) | |
| 1291 | + {
| |
| 1292 | + if (scroll.getItemId() == normaljewelscroll) | |
| 1293 | + {
| |
| 1294 | + if (item.getEnchantLevel() >= Config.NORMAL_JEWELRY_ENCHANT_LEVEL.size()) | |
| 1295 | + {
| |
| 1296 | + chance = Config.NORMAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(Config.NORMAL_JEWELRY_ENCHANT_LEVEL.size())).intValue(); | |
| 1297 | + } | |
| 1298 | + else | |
| 1299 | + {
| |
| 1300 | + chance = Config.NORMAL_JEWELRY_ENCHANT_LEVEL.get(Integer.valueOf(item.getEnchantLevel() + 1)).intValue(); | |
| 1301 | + } | |
| 1302 | + maxEnchantLevel = Config.ENCHANT_JEWELRY_MAX; | |
| 1303 | + break; | |
| 1304 | + } | |
| 1305 | + } | |
| 1306 | + } | |
| 1307 | + } | |
| 1308 | + if (((maxEnchantLevel != 0) && (item.getEnchantLevel() >= maxEnchantLevel)) || (item.getEnchantLevel() < minEnchantLevel) || (item.getEnchantLevel() >= nextEnchantLevel)) | |
| 1309 | + {
| |
| 1310 | + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION); | |
| 1311 | + return; | |
| 1312 | + } | |
| 1313 | + if (Config.SCROLL_STACKABLE) | |
| 1314 | + {
| |
| 1315 | + scroll = activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item);
| |
| 1316 | + } | |
| 1317 | + else | |
| 1318 | + {
| |
| 1319 | + scroll = activeChar.getInventory().destroyItem("Enchant", scroll, activeChar, item);
| |
| 1320 | + } | |
| 1321 | + if (scroll == null) | |
| 1322 | + {
| |
| 1323 | + activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS); | |
| 1324 | + return; | |
| 1325 | + } | |
| 1326 | + if ((item.getEnchantLevel() < Config.ENCHANT_SAFE_MAX) || ((item.getItem().getBodyPart() == 32768) && (item.getEnchantLevel() < Config.ENCHANT_SAFE_MAX_FULL))) | |
| 1327 | + {
| |
| 1328 | + chance = 100; | |
| 1329 | + } | |
| 1330 | + int rndValue = Rnd.get(100); | |
| 1331 | + | |
| 1332 | + Object aChance = item.fireEvent("calcEnchantChance", new Object[chance]);
| |
| 1333 | + if (aChance != null) | |
| 1334 | + {
| |
| 1335 | + chance = ((Integer) aChance).intValue(); | |
| 1336 | + } | |
| 1337 | + synchronized (item) | |
| 1338 | + {
| |
| 1339 | + if (rndValue < chance) | |
| 1340 | + {
| |
| 1341 | + if (item.getOwnerId() != activeChar.getObjectId()) | |
| 1342 | + {
| |
| 1343 | + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION); | |
| 1344 | + return; | |
| 1345 | + } | |
| 1346 | + if ((item.getLocation() != ItemLocation.INVENTORY) && (item.getLocation() != ItemLocation.PAPERDOLL)) | |
| 1347 | + {
| |
| 1348 | + activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITION); | |
| 1349 | + return; | |
| 1350 | + } | |
| 1351 | + if (item.getEnchantLevel() == 0) | |
| 1352 | + {
| |
| 1353 | + SystemMessage sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED); | |
| 1354 | + sm.addItemName(item.getItemId()); | |
| 1355 | + activeChar.sendPacket(sm); | |
| 1356 | + } | |
| 1357 | + else | |
| 1358 | + {
| |
| 1359 | + SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED); | |
| 1360 | + sm.addNumber(item.getEnchantLevel()); | |
| 1361 | + sm.addItemName(item.getItemId()); | |
| 1362 | + activeChar.sendPacket(sm); | |
| 1363 | + | |
| 1364 | + } | |
| 1365 | + item.setEnchantLevel(item.getEnchantLevel() + 1); | |
| 1366 | + item.updateDatabase(); | |
| 1367 | + } | |
| 1368 | + else | |
| 1369 | + {
| |
| 1370 | + if (crystalScroll) | |
| 1371 | + {
| |
| 1372 | + SystemMessage sm = SystemMessage.sendString("Failed in Crystal Enchant. The enchant value of the item become " + Config.CRYSTAL_ENCHANT_MIN);
| |
| 1373 | + activeChar.sendPacket(sm); | |
| 1374 | + } | |
| 1375 | + else if (blessedScroll) | |
| 1376 | + {
| |
| 1377 | + SystemMessage sm = new SystemMessage(SystemMessageId.BLESSED_ENCHANT_FAILED); | |
| 1378 | + activeChar.sendPacket(sm); | |
| 1379 | + } | |
| 1380 | + else if (donatorScroll) | |
| 1381 | + {
| |
| 1382 | + if (Config.DONATOR_DECREASE_ENCHANT) | |
| 1383 | + {
| |
| 1384 | + if (item.getEnchantLevel() <= Config.DONATOR_ENCHANT_MIN) | |
| 1385 | + {
| |
| 1386 | + SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant.");
| |
| 1387 | + activeChar.sendPacket(sm1); | |
| 1388 | + } | |
| 1389 | + else | |
| 1390 | + {
| |
| 1391 | + SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant. His equipment had 1 reduced enchant.");
| |
| 1392 | + activeChar.sendPacket(sm1); | |
| 1393 | + } | |
| 1394 | + } | |
| 1395 | + else | |
| 1396 | + {
| |
| 1397 | + SystemMessage sm1 = SystemMessage.sendString("Failed Golden Enchant.");
| |
| 1398 | + activeChar.sendPacket(sm1); | |
| 1399 | + } | |
| 1400 | + } | |
| 1401 | + else if (item.getEnchantLevel() > 0) | |
| 1402 | + {
| |
| 1403 | + SystemMessage sm = new SystemMessage(SystemMessageId.ENCHANTMENT_FAILED_S1_S2_EVAPORATED); | |
| 1404 | + sm.addNumber(item.getEnchantLevel()); | |
| 1405 | + sm.addItemName(item.getItemId()); | |
| 1406 | + activeChar.sendPacket(sm); | |
| 1407 | + } | |
| 1408 | + else | |
| 1409 | + {
| |
| 1410 | + SystemMessage sm = new SystemMessage(SystemMessageId.ENCHANTMENT_FAILED_S1_EVAPORATED); | |
| 1411 | + sm.addItemName(item.getItemId()); | |
| 1412 | + activeChar.sendPacket(sm); | |
| 1413 | + } | |
| 1414 | + if ((!blessedScroll) && (!crystalScroll) && (!donatorScroll)) | |
| 1415 | + {
| |
| 1416 | + if (item.getEnchantLevel() > 0) | |
| 1417 | + {
| |
| 1418 | + SystemMessage sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED); | |
| 1419 | + sm.addNumber(item.getEnchantLevel()); | |
| 1420 | + sm.addItemName(item.getItemId()); | |
| 1421 | + activeChar.sendPacket(sm); | |
| 1422 | + } | |
| 1423 | + else | |
| 1424 | + {
| |
| 1425 | + SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISARMED); | |
| 1426 | + sm.addItemName(item.getItemId()); | |
| 1427 | + activeChar.sendPacket(sm); | |
| 1428 | + } | |
| 1429 | + if (item.isEquipped()) | |
| 1430 | + {
| |
| 1431 | + if (item.isAugmented()) | |
| 1432 | + {
| |
| 1433 | + item.getAugmentation().removeBonus(activeChar); | |
| 1434 | + } | |
| 1435 | + ItemInstance[] unequiped = activeChar.getInventory().unequipItemInSlotAndRecord(item.getEquipSlot()); | |
| 1436 | + InventoryUpdate iu = new InventoryUpdate(); | |
| 1437 | + for (ItemInstance element : unequiped) | |
| 1438 | + {
| |
| 1439 | + iu.addModifiedItem(element); | |
| 1440 | + } | |
| 1441 | + activeChar.sendPacket(iu); | |
| 1442 | + | |
| 1443 | + activeChar.broadcastUserInfo(); | |
| 1444 | + } | |
| 1445 | + int count = item.getCrystalCount() - (item.getItem().getCrystalCount() + 1) / 2; | |
| 1446 | + if (count < 1) | |
| 1447 | + {
| |
| 1448 | + count = 1; | |
| 1449 | + } | |
| 1450 | + if (item.fireEvent("enchantFail", new Object[0]) != null)
| |
| 1451 | + {
| |
| 1452 | + return; | |
| 1453 | + } | |
| 1454 | + ItemInstance destroyItem = activeChar.getInventory().destroyItem("Enchant", item, activeChar, null);
| |
| 1455 | + if (destroyItem == null) | |
| 1456 | + {
| |
| 1457 | + return; | |
| 1458 | + } | |
| 1459 | + ItemInstance crystals = activeChar.getInventory().addItem("Enchant", crystalId, count, activeChar, destroyItem);
| |
| 1460 | + | |
| 1461 | + SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S); | |
| 1462 | + sm.addItemName(crystals.getItemId()); | |
| 1463 | + sm.addNumber(count); | |
| 1464 | + activeChar.sendPacket(sm); | |
| 1465 | + | |
| 1466 | + activeChar.sendPacket(new ItemList(activeChar, true)); | |
| 1467 | + | |
| 1468 | + StatusUpdate su = new StatusUpdate(activeChar); | |
| 1469 | + su.addAttribute(StatusType.CUR_LOAD, activeChar.getCurrentWeight()); | |
| 1470 | + activeChar.sendPacket(su); | |
| 1471 | + | |
| 1472 | + activeChar.broadcastUserInfo(); | |
| 1473 | + | |
| 1474 | + World world = World.getInstance(); | |
| 1475 | + world.removeObject(destroyItem); | |
| 1476 | + } | |
| 1477 | + else if (blessedScroll) | |
| 1478 | + {
| |
| 1479 | + item.setEnchantLevel(Config.BREAK_ENCHANT); | |
| 1480 | + item.updateDatabase(); | |
| 1481 | + } | |
| 1482 | + else if (crystalScroll) | |
| 1483 | + {
| |
| 1484 | + item.setEnchantLevel(Config.CRYSTAL_ENCHANT_MIN); | |
| 1485 | + item.updateDatabase(); | |
| 1486 | + } | |
| 1487 | + else if (donatorScroll) | |
| 1488 | + {
| |
| 1489 | + if (Config.DONATOR_DECREASE_ENCHANT) | |
| 1490 | + {
| |
| 1491 | + if (item.getEnchantLevel() <= Config.DONATOR_ENCHANT_MIN) | |
| 1492 | + {
| |
| 1493 | + item.setEnchantLevel(item.getEnchantLevel()); | |
| 1494 | + } | |
| 1495 | + else | |
| 1496 | + {
| |
| 1497 | + item.setEnchantLevel(item.getEnchantLevel() - 1); | |
| 1498 | + } | |
| 1499 | + } | |
| 1500 | + else | |
| 1501 | + {
| |
| 1502 | + item.setEnchantLevel(item.getEnchantLevel()); | |
| 1503 | + } | |
| 1504 | + item.updateDatabase(); | |
| 1505 | + } | |
| 1506 | + } | |
| 1507 | + } | |
| 1508 | + | |
| 1509 | + StatusUpdate su = new StatusUpdate(activeChar); | |
| 1510 | + su.addAttribute(StatusType.CUR_LOAD, activeChar.getCurrentWeight()); | |
| 1511 | + activeChar.sendPacket(su); | |
| 1512 | + su = null; | |
| 1513 | + | |
| 1514 | + activeChar.sendPacket(new EnchantResult(item.getEnchantLevel())); | |
| 1515 | + activeChar.sendPacket(new ItemList(activeChar, false)); | |
| 1516 | + activeChar.broadcastUserInfo(); | |
| 1517 | + activeChar.setActiveEnchantItem(null); | |
| 1518 | + } | |
| 1519 | + | |
| 1520 | + @Override | |
| 1521 | + public String getType() | |
| 1522 | + {
| |
| 1523 | + return "[C] 58 RequestEnchantItem"; | |
| 1524 | + } | |
| 1525 | +} | |
| 1526 | ||
| 1527 | diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java | |
| 1528 | index 4a90ea6..32bc359 100644 | |
| 1529 | --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java | |
| 1530 | +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/EnchantResult.java | |
| 1531 | @@ -10,7 +10,7 @@ | |
| 1532 | ||
| 1533 | private final int _result; | |
| 1534 | ||
| 1535 | - private EnchantResult(int result) | |
| 1536 | + public EnchantResult(int result) | |
| 1537 | {
| |
| 1538 | _result = result; | |
| 1539 | } | |
| 1540 | diff --git a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java | |
| 1541 | index f4ad4e9..a2cfb75 100644 | |
| 1542 | --- a/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java | |
| 1543 | +++ b/trunk_398 Limpa/java/net/sf/l2j/gameserver/network/serverpackets/SystemMessage.java | |
| 1544 | @@ -28,7 +28,7 @@ | |
| 1545 | private SMParam[] _params; | |
| 1546 | private int _paramIndex; | |
| 1547 | ||
| 1548 | - private SystemMessage(final SystemMessageId smId) | |
| 1549 | + public SystemMessage(final SystemMessageId smId) | |
| 1550 | {
| |
| 1551 | final int paramCount = smId.getParamCount(); | |
| 1552 | _smId = smId; | |
| 1553 |