Jump to content
  • 0

Error mod 2 click = item (Skin system mod)


Question

Posted

hi guys, i still trying to adapt the skin system + 2 click items.

I have some errors in the skin1.java and i just dont know how to fix it.

My skin1.java
 

package com.l2jfrozen.gameserver.handler.itemhandlers;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IItemHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
import com.l2jfrozen.gameserver.network.clientpackets.RequestBypassToServer;

public class skin1 implements IItemHandler 
{
    @Override
	public void useItem(L2PlayableInstance playable, L2ItemInstance item)
    {
        if(Config.ALLOW_DRESS_ME_SYSTEM)
        {
            if(!(playable instanceof L2PcInstance))
                return;
            L2PcInstance activeChar = (L2PcInstance)playable;
            
            RequestBypassToServer.setPart(activeChar, "chest", Config.SKIN_NAME1);
            RequestBypassToServer.setPart(activeChar, "legs", Config.SKIN_NAME1);
            RequestBypassToServer.setPart(activeChar, "gloves", Config.SKIN_NAME1);
            RequestBypassToServer.setPart(activeChar, "boots", Config.SKIN_NAME1);
            
            if (activeChar.isDressMeEnabled())
			{
				activeChar.setDressMeEnabled(false);
				activeChar.broadcastUserInfo();
				activeChar.sendMessage("You have disabled skin.");
			}
			else
			{
				activeChar.setDressMeEnabled(true);
				activeChar.broadcastUserInfo();
				activeChar.sendMessage("You have activated " + Config.SKIN_NAME1 + " skin.");
			}
        }
        else
        	playable.sendMessage("Sorry, admin has disabled skins.");
    }

	@Override
	public int[] getItemIds()
    {
        return ITEM_IDS;
    }

    private static final int ITEM_IDS[] = {
    	Config.SKIN_ITEM_1
    };
}

and the errors
506617672_error1.png.8a9aae820da3734e1d0



389551140_error2.png.c7af8127fe2fd2b6db8

2 answers to this question

Recommended Posts

  • 0
Posted

1st image, either setPart method doesn't exist in requestbypasstoserver or you're probably using wrong arguments. 2nd image, you either have to cast playable into l2pcinstance or use activeChar instead

  • 0
Posted
On 8/29/2020 at 7:19 AM, Zake said:

1st image, either setPart method doesn't exist in requestbypasstoserver or you're probably using wrong arguments. 2nd image, you either have to cast playable into l2pcinstance or use activeChar instead

hi man! thanks for answer always in my post. sorry for the delay, my wife and i are waiting a baby and she's already in the last weeks pregnant.

