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

    • Inventory restock: Premium business accounts are now available.   ✔ Wallester Business EU 🇪🇺|💳 Unlimited virtual cards, physical cards, 🏦 multi-currency IBAN, ₿ crypto & stablecoin deposits. ✔ Stripe Business UK 🇬🇧|💳 Instant virtual cards (Visa/Mastercard), high-conversion checkout, multi-currency payouts, ₿ crypto payments, no-code payment links. ✔ Mercury Business US 🇺🇸|🏦 US checking & savings, 💳 unlimited virtual cards, domestic & International wires, native stablecoin settlement. ✔ Payset Business EU 🇪🇺|🏦 Multiple IBANs, UK sort code, SEPA Instant, 💳 unlimited virtual cards, multi-currency accounts. ✔ Novo Business US 🇺🇸|🏦 Business checking account, ACH payments & invoicing, 💳 virtual & physical cards, novo boost.
    • Let me see if I understand correctly, older gentlemen, when a newcomer shows up to create modern things with the help of AI, doing what you charge them to do, you point the finger and laugh. I believe that's why everything is stagnant. The product isn't for programming experts, it's for newcomers. Don't buy from you if they can do it themselves using this base. You're going to deliver a similar product, maybe even worse than this one, so why are you complaining? PowerShell, as you well know, started with it, then came new platforms and new apps, new creation models, all with different languages; I chose the simplest one for my taste. This is about being organized and knowing how to choose the right words for each situation. It's not 100%, but it already gives a good impression. Nothing is 100%, so a topic written by AI, and all the code that you charge an absurd amount for to prohibit and sell hacks, could be open source so that everyone can create new practices, new models, new information for passing packets, prohibiting the use of cheats that cause server owners to break so much. Let's remember that the Admin doesn't always shut down the server; it's the players who find problems and take advantage by buying and reselling items, and they say that the GM shuts down the server every week, but that's a lie. What they do is duplicate items with packages and sell them, but perhaps this could give some future developers a starting point to create their own protection following the model in the initial documentation. Because none of you answer a question from a newbie, you think you're superior because you have knowledge, but with AI, people like that can have the same knowledge as you, but with less practice. And if they practice a lot, 10,000 hours, they can be as good as all of you older developers in the L2J field.
  • 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..