SHOW:
|
|
- or go back to the newest paste.
| 1 | ### Eclipse Workspace Patch 1.0 | |
| 2 | #P aCis_gameserver405 | |
| 3 | diff --git config/players.properties config/players.properties | |
| 4 | index c645204..99e7087 100644 | |
| 5 | --- config/players.properties | |
| 6 | +++ config/players.properties | |
| 7 | @@ -257,4 +257,16 @@ | |
| 8 | MaxBuffsAmount = 20 | |
| 9 | ||
| 10 | # Store buffs/debuffs on user logout. Default: True | |
| 11 | -StoreSkillCooltime = True | |
| 12 | \ No newline at end of file | |
| 13 | +StoreSkillCooltime = True | |
| 14 | + | |
| 15 | +# DressMe system. | |
| 16 | +AllowDressMeSystem = True | |
| 17 | + | |
| 18 | +# DressMe Command | |
| 19 | +DressMeCommand = dressme | |
| 20 | + | |
| 21 | +# Only for premium account | |
| 22 | +AllowDressMeForPremiumOnly = False | |
| 23 | + | |
| 24 | + | |
| 25 | +# Players won't see the skins in Olympiad | |
| 26 | +AllowDressMeInOly = True | |
| 27 | \ No newline at end of file | |
| 28 | diff --git java/Base/Skin/DressMeData.java java/Base/Skin/DressMeData.java | |
| 29 | new file mode 100644 | |
| 30 | index 0000000..cdf1053 | |
| 31 | --- /dev/null | |
| 32 | +++ java/Base/Skin/DressMeData.java | |
| 33 | @@ -0,0 +1,216 @@ | |
| 34 | +package Base.Skin; | |
| 35 | + | |
| 36 | +import java.util.HashMap; | |
| 37 | +import java.util.Map; | |
| 38 | +import java.util.logging.Logger; | |
| 39 | + | |
| 40 | +import net.sf.l2j.commons.data.StatSet; | |
| 41 | + | |
| 42 | +import org.w3c.dom.Document; | |
| 43 | +import org.w3c.dom.NamedNodeMap; | |
| 44 | +import org.w3c.dom.Node; | |
| 45 | + | |
| 46 | +import Base.Xml.IXmlReader; | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | +public class DressMeData implements IXmlReader | |
| 51 | +{
| |
| 52 | + private static final Logger LOG = Logger.getLogger(DressMeData.class.getName()); | |
| 53 | + | |
| 54 | + private final static Map<Integer, SkinPackage> _armorSkins = new HashMap<>(); | |
| 55 | + private final static Map<Integer, SkinPackage> _weaponSkins = new HashMap<>(); | |
| 56 | + private final static Map<Integer, SkinPackage> _hairSkins = new HashMap<>(); | |
| 57 | + private final static Map<Integer, SkinPackage> _faceSkins = new HashMap<>(); | |
| 58 | + private final static Map<Integer, SkinPackage> _shieldSkins = new HashMap<>(); | |
| 59 | + | |
| 60 | + public DressMeData() | |
| 61 | + {
| |
| 62 | + load(); | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void reload() | |
| 66 | + {
| |
| 67 | + _armorSkins.clear(); | |
| 68 | + _weaponSkins.clear(); | |
| 69 | + _hairSkins.clear(); | |
| 70 | + _faceSkins.clear(); | |
| 71 | + _shieldSkins.clear(); | |
| 72 | + | |
| 73 | + load(); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Override | |
| 77 | + public void load() | |
| 78 | + {
| |
| 79 | + parseDatapackFile("./data/xml/dressme.xml");
| |
| 80 | + LOG.info(getClass().getSimpleName() + ": Loaded " + _armorSkins.size() + " armor skins"); | |
| 81 | + LOG.info(getClass().getSimpleName() + ": Loaded " + _weaponSkins.size() + " weapon skins"); | |
| 82 | + LOG.info(getClass().getSimpleName() + ": Loaded " + _hairSkins.size() + " hair skins"); | |
| 83 | + LOG.info(getClass().getSimpleName() + ": Loaded " + _faceSkins.size() + " face skins"); | |
| 84 | + LOG.info(getClass().getSimpleName() + ": Loaded " + _shieldSkins.size() + " shield skins"); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Override | |
| 88 | + public void parseDocument(Document doc) | |
| 89 | + {
| |
| 90 | + for (Node list = doc.getFirstChild(); list != null; list = list.getNextSibling()) | |
| 91 | + {
| |
| 92 | + if ("list".equalsIgnoreCase(list.getNodeName()))
| |
| 93 | + {
| |
| 94 | + for (Node skin = list.getFirstChild(); skin != null; skin = skin.getNextSibling()) | |
| 95 | + {
| |
| 96 | + if ("skin".equalsIgnoreCase(skin.getNodeName()))
| |
| 97 | + {
| |
| 98 | + final NamedNodeMap attrs = skin.getAttributes(); | |
| 99 | + | |
| 100 | + String type = parseString(attrs, "type"); | |
| 101 | + | |
| 102 | + final StatSet set = new StatSet(); | |
| 103 | + | |
| 104 | + for (Node typeN = skin.getFirstChild(); typeN != null; typeN = typeN.getNextSibling()) | |
| 105 | + {
| |
| 106 | + if ("type".equalsIgnoreCase(typeN.getNodeName()))
| |
| 107 | + {
| |
| 108 | + final NamedNodeMap attrs2 = typeN.getAttributes(); | |
| 109 | + | |
| 110 | + int id = parseInteger(attrs2, "id"); | |
| 111 | + String name = parseString(attrs2, "name"); | |
| 112 | + int weaponId = parseInteger(attrs2, "weaponId", 0); | |
| 113 | + int shieldId = parseInteger(attrs2, "shieldId", 0); | |
| 114 | + int chestId = parseInteger(attrs2, "chestId", 0); | |
| 115 | + int hairId = parseInteger(attrs2, "hairId", 0); | |
| 116 | + int faceId = parseInteger(attrs2, "faceId", 0); | |
| 117 | + int legsId = parseInteger(attrs2, "legsId", 0); | |
| 118 | + int glovesId = parseInteger(attrs2, "glovesId", 0); | |
| 119 | + int feetId = parseInteger(attrs2, "feetId", 0); | |
| 120 | + int priceId = parseInteger(attrs2, "priceId", 0); | |
| 121 | + int priceCount = parseInteger(attrs2, "priceCount", 0); | |
| 122 | + | |
| 123 | + set.set("type", type);
| |
| 124 | + | |
| 125 | + set.set("id", id);
| |
| 126 | + set.set("name", name);
| |
| 127 | + set.set("weaponId", weaponId);
| |
| 128 | + set.set("shieldId", shieldId);
| |
| 129 | + set.set("chestId", chestId);
| |
| 130 | + set.set("hairId", hairId);
| |
| 131 | + set.set("faceId", faceId);
| |
| 132 | + set.set("legsId", legsId);
| |
| 133 | + set.set("glovesId", glovesId);
| |
| 134 | + set.set("feetId", feetId);
| |
| 135 | + set.set("priceId", priceId);
| |
| 136 | + set.set("priceCount", priceCount);
| |
| 137 | + | |
| 138 | + switch (type.toLowerCase()) | |
| 139 | + {
| |
| 140 | + case "armor": | |
| 141 | + _armorSkins.put(id, new SkinPackage(set)); | |
| 142 | + break; | |
| 143 | + case "weapon": | |
| 144 | + _weaponSkins.put(id, new SkinPackage(set)); | |
| 145 | + break; | |
| 146 | + case "hair": | |
| 147 | + _hairSkins.put(id, new SkinPackage(set)); | |
| 148 | + break; | |
| 149 | + case "face": | |
| 150 | + _faceSkins.put(id, new SkinPackage(set)); | |
| 151 | + break; | |
| 152 | + case "shield": | |
| 153 | + _shieldSkins.put(id, new SkinPackage(set)); | |
| 154 | + break; | |
| 155 | + } | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + } | |
| 160 | + } | |
| 161 | + } | |
| 162 | + | |
| 163 | + } | |
| 164 | + | |
| 165 | + public SkinPackage getArmorSkinsPackage(int id) | |
| 166 | + {
| |
| 167 | + if (!_armorSkins.containsKey(id)) | |
| 168 | + {
| |
| 169 | + return null; | |
| 170 | + } | |
| 171 | + | |
| 172 | + return _armorSkins.get(id); | |
| 173 | + } | |
| 174 | + | |
| 175 | + public Map<Integer, SkinPackage> getArmorSkinOptions() | |
| 176 | + {
| |
| 177 | + return _armorSkins; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public SkinPackage getWeaponSkinsPackage(int id) | |
| 181 | + {
| |
| 182 | + if (!_weaponSkins.containsKey(id)) | |
| 183 | + {
| |
| 184 | + return null; | |
| 185 | + } | |
| 186 | + | |
| 187 | + return _weaponSkins.get(id); | |
| 188 | + } | |
| 189 | + | |
| 190 | + public Map<Integer, SkinPackage> getWeaponSkinOptions() | |
| 191 | + {
| |
| 192 | + return _weaponSkins; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public SkinPackage getHairSkinsPackage(int id) | |
| 196 | + {
| |
| 197 | + if (!_hairSkins.containsKey(id)) | |
| 198 | + {
| |
| 199 | + return null; | |
| 200 | + } | |
| 201 | + | |
| 202 | + return _hairSkins.get(id); | |
| 203 | + } | |
| 204 | + | |
| 205 | + public Map<Integer, SkinPackage> getHairSkinOptions() | |
| 206 | + {
| |
| 207 | + return _hairSkins; | |
| 208 | + } | |
| 209 | + | |
| 210 | + public SkinPackage getFaceSkinsPackage(int id) | |
| 211 | + {
| |
| 212 | + if (!_faceSkins.containsKey(id)) | |
| 213 | + {
| |
| 214 | + return null; | |
| 215 | + } | |
| 216 | + | |
| 217 | + return _faceSkins.get(id); | |
| 218 | + } | |
| 219 | + | |
| 220 | + public Map<Integer, SkinPackage> getFaceSkinOptions() | |
| 221 | + {
| |
| 222 | + return _faceSkins; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public SkinPackage getShieldSkinsPackage(int id) | |
| 226 | + {
| |
| 227 | + if (!_shieldSkins.containsKey(id)) | |
| 228 | + {
| |
| 229 | + return null; | |
| 230 | + } | |
| 231 | + | |
| 232 | + return _shieldSkins.get(id); | |
| 233 | + } | |
| 234 | + | |
| 235 | + public Map<Integer, SkinPackage> getShieldSkinOptions() | |
| 236 | + {
| |
| 237 | + return _shieldSkins; | |
| 238 | + } | |
| 239 | + | |
| 240 | + public static DressMeData getInstance() | |
| 241 | + {
| |
| 242 | + return SingletonHolder._instance; | |
| 243 | + } | |
| 244 | + | |
| 245 | + private static class SingletonHolder | |
| 246 | + {
| |
| 247 | + protected static final DressMeData _instance = new DressMeData(); | |
| 248 | + } | |
| 249 | +} | |
| 250 | \ No newline at end of file | |
| 251 | diff --git java/Base/Skin/SkinPackage.java java/Base/Skin/SkinPackage.java | |
| 252 | new file mode 100644 | |
| 253 | index 0000000..ff40f74 | |
| 254 | --- /dev/null | |
| 255 | +++ java/Base/Skin/SkinPackage.java | |
| 256 | @@ -0,0 +1,104 @@ | |
| 257 | +package Base.Skin; | |
| 258 | + | |
| 259 | +import net.sf.l2j.commons.data.StatSet; | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | +public class SkinPackage | |
| 264 | +{
| |
| 265 | + private String _type; | |
| 266 | + private String _name; | |
| 267 | + private int _id; | |
| 268 | + private int _weaponId; | |
| 269 | + private int _shieldId; | |
| 270 | + private int _chestId; | |
| 271 | + private int _hairId; | |
| 272 | + private int _faceId; | |
| 273 | + private int _legsId; | |
| 274 | + private int _glovesId; | |
| 275 | + private int _feetId; | |
| 276 | + private int _priceId; | |
| 277 | + private int _priceCount; | |
| 278 | + | |
| 279 | + public SkinPackage(StatSet set) | |
| 280 | + {
| |
| 281 | + _type = set.getString("type", "default");
| |
| 282 | + _name = set.getString("name", "NoName");
| |
| 283 | + _id = set.getInteger("id", 0);
| |
| 284 | + _weaponId = set.getInteger("weaponId", 0);
| |
| 285 | + _shieldId = set.getInteger("shieldId", 0);
| |
| 286 | + _chestId = set.getInteger("chestId", 0);
| |
| 287 | + _hairId = set.getInteger("hairId", 0);
| |
| 288 | + _faceId = set.getInteger("faceId", 0);
| |
| 289 | + _legsId = set.getInteger("legsId", 0);
| |
| 290 | + _glovesId = set.getInteger("glovesId", 0);
| |
| 291 | + _feetId = set.getInteger("feetId", 0);
| |
| 292 | + _priceId = set.getInteger("priceId", 0);
| |
| 293 | + _priceCount = set.getInteger("priceCount", 0);
| |
| 294 | + } | |
| 295 | + | |
| 296 | + public int getId() | |
| 297 | + {
| |
| 298 | + return _id; | |
| 299 | + } | |
| 300 | + | |
| 301 | + public String getType() | |
| 302 | + {
| |
| 303 | + return _type; | |
| 304 | + } | |
| 305 | + | |
| 306 | + public String getName() | |
| 307 | + {
| |
| 308 | + return _name; | |
| 309 | + } | |
| 310 | + | |
| 311 | + public int getWeaponId() | |
| 312 | + {
| |
| 313 | + return _weaponId; | |
| 314 | + } | |
| 315 | + | |
| 316 | + public int getShieldId() | |
| 317 | + {
| |
| 318 | + return _shieldId; | |
| 319 | + } | |
| 320 | + | |
| 321 | + public int getChestId() | |
| 322 | + {
| |
| 323 | + return _chestId; | |
| 324 | + } | |
| 325 | + | |
| 326 | + public int getHairId() | |
| 327 | + {
| |
| 328 | + return _hairId; | |
| 329 | + } | |
| 330 | + | |
| 331 | + public int getFaceId() | |
| 332 | + {
| |
| 333 | + return _faceId; | |
| 334 | + } | |
| 335 | + | |
| 336 | + public int getLegsId() | |
| 337 | + {
| |
| 338 | + return _legsId; | |
| 339 | + } | |
| 340 | + | |
| 341 | + public int getGlovesId() | |
| 342 | + {
| |
| 343 | + return _glovesId; | |
| 344 | + } | |
| 345 | + | |
| 346 | + public int getFeetId() | |
| 347 | + {
| |
| 348 | + return _feetId; | |
| 349 | + } | |
| 350 | + | |
| 351 | + public int getPriceId() | |
| 352 | + {
| |
| 353 | + return _priceId; | |
| 354 | + } | |
| 355 | + | |
| 356 | + public int getPriceCount() | |
| 357 | + {
| |
| 358 | + return _priceCount; | |
| 359 | + } | |
| 360 | +} | |
| 361 | \ No newline at end of file | |
| 362 | diff --git java/Base/Xml/IXmlReader.java java/Base/Xml/IXmlReader.java | |
| 363 | new file mode 100644 | |
| 364 | index 0000000..044830c | |
| 365 | --- /dev/null | |
| 366 | +++ java/Base/Xml/IXmlReader.java | |
| 367 | @@ -0,0 +1,577 @@ | |
| 368 | + | |
| 369 | +package Base.Xml; | |
| 370 | + | |
| 371 | +import java.io.File; | |
| 372 | +import java.io.FileFilter; | |
| 373 | +import java.util.logging.Logger; | |
| 374 | + | |
| 375 | +import javax.xml.parsers.DocumentBuilder; | |
| 376 | +import javax.xml.parsers.DocumentBuilderFactory; | |
| 377 | + | |
| 378 | +import net.sf.l2j.commons.data.StatSet; | |
| 379 | + | |
| 380 | +import net.sf.l2j.gameserver.GameServer; | |
| 381 | + | |
| 382 | + | |
| 383 | +import org.w3c.dom.Document; | |
| 384 | +import org.w3c.dom.NamedNodeMap; | |
| 385 | +import org.w3c.dom.Node; | |
| 386 | +import org.xml.sax.ErrorHandler; | |
| 387 | +import org.xml.sax.SAXParseException; | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | +public interface IXmlReader | |
| 392 | +{
| |
| 393 | + static final Logger LOG = Logger.getLogger(GameServer.class.getName()); | |
| 394 | + | |
| 395 | + static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; | |
| 396 | + static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; | |
| 397 | + | |
| 398 | + static final XMLFilter XML_FILTER = new XMLFilter(); | |
| 399 | + | |
| 400 | + public void load(); | |
| 401 | + | |
| 402 | + default void parseDatapackFile(String path) | |
| 403 | + {
| |
| 404 | + parseFile(new File(".", path));
| |
| 405 | + } | |
| 406 | + | |
| 407 | + default void parseFile(File f) | |
| 408 | + {
| |
| 409 | + if (!getCurrentFileFilter().accept(f)) | |
| 410 | + {
| |
| 411 | + LOG.warning("{}: Could not parse {} is not a file or it doesn't exist!");
| |
| 412 | + return; | |
| 413 | + } | |
| 414 | + | |
| 415 | + final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | |
| 416 | + dbf.setNamespaceAware(true); | |
| 417 | + dbf.setValidating(false); | |
| 418 | + dbf.setIgnoringComments(true); | |
| 419 | + | |
| 420 | + try | |
| 421 | + {
| |
| 422 | + dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); | |
| 423 | + final DocumentBuilder db = dbf.newDocumentBuilder(); | |
| 424 | + db.setErrorHandler(new XMLErrorHandler()); | |
| 425 | + parseDocument(db.parse(f), f); | |
| 426 | + } | |
| 427 | + catch (SAXParseException e) | |
| 428 | + {
| |
| 429 | + LOG.warning("{}: Could not parse file {} at line {}, column {}");
| |
| 430 | + return; | |
| 431 | + } | |
| 432 | + catch (Exception e) | |
| 433 | + {
| |
| 434 | + LOG.warning("{}: Could not parse file {}");
| |
| 435 | + return; | |
| 436 | + } | |
| 437 | + } | |
| 438 | + | |
| 439 | + default boolean parseDirectory(File file) | |
| 440 | + {
| |
| 441 | + return parseDirectory(file, false); | |
| 442 | + } | |
| 443 | + | |
| 444 | + default boolean parseDirectory(String path) | |
| 445 | + {
| |
| 446 | + return parseDirectory(new File(path), false); | |
| 447 | + } | |
| 448 | + | |
| 449 | + default boolean parseDirectory(String path, boolean recursive) | |
| 450 | + {
| |
| 451 | + return parseDirectory(new File(path), recursive); | |
| 452 | + } | |
| 453 | + | |
| 454 | + default boolean parseDirectory(File dir, boolean recursive) | |
| 455 | + {
| |
| 456 | + if (!dir.exists()) | |
| 457 | + {
| |
| 458 | + LOG.warning("{}: Folder {} doesn't exist!");
| |
| 459 | + return false; | |
| 460 | + } | |
| 461 | + | |
| 462 | + final File[] files = dir.listFiles(); | |
| 463 | + if (files != null) | |
| 464 | + {
| |
| 465 | + for (File f : files) | |
| 466 | + {
| |
| 467 | + if (recursive && f.isDirectory()) | |
| 468 | + {
| |
| 469 | + parseDirectory(f, recursive); | |
| 470 | + } | |
| 471 | + else if (getCurrentFileFilter().accept(f)) | |
| 472 | + {
| |
| 473 | + parseFile(f); | |
| 474 | + } | |
| 475 | + } | |
| 476 | + } | |
| 477 | + return true; | |
| 478 | + } | |
| 479 | + | |
| 480 | + default boolean parseDatapackDirectory(String path, boolean recursive) | |
| 481 | + {
| |
| 482 | + return parseDirectory(new File(".", path), recursive);
| |
| 483 | + } | |
| 484 | + | |
| 485 | + default void parseDocument(Document doc, File f) | |
| 486 | + {
| |
| 487 | + parseDocument(doc); | |
| 488 | + } | |
| 489 | + | |
| 490 | + default void parseDocument(Document doc) | |
| 491 | + {
| |
| 492 | + LOG.warning("{}: Parser not implemented!");
| |
| 493 | + } | |
| 494 | + | |
| 495 | + default Boolean parseBoolean(Node node, Boolean defaultValue) | |
| 496 | + {
| |
| 497 | + return node != null ? Boolean.valueOf(node.getNodeValue()) : defaultValue; | |
| 498 | + } | |
| 499 | + | |
| 500 | + default Boolean parseBoolean(Node node) | |
| 501 | + {
| |
| 502 | + return parseBoolean(node, null); | |
| 503 | + } | |
| 504 | + | |
| 505 | + default Boolean parseBoolean(NamedNodeMap attrs, String name) | |
| 506 | + {
| |
| 507 | + return parseBoolean(attrs.getNamedItem(name)); | |
| 508 | + } | |
| 509 | + | |
| 510 | + default Boolean parseBoolean(NamedNodeMap attrs, String name, Boolean defaultValue) | |
| 511 | + {
| |
| 512 | + return parseBoolean(attrs.getNamedItem(name), defaultValue); | |
| 513 | + } | |
| 514 | + | |
| 515 | + default Byte parseByte(Node node, Byte defaultValue) | |
| 516 | + {
| |
| 517 | + return node != null ? Byte.valueOf(node.getNodeValue()) : defaultValue; | |
| 518 | + } | |
| 519 | + | |
| 520 | + default StatSet parseAttributes(Node node) | |
| 521 | + {
| |
| 522 | + final NamedNodeMap attrs = node.getAttributes(); | |
| 523 | + final StatSet map = new StatSet(); | |
| 524 | + for (int i = 0; i < attrs.getLength(); i++) | |
| 525 | + {
| |
| 526 | + final Node att = attrs.item(i); | |
| 527 | + map.set(att.getNodeName(), att.getNodeValue()); | |
| 528 | + } | |
| 529 | + return map; | |
| 530 | + } | |
| 531 | + | |
| 532 | + /** | |
| 533 | + * Parses a byte value. | |
| 534 | + * @param node the node to parse | |
| 535 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 536 | + */ | |
| 537 | + default Byte parseByte(Node node) | |
| 538 | + {
| |
| 539 | + return parseByte(node, null); | |
| 540 | + } | |
| 541 | + | |
| 542 | + /** | |
| 543 | + * Parses a byte value. | |
| 544 | + * @param attrs the attributes | |
| 545 | + * @param name the name of the attribute to parse | |
| 546 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 547 | + */ | |
| 548 | + default Byte parseByte(NamedNodeMap attrs, String name) | |
| 549 | + {
| |
| 550 | + return parseByte(attrs.getNamedItem(name)); | |
| 551 | + } | |
| 552 | + | |
| 553 | + /** | |
| 554 | + * Parses a byte value. | |
| 555 | + * @param attrs the attributes | |
| 556 | + * @param name the name of the attribute to parse | |
| 557 | + * @param defaultValue the default value | |
| 558 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 559 | + */ | |
| 560 | + default Byte parseByte(NamedNodeMap attrs, String name, Byte defaultValue) | |
| 561 | + {
| |
| 562 | + return parseByte(attrs.getNamedItem(name), defaultValue); | |
| 563 | + } | |
| 564 | + | |
| 565 | + /** | |
| 566 | + * Parses a short value. | |
| 567 | + * @param node the node to parse | |
| 568 | + * @param defaultValue the default value | |
| 569 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 570 | + */ | |
| 571 | + default Short parseShort(Node node, Short defaultValue) | |
| 572 | + {
| |
| 573 | + return node != null ? Short.valueOf(node.getNodeValue()) : defaultValue; | |
| 574 | + } | |
| 575 | + | |
| 576 | + /** | |
| 577 | + * Parses a short value. | |
| 578 | + * @param node the node to parse | |
| 579 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 580 | + */ | |
| 581 | + default Short parseShort(Node node) | |
| 582 | + {
| |
| 583 | + return parseShort(node, null); | |
| 584 | + } | |
| 585 | + | |
| 586 | + /** | |
| 587 | + * Parses a short value. | |
| 588 | + * @param attrs the attributes | |
| 589 | + * @param name the name of the attribute to parse | |
| 590 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 591 | + */ | |
| 592 | + default Short parseShort(NamedNodeMap attrs, String name) | |
| 593 | + {
| |
| 594 | + return parseShort(attrs.getNamedItem(name)); | |
| 595 | + } | |
| 596 | + | |
| 597 | + /** | |
| 598 | + * Parses a short value. | |
| 599 | + * @param attrs the attributes | |
| 600 | + * @param name the name of the attribute to parse | |
| 601 | + * @param defaultValue the default value | |
| 602 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 603 | + */ | |
| 604 | + default Short parseShort(NamedNodeMap attrs, String name, Short defaultValue) | |
| 605 | + {
| |
| 606 | + return parseShort(attrs.getNamedItem(name), defaultValue); | |
| 607 | + } | |
| 608 | + | |
| 609 | + /** | |
| 610 | + * Parses an int value. | |
| 611 | + * @param node the node to parse | |
| 612 | + * @param defaultValue the default value | |
| 613 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 614 | + */ | |
| 615 | + default int parseInt(Node node, Integer defaultValue) | |
| 616 | + {
| |
| 617 | + return node != null ? Integer.parseInt(node.getNodeValue()) : defaultValue; | |
| 618 | + } | |
| 619 | + | |
| 620 | + /** | |
| 621 | + * Parses an int value. | |
| 622 | + * @param node the node to parse | |
| 623 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 624 | + */ | |
| 625 | + default int parseInt(Node node) | |
| 626 | + {
| |
| 627 | + return parseInt(node, -1); | |
| 628 | + } | |
| 629 | + | |
| 630 | + /** | |
| 631 | + * Parses an integer value. | |
| 632 | + * @param node the node to parse | |
| 633 | + * @param defaultValue the default value | |
| 634 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 635 | + */ | |
| 636 | + default Integer parseInteger(Node node, Integer defaultValue) | |
| 637 | + {
| |
| 638 | + return node != null ? Integer.valueOf(node.getNodeValue()) : defaultValue; | |
| 639 | + } | |
| 640 | + | |
| 641 | + /** | |
| 642 | + * Parses an integer value. | |
| 643 | + * @param node the node to parse | |
| 644 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 645 | + */ | |
| 646 | + default Integer parseInteger(Node node) | |
| 647 | + {
| |
| 648 | + return parseInteger(node, null); | |
| 649 | + } | |
| 650 | + | |
| 651 | + /** | |
| 652 | + * Parses an integer value. | |
| 653 | + * @param attrs the attributes | |
| 654 | + * @param name the name of the attribute to parse | |
| 655 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 656 | + */ | |
| 657 | + default Integer parseInteger(NamedNodeMap attrs, String name) | |
| 658 | + {
| |
| 659 | + return parseInteger(attrs.getNamedItem(name)); | |
| 660 | + } | |
| 661 | + | |
| 662 | + /** | |
| 663 | + * Parses an integer value. | |
| 664 | + * @param attrs the attributes | |
| 665 | + * @param name the name of the attribute to parse | |
| 666 | + * @param defaultValue the default value | |
| 667 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 668 | + */ | |
| 669 | + default Integer parseInteger(NamedNodeMap attrs, String name, Integer defaultValue) | |
| 670 | + {
| |
| 671 | + return parseInteger(attrs.getNamedItem(name), defaultValue); | |
| 672 | + } | |
| 673 | + | |
| 674 | + /** | |
| 675 | + * Parses a long value. | |
| 676 | + * @param node the node to parse | |
| 677 | + * @param defaultValue the default value | |
| 678 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 679 | + */ | |
| 680 | + default Long parseLong(Node node, Long defaultValue) | |
| 681 | + {
| |
| 682 | + return node != null ? Long.valueOf(node.getNodeValue()) : defaultValue; | |
| 683 | + } | |
| 684 | + | |
| 685 | + /** | |
| 686 | + * Parses a long value. | |
| 687 | + * @param node the node to parse | |
| 688 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 689 | + */ | |
| 690 | + default Long parseLong(Node node) | |
| 691 | + {
| |
| 692 | + return parseLong(node, null); | |
| 693 | + } | |
| 694 | + | |
| 695 | + /** | |
| 696 | + * Parses a long value. | |
| 697 | + * @param attrs the attributes | |
| 698 | + * @param name the name of the attribute to parse | |
| 699 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 700 | + */ | |
| 701 | + default Long parseLong(NamedNodeMap attrs, String name) | |
| 702 | + {
| |
| 703 | + return parseLong(attrs.getNamedItem(name)); | |
| 704 | + } | |
| 705 | + | |
| 706 | + /** | |
| 707 | + * Parses a long value. | |
| 708 | + * @param attrs the attributes | |
| 709 | + * @param name the name of the attribute to parse | |
| 710 | + * @param defaultValue the default value | |
| 711 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 712 | + */ | |
| 713 | + default Long parseLong(NamedNodeMap attrs, String name, Long defaultValue) | |
| 714 | + {
| |
| 715 | + return parseLong(attrs.getNamedItem(name), defaultValue); | |
| 716 | + } | |
| 717 | + | |
| 718 | + /** | |
| 719 | + * Parses a float value. | |
| 720 | + * @param node the node to parse | |
| 721 | + * @param defaultValue the default value | |
| 722 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 723 | + */ | |
| 724 | + default Float parseFloat(Node node, Float defaultValue) | |
| 725 | + {
| |
| 726 | + return node != null ? Float.valueOf(node.getNodeValue()) : defaultValue; | |
| 727 | + } | |
| 728 | + | |
| 729 | + /** | |
| 730 | + * Parses a float value. | |
| 731 | + * @param node the node to parse | |
| 732 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 733 | + */ | |
| 734 | + default Float parseFloat(Node node) | |
| 735 | + {
| |
| 736 | + return parseFloat(node, null); | |
| 737 | + } | |
| 738 | + | |
| 739 | + /** | |
| 740 | + * Parses a float value. | |
| 741 | + * @param attrs the attributes | |
| 742 | + * @param name the name of the attribute to parse | |
| 743 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 744 | + */ | |
| 745 | + default Float parseFloat(NamedNodeMap attrs, String name) | |
| 746 | + {
| |
| 747 | + return parseFloat(attrs.getNamedItem(name)); | |
| 748 | + } | |
| 749 | + | |
| 750 | + /** | |
| 751 | + * Parses a float value. | |
| 752 | + * @param attrs the attributes | |
| 753 | + * @param name the name of the attribute to parse | |
| 754 | + * @param defaultValue the default value | |
| 755 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 756 | + */ | |
| 757 | + default Float parseFloat(NamedNodeMap attrs, String name, Float defaultValue) | |
| 758 | + {
| |
| 759 | + return parseFloat(attrs.getNamedItem(name), defaultValue); | |
| 760 | + } | |
| 761 | + | |
| 762 | + /** | |
| 763 | + * Parses a double value. | |
| 764 | + * @param node the node to parse | |
| 765 | + * @param defaultValue the default value | |
| 766 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 767 | + */ | |
| 768 | + default Double parseDouble(Node node, Double defaultValue) | |
| 769 | + {
| |
| 770 | + return node != null ? Double.valueOf(node.getNodeValue()) : defaultValue; | |
| 771 | + } | |
| 772 | + | |
| 773 | + /** | |
| 774 | + * Parses a double value. | |
| 775 | + * @param node the node to parse | |
| 776 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 777 | + */ | |
| 778 | + default Double parseDouble(Node node) | |
| 779 | + {
| |
| 780 | + return parseDouble(node, null); | |
| 781 | + } | |
| 782 | + | |
| 783 | + /** | |
| 784 | + * Parses a double value. | |
| 785 | + * @param attrs the attributes | |
| 786 | + * @param name the name of the attribute to parse | |
| 787 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 788 | + */ | |
| 789 | + default Double parseDouble(NamedNodeMap attrs, String name) | |
| 790 | + {
| |
| 791 | + return parseDouble(attrs.getNamedItem(name)); | |
| 792 | + } | |
| 793 | + | |
| 794 | + /** | |
| 795 | + * Parses a double value. | |
| 796 | + * @param attrs the attributes | |
| 797 | + * @param name the name of the attribute to parse | |
| 798 | + * @param defaultValue the default value | |
| 799 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 800 | + */ | |
| 801 | + default Double parseDouble(NamedNodeMap attrs, String name, Double defaultValue) | |
| 802 | + {
| |
| 803 | + return parseDouble(attrs.getNamedItem(name), defaultValue); | |
| 804 | + } | |
| 805 | + | |
| 806 | + /** | |
| 807 | + * Parses a string value. | |
| 808 | + * @param node the node to parse | |
| 809 | + * @param defaultValue the default value | |
| 810 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 811 | + */ | |
| 812 | + default String parseString(Node node, String defaultValue) | |
| 813 | + {
| |
| 814 | + return node != null ? node.getNodeValue() : defaultValue; | |
| 815 | + } | |
| 816 | + | |
| 817 | + /** | |
| 818 | + * Parses a string value. | |
| 819 | + * @param node the node to parse | |
| 820 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 821 | + */ | |
| 822 | + default String parseString(Node node) | |
| 823 | + {
| |
| 824 | + return parseString(node, null); | |
| 825 | + } | |
| 826 | + | |
| 827 | + /** | |
| 828 | + * Parses a string value. | |
| 829 | + * @param attrs the attributes | |
| 830 | + * @param name the name of the attribute to parse | |
| 831 | + * @return if the node is not null, the value of the parsed node, otherwise null | |
| 832 | + */ | |
| 833 | + default String parseString(NamedNodeMap attrs, String name) | |
| 834 | + {
| |
| 835 | + return parseString(attrs.getNamedItem(name)); | |
| 836 | + } | |
| 837 | + | |
| 838 | + /** | |
| 839 | + * Parses a string value. | |
| 840 | + * @param attrs the attributes | |
| 841 | + * @param name the name of the attribute to parse | |
| 842 | + * @param defaultValue the default value | |
| 843 | + * @return if the node is not null, the value of the parsed node, otherwise the default value | |
| 844 | + */ | |
| 845 | + default String parseString(NamedNodeMap attrs, String name, String defaultValue) | |
| 846 | + {
| |
| 847 | + return parseString(attrs.getNamedItem(name), defaultValue); | |
| 848 | + } | |
| 849 | + | |
| 850 | + /** | |
| 851 | + * Parses an enumerated value. | |
| 852 | + * @param <T> the enumerated type | |
| 853 | + * @param node the node to parse | |
| 854 | + * @param clazz the class of the enumerated | |
| 855 | + * @param defaultValue the default value | |
| 856 | + * @return if the node is not null and the node value is valid the parsed value, otherwise the default value | |
| 857 | + */ | |
| 858 | + default <T extends Enum<T>> T parseEnum(Node node, Class<T> clazz, T defaultValue) | |
| 859 | + {
| |
| 860 | + if (node == null) | |
| 861 | + {
| |
| 862 | + return defaultValue; | |
| 863 | + } | |
| 864 | + | |
| 865 | + try | |
| 866 | + {
| |
| 867 | + return Enum.valueOf(clazz, node.getNodeValue()); | |
| 868 | + } | |
| 869 | + catch (IllegalArgumentException e) | |
| 870 | + {
| |
| 871 | + LOG.warning("Invalid value specified for node: {} specified value: {} should be enum value of \"{}\" using default value: {}");
| |
| 872 | + return defaultValue; | |
| 873 | + } | |
| 874 | + } | |
| 875 | + | |
| 876 | + /** | |
| 877 | + * Parses an enumerated value. | |
| 878 | + * @param <T> the enumerated type | |
| 879 | + * @param node the node to parse | |
| 880 | + * @param clazz the class of the enumerated | |
| 881 | + * @return if the node is not null and the node value is valid the parsed value, otherwise null | |
| 882 | + */ | |
| 883 | + default <T extends Enum<T>> T parseEnum(Node node, Class<T> clazz) | |
| 884 | + {
| |
| 885 | + return parseEnum(node, clazz, null); | |
| 886 | + } | |
| 887 | + | |
| 888 | + /** | |
| 889 | + * Parses an enumerated value. | |
| 890 | + * @param <T> the enumerated type | |
| 891 | + * @param attrs the attributes | |
| 892 | + * @param clazz the class of the enumerated | |
| 893 | + * @param name the name of the attribute to parse | |
| 894 | + * @return if the node is not null and the node value is valid the parsed value, otherwise null | |
| 895 | + */ | |
| 896 | + default <T extends Enum<T>> T parseEnum(NamedNodeMap attrs, Class<T> clazz, String name) | |
| 897 | + {
| |
| 898 | + return parseEnum(attrs.getNamedItem(name), clazz); | |
| 899 | + } | |
| 900 | + | |
| 901 | + /** | |
| 902 | + * Parses an enumerated value. | |
| 903 | + * @param <T> the enumerated type | |
| 904 | + * @param attrs the attributes | |
| 905 | + * @param clazz the class of the enumerated | |
| 906 | + * @param name the name of the attribute to parse | |
| 907 | + * @param defaultValue the default value | |
| 908 | + * @return if the node is not null and the node value is valid the parsed value, otherwise the default value | |
| 909 | + */ | |
| 910 | + default <T extends Enum<T>> T parseEnum(NamedNodeMap attrs, Class<T> clazz, String name, T defaultValue) | |
| 911 | + {
| |
| 912 | + return parseEnum(attrs.getNamedItem(name), clazz, defaultValue); | |
| 913 | + } | |
| 914 | + | |
| 915 | + /** | |
| 916 | + * Gets the current file filter. | |
| 917 | + * @return the current file filter | |
| 918 | + */ | |
| 919 | + default FileFilter getCurrentFileFilter() | |
| 920 | + {
| |
| 921 | + return XML_FILTER; | |
| 922 | + } | |
| 923 | + | |
| 924 | + static class XMLErrorHandler implements ErrorHandler | |
| 925 | + {
| |
| 926 | + @Override | |
| 927 | + public void warning(SAXParseException e) throws SAXParseException | |
| 928 | + {
| |
| 929 | + throw e; | |
| 930 | + } | |
| 931 | + | |
| 932 | + @Override | |
| 933 | + public void error(SAXParseException e) throws SAXParseException | |
| 934 | + {
| |
| 935 | + throw e; | |
| 936 | + } | |
| 937 | + | |
| 938 | + @Override | |
| 939 | + public void fatalError(SAXParseException e) throws SAXParseException | |
| 940 | + {
| |
| 941 | + throw e; | |
| 942 | + } | |
| 943 | + } | |
| 944 | +} | |
| 945 | diff --git java/Base/Xml/XMLFilter.java java/Base/Xml/XMLFilter.java | |
| 946 | new file mode 100644 | |
| 947 | index 0000000..faa1805 | |
| 948 | --- /dev/null | |
| 949 | +++ java/Base/Xml/XMLFilter.java | |
| 950 | @@ -0,0 +1,17 @@ | |
| 951 | +package Base.Xml; | |
| 952 | + | |
| 953 | +import java.io.File; | |
| 954 | +import java.io.FileFilter; | |
| 955 | + | |
| 956 | +public class XMLFilter implements FileFilter | |
| 957 | +{
| |
| 958 | + @Override | |
| 959 | + public boolean accept(File f) | |
| 960 | + {
| |
| 961 | + if ((f == null) || !f.isFile()) | |
| 962 | + {
| |
| 963 | + return false; | |
| 964 | + } | |
| 965 | + return f.getName().toLowerCase().endsWith(".xml");
| |
| 966 | + } | |
| 967 | +} | |
| 968 | diff --git java/net/sf/l2j/Config.java java/net/sf/l2j/Config.java | |
| 969 | index 5fb661c..a0fde2e 100644 | |
| 970 | --- java/net/sf/l2j/Config.java | |
| 971 | +++ java/net/sf/l2j/Config.java | |
| 972 | @@ -36,6 +36,15 @@ | |
| 973 | public static final String SERVER_FILE = "./config/server.properties"; | |
| 974 | public static final String SIEGE_FILE = "./config/siege.properties"; | |
| 975 | ||
| 976 | + | |
| 977 | + | |
| 978 | + public static boolean ALLOW_DRESS_ME_SYSTEM; | |
| 979 | + public static String DRESS_ME_COMMAND; | |
| 980 | + public static boolean ALLOW_DRESS_ME_FOR_PREMIUM; | |
| 981 | + public static boolean ALLOW_DRESS_ME_IN_OLY; | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | // -------------------------------------------------- | |
| 986 | // Clans settings | |
| 987 | // -------------------------------------------------- | |
| 988 | @@ -943,6 +952,14 @@ | |
| 989 | final ExProperties players = initProperties(PLAYERS_FILE); | |
| 990 | ||
| 991 | EFFECT_CANCELING = players.getProperty("CancelLesserEffect", true);
| |
| 992 | + | |
| 993 | + ALLOW_DRESS_ME_SYSTEM = players.getProperty("AllowDressMeSystem", false);
| |
| 994 | + DRESS_ME_COMMAND = players.getProperty("DressMeCommand", "dressme");
| |
| 995 | + ALLOW_DRESS_ME_FOR_PREMIUM = players.getProperty("AllowDressMeForPremiumOnly", false);
| |
| 996 | + ALLOW_DRESS_ME_IN_OLY = players.getProperty("AllowDressMeInOly", false);
| |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | HP_REGEN_MULTIPLIER = players.getProperty("HpRegenMultiplier", 1.);
| |
| 1001 | MP_REGEN_MULTIPLIER = players.getProperty("MpRegenMultiplier", 1.);
| |
| 1002 | CP_REGEN_MULTIPLIER = players.getProperty("CpRegenMultiplier", 1.);
| |
| 1003 | diff --git java/net/sf/l2j/gameserver/GameServer.java java/net/sf/l2j/gameserver/GameServer.java | |
| 1004 | index 2d0b8e7..29763e0 100644 | |
| 1005 | --- java/net/sf/l2j/gameserver/GameServer.java | |
| 1006 | +++ java/net/sf/l2j/gameserver/GameServer.java | |
| 1007 | @@ -78,6 +78,7 @@ | |
| 1008 | import net.sf.l2j.gameserver.handler.SkillHandler; | |
| 1009 | import net.sf.l2j.gameserver.handler.TargetHandler; | |
| 1010 | import net.sf.l2j.gameserver.handler.UserCommandHandler; | |
| 1011 | +import net.sf.l2j.gameserver.handler.VoicedCommandHandler; | |
| 1012 | import net.sf.l2j.gameserver.idfactory.IdFactory; | |
| 1013 | import net.sf.l2j.gameserver.model.World; | |
| 1014 | import net.sf.l2j.gameserver.model.boat.BoatGiranTalking; | |
| 1015 | @@ -85,6 +86,7 @@ | |
| 1016 | import net.sf.l2j.gameserver.model.boat.BoatInnadrilTour; | |
| 1017 | import net.sf.l2j.gameserver.model.boat.BoatRunePrimeval; | |
| 1018 | import net.sf.l2j.gameserver.model.boat.BoatTalkingGludin; | |
| 1019 | +import net.sf.l2j.gameserver.model.item.kind.Item; | |
| 1020 | import net.sf.l2j.gameserver.model.olympiad.Olympiad; | |
| 1021 | import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager; | |
| 1022 | import net.sf.l2j.gameserver.network.GameClient; | |
| 1023 | @@ -100,6 +102,8 @@ | |
| 1024 | import net.sf.l2j.util.DeadLockDetector; | |
| 1025 | import net.sf.l2j.util.IPv4Filter; | |
| 1026 | ||
| 1027 | +import Base.Skin.DressMeData; | |
| 1028 | + | |
| 1029 | public class GameServer | |
| 1030 | {
| |
| 1031 | private static final CLogger LOGGER = new CLogger(GameServer.class.getName()); | |
| 1032 | @@ -269,10 +273,26 @@ | |
| 1033 | LOGGER.info("Loaded {} skill handlers.", SkillHandler.getInstance().size());
| |
| 1034 | LOGGER.info("Loaded {} target handlers.", TargetHandler.getInstance().size());
| |
| 1035 | LOGGER.info("Loaded {} user command handlers.", UserCommandHandler.getInstance().size());
| |
| 1036 | - | |
| 1037 | + LOGGER.info("Loaded {} user VoicedCommandHandler handlers.", VoicedCommandHandler.getInstance().size());
| |
| 1038 | StringUtil.printSection("System");
| |
| 1039 | Runtime.getRuntime().addShutdownHook(Shutdown.getInstance()); | |
| 1040 | ||
| 1041 | + | |
| 1042 | + Item.LoadAllIcons(); | |
| 1043 | + | |
| 1044 | + if (Config.ALLOW_DRESS_ME_SYSTEM) | |
| 1045 | + {
| |
| 1046 | + StringUtil.printSection("Dress Me / Skins");
| |
| 1047 | + DressMeData.getInstance(); | |
| 1048 | + } | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | if (Config.DEADLOCK_DETECTOR) | |
| 1058 | {
| |
| 1059 | LOGGER.info("Deadlock detector is enabled. Timer: {}s.", Config.DEADLOCK_CHECK_INTERVAL);
| |
| 1060 | diff --git java/net/sf/l2j/gameserver/data/xml/ItemData.java java/net/sf/l2j/gameserver/data/xml/ItemData.java | |
| 1061 | index 4cadc26..15ef358 100644 | |
| 1062 | --- java/net/sf/l2j/gameserver/data/xml/ItemData.java | |
| 1063 | +++ java/net/sf/l2j/gameserver/data/xml/ItemData.java | |
| 1064 | @@ -3,10 +3,13 @@ | |
| 1065 | import java.io.File; | |
| 1066 | import java.util.HashMap; | |
| 1067 | import java.util.Map; | |
| 1068 | +import java.util.logging.Level; | |
| 1069 | ||
| 1070 | import net.sf.l2j.commons.logging.CLogger; | |
| 1071 | ||
| 1072 | + | |
| 1073 | import net.sf.l2j.gameserver.data.DocumentItem; | |
| 1074 | +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
| 1075 | import net.sf.l2j.gameserver.model.item.kind.Armor; | |
| 1076 | import net.sf.l2j.gameserver.model.item.kind.EtcItem; | |
| 1077 | import net.sf.l2j.gameserver.model.item.kind.Item; | |
| 1078 | @@ -88,6 +91,47 @@ | |
| 1079 | return SingletonHolder.INSTANCE; | |
| 1080 | } | |
| 1081 | ||
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + public ItemInstance createDummyItem(final int itemId) | |
| 1087 | + {
| |
| 1088 | + final Item item = getTemplate(itemId); | |
| 1089 | + | |
| 1090 | + if (item == null) | |
| 1091 | + {
| |
| 1092 | + return null; | |
| 1093 | + } | |
| 1094 | + | |
| 1095 | + ItemInstance temp = new ItemInstance(0, item); | |
| 1096 | + | |
| 1097 | + try | |
| 1098 | + {
| |
| 1099 | + temp = new ItemInstance(0, itemId); | |
| 1100 | + } | |
| 1101 | + catch (final ArrayIndexOutOfBoundsException e) | |
| 1102 | + {
| |
| 1103 | + | |
| 1104 | + e.printStackTrace(); | |
| 1105 | + | |
| 1106 | + } | |
| 1107 | + | |
| 1108 | + if (temp.getItem() == null) | |
| 1109 | + {
| |
| 1110 | + LOGGER.warn(Level.WARNING, "ItemTable: Item Template missing for Id: {}" + " " + itemId);
| |
| 1111 | + } | |
| 1112 | + | |
| 1113 | + return temp; | |
| 1114 | + } | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | private static class SingletonHolder | |
| 1124 | {
| |
| 1125 | protected static final ItemData INSTANCE = new ItemData(); | |
| 1126 | diff --git java/net/sf/l2j/gameserver/handler/BypassHandler.java java/net/sf/l2j/gameserver/handler/BypassHandler.java | |
| 1127 | new file mode 100644 | |
| 1128 | index 0000000..ad2fbd4 | |
| 1129 | --- /dev/null | |
| 1130 | +++ java/net/sf/l2j/gameserver/handler/BypassHandler.java | |
| 1131 | @@ -0,0 +1,69 @@ | |
| 1132 | +package net.sf.l2j.gameserver.handler; | |
| 1133 | + | |
| 1134 | +import java.util.HashMap; | |
| 1135 | +import java.util.Map; | |
| 1136 | +import java.util.logging.Logger; | |
| 1137 | + | |
| 1138 | +import net.sf.l2j.Config; | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | +/** | |
| 1143 | + * @author Dwight | |
| 1144 | + */ | |
| 1145 | +public class BypassHandler | |
| 1146 | +{
| |
| 1147 | + private static Logger _log = Logger.getLogger(BypassHandler.class.getName()); | |
| 1148 | + private final Map<Integer, IBypassHandler> _datatable = new HashMap<>(); | |
| 1149 | + | |
| 1150 | + public static BypassHandler getInstance() | |
| 1151 | + {
| |
| 1152 | + return SingletonHolder._instance; | |
| 1153 | + } | |
| 1154 | + | |
| 1155 | + private BypassHandler() | |
| 1156 | + {
| |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + } | |
| 1161 | + | |
| 1162 | + public void registerBypassHandler(IBypassHandler handler) | |
| 1163 | + {
| |
| 1164 | + String[] ids = handler.getBypassHandlersList(); | |
| 1165 | + for (int i = 0; i < ids.length; i++) | |
| 1166 | + {
| |
| 1167 | + if (Config.PACKET_HANDLER_DEBUG) | |
| 1168 | + {
| |
| 1169 | + _log.fine("Adding handler for command " + ids[i]);
| |
| 1170 | + } | |
| 1171 | + _datatable.put(ids[i].hashCode(), handler); | |
| 1172 | + } | |
| 1173 | + } | |
| 1174 | + | |
| 1175 | + public IBypassHandler getBypassHandler(String bypass) | |
| 1176 | + {
| |
| 1177 | + String command = bypass; | |
| 1178 | + | |
| 1179 | + if (bypass.indexOf(" ") != -1)
| |
| 1180 | + {
| |
| 1181 | + command = bypass.substring(0, bypass.indexOf(" "));
| |
| 1182 | + } | |
| 1183 | + | |
| 1184 | + if (Config.PACKET_HANDLER_DEBUG) | |
| 1185 | + {
| |
| 1186 | + _log.fine("getting handler for command: " + command + " -> " + (_datatable.get(command.hashCode()) != null));
| |
| 1187 | + } | |
| 1188 | + return _datatable.get(command.hashCode()); | |
| 1189 | + } | |
| 1190 | + | |
| 1191 | + public int size() | |
| 1192 | + {
| |
| 1193 | + return _datatable.size(); | |
| 1194 | + } | |
| 1195 | + | |
| 1196 | + private static class SingletonHolder | |
| 1197 | + {
| |
| 1198 | + protected static final BypassHandler _instance = new BypassHandler(); | |
| 1199 | + } | |
| 1200 | +} | |
| 1201 | diff --git java/net/sf/l2j/gameserver/handler/CustomBypassHandler.java java/net/sf/l2j/gameserver/handler/CustomBypassHandler.java | |
| 1202 | new file mode 100644 | |
| 1203 | index 0000000..e07fdff | |
| 1204 | --- /dev/null | |
| 1205 | +++ java/net/sf/l2j/gameserver/handler/CustomBypassHandler.java | |
| 1206 | @@ -0,0 +1,70 @@ | |
| 1207 | + | |
| 1208 | +package net.sf.l2j.gameserver.handler; | |
| 1209 | + | |
| 1210 | +import java.util.HashMap; | |
| 1211 | +import java.util.Map; | |
| 1212 | + | |
| 1213 | +import net.sf.l2j.gameserver.handler.usercommandhandlers.DressMe; | |
| 1214 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | +public class CustomBypassHandler | |
| 1220 | +{
| |
| 1221 | + | |
| 1222 | + | |
| 1223 | + private static CustomBypassHandler _instance = null; | |
| 1224 | + private final Map<String, ICustomByPassHandler> _handlers; | |
| 1225 | + | |
| 1226 | + private CustomBypassHandler() | |
| 1227 | + {
| |
| 1228 | + _handlers = new HashMap<>(); | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + registerCustomBypassHandler(new DressMe()); | |
| 1232 | + } | |
| 1233 | + | |
| 1234 | + public static CustomBypassHandler getInstance() | |
| 1235 | + {
| |
| 1236 | + if (_instance == null) | |
| 1237 | + {
| |
| 1238 | + _instance = new CustomBypassHandler(); | |
| 1239 | + } | |
| 1240 | + | |
| 1241 | + return _instance; | |
| 1242 | + } | |
| 1243 | + | |
| 1244 | + public void registerCustomBypassHandler(final ICustomByPassHandler handler) | |
| 1245 | + {
| |
| 1246 | + for (final String s : handler.getByPassCommands()) | |
| 1247 | + {
| |
| 1248 | + _handlers.put(s, handler); | |
| 1249 | + } | |
| 1250 | + } | |
| 1251 | + | |
| 1252 | + public void handleBypass(final Player player, final String command) | |
| 1253 | + {
| |
| 1254 | + String cmd = ""; | |
| 1255 | + String params = ""; | |
| 1256 | + final int iPos = command.indexOf(" ");
| |
| 1257 | + if (iPos != -1) | |
| 1258 | + {
| |
| 1259 | + cmd = command.substring(7, iPos); | |
| 1260 | + params = command.substring(iPos + 1); | |
| 1261 | + } | |
| 1262 | + else | |
| 1263 | + {
| |
| 1264 | + cmd = command.substring(7); | |
| 1265 | + } | |
| 1266 | + final ICustomByPassHandler ch = _handlers.get(cmd); | |
| 1267 | + if (ch != null) | |
| 1268 | + {
| |
| 1269 | + ch.handleCommand(cmd, player, params); | |
| 1270 | + } | |
| 1271 | + else | |
| 1272 | + {
| |
| 1273 | + | |
| 1274 | + } | |
| 1275 | + } | |
| 1276 | +} | |
| 1277 | \ No newline at end of file | |
| 1278 | diff --git java/net/sf/l2j/gameserver/handler/IBypassHandler.java java/net/sf/l2j/gameserver/handler/IBypassHandler.java | |
| 1279 | new file mode 100644 | |
| 1280 | index 0000000..a942b63 | |
| 1281 | --- /dev/null | |
| 1282 | +++ java/net/sf/l2j/gameserver/handler/IBypassHandler.java | |
| 1283 | @@ -0,0 +1,13 @@ | |
| 1284 | +package net.sf.l2j.gameserver.handler; | |
| 1285 | + | |
| 1286 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 1287 | + | |
| 1288 | +/** | |
| 1289 | + * @author Dwight | |
| 1290 | + */ | |
| 1291 | +public interface IBypassHandler | |
| 1292 | +{
| |
| 1293 | + public boolean handleBypass(String bypass, Player activeChar); | |
| 1294 | + | |
| 1295 | + public String[] getBypassHandlersList(); | |
| 1296 | +} | |
| 1297 | diff --git java/net/sf/l2j/gameserver/handler/ICustomByPassHandler.java java/net/sf/l2j/gameserver/handler/ICustomByPassHandler.java | |
| 1298 | new file mode 100644 | |
| 1299 | index 0000000..6b4c1b4 | |
| 1300 | --- /dev/null | |
| 1301 | +++ java/net/sf/l2j/gameserver/handler/ICustomByPassHandler.java | |
| 1302 | @@ -0,0 +1,10 @@ | |
| 1303 | +package net.sf.l2j.gameserver.handler; | |
| 1304 | + | |
| 1305 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 1306 | + | |
| 1307 | +public interface ICustomByPassHandler | |
| 1308 | +{
| |
| 1309 | + public String[] getByPassCommands(); | |
| 1310 | + | |
| 1311 | + public void handleCommand(String command, Player player, String parameters); | |
| 1312 | +} | |
| 1313 | diff --git java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java | |
| 1314 | new file mode 100644 | |
| 1315 | index 0000000..3b0f12a | |
| 1316 | --- /dev/null | |
| 1317 | +++ java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java | |
| 1318 | @@ -0,0 +1,10 @@ | |
| 1319 | +package net.sf.l2j.gameserver.handler; | |
| 1320 | + | |
| 1321 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 1322 | + | |
| 1323 | +public interface IVoicedCommandHandler | |
| 1324 | +{
| |
| 1325 | + public boolean useVoicedCommand(String command, Player activeChar, String params); | |
| 1326 | + | |
| 1327 | + public String[] getVoicedCommandList(); | |
| 1328 | +} | |
| 1329 | \ No newline at end of file | |
| 1330 | diff --git java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
| 1331 | new file mode 100644 | |
| 1332 | index 0000000..35df73c | |
| 1333 | --- /dev/null | |
| 1334 | +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java | |
| 1335 | @@ -0,0 +1,51 @@ | |
| 1336 | +package net.sf.l2j.gameserver.handler; | |
| 1337 | + | |
| 1338 | +import java.util.HashMap; | |
| 1339 | +import java.util.Map; | |
| 1340 | + | |
| 1341 | +import net.sf.l2j.gameserver.handler.usercommandhandlers.DressMe; | |
| 1342 | + | |
| 1343 | +public class VoicedCommandHandler | |
| 1344 | +{
| |
| 1345 | + private final Map<Integer, IVoicedCommandHandler> _datatable = new HashMap<>(); | |
| 1346 | + | |
| 1347 | + public static VoicedCommandHandler getInstance() | |
| 1348 | + {
| |
| 1349 | + return SingletonHolder._instance; | |
| 1350 | + } | |
| 1351 | + | |
| 1352 | + protected VoicedCommandHandler() | |
| 1353 | + {
| |
| 1354 | + //Codigos para colocar aqui dentro | |
| 1355 | + registerHandler(new DressMe()); | |
| 1356 | + | |
| 1357 | + } | |
| 1358 | + | |
| 1359 | + public void registerHandler(IVoicedCommandHandler handler) | |
| 1360 | + {
| |
| 1361 | + String[] ids = handler.getVoicedCommandList(); | |
| 1362 | + | |
| 1363 | + for (int i = 0; i < ids.length; i++) | |
| 1364 | + _datatable.put(ids[i].hashCode(), handler); | |
| 1365 | + } | |
| 1366 | + | |
| 1367 | + public IVoicedCommandHandler getHandler(String voicedCommand) | |
| 1368 | + {
| |
| 1369 | + String command = voicedCommand; | |
| 1370 | + | |
| 1371 | + if (voicedCommand.indexOf(" ") != -1)
| |
| 1372 | + command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
| |
| 1373 | + | |
| 1374 | + return _datatable.get(command.hashCode()); | |
| 1375 | + } | |
| 1376 | + | |
| 1377 | + public int size() | |
| 1378 | + {
| |
| 1379 | + return _datatable.size(); | |
| 1380 | + } | |
| 1381 | + | |
| 1382 | + private static class SingletonHolder | |
| 1383 | + {
| |
| 1384 | + protected static final VoicedCommandHandler _instance = new VoicedCommandHandler(); | |
| 1385 | + } | |
| 1386 | +} | |
| 1387 | \ No newline at end of file | |
| 1388 | diff --git java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java | |
| 1389 | index ac326e9..2bcda59 100644 | |
| 1390 | --- java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java | |
| 1391 | +++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java | |
| 1392 | @@ -1,8 +1,12 @@ | |
| 1393 | package net.sf.l2j.gameserver.handler.chathandlers; | |
| 1394 | ||
| 1395 | +import java.util.StringTokenizer; | |
| 1396 | + | |
| 1397 | import net.sf.l2j.gameserver.enums.FloodProtector; | |
| 1398 | import net.sf.l2j.gameserver.enums.SayType; | |
| 1399 | import net.sf.l2j.gameserver.handler.IChatHandler; | |
| 1400 | +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; | |
| 1401 | +import net.sf.l2j.gameserver.handler.VoicedCommandHandler; | |
| 1402 | import net.sf.l2j.gameserver.model.actor.Player; | |
| 1403 | import net.sf.l2j.gameserver.network.serverpackets.CreatureSay; | |
| 1404 | ||
| 1405 | @@ -19,11 +23,39 @@ | |
| 1406 | if (!player.getClient().performAction(FloodProtector.GLOBAL_CHAT)) | |
| 1407 | return; | |
| 1408 | ||
| 1409 | - final CreatureSay cs = new CreatureSay(player, type, text); | |
| 1410 | - for (Player knownPlayer : player.getKnownTypeInRadius(Player.class, 1250)) | |
| 1411 | - knownPlayer.sendPacket(cs); | |
| 1412 | + boolean vcd_used = false; | |
| 1413 | + if (text.startsWith("."))
| |
| 1414 | + {
| |
| 1415 | + StringTokenizer st = new StringTokenizer(text); | |
| 1416 | + IVoicedCommandHandler vch; | |
| 1417 | + String command = ""; | |
| 1418 | + if (st.countTokens() > 1) | |
| 1419 | + {
| |
| 1420 | + command = st.nextToken().substring(1); | |
| 1421 | + target = text.substring(command.length() + 2); | |
| 1422 | + vch = VoicedCommandHandler.getInstance().getHandler(command); | |
| 1423 | + } | |
| 1424 | + else | |
| 1425 | + {
| |
| 1426 | + command = text.substring(1); | |
| 1427 | + vch = VoicedCommandHandler.getInstance().getHandler(command); | |
| 1428 | + } | |
| 1429 | ||
| 1430 | - player.sendPacket(cs); | |
| 1431 | + if (vch != null) | |
| 1432 | + {
| |
| 1433 | + vch.useVoicedCommand(command, player, text); | |
| 1434 | + vcd_used = true; | |
| 1435 | + | |
| 1436 | + } | |
| 1437 | + } | |
| 1438 | + if (!vcd_used) | |
| 1439 | + {
| |
| 1440 | + final CreatureSay cs = new CreatureSay(player, type, text); | |
| 1441 | + for (Player knownPlayer : player.getKnownTypeInRadius(Player.class, 1250)) | |
| 1442 | + knownPlayer.sendPacket(cs); | |
| 1443 | + | |
| 1444 | + player.sendPacket(cs); | |
| 1445 | + } | |
| 1446 | } | |
| 1447 | ||
| 1448 | @Override | |
| 1449 | diff --git java/net/sf/l2j/gameserver/handler/usercommandhandlers/DressMe.java java/net/sf/l2j/gameserver/handler/usercommandhandlers/DressMe.java | |
| 1450 | new file mode 100644 | |
| 1451 | index 0000000..56c1309 | |
| 1452 | --- /dev/null | |
| 1453 | +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/DressMe.java | |
| 1454 | @@ -0,0 +1,93 @@ | |
| 1455 | +package net.sf.l2j.gameserver.handler.usercommandhandlers; | |
| 1456 | + | |
| 1457 | +import java.text.SimpleDateFormat; | |
| 1458 | +import java.util.Date; | |
| 1459 | + | |
| 1460 | +import net.sf.l2j.Config; | |
| 1461 | +import net.sf.l2j.gameserver.data.cache.HtmCache; | |
| 1462 | +import net.sf.l2j.gameserver.handler.ICustomByPassHandler; | |
| 1463 | +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; | |
| 1464 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 1465 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | +public class DressMe implements IVoicedCommandHandler, ICustomByPassHandler | |
| 1470 | +{
| |
| 1471 | + private static String[] _voicedCommands = | |
| 1472 | + {
| |
| 1473 | + Config.DRESS_ME_COMMAND | |
| 1474 | + }; | |
| 1475 | + | |
| 1476 | + @Override | |
| 1477 | + public boolean useVoicedCommand(String command, Player activeChar, String target) | |
| 1478 | + {
| |
| 1479 | + | |
| 1480 | + | |
| 1481 | + if (command.startsWith(Config.DRESS_ME_COMMAND)) | |
| 1482 | + {
| |
| 1483 | + showHtm(activeChar); | |
| 1484 | + } | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + return true; | |
| 1488 | + } | |
| 1489 | + | |
| 1490 | + private static void showHtm(Player player) | |
| 1491 | + {
| |
| 1492 | + NpcHtmlMessage htm = new NpcHtmlMessage(1); | |
| 1493 | + String text = HtmCache.getInstance().getHtm("data/html/dressme/index.htm");
| |
| 1494 | + | |
| 1495 | + htm.setHtml(text); | |
| 1496 | + | |
| 1497 | + {
| |
| 1498 | + htm.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
| |
| 1499 | + htm.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
| |
| 1500 | + | |
| 1501 | + } | |
| 1502 | + | |
| 1503 | + player.sendPacket(htm); | |
| 1504 | + } | |
| 1505 | + | |
| 1506 | + static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
| |
| 1507 | + | |
| 1508 | + @Override | |
| 1509 | + public String[] getVoicedCommandList() | |
| 1510 | + {
| |
| 1511 | + return _voicedCommands; | |
| 1512 | + } | |
| 1513 | + | |
| 1514 | + @Override | |
| 1515 | + public String[] getByPassCommands() | |
| 1516 | + {
| |
| 1517 | + return new String[] | |
| 1518 | + {
| |
| 1519 | + "dressme_back" | |
| 1520 | + }; | |
| 1521 | + } | |
| 1522 | + | |
| 1523 | + private enum CommandEnum | |
| 1524 | + {
| |
| 1525 | + dressme_back, | |
| 1526 | + } | |
| 1527 | + | |
| 1528 | + @Override | |
| 1529 | + public void handleCommand(String command, Player player, String parameters) | |
| 1530 | + {
| |
| 1531 | + CommandEnum comm = CommandEnum.valueOf(command); | |
| 1532 | + | |
| 1533 | + if (comm == null) | |
| 1534 | + {
| |
| 1535 | + return; | |
| 1536 | + } | |
| 1537 | + | |
| 1538 | + switch (comm) | |
| 1539 | + {
| |
| 1540 | + case dressme_back: | |
| 1541 | + {
| |
| 1542 | + showHtm(player); | |
| 1543 | + } | |
| 1544 | + break; | |
| 1545 | + } | |
| 1546 | + } | |
| 1547 | +} | |
| 1548 | \ No newline at end of file | |
| 1549 | diff --git java/net/sf/l2j/gameserver/model/actor/Player.java java/net/sf/l2j/gameserver/model/actor/Player.java | |
| 1550 | index 172649c..8610748 100644 | |
| 1551 | --- java/net/sf/l2j/gameserver/model/actor/Player.java | |
| 1552 | +++ java/net/sf/l2j/gameserver/model/actor/Player.java | |
| 1553 | @@ -14,6 +14,7 @@ | |
| 1554 | import java.util.Set; | |
| 1555 | import java.util.concurrent.ConcurrentHashMap; | |
| 1556 | import java.util.concurrent.ConcurrentSkipListMap; | |
| 1557 | +import java.util.concurrent.CopyOnWriteArrayList; | |
| 1558 | import java.util.concurrent.Future; | |
| 1559 | import java.util.concurrent.ScheduledFuture; | |
| 1560 | import java.util.concurrent.atomic.AtomicInteger; | |
| 1561 | @@ -163,6 +164,7 @@ | |
| 1562 | import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode; | |
| 1563 | import net.sf.l2j.gameserver.network.serverpackets.ExServerPrimitive; | |
| 1564 | import net.sf.l2j.gameserver.network.serverpackets.ExSetCompassZoneCode; | |
| 1565 | +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage; | |
| 1566 | import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount; | |
| 1567 | import net.sf.l2j.gameserver.network.serverpackets.GetOnVehicle; | |
| 1568 | import net.sf.l2j.gameserver.network.serverpackets.HennaInfo; | |
| 1569 | @@ -177,6 +179,7 @@ | |
| 1570 | import net.sf.l2j.gameserver.network.serverpackets.ObserverStart; | |
| 1571 | import net.sf.l2j.gameserver.network.serverpackets.PartySmallWindowUpdate; | |
| 1572 | import net.sf.l2j.gameserver.network.serverpackets.PetInventoryUpdate; | |
| 1573 | +import net.sf.l2j.gameserver.network.serverpackets.PlaySound; | |
| 1574 | import net.sf.l2j.gameserver.network.serverpackets.PledgeShowMemberListDelete; | |
| 1575 | import net.sf.l2j.gameserver.network.serverpackets.PledgeShowMemberListUpdate; | |
| 1576 | import net.sf.l2j.gameserver.network.serverpackets.PrivateStoreListBuy; | |
| 1577 | @@ -225,12 +228,48 @@ | |
| 1578 | import net.sf.l2j.gameserver.taskmanager.ShadowItemTaskManager; | |
| 1579 | import net.sf.l2j.gameserver.taskmanager.WaterTaskManager; | |
| 1580 | ||
| 1581 | +import Base.Skin.DressMeData; | |
| 1582 | + | |
| 1583 | /** | |
| 1584 | * This class represents a player in the world.<br> | |
| 1585 | * There is always a client-thread connected to this (except if a player-store is activated upon logout). | |
| 1586 | */ | |
| 1587 | public final class Player extends Playable | |
| 1588 | {
| |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + private int _armorSkinOption = 0; | |
| 1594 | + private int _weaponSkinOption = 0; | |
| 1595 | + private int _hairSkinOption = 0; | |
| 1596 | + private int _faceSkinOption = 0; | |
| 1597 | + private int _shieldSkinOption = 0; | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + private boolean isTryingSkin = false; | |
| 1601 | + private boolean isTryingSkinPremium = false; | |
| 1602 | + private List<Integer> _armorSkins = new CopyOnWriteArrayList<>(); | |
| 1603 | + private List<Integer> _weaponSkins = new CopyOnWriteArrayList<>(); | |
| 1604 | + private List<Integer> _hairSkins = new CopyOnWriteArrayList<>(); | |
| 1605 | + private List<Integer> _faceSkins = new CopyOnWriteArrayList<>(); | |
| 1606 | + private List<Integer> _shieldSkins = new CopyOnWriteArrayList<>(); | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + private static final String INSERT_OR_UPDATE_CHARACTER_DRESSME_DATA = "INSERT INTO characters_dressme_data (obj_Id, armor_skins, armor_skin_option, weapon_skins, weapon_skin_option, hair_skins, hair_skin_option, face_skins, face_skin_option) VALUES (?,?,?,?,?,?,?,?,?) " | |
| 1610 | + + "ON DUPLICATE KEY UPDATE obj_Id=?, armor_skins=?, armor_skin_option=?, weapon_skins=?, weapon_skin_option=?, hair_skins=?, hair_skin_option=?, face_skins=?, face_skin_option=?, shield_skins=?, shield_skin_option=?"; | |
| 1611 | + private static final String RESTORE_CHARACTER_DRESSME_DATA = "SELECT obj_Id, armor_skins, armor_skin_option, weapon_skins, weapon_skin_option, hair_skins, hair_skin_option, face_skins, face_skin_option, shield_skins, shield_skin_option FROM characters_dressme_data WHERE obj_id=?"; | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?"; | |
| 1624 | private static final String ADD_OR_UPDATE_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE skill_level=VALUES(skill_level)"; | |
| 1625 | private static final String DELETE_SKILL_FROM_CHAR = "DELETE FROM character_skills WHERE skill_id=? AND char_obj_id=? AND class_index=?"; | |
| 1626 | @@ -1225,6 +1264,28 @@ | |
| 1627 | if (item.getItem() instanceof Weapon) | |
| 1628 | item.unChargeAllShots(); | |
| 1629 | ||
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + if (getWeaponSkinOption() > 0 && DressMeData.getInstance().getWeaponSkinsPackage(getWeaponSkinOption()) != null) | |
| 1634 | + {
| |
| 1635 | + sendMessage("At first you must to remove a skin of weapon.");
| |
| 1636 | + sendPacket(new ExShowScreenMessage("At first you must to remove a skin of weapon.", 2000));
| |
| 1637 | + sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 1638 | + return; | |
| 1639 | + } | |
| 1640 | + | |
| 1641 | + if (getShieldSkinOption() > 0 && DressMeData.getInstance().getShieldSkinsPackage(getShieldSkinOption()) != null) | |
| 1642 | + {
| |
| 1643 | + sendMessage("At first you must to remove a skin of weapon.");
| |
| 1644 | + sendPacket(new ExShowScreenMessage("At first you must to remove a skin of weapon.", 2000));
| |
| 1645 | + sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 1646 | + return; | |
| 1647 | + } | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | if (isEquipped) | |
| 1653 | {
| |
| 1654 | if (item.getEnchantLevel() > 0) | |
| 1655 | @@ -4379,7 +4440,7 @@ | |
| 1656 | player.refreshHennaList(); | |
| 1657 | ||
| 1658 | player.restoreFriendList(); | |
| 1659 | - | |
| 1660 | + player.restoreDressMeData(); | |
| 1661 | player.setOnlineStatus(true, false); | |
| 1662 | player.setRunning(true); | |
| 1663 | player.setStanding(true); | |
| 1664 | @@ -4484,6 +4545,20 @@ | |
| 1665 | */ | |
| 1666 | public synchronized void store(boolean storeActiveEffects) | |
| 1667 | {
| |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + if (!isTryingSkin() || !isTryingSkinPremium()) | |
| 1673 | + {
| |
| 1674 | + storeDressMeData(); | |
| 1675 | + } | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | storeCharBase(); | |
| 1683 | storeCharSub(); | |
| 1684 | storeEffect(storeActiveEffects); | |
| 1685 | @@ -7444,4 +7519,473 @@ | |
| 1686 | ||
| 1687 | return gms; | |
| 1688 | } | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + private synchronized void storeDressMeData() | |
| 1698 | + {
| |
| 1699 | + | |
| 1700 | + try (Connection con = ConnectionPool.getConnection(); | |
| 1701 | + PreparedStatement statement = con.prepareStatement(INSERT_OR_UPDATE_CHARACTER_DRESSME_DATA)) | |
| 1702 | + {
| |
| 1703 | + | |
| 1704 | + statement.setInt(1, getObjectId()); | |
| 1705 | + if (_armorSkins.isEmpty()) | |
| 1706 | + {
| |
| 1707 | + statement.setString(2, ""); | |
| 1708 | + } | |
| 1709 | + else | |
| 1710 | + {
| |
| 1711 | + String s = ""; | |
| 1712 | + for (int i : _armorSkins) | |
| 1713 | + {
| |
| 1714 | + s += String.valueOf(i) + ","; | |
| 1715 | + } | |
| 1716 | + statement.setString(2, s); | |
| 1717 | + } | |
| 1718 | + statement.setInt(3, getArmorSkinOption()); | |
| 1719 | + | |
| 1720 | + if (_weaponSkins.isEmpty()) | |
| 1721 | + {
| |
| 1722 | + statement.setString(4, ""); | |
| 1723 | + } | |
| 1724 | + else | |
| 1725 | + {
| |
| 1726 | + String s = ""; | |
| 1727 | + for (int i : _weaponSkins) | |
| 1728 | + {
| |
| 1729 | + s += String.valueOf(i) + ","; | |
| 1730 | + } | |
| 1731 | + statement.setString(4, s); | |
| 1732 | + } | |
| 1733 | + statement.setInt(5, getWeaponSkinOption()); | |
| 1734 | + | |
| 1735 | + if (_hairSkins.isEmpty()) | |
| 1736 | + {
| |
| 1737 | + statement.setString(6, ""); | |
| 1738 | + } | |
| 1739 | + else | |
| 1740 | + {
| |
| 1741 | + String s = ""; | |
| 1742 | + for (int i : _hairSkins) | |
| 1743 | + {
| |
| 1744 | + s += String.valueOf(i) + ","; | |
| 1745 | + } | |
| 1746 | + statement.setString(6, s); | |
| 1747 | + } | |
| 1748 | + statement.setInt(7, getHairSkinOption()); | |
| 1749 | + | |
| 1750 | + if (_faceSkins.isEmpty()) | |
| 1751 | + {
| |
| 1752 | + statement.setString(8, ""); | |
| 1753 | + } | |
| 1754 | + else | |
| 1755 | + {
| |
| 1756 | + String s = ""; | |
| 1757 | + for (int i : _faceSkins) | |
| 1758 | + {
| |
| 1759 | + s += String.valueOf(i) + ","; | |
| 1760 | + } | |
| 1761 | + statement.setString(8, s); | |
| 1762 | + } | |
| 1763 | + statement.setInt(9, getFaceSkinOption()); | |
| 1764 | + | |
| 1765 | + if (_shieldSkins.isEmpty()) | |
| 1766 | + {
| |
| 1767 | + statement.setString(10, ""); | |
| 1768 | + } | |
| 1769 | + else | |
| 1770 | + {
| |
| 1771 | + String s = ""; | |
| 1772 | + for (int i : _shieldSkins) | |
| 1773 | + {
| |
| 1774 | + s += String.valueOf(i) + ","; | |
| 1775 | + } | |
| 1776 | + statement.setString(10, s); | |
| 1777 | + } | |
| 1778 | + statement.setInt(11, getShieldSkinOption()); | |
| 1779 | + | |
| 1780 | + // second part | |
| 1781 | + | |
| 1782 | + statement.setInt(10, getObjectId()); | |
| 1783 | + if (_armorSkins.isEmpty()) | |
| 1784 | + {
| |
| 1785 | + statement.setString(11, ""); | |
| 1786 | + } | |
| 1787 | + else | |
| 1788 | + {
| |
| 1789 | + String s = ""; | |
| 1790 | + for (int i : _armorSkins) | |
| 1791 | + {
| |
| 1792 | + s += String.valueOf(i) + ","; | |
| 1793 | + } | |
| 1794 | + statement.setString(11, s); | |
| 1795 | + } | |
| 1796 | + statement.setInt(12, getArmorSkinOption()); | |
| 1797 | + | |
| 1798 | + if (_weaponSkins.isEmpty()) | |
| 1799 | + {
| |
| 1800 | + statement.setString(13, ""); | |
| 1801 | + } | |
| 1802 | + else | |
| 1803 | + {
| |
| 1804 | + String s = ""; | |
| 1805 | + for (int i : _weaponSkins) | |
| 1806 | + {
| |
| 1807 | + s += String.valueOf(i) + ","; | |
| 1808 | + } | |
| 1809 | + statement.setString(13, s); | |
| 1810 | + } | |
| 1811 | + statement.setInt(14, getWeaponSkinOption()); | |
| 1812 | + | |
| 1813 | + if (_hairSkins.isEmpty()) | |
| 1814 | + {
| |
| 1815 | + statement.setString(15, ""); | |
| 1816 | + } | |
| 1817 | + else | |
| 1818 | + {
| |
| 1819 | + String s = ""; | |
| 1820 | + for (int i : _hairSkins) | |
| 1821 | + {
| |
| 1822 | + s += String.valueOf(i) + ","; | |
| 1823 | + } | |
| 1824 | + statement.setString(15, s); | |
| 1825 | + } | |
| 1826 | + statement.setInt(16, getHairSkinOption()); | |
| 1827 | + | |
| 1828 | + if (_faceSkins.isEmpty()) | |
| 1829 | + {
| |
| 1830 | + statement.setString(17, ""); | |
| 1831 | + } | |
| 1832 | + else | |
| 1833 | + {
| |
| 1834 | + String s = ""; | |
| 1835 | + for (int i : _faceSkins) | |
| 1836 | + {
| |
| 1837 | + s += String.valueOf(i) + ","; | |
| 1838 | + } | |
| 1839 | + statement.setString(17, s); | |
| 1840 | + } | |
| 1841 | + statement.setInt(18, getFaceSkinOption()); | |
| 1842 | + | |
| 1843 | + if (_shieldSkins.isEmpty()) | |
| 1844 | + {
| |
| 1845 | + statement.setString(19, ""); | |
| 1846 | + } | |
| 1847 | + else | |
| 1848 | + {
| |
| 1849 | + String s = ""; | |
| 1850 | + for (int i : _shieldSkins) | |
| 1851 | + {
| |
| 1852 | + s += String.valueOf(i) + ","; | |
| 1853 | + } | |
| 1854 | + statement.setString(19, s); | |
| 1855 | + } | |
| 1856 | + statement.setInt(20, getShieldSkinOption()); | |
| 1857 | + | |
| 1858 | + statement.execute(); | |
| 1859 | + | |
| 1860 | + } | |
| 1861 | + catch (Exception e) | |
| 1862 | + {
| |
| 1863 | + | |
| 1864 | + LOGGER.warn("Could not store storeDressMeData():");
| |
| 1865 | + e.printStackTrace(); | |
| 1866 | + | |
| 1867 | + } | |
| 1868 | + | |
| 1869 | + } | |
| 1870 | + | |
| 1871 | + private void restoreDressMeData() | |
| 1872 | + {
| |
| 1873 | + try (Connection con = ConnectionPool.getConnection(); | |
| 1874 | + PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER_DRESSME_DATA)) | |
| 1875 | + {
| |
| 1876 | + | |
| 1877 | + statement.setInt(1, getObjectId()); // Establecer el parΓ‘metro objectId | |
| 1878 | + | |
| 1879 | + try (ResultSet rset = statement.executeQuery()) | |
| 1880 | + {
| |
| 1881 | + while (rset.next()) | |
| 1882 | + {
| |
| 1883 | + String armorskinIds = rset.getString("armor_skins");
| |
| 1884 | + if (armorskinIds != null && armorskinIds.length() > 0) | |
| 1885 | + {
| |
| 1886 | + for (String s : armorskinIds.split(","))
| |
| 1887 | + {
| |
| 1888 | + if (s == null) | |
| 1889 | + {
| |
| 1890 | + continue; | |
| 1891 | + } | |
| 1892 | + buyArmorSkin(Integer.parseInt(s)); | |
| 1893 | + } | |
| 1894 | + } | |
| 1895 | + setArmorSkinOption(rset.getInt("armor_skin_option"));
| |
| 1896 | + | |
| 1897 | + String weaponskinIds = rset.getString("weapon_skins");
| |
| 1898 | + if (weaponskinIds != null && weaponskinIds.length() > 0) | |
| 1899 | + {
| |
| 1900 | + for (String s : weaponskinIds.split(","))
| |
| 1901 | + {
| |
| 1902 | + if (s == null) | |
| 1903 | + {
| |
| 1904 | + continue; | |
| 1905 | + } | |
| 1906 | + buyWeaponSkin(Integer.parseInt(s)); | |
| 1907 | + } | |
| 1908 | + } | |
| 1909 | + setWeaponSkinOption(rset.getInt("weapon_skin_option"));
| |
| 1910 | + | |
| 1911 | + String hairskinIds = rset.getString("hair_skins");
| |
| 1912 | + if (hairskinIds != null && hairskinIds.length() > 0) | |
| 1913 | + {
| |
| 1914 | + for (String s : hairskinIds.split(","))
| |
| 1915 | + {
| |
| 1916 | + if (s == null) | |
| 1917 | + {
| |
| 1918 | + continue; | |
| 1919 | + } | |
| 1920 | + buyHairSkin(Integer.parseInt(s)); | |
| 1921 | + } | |
| 1922 | + } | |
| 1923 | + setHairSkinOption(rset.getInt("hair_skin_option"));
| |
| 1924 | + | |
| 1925 | + String faceskinIds = rset.getString("face_skins");
| |
| 1926 | + if (faceskinIds != null && faceskinIds.length() > 0) | |
| 1927 | + {
| |
| 1928 | + for (String s : faceskinIds.split(","))
| |
| 1929 | + {
| |
| 1930 | + if (s == null) | |
| 1931 | + {
| |
| 1932 | + continue; | |
| 1933 | + } | |
| 1934 | + buyFaceSkin(Integer.parseInt(s)); | |
| 1935 | + } | |
| 1936 | + } | |
| 1937 | + setFaceSkinOption(rset.getInt("face_skin_option"));
| |
| 1938 | + | |
| 1939 | + String shieldkinIds = rset.getString("shield_skins");
| |
| 1940 | + if (shieldkinIds != null && shieldkinIds.length() > 0) | |
| 1941 | + {
| |
| 1942 | + for (String s : shieldkinIds.split(","))
| |
| 1943 | + {
| |
| 1944 | + if (s == null) | |
| 1945 | + {
| |
| 1946 | + continue; | |
| 1947 | + } | |
| 1948 | + buyShieldSkin(Integer.parseInt(s)); | |
| 1949 | + } | |
| 1950 | + } | |
| 1951 | + setShieldSkinOption(rset.getInt("shield_skin_option"));
| |
| 1952 | + } | |
| 1953 | + } | |
| 1954 | + } | |
| 1955 | + catch (Exception e) | |
| 1956 | + {
| |
| 1957 | + LOGGER.warn("Could not restore char data:");
| |
| 1958 | + e.printStackTrace(); | |
| 1959 | + } | |
| 1960 | + } | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + // Dress Me | |
| 1973 | + public boolean isTryingSkin() | |
| 1974 | + {
| |
| 1975 | + return isTryingSkin; | |
| 1976 | + } | |
| 1977 | + | |
| 1978 | + public void setIsTryingSkin(boolean b) | |
| 1979 | + {
| |
| 1980 | + isTryingSkin = b; | |
| 1981 | + } | |
| 1982 | + | |
| 1983 | + public boolean isTryingSkinPremium() | |
| 1984 | + {
| |
| 1985 | + return isTryingSkinPremium; | |
| 1986 | + } | |
| 1987 | + | |
| 1988 | + public void setIsTryingSkinPremium(boolean b) | |
| 1989 | + {
| |
| 1990 | + isTryingSkinPremium = b; | |
| 1991 | + } | |
| 1992 | + | |
| 1993 | + public boolean hasArmorSkin(int skin) | |
| 1994 | + {
| |
| 1995 | + return _armorSkins.contains(skin); | |
| 1996 | + } | |
| 1997 | + | |
| 1998 | + public boolean hasWeaponSkin(int skin) | |
| 1999 | + {
| |
| 2000 | + return _weaponSkins.contains(skin); | |
| 2001 | + } | |
| 2002 | + | |
| 2003 | + public boolean hasHairSkin(int skin) | |
| 2004 | + {
| |
| 2005 | + return _hairSkins.contains(skin); | |
| 2006 | + } | |
| 2007 | + | |
| 2008 | + public boolean hasFaceSkin(int skin) | |
| 2009 | + {
| |
| 2010 | + return _faceSkins.contains(skin); | |
| 2011 | + } | |
| 2012 | + | |
| 2013 | + public boolean hasShieldSkin(int skin) | |
| 2014 | + {
| |
| 2015 | + return _shieldSkins.contains(skin); | |
| 2016 | + } | |
| 2017 | + | |
| 2018 | + public boolean hasEquippedArmorSkin(String skin) | |
| 2019 | + {
| |
| 2020 | + return String.valueOf(_armorSkinOption).contains(String.valueOf(skin)); | |
| 2021 | + } | |
| 2022 | + | |
| 2023 | + public boolean hasEquippedWeaponSkin(String skin) | |
| 2024 | + {
| |
| 2025 | + return String.valueOf(_weaponSkinOption).contains(String.valueOf(skin)); | |
| 2026 | + } | |
| 2027 | + | |
| 2028 | + public boolean hasEquippedHairSkin(String skin) | |
| 2029 | + {
| |
| 2030 | + return String.valueOf(_hairSkinOption).contains(String.valueOf(skin)); | |
| 2031 | + } | |
| 2032 | + | |
| 2033 | + public boolean hasEquippedFaceSkin(String skin) | |
| 2034 | + {
| |
| 2035 | + return String.valueOf(_faceSkinOption).contains(String.valueOf(skin)); | |
| 2036 | + } | |
| 2037 | + | |
| 2038 | + public boolean hasEquippedShieldSkin(String skin) | |
| 2039 | + {
| |
| 2040 | + return String.valueOf(_shieldSkinOption).contains(String.valueOf(skin)); | |
| 2041 | + } | |
| 2042 | + | |
| 2043 | + public void buyArmorSkin(int id) | |
| 2044 | + {
| |
| 2045 | + if (!_armorSkins.contains(id)) | |
| 2046 | + {
| |
| 2047 | + _armorSkins.add(id); | |
| 2048 | + } | |
| 2049 | + } | |
| 2050 | + | |
| 2051 | + public void buyWeaponSkin(int id) | |
| 2052 | + {
| |
| 2053 | + if (!_weaponSkins.contains(id)) | |
| 2054 | + {
| |
| 2055 | + _weaponSkins.add(id); | |
| 2056 | + } | |
| 2057 | + } | |
| 2058 | + | |
| 2059 | + public void buyHairSkin(int id) | |
| 2060 | + {
| |
| 2061 | + if (!_hairSkins.contains(id)) | |
| 2062 | + {
| |
| 2063 | + _hairSkins.add(id); | |
| 2064 | + } | |
| 2065 | + } | |
| 2066 | + | |
| 2067 | + public void buyFaceSkin(int id) | |
| 2068 | + {
| |
| 2069 | + if (!_faceSkins.contains(id)) | |
| 2070 | + {
| |
| 2071 | + _faceSkins.add(id); | |
| 2072 | + } | |
| 2073 | + } | |
| 2074 | + | |
| 2075 | + public void buyShieldSkin(int id) | |
| 2076 | + {
| |
| 2077 | + if (!_shieldSkins.contains(id)) | |
| 2078 | + {
| |
| 2079 | + _shieldSkins.add(id); | |
| 2080 | + } | |
| 2081 | + } | |
| 2082 | + | |
| 2083 | + public void setArmorSkinOption(int armorSkinOption) | |
| 2084 | + {
| |
| 2085 | + _armorSkinOption = armorSkinOption; | |
| 2086 | + } | |
| 2087 | + | |
| 2088 | + public int getArmorSkinOption() | |
| 2089 | + {
| |
| 2090 | + return _armorSkinOption; | |
| 2091 | + } | |
| 2092 | + | |
| 2093 | + public void setWeaponSkinOption(int weaponSkinOption) | |
| 2094 | + {
| |
| 2095 | + _weaponSkinOption = weaponSkinOption; | |
| 2096 | + } | |
| 2097 | + | |
| 2098 | + public int getWeaponSkinOption() | |
| 2099 | + {
| |
| 2100 | + return _weaponSkinOption; | |
| 2101 | + } | |
| 2102 | + | |
| 2103 | + public void setHairSkinOption(int hairSkinOption) | |
| 2104 | + {
| |
| 2105 | + _hairSkinOption = hairSkinOption; | |
| 2106 | + } | |
| 2107 | + | |
| 2108 | + public int getHairSkinOption() | |
| 2109 | + {
| |
| 2110 | + return _hairSkinOption; | |
| 2111 | + } | |
| 2112 | + | |
| 2113 | + public void setFaceSkinOption(int faceSkinOption) | |
| 2114 | + {
| |
| 2115 | + _faceSkinOption = faceSkinOption; | |
| 2116 | + } | |
| 2117 | + | |
| 2118 | + public int getFaceSkinOption() | |
| 2119 | + {
| |
| 2120 | + return _faceSkinOption; | |
| 2121 | + } | |
| 2122 | + | |
| 2123 | + public void setShieldSkinOption(int shieldSkinOption) | |
| 2124 | + {
| |
| 2125 | + _shieldSkinOption = shieldSkinOption; | |
| 2126 | + } | |
| 2127 | + | |
| 2128 | + public int getShieldSkinOption() | |
| 2129 | + {
| |
| 2130 | + return _shieldSkinOption; | |
| 2131 | + } | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | } | |
| 2141 | \ No newline at end of file | |
| 2142 | diff --git java/net/sf/l2j/gameserver/model/item/kind/Item.java java/net/sf/l2j/gameserver/model/item/kind/Item.java | |
| 2143 | index a461fe2..9c641b1 100644 | |
| 2144 | --- java/net/sf/l2j/gameserver/model/item/kind/Item.java | |
| 2145 | +++ java/net/sf/l2j/gameserver/model/item/kind/Item.java | |
| 2146 | @@ -1,5 +1,8 @@ | |
| 2147 | package net.sf.l2j.gameserver.model.item.kind; | |
| 2148 | ||
| 2149 | +import java.sql.Connection; | |
| 2150 | +import java.sql.PreparedStatement; | |
| 2151 | +import java.sql.ResultSet; | |
| 2152 | import java.util.ArrayList; | |
| 2153 | import java.util.Collections; | |
| 2154 | import java.util.HashMap; | |
| 2155 | @@ -7,7 +10,9 @@ | |
| 2156 | import java.util.Map; | |
| 2157 | ||
| 2158 | import net.sf.l2j.commons.data.StatSet; | |
| 2159 | +import net.sf.l2j.commons.pool.ConnectionPool; | |
| 2160 | ||
| 2161 | +import net.sf.l2j.gameserver.data.xml.ItemData; | |
| 2162 | import net.sf.l2j.gameserver.enums.items.ActionType; | |
| 2163 | import net.sf.l2j.gameserver.enums.items.ArmorType; | |
| 2164 | import net.sf.l2j.gameserver.enums.items.CrystalType; | |
| 2165 | @@ -21,6 +26,7 @@ | |
| 2166 | import net.sf.l2j.gameserver.model.actor.Summon; | |
| 2167 | import net.sf.l2j.gameserver.model.holder.IntIntHolder; | |
| 2168 | import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
| 2169 | +import net.sf.l2j.gameserver.network.GameClient; | |
| 2170 | import net.sf.l2j.gameserver.network.SystemMessageId; | |
| 2171 | import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; | |
| 2172 | import net.sf.l2j.gameserver.scripting.Quest; | |
| 2173 | @@ -33,6 +39,10 @@ | |
| 2174 | */ | |
| 2175 | public abstract class Item | |
| 2176 | {
| |
| 2177 | + | |
| 2178 | + private static Map<Integer, String> _Icons = null; | |
| 2179 | + private static GameClient _client; | |
| 2180 | + | |
| 2181 | private static final Map<String, Integer> SLOTS = new HashMap<>(); | |
| 2182 | {
| |
| 2183 | SLOTS.put("chest", SLOT_CHEST);
| |
| 2184 | @@ -543,4 +553,90 @@ | |
| 2185 | {
| |
| 2186 | return _questEvents; | |
| 2187 | } | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + public static String getItemIcon(int itemId) | |
| 2192 | + {
| |
| 2193 | + if (_Icons != null && !_Icons.isEmpty()) | |
| 2194 | + {
| |
| 2195 | + return _Icons.get(itemId); | |
| 2196 | + } | |
| 2197 | + return null; | |
| 2198 | + } | |
| 2199 | + | |
| 2200 | + public static void LoadAllIcons() | |
| 2201 | + {
| |
| 2202 | + loadIcons(); | |
| 2203 | + } | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + public static String getItemNameById(int itemId) | |
| 2208 | + {
| |
| 2209 | + Item item = ItemData.getInstance().getTemplate(itemId); | |
| 2210 | + | |
| 2211 | + String itemName = "NoName"; | |
| 2212 | + | |
| 2213 | + if (itemId != 0) | |
| 2214 | + {
| |
| 2215 | + itemName = item.getName(); | |
| 2216 | + } | |
| 2217 | + | |
| 2218 | + return itemName; | |
| 2219 | + } | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + /** | |
| 2226 | + * @return The client owner of this char. | |
| 2227 | + */ | |
| 2228 | + public GameClient getClient() | |
| 2229 | + {
| |
| 2230 | + return _client; | |
| 2231 | + } | |
| 2232 | + | |
| 2233 | + public void setClient(GameClient client) | |
| 2234 | + {
| |
| 2235 | + _client = client; | |
| 2236 | + } | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + @SuppressWarnings("resource")
| |
| 2240 | + private static void loadIcons() | |
| 2241 | + {
| |
| 2242 | + _Icons = new HashMap<>(); | |
| 2243 | + | |
| 2244 | + Connection con = null; | |
| 2245 | + try | |
| 2246 | + {
| |
| 2247 | + con = ConnectionPool.getConnection(); | |
| 2248 | + PreparedStatement statement = con.prepareStatement("SELECT * FROM item_icons");
| |
| 2249 | + ResultSet rset = statement.executeQuery(); | |
| 2250 | + | |
| 2251 | + while (rset.next()) | |
| 2252 | + {
| |
| 2253 | + int itemId = rset.getInt("itemId");
| |
| 2254 | + String itemIcon = rset.getString("itemIcon");
| |
| 2255 | + _Icons.put(itemId, itemIcon); | |
| 2256 | + } | |
| 2257 | + | |
| 2258 | + rset.close(); | |
| 2259 | + statement.close(); | |
| 2260 | + } | |
| 2261 | + catch (Exception e) | |
| 2262 | + {
| |
| 2263 | + | |
| 2264 | + } | |
| 2265 | + finally | |
| 2266 | + {
| |
| 2267 | + | |
| 2268 | + } | |
| 2269 | + } | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | } | |
| 2275 | \ No newline at end of file | |
| 2276 | diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
| 2277 | index 882ab73..dcabe3f 100644 | |
| 2278 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
| 2279 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java | |
| 2280 | @@ -1,26 +1,46 @@ | |
| 2281 | package net.sf.l2j.gameserver.network.clientpackets; | |
| 2282 | ||
| 2283 | +import java.sql.Date; | |
| 2284 | +import java.text.SimpleDateFormat; | |
| 2285 | +import java.util.List; | |
| 2286 | import java.util.StringTokenizer; | |
| 2287 | import java.util.logging.Logger; | |
| 2288 | +import java.util.stream.Collectors; | |
| 2289 | +import java.util.stream.Stream; | |
| 2290 | + | |
| 2291 | +import net.sf.l2j.commons.pool.ThreadPool; | |
| 2292 | ||
| 2293 | import net.sf.l2j.Config; | |
| 2294 | import net.sf.l2j.gameserver.communitybbs.CommunityBoard; | |
| 2295 | +import net.sf.l2j.gameserver.data.cache.HtmCache; | |
| 2296 | import net.sf.l2j.gameserver.data.manager.HeroManager; | |
| 2297 | import net.sf.l2j.gameserver.data.xml.AdminData; | |
| 2298 | +import net.sf.l2j.gameserver.data.xml.ItemData; | |
| 2299 | import net.sf.l2j.gameserver.enums.FloodProtector; | |
| 2300 | +import net.sf.l2j.gameserver.enums.items.WeaponType; | |
| 2301 | import net.sf.l2j.gameserver.handler.AdminCommandHandler; | |
| 2302 | +import net.sf.l2j.gameserver.handler.CustomBypassHandler; | |
| 2303 | import net.sf.l2j.gameserver.handler.IAdminCommandHandler; | |
| 2304 | +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; | |
| 2305 | +import net.sf.l2j.gameserver.handler.VoicedCommandHandler; | |
| 2306 | import net.sf.l2j.gameserver.model.World; | |
| 2307 | import net.sf.l2j.gameserver.model.WorldObject; | |
| 2308 | import net.sf.l2j.gameserver.model.actor.Npc; | |
| 2309 | import net.sf.l2j.gameserver.model.actor.Player; | |
| 2310 | import net.sf.l2j.gameserver.model.actor.instance.OlympiadManagerNpc; | |
| 2311 | +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
| 2312 | +import net.sf.l2j.gameserver.model.item.kind.Item; | |
| 2313 | import net.sf.l2j.gameserver.model.olympiad.OlympiadManager; | |
| 2314 | import net.sf.l2j.gameserver.network.SystemMessageId; | |
| 2315 | import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; | |
| 2316 | +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage; | |
| 2317 | import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
| 2318 | +import net.sf.l2j.gameserver.network.serverpackets.PlaySound; | |
| 2319 | import net.sf.l2j.gameserver.scripting.QuestState; | |
| 2320 | ||
| 2321 | +import Base.Skin.DressMeData; | |
| 2322 | +import Base.Skin.SkinPackage; | |
| 2323 | + | |
| 2324 | public final class RequestBypassToServer extends L2GameClientPacket | |
| 2325 | {
| |
| 2326 | private static final Logger GMAUDIT_LOG = Logger.getLogger("gmaudit");
| |
| 2327 | @@ -72,6 +92,436 @@ | |
| 2328 | ||
| 2329 | ach.useAdminCommand(_command, player); | |
| 2330 | } | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + else if (_command.startsWith("voiced_"))
| |
| 2337 | + {
| |
| 2338 | + String command = _command.split(" ")[0];
| |
| 2339 | + | |
| 2340 | + IVoicedCommandHandler ach = VoicedCommandHandler.getInstance().getHandler(_command.substring(7)); | |
| 2341 | + | |
| 2342 | + if (ach == null) | |
| 2343 | + {
| |
| 2344 | + player.sendMessage("The command " + command.substring(7) + " does not exist!");
| |
| 2345 | + LOGGER.warn("No handler registered for command '" + _command + "'");
| |
| 2346 | + return; | |
| 2347 | + } | |
| 2348 | + ach.useVoicedCommand(_command.substring(7), player, null); | |
| 2349 | + } | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | +else if (_command.startsWith("custom_"))
| |
| 2355 | +{
| |
| 2356 | +Player player2 = getClient().getPlayer(); | |
| 2357 | +CustomBypassHandler.getInstance().handleBypass(player2, _command); | |
| 2358 | +} | |
| 2359 | + | |
| 2360 | + | |
| 2361 | +else if (_command.startsWith("dressme"))
| |
| 2362 | +{
| |
| 2363 | +if (!Config.ALLOW_DRESS_ME_IN_OLY && player.isInOlympiadMode()) | |
| 2364 | +{
| |
| 2365 | + player.sendMessage("DressMe can't be used on The Olympiad game.");
| |
| 2366 | + return; | |
| 2367 | +} | |
| 2368 | + | |
| 2369 | +StringTokenizer st = new StringTokenizer(_command, " "); | |
| 2370 | +st.nextToken(); | |
| 2371 | +if (!st.hasMoreTokens()) | |
| 2372 | +{
| |
| 2373 | + showDressMeMainPage(player); | |
| 2374 | + return; | |
| 2375 | +} | |
| 2376 | +int page = Integer.parseInt(st.nextToken()); | |
| 2377 | + | |
| 2378 | +if (!st.hasMoreTokens()) | |
| 2379 | +{
| |
| 2380 | + showDressMeMainPage(player); | |
| 2381 | + return; | |
| 2382 | +} | |
| 2383 | +String next = st.nextToken(); | |
| 2384 | +if (next.startsWith("skinlist"))
| |
| 2385 | +{
| |
| 2386 | + String type = st.nextToken(); | |
| 2387 | + showSkinList(player, type, page); | |
| 2388 | +} | |
| 2389 | +else if (next.startsWith("myskinlist"))
| |
| 2390 | +{
| |
| 2391 | + | |
| 2392 | + showMySkinList(player, page); | |
| 2393 | +} | |
| 2394 | +if (next.equals("clean"))
| |
| 2395 | +{
| |
| 2396 | + String type = st.nextToken(); | |
| 2397 | + | |
| 2398 | + if (player.isTryingSkin()) | |
| 2399 | + {
| |
| 2400 | + player.sendMessage("You can't do this while trying a skin.");
| |
| 2401 | + player.sendPacket(new ExShowScreenMessage("You can't do this while trying a skin.", 2000));
| |
| 2402 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2403 | + showDressMeMainPage(player); | |
| 2404 | + return; | |
| 2405 | + } | |
| 2406 | + | |
| 2407 | + switch (type.toLowerCase()) | |
| 2408 | + {
| |
| 2409 | + case "armor": | |
| 2410 | + player.setArmorSkinOption(0); | |
| 2411 | + break; | |
| 2412 | + case "weapon": | |
| 2413 | + player.setWeaponSkinOption(0); | |
| 2414 | + break; | |
| 2415 | + case "hair": | |
| 2416 | + player.setHairSkinOption(0); | |
| 2417 | + break; | |
| 2418 | + case "face": | |
| 2419 | + player.setFaceSkinOption(0); | |
| 2420 | + break; | |
| 2421 | + case "shield": | |
| 2422 | + player.setShieldSkinOption(0); | |
| 2423 | + break; | |
| 2424 | + } | |
| 2425 | + | |
| 2426 | + player.broadcastUserInfo(); | |
| 2427 | + showMySkinList(player, page); | |
| 2428 | +} | |
| 2429 | +else if (next.startsWith("buyskin"))
| |
| 2430 | +{
| |
| 2431 | + if (!st.hasMoreTokens()) | |
| 2432 | + {
| |
| 2433 | + showDressMeMainPage(player); | |
| 2434 | + return; | |
| 2435 | + } | |
| 2436 | + | |
| 2437 | + int skinId = Integer.parseInt(st.nextToken()); | |
| 2438 | + String type = st.nextToken(); | |
| 2439 | + int itemId = Integer.parseInt(st.nextToken()); | |
| 2440 | + | |
| 2441 | + SkinPackage sp = null; | |
| 2442 | + | |
| 2443 | + switch (type.toLowerCase()) | |
| 2444 | + {
| |
| 2445 | + case "armor": | |
| 2446 | + sp = DressMeData.getInstance().getArmorSkinsPackage(skinId); | |
| 2447 | + break; | |
| 2448 | + case "weapon": | |
| 2449 | + sp = DressMeData.getInstance().getWeaponSkinsPackage(skinId); | |
| 2450 | + | |
| 2451 | + if (player.getActiveWeaponItem() == null) | |
| 2452 | + {
| |
| 2453 | + player.sendMessage("You can't buy this skin without a weapon.");
| |
| 2454 | + player.sendPacket(new ExShowScreenMessage("You can't buy this skin without a weapon.", 2000));
| |
| 2455 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2456 | + showSkinList(player, type, page); | |
| 2457 | + return; | |
| 2458 | + } | |
| 2459 | + | |
| 2460 | + ItemInstance skinWeapon = null; | |
| 2461 | + if (ItemData.getInstance().getTemplate(itemId) != null) | |
| 2462 | + {
| |
| 2463 | + skinWeapon = ItemData.getInstance().createDummyItem(itemId); | |
| 2464 | + | |
| 2465 | + if (!checkWeapons(player, skinWeapon, WeaponType.BOW, WeaponType.BOW) // | |
| 2466 | + || !checkWeapons(player, skinWeapon, WeaponType.SWORD, WeaponType.SWORD) // | |
| 2467 | + || !checkWeapons(player, skinWeapon, WeaponType.BLUNT, WeaponType.BLUNT) // | |
| 2468 | + || !checkWeapons(player, skinWeapon, WeaponType.DAGGER, WeaponType.DAGGER) // | |
| 2469 | + || !checkWeapons(player, skinWeapon, WeaponType.POLE, WeaponType.POLE) // | |
| 2470 | + || !checkWeapons(player, skinWeapon, WeaponType.DUAL, WeaponType.DUAL) // | |
| 2471 | + || !checkWeapons(player, skinWeapon, WeaponType.DUALFIST, WeaponType.DUALFIST) // | |
| 2472 | + || !checkWeapons(player, skinWeapon, WeaponType.BIGSWORD, WeaponType.BIGSWORD) // | |
| 2473 | + || !checkWeapons(player, skinWeapon, WeaponType.FIST, WeaponType.FIST) // | |
| 2474 | + || !checkWeapons(player, skinWeapon, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT)) | |
| 2475 | + {
| |
| 2476 | + player.sendMessage("This skin is not suitable for your weapon type.");
| |
| 2477 | + player.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000));
| |
| 2478 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2479 | + showSkinList(player, type, page); | |
| 2480 | + return; | |
| 2481 | + } | |
| 2482 | + } | |
| 2483 | + break; | |
| 2484 | + case "hair": | |
| 2485 | + sp = DressMeData.getInstance().getHairSkinsPackage(skinId); | |
| 2486 | + break; | |
| 2487 | + case "face": | |
| 2488 | + sp = DressMeData.getInstance().getFaceSkinsPackage(skinId); | |
| 2489 | + break; | |
| 2490 | + case "shield": | |
| 2491 | + sp = DressMeData.getInstance().getShieldSkinsPackage(skinId); | |
| 2492 | + if (player.getActiveWeaponItem() == null) | |
| 2493 | + {
| |
| 2494 | + player.sendMessage("You can't buy this skin without a weapon.");
| |
| 2495 | + player.sendPacket(new ExShowScreenMessage("You can't buy this skin without a weapon.", 2000));
| |
| 2496 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2497 | + showSkinList(player, type, page); | |
| 2498 | + return; | |
| 2499 | + } | |
| 2500 | + | |
| 2501 | + ItemInstance skinShield = null; | |
| 2502 | + if (ItemData.getInstance().getTemplate(itemId) != null) | |
| 2503 | + {
| |
| 2504 | + skinShield = ItemData.getInstance().createDummyItem(itemId); | |
| 2505 | + | |
| 2506 | + if (!checkWeapons(player, skinShield, WeaponType.BOW, WeaponType.BOW) // | |
| 2507 | + || !checkWeapons(player, skinShield, WeaponType.POLE, WeaponType.POLE) // | |
| 2508 | + || !checkWeapons(player, skinShield, WeaponType.DUAL, WeaponType.DUAL) // | |
| 2509 | + || !checkWeapons(player, skinShield, WeaponType.DUALFIST, WeaponType.DUALFIST) // | |
| 2510 | + || !checkWeapons(player, skinShield, WeaponType.BIGSWORD, WeaponType.BIGSWORD) // | |
| 2511 | + || !checkWeapons(player, skinShield, WeaponType.FIST, WeaponType.FIST) // | |
| 2512 | + || !checkWeapons(player, skinShield, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT)) | |
| 2513 | + {
| |
| 2514 | + player.sendMessage("This skin is not suitable for your weapon type.");
| |
| 2515 | + player.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000));
| |
| 2516 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2517 | + showSkinList(player, type, page); | |
| 2518 | + return; | |
| 2519 | + } | |
| 2520 | + } | |
| 2521 | + break; | |
| 2522 | + } | |
| 2523 | + | |
| 2524 | + if (sp == null) | |
| 2525 | + {
| |
| 2526 | + player.sendMessage("There is no such skin.");
| |
| 2527 | + player.sendPacket(new ExShowScreenMessage("There is no such skin.", 2000));
| |
| 2528 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2529 | + showSkinList(player, type, page); | |
| 2530 | + return; | |
| 2531 | + } | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + if (player.destroyItemByItemId("dressme", sp.getPriceId(), sp.getPriceCount(), player, true))
| |
| 2535 | + {
| |
| 2536 | + player.sendMessage("You have successfully purchased " + sp.getName() + " skin.");
| |
| 2537 | + player.sendPacket(new ExShowScreenMessage("You have successfully purchased " + sp.getName() + " skin.", 2000));
| |
| 2538 | + | |
| 2539 | + switch (type.toLowerCase()) | |
| 2540 | + {
| |
| 2541 | + case "armor": | |
| 2542 | + player.buyArmorSkin(skinId); | |
| 2543 | + player.setArmorSkinOption(skinId); | |
| 2544 | + break; | |
| 2545 | + case "weapon": | |
| 2546 | + player.buyWeaponSkin(skinId); | |
| 2547 | + player.setWeaponSkinOption(skinId); | |
| 2548 | + break; | |
| 2549 | + case "hair": | |
| 2550 | + player.buyHairSkin(skinId); | |
| 2551 | + player.setHairSkinOption(skinId); | |
| 2552 | + break; | |
| 2553 | + case "face": | |
| 2554 | + player.buyFaceSkin(skinId); | |
| 2555 | + player.setFaceSkinOption(skinId); | |
| 2556 | + break; | |
| 2557 | + case "shield": | |
| 2558 | + player.buyShieldSkin(skinId); | |
| 2559 | + player.setShieldSkinOption(skinId); | |
| 2560 | + break; | |
| 2561 | + } | |
| 2562 | + | |
| 2563 | + player.broadcastUserInfo(); | |
| 2564 | + } | |
| 2565 | + showSkinList(player, type, page); | |
| 2566 | +} | |
| 2567 | +else if (next.startsWith("tryskin"))
| |
| 2568 | +{
| |
| 2569 | + | |
| 2570 | + int skinId = Integer.parseInt(st.nextToken()); | |
| 2571 | + | |
| 2572 | + String type = st.nextToken(); | |
| 2573 | + | |
| 2574 | + if (player.isTryingSkin()) | |
| 2575 | + {
| |
| 2576 | + player.sendMessage("You are already trying a skin.");
| |
| 2577 | + player.sendPacket(new ExShowScreenMessage("You are already trying a skin.", 2000));
| |
| 2578 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2579 | + showSkinList(player, type, page); | |
| 2580 | + return; | |
| 2581 | + } | |
| 2582 | + | |
| 2583 | + player.setIsTryingSkin(true); | |
| 2584 | + | |
| 2585 | + int oldArmorSkinId = player.getArmorSkinOption(); | |
| 2586 | + int oldWeaponSkinId = player.getWeaponSkinOption(); | |
| 2587 | + int oldHairSkinId = player.getHairSkinOption(); | |
| 2588 | + int oldFaceSkinId = player.getFaceSkinOption(); | |
| 2589 | + int oldShieldSkinId = player.getShieldSkinOption(); | |
| 2590 | + | |
| 2591 | + switch (type.toLowerCase()) | |
| 2592 | + {
| |
| 2593 | + case "armor": | |
| 2594 | + player.setArmorSkinOption(skinId); | |
| 2595 | + break; | |
| 2596 | + case "weapon": | |
| 2597 | + player.setWeaponSkinOption(skinId); | |
| 2598 | + break; | |
| 2599 | + case "hair": | |
| 2600 | + player.setHairSkinOption(skinId); | |
| 2601 | + break; | |
| 2602 | + case "face": | |
| 2603 | + player.setFaceSkinOption(skinId); | |
| 2604 | + break; | |
| 2605 | + case "shield": | |
| 2606 | + | |
| 2607 | + player.setShieldSkinOption(skinId); | |
| 2608 | + | |
| 2609 | + break; | |
| 2610 | + } | |
| 2611 | + | |
| 2612 | + player.broadcastUserInfo(); | |
| 2613 | + showSkinList(player, type, page); | |
| 2614 | + | |
| 2615 | + ThreadPool.schedule(() -> | |
| 2616 | + {
| |
| 2617 | + switch (type.toLowerCase()) | |
| 2618 | + {
| |
| 2619 | + case "armor": | |
| 2620 | + player.setArmorSkinOption(oldArmorSkinId); | |
| 2621 | + break; | |
| 2622 | + case "weapon": | |
| 2623 | + player.setWeaponSkinOption(oldWeaponSkinId); | |
| 2624 | + break; | |
| 2625 | + case "hair": | |
| 2626 | + player.setHairSkinOption(oldHairSkinId); | |
| 2627 | + break; | |
| 2628 | + case "face": | |
| 2629 | + player.setFaceSkinOption(oldFaceSkinId); | |
| 2630 | + break; | |
| 2631 | + case "shield": | |
| 2632 | + player.setShieldSkinOption(oldShieldSkinId); | |
| 2633 | + break; | |
| 2634 | + } | |
| 2635 | + | |
| 2636 | + player.broadcastUserInfo(); | |
| 2637 | + player.setIsTryingSkin(false); | |
| 2638 | + }, 5000); | |
| 2639 | +} | |
| 2640 | +else if (next.startsWith("setskin"))
| |
| 2641 | +{
| |
| 2642 | + int id = Integer.parseInt(st.nextToken()); | |
| 2643 | + String type = st.nextToken(); | |
| 2644 | + int itemId = Integer.parseInt(st.nextToken()); | |
| 2645 | + | |
| 2646 | + if (player.isTryingSkin()) | |
| 2647 | + {
| |
| 2648 | + player.sendMessage("You can't do this while trying skins.");
| |
| 2649 | + player.sendPacket(new ExShowScreenMessage("You can't do this while trying skins.", 2000));
| |
| 2650 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2651 | + showMySkinList(player, page); | |
| 2652 | + return; | |
| 2653 | + } | |
| 2654 | + | |
| 2655 | + if (type.toLowerCase().contains("armor") && player.hasEquippedArmorSkin(String.valueOf(id)) || type.toLowerCase().contains("weapon") && player.hasEquippedWeaponSkin(String.valueOf(id))
| |
| 2656 | + || type.toLowerCase().contains("hair") && player.hasEquippedHairSkin(String.valueOf(id)) || type.toLowerCase().contains("face") && player.hasEquippedFaceSkin(String.valueOf(id)))
| |
| 2657 | + {
| |
| 2658 | + player.sendMessage("You are already equipped this skin.");
| |
| 2659 | + player.sendPacket(new ExShowScreenMessage("You are already equipped this skin.", 2000));
| |
| 2660 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2661 | + showMySkinList(player, page); | |
| 2662 | + return; | |
| 2663 | + } | |
| 2664 | + | |
| 2665 | + switch (type.toLowerCase()) | |
| 2666 | + {
| |
| 2667 | + case "armor": | |
| 2668 | + player.setArmorSkinOption(id); | |
| 2669 | + break; | |
| 2670 | + case "weapon": | |
| 2671 | + if (player.getActiveWeaponItem() == null) | |
| 2672 | + {
| |
| 2673 | + player.sendMessage("You can't use this skin without a weapon.");
| |
| 2674 | + player.sendPacket(new ExShowScreenMessage("You can't use this skin without a weapon.", 2000));
| |
| 2675 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2676 | + showMySkinList(player, page); | |
| 2677 | + return; | |
| 2678 | + } | |
| 2679 | + | |
| 2680 | + ItemInstance skinWeapon = null; | |
| 2681 | + if (ItemData.getInstance().getTemplate(itemId) != null) | |
| 2682 | + {
| |
| 2683 | + skinWeapon = ItemData.getInstance().createDummyItem(itemId); | |
| 2684 | + | |
| 2685 | + if (!checkWeapons(player, skinWeapon, WeaponType.BOW, WeaponType.BOW) // | |
| 2686 | + || !checkWeapons(player, skinWeapon, WeaponType.SWORD, WeaponType.SWORD) // | |
| 2687 | + || !checkWeapons(player, skinWeapon, WeaponType.BLUNT, WeaponType.BLUNT) // | |
| 2688 | + || !checkWeapons(player, skinWeapon, WeaponType.DAGGER, WeaponType.DAGGER) // | |
| 2689 | + || !checkWeapons(player, skinWeapon, WeaponType.POLE, WeaponType.POLE) // | |
| 2690 | + || !checkWeapons(player, skinWeapon, WeaponType.DUAL, WeaponType.DUAL) // | |
| 2691 | + || !checkWeapons(player, skinWeapon, WeaponType.DUALFIST, WeaponType.DUALFIST) // | |
| 2692 | + || !checkWeapons(player, skinWeapon, WeaponType.BIGSWORD, WeaponType.BIGSWORD) // | |
| 2693 | + || !checkWeapons(player, skinWeapon, WeaponType.FIST, WeaponType.FIST) // | |
| 2694 | + || !checkWeapons(player, skinWeapon, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT)) | |
| 2695 | + {
| |
| 2696 | + player.sendMessage("This skin is not suitable for your weapon type.");
| |
| 2697 | + player.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000));
| |
| 2698 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2699 | + showMySkinList(player, page); | |
| 2700 | + return; | |
| 2701 | + } | |
| 2702 | + | |
| 2703 | + player.setWeaponSkinOption(id); | |
| 2704 | + } | |
| 2705 | + break; | |
| 2706 | + case "hair": | |
| 2707 | + player.setHairSkinOption(id); | |
| 2708 | + break; | |
| 2709 | + case "face": | |
| 2710 | + player.setFaceSkinOption(id); | |
| 2711 | + break; | |
| 2712 | + case "shield": | |
| 2713 | + if (player.getActiveWeaponItem() == null) | |
| 2714 | + {
| |
| 2715 | + player.sendMessage("You can't use this skin without a weapon.");
| |
| 2716 | + player.sendPacket(new ExShowScreenMessage("You can't use this skin without a weapon.", 2000));
| |
| 2717 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2718 | + showMySkinList(player, page); | |
| 2719 | + return; | |
| 2720 | + } | |
| 2721 | + | |
| 2722 | + ItemInstance skinShield = null; | |
| 2723 | + if (ItemData.getInstance().getTemplate(itemId) != null) | |
| 2724 | + {
| |
| 2725 | + skinShield = ItemData.getInstance().createDummyItem(itemId); | |
| 2726 | + | |
| 2727 | + if (!checkWeapons(player, skinShield, WeaponType.BOW, WeaponType.BOW) // | |
| 2728 | + || !checkWeapons(player, skinShield, WeaponType.POLE, WeaponType.POLE) // | |
| 2729 | + || !checkWeapons(player, skinShield, WeaponType.DUAL, WeaponType.DUAL) // | |
| 2730 | + || !checkWeapons(player, skinShield, WeaponType.DUALFIST, WeaponType.DUALFIST) // | |
| 2731 | + || !checkWeapons(player, skinShield, WeaponType.BIGSWORD, WeaponType.BIGSWORD) // | |
| 2732 | + || !checkWeapons(player, skinShield, WeaponType.FIST, WeaponType.FIST) // | |
| 2733 | + || !checkWeapons(player, skinShield, WeaponType.BIGBLUNT, WeaponType.BIGBLUNT)) | |
| 2734 | + {
| |
| 2735 | + player.sendMessage("This skin is not suitable for your weapon type.");
| |
| 2736 | + player.sendPacket(new ExShowScreenMessage("This skin is not suitable for your weapon type.", 2000));
| |
| 2737 | + player.sendPacket(new PlaySound("ItemSound3.sys_impossible"));
| |
| 2738 | + showMySkinList(player, page); | |
| 2739 | + return; | |
| 2740 | + } | |
| 2741 | + | |
| 2742 | + player.setShieldSkinOption(id); | |
| 2743 | + } | |
| 2744 | + | |
| 2745 | + break; | |
| 2746 | + } | |
| 2747 | + | |
| 2748 | + player.broadcastUserInfo(); | |
| 2749 | + showMySkinList(player, page); | |
| 2750 | +} | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + } | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | else if (_command.startsWith("player_help "))
| |
| 2762 | {
| |
| 2763 | final String path = _command.substring(12); | |
| 2764 | @@ -186,4 +636,263 @@ | |
| 2765 | player.enterOlympiadObserverMode(arenaId); | |
| 2766 | } | |
| 2767 | } | |
| 2768 | + | |
| 2769 | + public static String getItemNameById(int itemId) | |
| 2770 | + {
| |
| 2771 | + Item item = ItemData.getInstance().getTemplate(itemId); | |
| 2772 | + | |
| 2773 | + String itemName = "NoName"; | |
| 2774 | + | |
| 2775 | + if (itemId != 0) | |
| 2776 | + {
| |
| 2777 | + itemName = item.getName(); | |
| 2778 | + } | |
| 2779 | + | |
| 2780 | + return itemName; | |
| 2781 | + } | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + public static void showDressMeMainPage(Player player) | |
| 2785 | + {
| |
| 2786 | + NpcHtmlMessage htm = new NpcHtmlMessage(1); | |
| 2787 | + String text = HtmCache.getInstance().getHtm("data/html/dressme/index.htm");
| |
| 2788 | + | |
| 2789 | + htm.setHtml(text); | |
| 2790 | + | |
| 2791 | + {
| |
| 2792 | + htm.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
| |
| 2793 | + htm.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
| |
| 2794 | + | |
| 2795 | + } | |
| 2796 | + | |
| 2797 | + player.sendPacket(htm); | |
| 2798 | + } | |
| 2799 | + | |
| 2800 | + static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
| |
| 2801 | + | |
| 2802 | + private static void showSkinList(Player player, String type, int page) | |
| 2803 | + {
| |
| 2804 | + NpcHtmlMessage html = new NpcHtmlMessage(1); | |
| 2805 | + | |
| 2806 | + html.setFile("data/html/dressme/allskins.htm");
| |
| 2807 | + | |
| 2808 | + html.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
| |
| 2809 | + html.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
| |
| 2810 | + | |
| 2811 | + final int ITEMS_PER_PAGE = 8; | |
| 2812 | + | |
| 2813 | + int myPage = 1; | |
| 2814 | + int i = 0; | |
| 2815 | + int shown = 0; | |
| 2816 | + boolean hasMore = false; | |
| 2817 | + int itemId = 0; | |
| 2818 | + | |
| 2819 | + final StringBuilder sb = new StringBuilder(); | |
| 2820 | + | |
| 2821 | + List<SkinPackage> tempList = null; | |
| 2822 | + switch (type.toLowerCase()) | |
| 2823 | + {
| |
| 2824 | + case "armor": | |
| 2825 | + tempList = DressMeData.getInstance().getArmorSkinOptions().values().stream().filter(s -> !player.hasArmorSkin(s.getId())).collect(Collectors.toList()); | |
| 2826 | + break; | |
| 2827 | + case "weapon": | |
| 2828 | + tempList = DressMeData.getInstance().getWeaponSkinOptions().values().stream().filter(s -> !player.hasWeaponSkin(s.getId())).collect(Collectors.toList()); | |
| 2829 | + break; | |
| 2830 | + case "hair": | |
| 2831 | + tempList = DressMeData.getInstance().getHairSkinOptions().values().stream().filter(s -> !player.hasHairSkin(s.getId())).collect(Collectors.toList()); | |
| 2832 | + break; | |
| 2833 | + case "face": | |
| 2834 | + tempList = DressMeData.getInstance().getFaceSkinOptions().values().stream().filter(s -> !player.hasFaceSkin(s.getId())).collect(Collectors.toList()); | |
| 2835 | + break; | |
| 2836 | + case "shield": | |
| 2837 | + tempList = DressMeData.getInstance().getShieldSkinOptions().values().stream().filter(s -> !player.hasShieldSkin(s.getId())).collect(Collectors.toList()); | |
| 2838 | + break; | |
| 2839 | + } | |
| 2840 | + | |
| 2841 | + if (tempList != null && !tempList.isEmpty()) | |
| 2842 | + {
| |
| 2843 | + for (SkinPackage sp : tempList) | |
| 2844 | + {
| |
| 2845 | + if (sp == null) | |
| 2846 | + {
| |
| 2847 | + continue; | |
| 2848 | + } | |
| 2849 | + | |
| 2850 | + if (shown == ITEMS_PER_PAGE) | |
| 2851 | + {
| |
| 2852 | + hasMore = true; | |
| 2853 | + break; | |
| 2854 | + } | |
| 2855 | + | |
| 2856 | + if (myPage != page) | |
| 2857 | + {
| |
| 2858 | + i++; | |
| 2859 | + if (i == ITEMS_PER_PAGE) | |
| 2860 | + {
| |
| 2861 | + myPage++; | |
| 2862 | + i = 0; | |
| 2863 | + } | |
| 2864 | + continue; | |
| 2865 | + } | |
| 2866 | + | |
| 2867 | + if (shown == ITEMS_PER_PAGE) | |
| 2868 | + {
| |
| 2869 | + hasMore = true; | |
| 2870 | + break; | |
| 2871 | + } | |
| 2872 | + | |
| 2873 | + switch (type.toLowerCase()) | |
| 2874 | + {
| |
| 2875 | + case "armor": | |
| 2876 | + itemId = sp.getChestId(); | |
| 2877 | + break; | |
| 2878 | + case "weapon": | |
| 2879 | + itemId = sp.getWeaponId(); | |
| 2880 | + break; | |
| 2881 | + case "hair": | |
| 2882 | + itemId = sp.getHairId(); | |
| 2883 | + break; | |
| 2884 | + case "face": | |
| 2885 | + itemId = sp.getFaceId(); | |
| 2886 | + break; | |
| 2887 | + case "shield": | |
| 2888 | + itemId = sp.getShieldId(); | |
| 2889 | + break; | |
| 2890 | + } | |
| 2891 | + | |
| 2892 | + sb.append("<table border=0 cellspacing=0 cellpadding=2 height=36><tr>");
| |
| 2893 | + sb.append("<td width=32 align=center>" + "<button width=32 height=32 back=" + Item.getItemIcon(itemId) + " fore=" + Item.getItemIcon(itemId) + ">" + "</td>");
| |
| 2894 | + sb.append("<td width=124>" + sp.getName() + "<br1> <font color=999999>Price:</font> <font color=339966>" + Item.getItemNameById(sp.getPriceId()) + "</font> (<font color=LEVEL>" + sp.getPriceCount() + "</font>)</td>");
| |
| 2895 | + sb.append("<td align=center width=65>" + "<button value=\"Buy\" action=\"bypass -h dressme " + page + " buyskin " + sp.getId() + " " + type + " " + itemId + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
| |
| 2896 | + sb.append("<td align=center width=65>" + "<button value=\"Try\" action=\"bypass -h dressme " + page + " tryskin " + sp.getId() + " " + type + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
| |
| 2897 | + | |
| 2898 | + sb.append("</tr></table>");
| |
| 2899 | + sb.append("<img src=\"L2UI.Squaregray\" width=\"300\" height=\"1\">");
| |
| 2900 | + shown++; | |
| 2901 | + } | |
| 2902 | + } | |
| 2903 | + | |
| 2904 | + sb.append("<table width=300><tr>");
| |
| 2905 | + sb.append("<td align=center width=70>" + (page > 1 ? "<button value=\"< PREV\" action=\"bypass -h dressme " + (page - 1) + " skinlist " + type + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
| |
| 2906 | + sb.append("<td align=center width=140>Page: " + page + "</td>");
| |
| 2907 | + sb.append("<td align=center width=70>" + (hasMore ? "<button value=\"NEXT >\" action=\"bypass -h dressme " + (page + 1) + " skinlist " + type + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
| |
| 2908 | + sb.append("</tr></table>");
| |
| 2909 | + | |
| 2910 | + html.replace("%showList%", sb.toString());
| |
| 2911 | + player.sendPacket(html); | |
| 2912 | + } | |
| 2913 | + | |
| 2914 | + private static void showMySkinList(Player player, int page) | |
| 2915 | + {
| |
| 2916 | + NpcHtmlMessage html = new NpcHtmlMessage(1); | |
| 2917 | + html.setFile("data/html/dressme/myskins.htm");
| |
| 2918 | + | |
| 2919 | + html.replace("%time%", sdf.format(new Date(System.currentTimeMillis())));
| |
| 2920 | + html.replace("%dat%", (new SimpleDateFormat("dd/MM/yyyy")).format(new Date(System.currentTimeMillis())));
| |
| 2921 | + | |
| 2922 | + final int ITEMS_PER_PAGE = 8; | |
| 2923 | + int itemId = 0; | |
| 2924 | + | |
| 2925 | + int myPage = 1; | |
| 2926 | + int i = 0; | |
| 2927 | + int shown = 0; | |
| 2928 | + boolean hasMore = false; | |
| 2929 | + | |
| 2930 | + final StringBuilder sb = new StringBuilder(); | |
| 2931 | + | |
| 2932 | + List<SkinPackage> armors = DressMeData.getInstance().getArmorSkinOptions().values().stream().filter(s -> player.hasArmorSkin(s.getId())).collect(Collectors.toList()); | |
| 2933 | + List<SkinPackage> weapons = DressMeData.getInstance().getWeaponSkinOptions().values().stream().filter(s -> player.hasWeaponSkin(s.getId())).collect(Collectors.toList()); | |
| 2934 | + List<SkinPackage> hairs = DressMeData.getInstance().getHairSkinOptions().values().stream().filter(s -> player.hasHairSkin(s.getId())).collect(Collectors.toList()); | |
| 2935 | + List<SkinPackage> faces = DressMeData.getInstance().getFaceSkinOptions().values().stream().filter(s -> player.hasFaceSkin(s.getId())).collect(Collectors.toList()); | |
| 2936 | + List<SkinPackage> shield = DressMeData.getInstance().getShieldSkinOptions().values().stream().filter(s -> player.hasShieldSkin(s.getId())).collect(Collectors.toList()); | |
| 2937 | + | |
| 2938 | + List<SkinPackage> list = Stream.concat(armors.stream(), weapons.stream()).collect(Collectors.toList()); | |
| 2939 | + shield.stream().collect(Collectors.toList()); | |
| 2940 | + List<SkinPackage> list2 = Stream.concat(hairs.stream(), shield.stream()).collect(Collectors.toList()); | |
| 2941 | + List<SkinPackage> list3 = faces.stream().collect(Collectors.toList()); | |
| 2942 | + | |
| 2943 | + List<SkinPackage> allLists = Stream.concat(list.stream(),Stream.concat(list2.stream(), list3.stream())).collect(Collectors.toList()); | |
| 2944 | + | |
| 2945 | + if (!allLists.isEmpty()) | |
| 2946 | + {
| |
| 2947 | + for (SkinPackage sp : allLists) | |
| 2948 | + {
| |
| 2949 | + if (sp == null) | |
| 2950 | + {
| |
| 2951 | + continue; | |
| 2952 | + } | |
| 2953 | + | |
| 2954 | + if (shown == ITEMS_PER_PAGE) | |
| 2955 | + {
| |
| 2956 | + hasMore = true; | |
| 2957 | + break; | |
| 2958 | + } | |
| 2959 | + | |
| 2960 | + if (myPage != page) | |
| 2961 | + {
| |
| 2962 | + i++; | |
| 2963 | + if (i == ITEMS_PER_PAGE) | |
| 2964 | + {
| |
| 2965 | + myPage++; | |
| 2966 | + i = 0; | |
| 2967 | + } | |
| 2968 | + continue; | |
| 2969 | + } | |
| 2970 | + | |
| 2971 | + if (shown == ITEMS_PER_PAGE) | |
| 2972 | + {
| |
| 2973 | + hasMore = true; | |
| 2974 | + break; | |
| 2975 | + } | |
| 2976 | + | |
| 2977 | + switch (sp.getType().toLowerCase()) | |
| 2978 | + {
| |
| 2979 | + case "armor": | |
| 2980 | + itemId = sp.getChestId(); | |
| 2981 | + break; | |
| 2982 | + case "weapon": | |
| 2983 | + itemId = sp.getWeaponId(); | |
| 2984 | + break; | |
| 2985 | + case "hair": | |
| 2986 | + itemId = sp.getHairId(); | |
| 2987 | + break; | |
| 2988 | + case "face": | |
| 2989 | + itemId = sp.getFaceId(); | |
| 2990 | + break; | |
| 2991 | + case "shield": | |
| 2992 | + itemId = sp.getShieldId(); | |
| 2993 | + break; | |
| 2994 | + } | |
| 2995 | + | |
| 2996 | + sb.append("<table border=0 cellspacing=0 cellpadding=2 height=36><tr>");
| |
| 2997 | + sb.append("<td width=32 align=center>" + "<button width=32 height=32 back=" + Item.getItemIcon(itemId) + " fore=" + Item.getItemIcon(itemId) + ">" + "</td>");
| |
| 2998 | + sb.append("<td width=124>" + sp.getName() + "</td>");
| |
| 2999 | + sb.append("<td align=center width=65>" + "<button value=\"Equip\" action=\"bypass -h dressme " + page + " setskin " + sp.getId() + " " + sp.getType() + " " + itemId + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
| |
| 3000 | + sb.append("<td align=center width=65>" + "<button value=\"Remove\" action=\"bypass -h dressme " + page + " clean " + sp.getType() + "\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" + "</td>");
| |
| 3001 | + sb.append("</tr></table>");
| |
| 3002 | + sb.append("<img src=\"L2UI.Squaregray\" width=\"300\" height=\"1\">");
| |
| 3003 | + shown++; | |
| 3004 | + } | |
| 3005 | + } | |
| 3006 | + | |
| 3007 | + sb.append("<table width=300><tr>");
| |
| 3008 | + sb.append("<td align=center width=70>" + (page > 1 ? "<button value=\"< PREV\" action=\"bypass -h dressme " + (page - 1) + " myskinlist\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
| |
| 3009 | + sb.append("<td align=center width=140>Page: " + page + "</td>");
| |
| 3010 | + sb.append("<td align=center width=70>" + (hasMore ? "<button value=\"NEXT >\" action=\"bypass -h dressme " + (page + 1) + " myskinlist\" width=65 height=19 back=L2UI_ch3.smallbutton2_over fore=L2UI_ch3.smallbutton2>" : "") + "</td>");
| |
| 3011 | + sb.append("</tr></table>");
| |
| 3012 | + | |
| 3013 | + html.replace("%showList%", sb.toString());
| |
| 3014 | + player.sendPacket(html); | |
| 3015 | + } | |
| 3016 | + | |
| 3017 | + public static boolean checkWeapons(Player player, ItemInstance skin, WeaponType weapon1, WeaponType weapon2) | |
| 3018 | + {
| |
| 3019 | + if (player.getActiveWeaponItem().getItemType() == weapon1 && skin.getItem().getItemType() != weapon2) | |
| 3020 | + {
| |
| 3021 | + return false; | |
| 3022 | + } | |
| 3023 | + | |
| 3024 | + return true; | |
| 3025 | + } | |
| 3026 | + | |
| 3027 | } | |
| 3028 | \ No newline at end of file | |
| 3029 | diff --git java/net/sf/l2j/gameserver/network/serverpackets/CharSelectInfo.java java/net/sf/l2j/gameserver/network/serverpackets/CharSelectInfo.java | |
| 3030 | index 473b3fc..9ea446b 100644 | |
| 3031 | --- java/net/sf/l2j/gameserver/network/serverpackets/CharSelectInfo.java | |
| 3032 | +++ java/net/sf/l2j/gameserver/network/serverpackets/CharSelectInfo.java | |
| 3033 | @@ -8,12 +8,16 @@ | |
| 3034 | ||
| 3035 | import net.sf.l2j.commons.pool.ConnectionPool; | |
| 3036 | ||
| 3037 | +import net.sf.l2j.Config; | |
| 3038 | import net.sf.l2j.gameserver.data.sql.ClanTable; | |
| 3039 | import net.sf.l2j.gameserver.enums.Paperdoll; | |
| 3040 | import net.sf.l2j.gameserver.model.CharSelectSlot; | |
| 3041 | import net.sf.l2j.gameserver.model.pledge.Clan; | |
| 3042 | import net.sf.l2j.gameserver.network.GameClient; | |
| 3043 | ||
| 3044 | +import Base.Skin.DressMeData; | |
| 3045 | +import Base.Skin.SkinPackage; | |
| 3046 | + | |
| 3047 | public class CharSelectInfo extends L2GameServerPacket | |
| 3048 | {
| |
| 3049 | private static final String SELECT_INFOS = "SELECT obj_Id, char_name, level, maxHp, curHp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, accesslevel, online, lastAccess, base_class FROM characters WHERE account_name=?"; | |
| 3050 | @@ -111,16 +115,77 @@ | |
| 3051 | writeD(slot.getPaperdollObjectId(Paperdoll.RFINGER)); | |
| 3052 | writeD(slot.getPaperdollObjectId(Paperdoll.LFINGER)); | |
| 3053 | writeD(slot.getPaperdollObjectId(Paperdoll.HEAD)); | |
| 3054 | - writeD(slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3055 | - writeD(slot.getPaperdollObjectId(Paperdoll.LHAND)); | |
| 3056 | - writeD(slot.getPaperdollObjectId(Paperdoll.GLOVES)); | |
| 3057 | - writeD(slot.getPaperdollObjectId(Paperdoll.CHEST)); | |
| 3058 | - writeD(slot.getPaperdollObjectId(Paperdoll.LEGS)); | |
| 3059 | - writeD(slot.getPaperdollObjectId(Paperdoll.FEET)); | |
| 3060 | - writeD(slot.getPaperdollObjectId(Paperdoll.CLOAK)); | |
| 3061 | - writeD(slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3062 | - writeD(slot.getPaperdollObjectId(Paperdoll.HAIR)); | |
| 3063 | - writeD(slot.getPaperdollObjectId(Paperdoll.FACE)); | |
| 3064 | + | |
| 3065 | + if (Config.ALLOW_DRESS_ME_SYSTEM) | |
| 3066 | + {
| |
| 3067 | + if (slot.getWeaponSkinOption() > 0 && getWeaponOption(slot.getWeaponSkinOption()) != null) | |
| 3068 | + {
| |
| 3069 | + writeD(getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() : slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3070 | + } | |
| 3071 | + else | |
| 3072 | + {
| |
| 3073 | + writeD(slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3074 | + } | |
| 3075 | + | |
| 3076 | + writeD(slot.getPaperdollObjectId(Paperdoll.LHAND)); | |
| 3077 | + | |
| 3078 | + if (slot.getArmorSkinOption() > 0 && getArmorOption(slot.getArmorSkinOption()) != null) | |
| 3079 | + {
| |
| 3080 | + writeD(getArmorOption(slot.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getGlovesId() : slot.getPaperdollObjectId(Paperdoll.GLOVES)); | |
| 3081 | + writeD(getArmorOption(slot.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getChestId() : slot.getPaperdollObjectId(Paperdoll.CHEST)); | |
| 3082 | + writeD(getArmorOption(slot.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getLegsId() : slot.getPaperdollObjectId(Paperdoll.LEGS)); | |
| 3083 | + writeD(getArmorOption(slot.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getFeetId() : slot.getPaperdollObjectId(Paperdoll.FEET)); | |
| 3084 | + } | |
| 3085 | + else | |
| 3086 | + {
| |
| 3087 | + writeD(slot.getPaperdollObjectId(Paperdoll.GLOVES)); | |
| 3088 | + writeD(slot.getPaperdollObjectId(Paperdoll.CHEST)); | |
| 3089 | + writeD(slot.getPaperdollObjectId(Paperdoll.LEGS)); | |
| 3090 | + writeD(slot.getPaperdollObjectId(Paperdoll.FEET)); | |
| 3091 | + } | |
| 3092 | + | |
| 3093 | + writeD(slot.getPaperdollObjectId(Paperdoll.CLOAK)); | |
| 3094 | + | |
| 3095 | + if (slot.getWeaponSkinOption() > 0 && getWeaponOption(slot.getWeaponSkinOption()) != null) | |
| 3096 | + {
| |
| 3097 | + writeD(getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() : slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3098 | + } | |
| 3099 | + else | |
| 3100 | + {
| |
| 3101 | + writeD(slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3102 | + } | |
| 3103 | + | |
| 3104 | + if (slot.getHairSkinOption() > 0 && getHairOption(slot.getHairSkinOption()) != null) | |
| 3105 | + {
| |
| 3106 | + writeD(getHairOption(slot.getHairSkinOption()).getHairId() != 0 ? getHairOption(slot.getHairSkinOption()).getHairId() : slot.getPaperdollObjectId(Paperdoll.HAIR)); | |
| 3107 | + } | |
| 3108 | + else | |
| 3109 | + {
| |
| 3110 | + writeD(slot.getPaperdollObjectId(Paperdoll.HAIR)); | |
| 3111 | + } | |
| 3112 | + | |
| 3113 | + if (slot.getFaceSkinOption() > 0 && getFaceOption(slot.getFaceSkinOption()) != null) | |
| 3114 | + {
| |
| 3115 | + writeD(getFaceOption(slot.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(slot.getFaceSkinOption()).getFaceId() : slot.getPaperdollObjectId(Paperdoll.FACE)); | |
| 3116 | + } | |
| 3117 | + else | |
| 3118 | + {
| |
| 3119 | + writeD(slot.getPaperdollObjectId(Paperdoll.FACE)); | |
| 3120 | + } | |
| 3121 | + } | |
| 3122 | + else | |
| 3123 | + {
| |
| 3124 | + writeD(slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3125 | + writeD(slot.getPaperdollObjectId(Paperdoll.LHAND)); | |
| 3126 | + writeD(slot.getPaperdollObjectId(Paperdoll.GLOVES)); | |
| 3127 | + writeD(slot.getPaperdollObjectId(Paperdoll.CHEST)); | |
| 3128 | + writeD(slot.getPaperdollObjectId(Paperdoll.LEGS)); | |
| 3129 | + writeD(slot.getPaperdollObjectId(Paperdoll.FEET)); | |
| 3130 | + writeD(slot.getPaperdollObjectId(Paperdoll.CLOAK)); | |
| 3131 | + writeD(slot.getPaperdollObjectId(Paperdoll.RHAND)); | |
| 3132 | + writeD(slot.getPaperdollObjectId(Paperdoll.HAIR)); | |
| 3133 | + writeD(slot.getPaperdollObjectId(Paperdoll.FACE)); | |
| 3134 | + } | |
| 3135 | ||
| 3136 | writeD(slot.getPaperdollItemId(Paperdoll.HAIRALL)); | |
| 3137 | writeD(slot.getPaperdollItemId(Paperdoll.REAR)); | |
| 3138 | @@ -129,16 +194,76 @@ | |
| 3139 | writeD(slot.getPaperdollItemId(Paperdoll.RFINGER)); | |
| 3140 | writeD(slot.getPaperdollItemId(Paperdoll.LFINGER)); | |
| 3141 | writeD(slot.getPaperdollItemId(Paperdoll.HEAD)); | |
| 3142 | - writeD(slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3143 | - writeD(slot.getPaperdollItemId(Paperdoll.LHAND)); | |
| 3144 | - writeD(slot.getPaperdollItemId(Paperdoll.GLOVES)); | |
| 3145 | - writeD(slot.getPaperdollItemId(Paperdoll.CHEST)); | |
| 3146 | - writeD(slot.getPaperdollItemId(Paperdoll.LEGS)); | |
| 3147 | - writeD(slot.getPaperdollItemId(Paperdoll.FEET)); | |
| 3148 | - writeD(slot.getPaperdollItemId(Paperdoll.CLOAK)); | |
| 3149 | - writeD(slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3150 | - writeD(slot.getPaperdollItemId(Paperdoll.HAIR)); | |
| 3151 | - writeD(slot.getPaperdollItemId(Paperdoll.FACE)); | |
| 3152 | + if (Config.ALLOW_DRESS_ME_SYSTEM) | |
| 3153 | + {
| |
| 3154 | + if (slot.getWeaponSkinOption() > 0 && getWeaponOption(slot.getWeaponSkinOption()) != null) | |
| 3155 | + {
| |
| 3156 | + writeD(getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() : slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3157 | + } | |
| 3158 | + else | |
| 3159 | + {
| |
| 3160 | + writeD(slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3161 | + } | |
| 3162 | + | |
| 3163 | + writeD(slot.getPaperdollItemId(Paperdoll.LHAND)); | |
| 3164 | + | |
| 3165 | + if (slot.getArmorSkinOption() > 0 && getArmorOption(slot.getArmorSkinOption()) != null) | |
| 3166 | + {
| |
| 3167 | + writeD(getArmorOption(slot.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getGlovesId() : slot.getPaperdollItemId(Paperdoll.GLOVES)); | |
| 3168 | + writeD(getArmorOption(slot.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getChestId() : slot.getPaperdollItemId(Paperdoll.CHEST)); | |
| 3169 | + writeD(getArmorOption(slot.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getLegsId() : slot.getPaperdollItemId(Paperdoll.LEGS)); | |
| 3170 | + writeD(getArmorOption(slot.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(slot.getArmorSkinOption()).getFeetId() : slot.getPaperdollItemId(Paperdoll.FEET)); | |
| 3171 | + } | |
| 3172 | + else | |
| 3173 | + {
| |
| 3174 | + writeD(slot.getPaperdollItemId(Paperdoll.GLOVES)); | |
| 3175 | + writeD(slot.getPaperdollItemId(Paperdoll.CHEST)); | |
| 3176 | + writeD(slot.getPaperdollItemId(Paperdoll.LEGS)); | |
| 3177 | + writeD(slot.getPaperdollItemId(Paperdoll.FEET)); | |
| 3178 | + } | |
| 3179 | + | |
| 3180 | + writeD(slot.getPaperdollItemId(Paperdoll.CLOAK)); | |
| 3181 | + | |
| 3182 | + if (slot.getWeaponSkinOption() > 0 && getWeaponOption(slot.getWeaponSkinOption()) != null) | |
| 3183 | + {
| |
| 3184 | + writeD(getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(slot.getWeaponSkinOption()).getWeaponId() : slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3185 | + } | |
| 3186 | + else | |
| 3187 | + {
| |
| 3188 | + writeD(slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3189 | + } | |
| 3190 | + | |
| 3191 | + if (slot.getHairSkinOption() > 0 && getHairOption(slot.getHairSkinOption()) != null) | |
| 3192 | + {
| |
| 3193 | + writeD(getHairOption(slot.getHairSkinOption()).getHairId() != 0 ? getHairOption(slot.getHairSkinOption()).getHairId() : slot.getPaperdollItemId(Paperdoll.HAIR)); | |
| 3194 | + } | |
| 3195 | + else | |
| 3196 | + {
| |
| 3197 | + writeD(slot.getPaperdollItemId(Paperdoll.HAIR)); | |
| 3198 | + } | |
| 3199 | + | |
| 3200 | + if (slot.getFaceSkinOption() > 0 && getFaceOption(slot.getFaceSkinOption()) != null) | |
| 3201 | + {
| |
| 3202 | + writeD(getFaceOption(slot.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(slot.getFaceSkinOption()).getFaceId() : slot.getPaperdollItemId(Paperdoll.FACE)); | |
| 3203 | + } | |
| 3204 | + else | |
| 3205 | + {
| |
| 3206 | + writeD(slot.getPaperdollItemId(Paperdoll.FACE)); | |
| 3207 | + } | |
| 3208 | + } | |
| 3209 | + else | |
| 3210 | + {
| |
| 3211 | + writeD(slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3212 | + writeD(slot.getPaperdollItemId(Paperdoll.LHAND)); | |
| 3213 | + writeD(slot.getPaperdollItemId(Paperdoll.GLOVES)); | |
| 3214 | + writeD(slot.getPaperdollItemId(Paperdoll.CHEST)); | |
| 3215 | + writeD(slot.getPaperdollItemId(Paperdoll.LEGS)); | |
| 3216 | + writeD(slot.getPaperdollItemId(Paperdoll.FEET)); | |
| 3217 | + writeD(slot.getPaperdollItemId(Paperdoll.CLOAK)); | |
| 3218 | + writeD(slot.getPaperdollItemId(Paperdoll.RHAND)); | |
| 3219 | + writeD(slot.getPaperdollItemId(Paperdoll.HAIR)); | |
| 3220 | + writeD(slot.getPaperdollItemId(Paperdoll.FACE)); | |
| 3221 | + } | |
| 3222 | ||
| 3223 | writeD(slot.getHairStyle()); | |
| 3224 | writeD(slot.getHairColor()); | |
| 3225 | @@ -235,6 +360,7 @@ | |
| 3226 | } | |
| 3227 | ||
| 3228 | slot.setClassId(activeClassId); | |
| 3229 | + loadCharacterDressMeInfo(slot, objectId); | |
| 3230 | ||
| 3231 | // Get the augmentation for equipped weapon. | |
| 3232 | final int weaponObjId = slot.getPaperdollObjectId(Paperdoll.RHAND); | |
| 3233 | @@ -273,4 +399,49 @@ | |
| 3234 | ||
| 3235 | return new CharSelectSlot[0]; | |
| 3236 | } | |
| 3237 | + | |
| 3238 | + private static void loadCharacterDressMeInfo(final CharSelectSlot charInfopackage, final int objectId) | |
| 3239 | + {
| |
| 3240 | + try (Connection con = ConnectionPool.getConnection(); | |
| 3241 | + PreparedStatement statement = con.prepareStatement("SELECT obj_Id, armor_skins, armor_skin_option, weapon_skins, weapon_skin_option, hair_skins, hair_skin_option, face_skins, face_skin_option FROM characters_dressme_data WHERE obj_id=?"))
| |
| 3242 | + {
| |
| 3243 | + | |
| 3244 | + statement.setInt(1, objectId); | |
| 3245 | + try (ResultSet chardata = statement.executeQuery()) | |
| 3246 | + {
| |
| 3247 | + if (chardata.next()) | |
| 3248 | + {
| |
| 3249 | + charInfopackage.setArmorSkinOption(chardata.getInt("armor_skin_option"));
| |
| 3250 | + charInfopackage.setWeaponSkinOption(chardata.getInt("weapon_skin_option"));
| |
| 3251 | + charInfopackage.setHairSkinOption(chardata.getInt("hair_skin_option"));
| |
| 3252 | + charInfopackage.setFaceSkinOption(chardata.getInt("face_skin_option"));
| |
| 3253 | + } | |
| 3254 | + } | |
| 3255 | + } | |
| 3256 | + catch (final Exception e) | |
| 3257 | + {
| |
| 3258 | + e.printStackTrace(); | |
| 3259 | + } | |
| 3260 | + } | |
| 3261 | + | |
| 3262 | + public SkinPackage getArmorOption(int option) | |
| 3263 | + {
| |
| 3264 | + return (DressMeData.getInstance().getArmorSkinsPackage(option)); | |
| 3265 | + } | |
| 3266 | + | |
| 3267 | + public SkinPackage getWeaponOption(int option) | |
| 3268 | + {
| |
| 3269 | + return DressMeData.getInstance().getWeaponSkinsPackage(option); | |
| 3270 | + } | |
| 3271 | + | |
| 3272 | + public SkinPackage getHairOption(int option) | |
| 3273 | + {
| |
| 3274 | + return DressMeData.getInstance().getHairSkinsPackage(option); | |
| 3275 | + } | |
| 3276 | + | |
| 3277 | + public SkinPackage getFaceOption(int option) | |
| 3278 | + {
| |
| 3279 | + return DressMeData.getInstance().getFaceSkinsPackage(option); | |
| 3280 | + } | |
| 3281 | + | |
| 3282 | } | |
| 3283 | \ No newline at end of file | |
| 3284 | diff --git java/net/sf/l2j/gameserver/model/CharSelectSlot.java java/net/sf/l2j/gameserver/model/CharSelectSlot.java | |
| 3285 | index 814d28a..4ef5400 100644 | |
| 3286 | --- java/net/sf/l2j/gameserver/model/CharSelectSlot.java | |
| 3287 | +++ java/net/sf/l2j/gameserver/model/CharSelectSlot.java | |
| 3288 | @@ -49,6 +49,11 @@ | |
| 3289 | private int _z = 0; | |
| 3290 | private int _accessLevel = 0; | |
| 3291 | ||
| 3292 | + private int _armorSkinOption = 0; | |
| 3293 | + private int _weaponSkinOption = 0; | |
| 3294 | + private int _hairSkinOption = 0; | |
| 3295 | + private int _faceSkinOption = 0; | |
| 3296 | + | |
| 3297 | public CharSelectSlot(int objectId, String name) | |
| 3298 | {
| |
| 3299 | _objectId = objectId; | |
| 3300 | @@ -368,4 +373,45 @@ | |
| 3301 | } | |
| 3302 | return paperdoll; | |
| 3303 | } | |
| 3304 | + | |
| 3305 | + public void setArmorSkinOption(int armorSkinOption) | |
| 3306 | + {
| |
| 3307 | + _armorSkinOption = armorSkinOption; | |
| 3308 | + } | |
| 3309 | + | |
| 3310 | + public int getArmorSkinOption() | |
| 3311 | + {
| |
| 3312 | + return _armorSkinOption; | |
| 3313 | + } | |
| 3314 | + | |
| 3315 | + public void setWeaponSkinOption(int armorSkinOption) | |
| 3316 | + {
| |
| 3317 | + _weaponSkinOption = armorSkinOption; | |
| 3318 | + } | |
| 3319 | + | |
| 3320 | + public int getWeaponSkinOption() | |
| 3321 | + {
| |
| 3322 | + return _weaponSkinOption; | |
| 3323 | + } | |
| 3324 | + | |
| 3325 | + public void setHairSkinOption(int hairSkinOption) | |
| 3326 | + {
| |
| 3327 | + _hairSkinOption = hairSkinOption; | |
| 3328 | + } | |
| 3329 | + | |
| 3330 | + public int getHairSkinOption() | |
| 3331 | + {
| |
| 3332 | + return _hairSkinOption; | |
| 3333 | + } | |
| 3334 | + | |
| 3335 | + public void setFaceSkinOption(int faceSkinOption) | |
| 3336 | + {
| |
| 3337 | + _faceSkinOption = faceSkinOption; | |
| 3338 | + } | |
| 3339 | + | |
| 3340 | + public int getFaceSkinOption() | |
| 3341 | + {
| |
| 3342 | + return _faceSkinOption; | |
| 3343 | + } | |
| 3344 | + | |
| 3345 | } | |
| 3346 | \ No newline at end of file | |
| 3347 | diff --git java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java | |
| 3348 | index b963bd0..e5601b6 100644 | |
| 3349 | --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java | |
| 3350 | +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java | |
| 3351 | @@ -9,6 +9,9 @@ | |
| 3352 | import net.sf.l2j.gameserver.model.actor.Summon; | |
| 3353 | import net.sf.l2j.gameserver.model.actor.instance.Cubic; | |
| 3354 | ||
| 3355 | +import Base.Skin.DressMeData; | |
| 3356 | +import Base.Skin.SkinPackage; | |
| 3357 | + | |
| 3358 | public class CharInfo extends L2GameServerPacket | |
| 3359 | {
| |
| 3360 | private final Player _player; | |
| 3361 | @@ -43,16 +46,83 @@ | |
| 3362 | ||
| 3363 | writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIRALL)); | |
| 3364 | writeD(_player.getInventory().getItemIdFrom(Paperdoll.HEAD)); | |
| 3365 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3366 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3367 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3368 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3369 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3370 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3371 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.CLOAK)); | |
| 3372 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3373 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3374 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3375 | + if (Config.ALLOW_DRESS_ME_SYSTEM) | |
| 3376 | + {
| |
| 3377 | + if (_player.getWeaponSkinOption() > 0 && getWeaponOption(_player.getWeaponSkinOption()) != null) | |
| 3378 | + {
| |
| 3379 | + writeD(getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() : _player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3380 | + } | |
| 3381 | + else | |
| 3382 | + {
| |
| 3383 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3384 | + } | |
| 3385 | + | |
| 3386 | + if (_player.getShieldSkinOption() > 0 && getShieldOption(_player.getShieldSkinOption()) != null) | |
| 3387 | + {
| |
| 3388 | + writeD(getShieldOption(_player.getShieldSkinOption()).getShieldId() != 0 ? getShieldOption(_player.getShieldSkinOption()).getShieldId() : _player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3389 | + } | |
| 3390 | + else | |
| 3391 | + {
| |
| 3392 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3393 | + } | |
| 3394 | + | |
| 3395 | + if (_player.getArmorSkinOption() > 0 && getArmorOption(_player.getArmorSkinOption()) != null) | |
| 3396 | + {
| |
| 3397 | + writeD(getArmorOption(_player.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getGlovesId() : _player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3398 | + writeD(getArmorOption(_player.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getChestId() : _player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3399 | + writeD(getArmorOption(_player.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getLegsId() : _player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3400 | + writeD(getArmorOption(_player.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getFeetId() : _player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3401 | + } | |
| 3402 | + else | |
| 3403 | + {
| |
| 3404 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3405 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3406 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3407 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3408 | + } | |
| 3409 | + | |
| 3410 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CLOAK)); | |
| 3411 | + | |
| 3412 | + if (_player.getWeaponSkinOption() > 0 && getWeaponOption(_player.getWeaponSkinOption()) != null) | |
| 3413 | + {
| |
| 3414 | + writeD(getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() : _player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3415 | + } | |
| 3416 | + else | |
| 3417 | + {
| |
| 3418 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3419 | + } | |
| 3420 | + | |
| 3421 | + if (_player.getHairSkinOption() > 0 && getHairOption(_player.getHairSkinOption()) != null) | |
| 3422 | + {
| |
| 3423 | + writeD(getHairOption(_player.getHairSkinOption()).getHairId() != 0 ? getHairOption(_player.getHairSkinOption()).getHairId() : _player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3424 | + } | |
| 3425 | + else | |
| 3426 | + {
| |
| 3427 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3428 | + } | |
| 3429 | + | |
| 3430 | + if (_player.getFaceSkinOption() > 0 && getFaceOption(_player.getFaceSkinOption()) != null) | |
| 3431 | + {
| |
| 3432 | + writeD(getFaceOption(_player.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(_player.getFaceSkinOption()).getFaceId() : _player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3433 | + } | |
| 3434 | + else | |
| 3435 | + {
| |
| 3436 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3437 | + } | |
| 3438 | + | |
| 3439 | + } | |
| 3440 | + else {
| |
| 3441 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3442 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3443 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3444 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3445 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3446 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3447 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CLOAK)); | |
| 3448 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3449 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3450 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3451 | + } | |
| 3452 | ||
| 3453 | writeH(0x00); | |
| 3454 | writeH(0x00); | |
| 3455 | @@ -159,4 +229,30 @@ | |
| 3456 | writeD(_player.getAppearance().getTitleColor()); | |
| 3457 | writeD(CursedWeaponManager.getInstance().getCurrentStage(_player.getCursedWeaponEquippedId())); | |
| 3458 | } | |
| 3459 | + | |
| 3460 | + public SkinPackage getArmorOption(int option) | |
| 3461 | + {
| |
| 3462 | + return (DressMeData.getInstance().getArmorSkinsPackage(option)); | |
| 3463 | + } | |
| 3464 | + | |
| 3465 | + public SkinPackage getWeaponOption(int option) | |
| 3466 | + {
| |
| 3467 | + return DressMeData.getInstance().getWeaponSkinsPackage(option); | |
| 3468 | + } | |
| 3469 | + | |
| 3470 | + public SkinPackage getHairOption(int option) | |
| 3471 | + {
| |
| 3472 | + return DressMeData.getInstance().getHairSkinsPackage(option); | |
| 3473 | + } | |
| 3474 | + | |
| 3475 | + public SkinPackage getFaceOption(int option) | |
| 3476 | + {
| |
| 3477 | + return DressMeData.getInstance().getFaceSkinsPackage(option); | |
| 3478 | + } | |
| 3479 | + | |
| 3480 | + public SkinPackage getShieldOption(int option) | |
| 3481 | + {
| |
| 3482 | + return DressMeData.getInstance().getShieldSkinsPackage(option); | |
| 3483 | + } | |
| 3484 | + | |
| 3485 | } | |
| 3486 | \ No newline at end of file | |
| 3487 | diff --git java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java | |
| 3488 | index b1679c0..b89ba55 100644 | |
| 3489 | --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java | |
| 3490 | +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java | |
| 3491 | @@ -9,6 +9,9 @@ | |
| 3492 | import net.sf.l2j.gameserver.model.actor.Summon; | |
| 3493 | import net.sf.l2j.gameserver.model.actor.instance.Cubic; | |
| 3494 | ||
| 3495 | +import Base.Skin.DressMeData; | |
| 3496 | +import Base.Skin.SkinPackage; | |
| 3497 | + | |
| 3498 | public class UserInfo extends L2GameServerPacket | |
| 3499 | {
| |
| 3500 | private final Player _player; | |
| 3501 | @@ -63,16 +66,83 @@ | |
| 3502 | writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.RFINGER)); | |
| 3503 | writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.LFINGER)); | |
| 3504 | writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.HEAD)); | |
| 3505 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3506 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.LHAND)); | |
| 3507 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.GLOVES)); | |
| 3508 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.CHEST)); | |
| 3509 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.LEGS)); | |
| 3510 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.FEET)); | |
| 3511 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.CLOAK)); | |
| 3512 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3513 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.HAIR)); | |
| 3514 | - writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.FACE)); | |
| 3515 | + if (Config.ALLOW_DRESS_ME_SYSTEM) | |
| 3516 | + {
| |
| 3517 | + if (_player.getWeaponSkinOption() > 0 && getWeaponOption(_player.getWeaponSkinOption()) != null) | |
| 3518 | + {
| |
| 3519 | + writeD(getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3520 | + } | |
| 3521 | + else | |
| 3522 | + {
| |
| 3523 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3524 | + } | |
| 3525 | + | |
| 3526 | + if (_player.getShieldSkinOption() > 0 && getShieldOption(_player.getShieldSkinOption()) != null) | |
| 3527 | + {
| |
| 3528 | + writeD(getShieldOption(_player.getShieldSkinOption()).getShieldId() != 0 ? getShieldOption(_player.getShieldSkinOption()).getShieldId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.LHAND)); | |
| 3529 | + } | |
| 3530 | + else | |
| 3531 | + {
| |
| 3532 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.LHAND)); | |
| 3533 | + } | |
| 3534 | + | |
| 3535 | + if (_player.getArmorSkinOption() > 0 && getArmorOption(_player.getArmorSkinOption()) != null) | |
| 3536 | + {
| |
| 3537 | + writeD(getArmorOption(_player.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getGlovesId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.GLOVES)); | |
| 3538 | + writeD(getArmorOption(_player.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getChestId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.CHEST)); | |
| 3539 | + writeD(getArmorOption(_player.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getLegsId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.LEGS)); | |
| 3540 | + writeD(getArmorOption(_player.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getFeetId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.FEET)); | |
| 3541 | + } | |
| 3542 | + else | |
| 3543 | + {
| |
| 3544 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.GLOVES)); | |
| 3545 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.CHEST)); | |
| 3546 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.LEGS)); | |
| 3547 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.FEET)); | |
| 3548 | + } | |
| 3549 | + | |
| 3550 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.CLOAK)); | |
| 3551 | + | |
| 3552 | + if (_player.getWeaponSkinOption() > 0 && getWeaponOption(_player.getWeaponSkinOption()) != null) | |
| 3553 | + {
| |
| 3554 | + writeD(getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3555 | + } | |
| 3556 | + else | |
| 3557 | + {
| |
| 3558 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3559 | + } | |
| 3560 | + | |
| 3561 | + if (_player.getHairSkinOption() > 0 && getHairOption(_player.getHairSkinOption()) != null) | |
| 3562 | + {
| |
| 3563 | + writeD(getHairOption(_player.getHairSkinOption()).getHairId() != 0 ? getHairOption(_player.getHairSkinOption()).getHairId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.HAIR)); | |
| 3564 | + } | |
| 3565 | + else | |
| 3566 | + {
| |
| 3567 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.HAIR)); | |
| 3568 | + } | |
| 3569 | + | |
| 3570 | + if (_player.getFaceSkinOption() > 0 && getFaceOption(_player.getFaceSkinOption()) != null) | |
| 3571 | + {
| |
| 3572 | + writeD(getFaceOption(_player.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(_player.getFaceSkinOption()).getFaceId() : _player.getInventory().getItemObjectIdFrom(Paperdoll.FACE)); | |
| 3573 | + } | |
| 3574 | + else | |
| 3575 | + {
| |
| 3576 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.FACE)); | |
| 3577 | + } | |
| 3578 | + | |
| 3579 | + } | |
| 3580 | + else {
| |
| 3581 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3582 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.LHAND)); | |
| 3583 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.GLOVES)); | |
| 3584 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.CHEST)); | |
| 3585 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.LEGS)); | |
| 3586 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.FEET)); | |
| 3587 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.CLOAK)); | |
| 3588 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.RHAND)); | |
| 3589 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.HAIR)); | |
| 3590 | + writeD(_player.getInventory().getItemObjectIdFrom(Paperdoll.FACE)); | |
| 3591 | + } | |
| 3592 | ||
| 3593 | writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIRALL)); | |
| 3594 | writeD(_player.getInventory().getItemIdFrom(Paperdoll.REAR)); | |
| 3595 | @@ -81,16 +151,83 @@ | |
| 3596 | writeD(_player.getInventory().getItemIdFrom(Paperdoll.RFINGER)); | |
| 3597 | writeD(_player.getInventory().getItemIdFrom(Paperdoll.LFINGER)); | |
| 3598 | writeD(_player.getInventory().getItemIdFrom(Paperdoll.HEAD)); | |
| 3599 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3600 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3601 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3602 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3603 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3604 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3605 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.CLOAK)); | |
| 3606 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3607 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3608 | - writeD(_player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3609 | + if (Config.ALLOW_DRESS_ME_SYSTEM) | |
| 3610 | + {
| |
| 3611 | + if (_player.getWeaponSkinOption() > 0 && getWeaponOption(_player.getWeaponSkinOption()) != null) | |
| 3612 | + {
| |
| 3613 | + writeD(getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() : _player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3614 | + } | |
| 3615 | + else | |
| 3616 | + {
| |
| 3617 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3618 | + } | |
| 3619 | + | |
| 3620 | + if (_player.getShieldSkinOption() > 0 && getShieldOption(_player.getShieldSkinOption()) != null) | |
| 3621 | + {
| |
| 3622 | + writeD(getShieldOption(_player.getShieldSkinOption()).getShieldId() != 0 ? getShieldOption(_player.getShieldSkinOption()).getShieldId() : _player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3623 | + } | |
| 3624 | + else | |
| 3625 | + {
| |
| 3626 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3627 | + } | |
| 3628 | + | |
| 3629 | + if (_player.getArmorSkinOption() > 0 && getArmorOption(_player.getArmorSkinOption()) != null) | |
| 3630 | + {
| |
| 3631 | + writeD(getArmorOption(_player.getArmorSkinOption()).getGlovesId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getGlovesId() : _player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3632 | + writeD(getArmorOption(_player.getArmorSkinOption()).getChestId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getChestId() : _player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3633 | + writeD(getArmorOption(_player.getArmorSkinOption()).getLegsId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getLegsId() : _player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3634 | + writeD(getArmorOption(_player.getArmorSkinOption()).getFeetId() != 0 ? getArmorOption(_player.getArmorSkinOption()).getFeetId() : _player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3635 | + } | |
| 3636 | + else | |
| 3637 | + {
| |
| 3638 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3639 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3640 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3641 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3642 | + } | |
| 3643 | + | |
| 3644 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CLOAK)); | |
| 3645 | + | |
| 3646 | + if (_player.getWeaponSkinOption() > 0 && getWeaponOption(_player.getWeaponSkinOption()) != null) | |
| 3647 | + {
| |
| 3648 | + writeD(getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() != 0 ? getWeaponOption(_player.getWeaponSkinOption()).getWeaponId() : _player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3649 | + } | |
| 3650 | + else | |
| 3651 | + {
| |
| 3652 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3653 | + } | |
| 3654 | + | |
| 3655 | + if (_player.getHairSkinOption() > 0 && getHairOption(_player.getHairSkinOption()) != null) | |
| 3656 | + {
| |
| 3657 | + writeD(getHairOption(_player.getHairSkinOption()).getHairId() != 0 ? getHairOption(_player.getHairSkinOption()).getHairId() : _player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3658 | + } | |
| 3659 | + else | |
| 3660 | + {
| |
| 3661 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3662 | + } | |
| 3663 | + | |
| 3664 | + if (_player.getFaceSkinOption() > 0 && getFaceOption(_player.getFaceSkinOption()) != null) | |
| 3665 | + {
| |
| 3666 | + writeD(getFaceOption(_player.getFaceSkinOption()).getFaceId() != 0 ? getFaceOption(_player.getFaceSkinOption()).getFaceId() : _player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3667 | + } | |
| 3668 | + else | |
| 3669 | + {
| |
| 3670 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3671 | + } | |
| 3672 | + | |
| 3673 | + } | |
| 3674 | + else {
| |
| 3675 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3676 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LHAND)); | |
| 3677 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.GLOVES)); | |
| 3678 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CHEST)); | |
| 3679 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.LEGS)); | |
| 3680 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FEET)); | |
| 3681 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.CLOAK)); | |
| 3682 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.RHAND)); | |
| 3683 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.HAIR)); | |
| 3684 | + writeD(_player.getInventory().getItemIdFrom(Paperdoll.FACE)); | |
| 3685 | + } | |
| 3686 | ||
| 3687 | writeH(0x00); | |
| 3688 | writeH(0x00); | |
| 3689 | @@ -214,4 +351,28 @@ | |
| 3690 | writeD(_player.getAppearance().getTitleColor()); | |
| 3691 | writeD(CursedWeaponManager.getInstance().getCurrentStage(_player.getCursedWeaponEquippedId())); | |
| 3692 | } | |
| 3693 | + public SkinPackage getArmorOption(int option) | |
| 3694 | + {
| |
| 3695 | + return (DressMeData.getInstance().getArmorSkinsPackage(option)); | |
| 3696 | + } | |
| 3697 | + | |
| 3698 | + public SkinPackage getWeaponOption(int option) | |
| 3699 | + {
| |
| 3700 | + return DressMeData.getInstance().getWeaponSkinsPackage(option); | |
| 3701 | + } | |
| 3702 | + | |
| 3703 | + public SkinPackage getHairOption(int option) | |
| 3704 | + {
| |
| 3705 | + return DressMeData.getInstance().getHairSkinsPackage(option); | |
| 3706 | + } | |
| 3707 | + | |
| 3708 | + public SkinPackage getFaceOption(int option) | |
| 3709 | + {
| |
| 3710 | + return DressMeData.getInstance().getFaceSkinsPackage(option); | |
| 3711 | + } | |
| 3712 | + | |
| 3713 | + public SkinPackage getShieldOption(int option) | |
| 3714 | + {
| |
| 3715 | + return DressMeData.getInstance().getShieldSkinsPackage(option); | |
| 3716 | + } | |
| 3717 | } | |
| 3718 | \ No newline at end of file | |
| 3719 | diff --git server/gameserver/data/html/dressme/allskins.htm server/gameserver/data/html/dressme/allskins.htm | |
| 3720 | new file mode 100644 | |
| 3721 | index 0000000..c865d6a | |
| 3722 | --- /dev/null | |
| 3723 | +++ server/gameserver/data/html/dressme/allskins.htm | |
| 3724 | @@ -0,0 +1,20 @@ | |
| 3725 | +<html> | |
| 3726 | +<body> | |
| 3727 | +<img src="L2UI.Squaregray" width="300" height="1"> | |
| 3728 | +<table width=300 border=0 cellspacing=0 cellpadding=1 bgcolor=000000 height=15> | |
| 3729 | +<tr> | |
| 3730 | +<td width=36 align=center></td> | |
| 3731 | +<td width=120 align=left>Name</td> | |
| 3732 | +<td width=65 align=left>Actions</td> | |
| 3733 | +</tr> | |
| 3734 | +</table> | |
| 3735 | +<img src="L2UI.Squaregray" width="300" height="1"> | |
| 3736 | + | |
| 3737 | +%showList% | |
| 3738 | + | |
| 3739 | +<center> | |
| 3740 | +<button value="Back" action="bypass -h custom_dressme_back" width=65 height=19 back="L2UI_ch3.smallbutton2_over" fore="L2UI_ch3.smallbutton2"> | |
| 3741 | +</center> | |
| 3742 | + | |
| 3743 | +</body> | |
| 3744 | +</html> | |
| 3745 | \ No newline at end of file | |
| 3746 | diff --git server/gameserver/data/html/dressme/index.htm server/gameserver/data/html/dressme/index.htm | |
| 3747 | new file mode 100644 | |
| 3748 | index 0000000..f03dd39 | |
| 3749 | --- /dev/null | |
| 3750 | +++ server/gameserver/data/html/dressme/index.htm | |
| 3751 | @@ -0,0 +1,26 @@ | |
| 3752 | +<html> | |
| 3753 | +<title>Skins Shop</title> | |
| 3754 | +<body> | |
| 3755 | +<br> | |
| 3756 | +<center>Skins:</center> | |
| 3757 | + | |
| 3758 | +<table width=300> | |
| 3759 | +<tr> | |
| 3760 | +<td align=center><button value="Armor buy/try" action="bypass -h dressme 1 skinlist armor" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td> | |
| 3761 | +</tr> | |
| 3762 | +<tr> | |
| 3763 | +<td align=center><button value="Weapon buy/try" action="bypass -h dressme 1 skinlist weapon" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td> | |
| 3764 | +</tr> | |
| 3765 | +<tr> | |
| 3766 | +<td align=center><button value="Hair buy/try" action="bypass -h dressme 1 skinlist hair" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td> | |
| 3767 | +</tr> | |
| 3768 | +<tr> | |
| 3769 | +<td align=center><button value="Face buy/try" action="bypass -h dressme 1 skinlist face" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td> | |
| 3770 | +</tr> | |
| 3771 | +<tr> | |
| 3772 | +<td align=center><button value="Shield buy/try" action="bypass -h dressme 1 skinlist shield" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td> | |
| 3773 | +</tr> | |
| 3774 | +<tr> | |
| 3775 | +<td align=center><button value="My skins" action="bypass -h dressme 1 myskinlist" width=134 height=19 back="L2UI_ch3.BigButton3_over" fore="L2UI_ch3.BigButton3"></td> | |
| 3776 | +</tr> | |
| 3777 | +</table> | |
| 3778 | diff --git server/gameserver/data/html/dressme/myskins.htm server/gameserver/data/html/dressme/myskins.htm | |
| 3779 | new file mode 100644 | |
| 3780 | index 0000000..2547f1e | |
| 3781 | --- /dev/null | |
| 3782 | +++ server/gameserver/data/html/dressme/myskins.htm | |
| 3783 | @@ -0,0 +1,21 @@ | |
| 3784 | +<html> | |
| 3785 | +<body> | |
| 3786 | +<img src="L2UI.Squaregray" width="300" height="1"> | |
| 3787 | +<table border=0 cellspacing=0 cellpadding=2 bgcolor=000000 height=20> | |
| 3788 | +<tr> | |
| 3789 | +<td width=32 align=center></td> | |
| 3790 | +<td width=203 align=left>Name</td> | |
| 3791 | +<td width=65 align=left>Actions</td> | |
| 3792 | +</tr> | |
| 3793 | +</table> | |
| 3794 | +<img src="L2UI.Squaregray" width="300" height="1"> | |
| 3795 | + | |
| 3796 | +%showList% | |
| 3797 | + | |
| 3798 | +<br> | |
| 3799 | +<br> | |
| 3800 | +<center> | |
| 3801 | +<button value="Back" action="bypass -h custom_dressme_back" width=65 height=19 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal"> | |
| 3802 | +</center> | |
| 3803 | +</body> | |
| 3804 | +</html> | |
| 3805 | \ No newline at end of file | |
| 3806 | diff --git server/gameserver/data/xml/dressme.xml server/gameserver/data/xml/dressme.xml | |
| 3807 | new file mode 100644 | |
| 3808 | index 0000000..cd823a3 | |
| 3809 | --- /dev/null | |
| 3810 | +++ server/gameserver/data/xml/dressme.xml | |
| 3811 | @@ -0,0 +1,22 @@ | |
| 3812 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 3813 | +<list> | |
| 3814 | + <skin type="armor"> <!-- Armors --> | |
| 3815 | + <type id="1" name="Draconic Armor" chestId="6379" legsId="0" glovesId="6380" feetId="6381" priceId="57" priceCount="100"/> | |
| 3816 | + <type id="2" name="Blue Wolf Leather Armor" chestId="2391" legsId="0" glovesId="0" feetId="0" priceId="57" priceCount="100"/> | |
| 3817 | + </skin> | |
| 3818 | + <skin type="weapon"> <!-- Weapons --> | |
| 3819 | + <type id="1" name="Draconic Bow" weaponId="7575" priceId="57" priceCount="100"/> | |
| 3820 | + <type id="2" name="Arcana Mace" weaponId="6608" priceId="57" priceCount="100"/> | |
| 3821 | + <type id="3" name="Keshanberk*Keshanberk" weaponId="5704" priceId="57" priceCount="100"/> | |
| 3822 | + </skin> | |
| 3823 | + <skin type="hair"> <!-- Hairs --> | |
| 3824 | + <type id="1" name="Cat Ear" hairId="6843" priceId="57" priceCount="100"/> | |
| 3825 | + </skin> | |
| 3826 | + <skin type="face"> <!-- Faces --> | |
| 3827 | + <type id="1" name="Party Mask" faceId="5808" priceId="57" priceCount="100"/> | |
| 3828 | + </skin> | |
| 3829 | + <skin type="shield"> <!-- Shields --> | |
| 3830 | + <type id="1" name="Shield of Night" shieldId="2498" priceId="57" priceCount="100"/> | |
| 3831 | + <type id="2" name="Imperial Shield" shieldId="6377" priceId="57" priceCount="100"/> | |
| 3832 | + </skin> | |
| 3833 | +</list> | |
| 3834 | \ No newline at end of file | |
| 3835 |