The method exist in the requestbypass
<code>

  1. + else if (_command.equals("bp_changedressmestatus"))
  2. + {
  3. + if (activeChar.isDressMeEnabled())
  4. + {
  5. + activeChar.setDressMeEnabled(false);
  6. + activeChar.broadcastUserInfo();
  7. + }
  8. + else
  9. + {
  10. + activeChar.setDressMeEnabled(true);
  11. + activeChar.broadcastUserInfo();
  12. + }
  13. +
  14. + DressMe.sendMainWindow(activeChar);
  15. + }
  16. + else if (_command.startsWith("bp_editWindow"))
  17. + {
  18. + String bp = _command.substring(14);
  19. + StringTokenizer st = new StringTokenizer(bp);
  20. +
  21. + sendEditWindow(activeChar, st.nextToken());
  22. + }
  23. + else if (_command.startsWith("bp_setpart"))
  24. + {
  25. + String bp = _command.substring(11);
  26. + StringTokenizer st = new StringTokenizer(bp);
  27. +
  28. + String part = st.nextToken();
  29. + String type = st.nextToken();
  30. +
  31. + setPart(activeChar, part, type);
  32. + }
  33. + else if (_command.startsWith("bp_gettarget"))
  34. + {
  35. + String bp = _command.substring(13);
  36. + StringTokenizer st = new StringTokenizer(bp);
  37. +
  38. + String part = st.nextToken();
  39. +
  40. + stealTarget(activeChar, part);
  41. + }
  42. + else if (_command.equals("bp_main"))
  43. + {
  44. + DressMe.sendMainWindow(activeChar);
  45. + }
  46. else if (_command.startsWith("voice "))
  47. {
  48. String text = _command.substring(5);
  49. @@ -249,6 +299,303 @@
  50. activeChar.sendPacket(html);
  51. }
  52.  
  53. + public void stealTarget(L2PcInstance p, String part)
  54. + {
  55. + if (p.getTarget() == null || !(p.getTarget() instanceof L2PcInstance))
  56. + {
  57. + p.sendMessage("Invalid target.");
  58. + return;
  59. + }
  60. +
  61. + L2PcInstance t = (L2PcInstance)p.getTarget();
  62. +
  63. + if (p.getDressMeData() == null)
  64. + {
  65. + DressMeData dmd = new DressMeData();
  66. + p.setDressMeData(dmd);
  67. + }
  68. +
  69. + boolean returnMain = false;
  70. +
  71. + switch (part)
  72. + {
  73. + case "chest":
  74. + {
  75. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) == null)
  76. + {
  77. + p.getDressMeData().setChestId(0);
  78. + }
  79. + else
  80. + {
  81. + p.getDressMeData().setChestId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItemId());
  82. + }
  83. + break;
  84. + }
  85. + case "legs":
  86. + {
  87. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) == null)
  88. + {
  89. + p.getDressMeData().setLegsId(0);
  90. + }
  91. + else
  92. + {
  93. + p.getDressMeData().setLegsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getItemId());
  94. + }
  95. + break;
  96. + }
  97. + case "gloves":
  98. + {
  99. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) == null)
  100. + {
  101. + p.getDressMeData().setGlovesId(0);
  102. + }
  103. + else
  104. + {
  105. + p.getDressMeData().setGlovesId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getItemId());
  106. + }
  107. + break;
  108. + }
  109. + case "boots":
  110. + {
  111. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) == null)
  112. + {
  113. + p.getDressMeData().setBootsId(0);
  114. + }
  115. + else
  116. + {
  117. + p.getDressMeData().setBootsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getItemId());
  118. + }
  119. + break;
  120. + }
  121. + case "weap":
  122. + {
  123. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)
  124. + {
  125. + p.getDressMeData().setWeapId(0);
  126. + }
  127. + else
  128. + {
  129. + p.getDressMeData().setWeapId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItemId());
  130. + }
  131. + break;
  132. + }
  133. + case "all":
  134. + {
  135. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) == null)
  136. + {
  137. + p.getDressMeData().setChestId(0);
  138. + }
  139. + else
  140. + {
  141. + p.getDressMeData().setChestId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItemId());
  142. + }
  143. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) == null)
  144. + {
  145. + p.getDressMeData().setLegsId(0);
  146. + }
  147. + else
  148. + {
  149. + p.getDressMeData().setLegsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getItemId());
  150. + }
  151. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) == null)
  152. + {
  153. + p.getDressMeData().setGlovesId(0);
  154. + }
  155. + else
  156. + {
  157. + p.getDressMeData().setGlovesId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getItemId());
  158. + }
  159. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) == null)
  160. + {
  161. + p.getDressMeData().setBootsId(0);
  162. + }
  163. + else
  164. + {
  165. + p.getDressMeData().setBootsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getItemId());
  166. + }
  167. + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)
  168. + {
  169. + p.getDressMeData().setWeapId(0);
  170. + }
  171. + else
  172. + {
  173. + p.getDressMeData().setWeapId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItemId());
  174. + }
  175. + returnMain = true;
  176. + break;
  177. + }
  178. + }
  179. +
  180. + p.broadcastUserInfo();
  181. + if (!returnMain)
  182. + sendEditWindow(p, part);
  183. + else
  184. + DressMe.sendMainWindow(p);
  185. + }
  186. +
  187. + public static void setPart(L2PcInstance p, String part, String type)
  188. + {
  189. + if (p.getDressMeData() == null)
  190. + {
  191. + DressMeData dmd = new DressMeData();
  192. + p.setDressMeData(dmd);
  193. + }
  194. +
  195. + switch (part)
  196. + {
  197. + case "chest":
  198. + {
  199. + if (Config.DRESS_ME_CHESTS.keySet().contains(type))
  200. + {
  201. + p.getDressMeData().setChestId(Config.DRESS_ME_CHESTS.get(type));
  202. + }
  203. +
  204. + break;
  205. + }
  206. + case "legs":
  207. + {
  208. + if (Config.DRESS_ME_LEGS.keySet().contains(type))
  209. + {
  210. + p.getDressMeData().setLegsId(Config.DRESS_ME_LEGS.get(type));
  211. + }
  212. +
  213. + break;
  214. + }
  215. + case "gloves":
  216. + {
  217. + if (Config.DRESS_ME_GLOVES.keySet().contains(type))
  218. + {
  219. + p.getDressMeData().setGlovesId(Config.DRESS_ME_GLOVES.get(type));
  220. + }
  221. +
  222. + break;
  223. + }
  224. + case "boots":
  225. + {
  226. + if (Config.DRESS_ME_BOOTS.keySet().contains(type))
  227. + {
  228. + p.getDressMeData().setBootsId(Config.DRESS_ME_BOOTS.get(type));
  229. + }
  230. +
  231. + break;
  232. + }
  233. + case "weap":
  234. + {
  235. + if (Config.DRESS_ME_WEAPONS.keySet().contains(type))
  236. + {
  237. + p.getDressMeData().setWeapId(Config.DRESS_ME_WEAPONS.get(type));
  238. + }
  239. +
  240. + break;
  241. + }
  242. + }
  243. +
  244. + p.broadcastUserInfo();
  245. +// sendEditWindow(p, part);
  246. + }
  247. +
  248. + public static void sendEditWindow(L2PcInstance p, String part)
  249. + {
  250. + NpcHtmlMessage htm = new NpcHtmlMessage(0);
  251. + htm.setFile("./data/html/custom/dressme/edit.htm");
  252. + htm.replace("%part%", part);
  253. + switch (part)
  254. + {
  255. + case "chest":
  256. + {
  257. + if (p.getDressMeData() == null)
  258. + {
  259. + htm.replace("%partinfo%", "You have no custom chest.");
  260. + }
  261. + else
  262. + {
  263. + htm.replace("%partinfo%", p.getDressMeData().getChestId() == 0 ? "You have no custom chest." : ItemTable.getInstance().getTemplate(p.getDressMeData().getChestId()).getName());
  264. + }
  265. + String temp = "";
  266. + for (String s : Config.DRESS_ME_CHESTS.keySet())
  267. + {
  268. + temp += s+";";
  269. + }
  270. + htm.replace("%dropboxdata%", temp);
  271. + break;
  272. + }
  273. + case "legs":
  274. + {
  275. + if (p.getDressMeData() == null)
  276. + {
  277. + htm.replace("%partinfo%", "You have no custom legs.");
  278. + }
  279. + else
  280. + {
  281. + htm.replace("%partinfo%", p.getDressMeData().getLegsId() == 0 ? "You have no custom legs." : ItemTable.getInstance().getTemplate(p.getDressMeData().getLegsId()).getName());
  282. + }
  283. + String temp = "";
  284. + for (String s : Config.DRESS_ME_LEGS.keySet())
  285. + {
  286. + temp += s+";";
  287. + }
  288. + htm.replace("%dropboxdata%", temp);
  289. + break;
  290. + }
  291. + case "gloves":
  292. + {
  293. + if (p.getDressMeData() == null)
  294. + {
  295. + htm.replace("%partinfo%", "You have no custom gloves.");
  296. + }
  297. + else
  298. + {
  299. + htm.replace("%partinfo%", p.getDressMeData().getGlovesId() == 0 ? "You have no custom gloves." : ItemTable.getInstance().getTemplate(p.getDressMeData().getGlovesId()).getName());
  300. + }
  301. + String temp = "";
  302. + for (String s : Config.DRESS_ME_GLOVES.keySet())
  303. + {
  304. + temp += s+";";
  305. + }
  306. + htm.replace("%dropboxdata%", temp);
  307. + break;
  308. + }
  309. + case "boots":
  310. + {
  311. + if (p.getDressMeData() == null)
  312. + {
  313. + htm.replace("%partinfo%", "You have no custom boots.");
  314. + }
  315. + else
  316. + {
  317. + htm.replace("%partinfo%", p.getDressMeData().getBootsId() == 0 ? "You have no custom boots." : ItemTable.getInstance().getTemplate(p.getDressMeData().getBootsId()).getName());
  318. + }
  319. + String temp = "";
  320. + for (String s : Config.DRESS_ME_BOOTS.keySet())
  321. + {
  322. + temp += s+";";
  323. + }
  324. + htm.replace("%dropboxdata%", temp);
  325. + break;
  326. + }
  327. + case "weap":
  328. + {
  329. + if (p.getDressMeData() == null)
  330. + {
  331. + htm.replace("%partinfo%", "You have no custom weapon.");
  332. + }
  333. + else
  334. + {
  335. + htm.replace("%partinfo%", p.getDressMeData().getWeapId() == 0 ? "You have no custom weapon." : ItemTable.getInstance().getTemplate(p.getDressMeData().getWeapId()).getName());
  336. + }
  337. + String temp = "";
  338. + for (String s : Config.DRESS_ME_WEAPONS.keySet())
  339. + {
  340. + temp += s+";";
  341. + }
  342. + htm.replace("%dropboxdata%", temp);
  343. + break;
  344. + }
  345. + }
  346. +
  347. + p.sendPacket(htm);
  348. + }
  349. +
    </code>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Looking for a Serious Lineage II Project Partner / Co-Owner Hello everyone! I'm looking for a serious, reliable and motivated person who would be interested in building and running a long-term Lineage II project together as equal-minded partners. I have extensive experience with both L2J and L2OFF development, including server-side development, custom features, configurations, databases, client modifications, troubleshooting and general server administration. I also have experience with website development, Linux and Windows server administration, networking, game proxies and hosting infrastructure. I'm fully capable of handling the development and technical side of a project myself. I'm not looking for someone to build a server for me or fix my files. I'm looking for someone who shares my passion for Lineage II and wants to create something successful together. Hardware & Infrastructure I already have dedicated hardware and hosting resources available: Dedicated Servers: AMD Ryzen 9 5950X — 16 cores / 32 threads, 64GB RAM AMD Ryzen 9 5900X — 12 cores / 24 threads, 32GB RAM 28 cores / 56 threads and 96GB RAM combined 2.5 Gbps symmetrical internet connection Additional Infrastructure: OVH VPS infrastructure for game proxies and additional services Website, domain and web hosting infrastructure Database hosting and management Windows Server and Linux environments Network configuration, proxy management and server security Full development and technical administration capabilities The hardware and technical resources are already available, so there is no need to start from scratch or immediately invest in expensive infrastructure. About Me & My Experience I've worked with both L2J and L2OFF, and I understand the technical challenges involved in running a Lineage II server. My experience covers server development, implementing custom systems, fixing issues, optimising performance and managing the infrastructure required to keep a project running. I enjoy both the technical development and creative sides of Lineage II, and I'm willing to invest my time and resources into building something worthwhile. What I'm Looking For I'm not looking for an employee, freelancer or paid developer. I'm looking for a genuine long-term partner / potential co-owner who wants to be actively involved in the project. Ideally, someone who: Has good knowledge of Lineage II and its community Can contribute ideas, experience and constructive feedback Is interested in gameplay, balancing, community building or development Is reliable, mature and communicates well Wants to be involved in decisions and the long-term direction of the project Understands that building a successful server takes time and dedication You don't need to be an expert developer. I can already handle the technical work. What matters most is finding someone who is genuinely interested in working together and contributing to the project's success. The Goal My goal is to create a stable, professional and long-lasting Lineage II server with enjoyable gameplay, quality features, proper infrastructure and an active community. I'm not interested in quick cash-grab projects or opening a server that disappears after a few weeks. I would rather work with the right person, plan everything properly and build a server that players genuinely want to return to. I'm open to discussing the project's direction, responsibilities, ownership structure and potential revenue sharing once we get to know each other. Contact Project: L2Nexus Website: https://l2nexus.club Discord: @litrabolas If you have experience with Lineage II, have been thinking about starting your own project, or simply want to build something serious with someone who already has the experience and infrastructure, feel free to contact me. Let's discuss ideas and see if we can build something great together.
    • 🔒 Permanent ownership of your personal files: 1-click activation link delivered instantly upon order completion.     FINAL CALL: Google is Shutting This Down After October 2026! Google will NEVER bring back this window of opportunity again. Once this month ends, this massive backdoor upgrade is gone permanently!  BUY 2, GET 1 FREE IS STILL LIVE! Stock up now for yourself, your family, your business, and your friends! Think about it: Every single person you know uses a Gmail account, and everyone is running out of storage. Don't let your loved ones get trapped paying $20–$30 every single month when you can set them up with 5TB Cloud Storage + Gemini Advanced (12–18 Months) right now for only $15! Why Buy Bulk Activations Today? Instant Gift Value: Perfect lifetime-style gift for clients, family, or team members. 100% Private & Safe: Activates on personal Gmails—zero passwords or logins required. Global Access: Works worldwide with zero VPN hassles. Instant Automated Delivery: Receive your activation links in seconds 24/7! ‍ Time is running out fast—secure your extra free licenses before the October deadline hits! Order Your Bundle Now on the Website    
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..