-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsexyitem-acis-409.diff
More file actions
85 lines (76 loc) · 2.74 KB
/
Copy pathsexyitem-acis-409.diff
File metadata and controls
85 lines (76 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Index: java/net/sf/l2j/Config.java
===================================================================
+ public static boolean ENABLE_CHANGESEX_COIN;
+ public static int CHANGESEX_COIN_ID;
+ public static int CHANGESEX_COIN_AMOUNT;
+
+ ENABLE_CHANGESEX_COIN = jextreme.getProperty("EnableChangeSexItem", false);
+ CHANGESEX_COIN_ID = jextreme.getProperty("ChangeSexCoinId", 0);
+ CHANGESEX_COIN_AMOUNT = jextreme.getProperty("ChangeSexCoinAmount", 1);
+
Index: java/net/sf/l2j/gameserver/handler/itemhandlers/ChangeSexItem.java
===================================================================
+package net.sf.l2j.gameserver.handler.itemhandlers;
+
+import net.sf.l2j.commons.pool.ThreadPool;
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.IItemHandler;
+import net.sf.l2j.gameserver.model.actor.Playable;
+import net.sf.l2j.gameserver.model.actor.Player;
+import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
+import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.enums.actors.Sex;
+
+/**
+ * @author Vinícius Gonçalves
+ *
+ */
+public class ChangeSexItem implements IItemHandler
+{
+ @Override
+ public void useItem(Playable playable, ItemInstance item, boolean forceUse)
+ {
+ if (!Config.ENABLE_CHANGESEX_COIN)
+ return;
+
+ if (!(playable instanceof Player player))
+ return;
+
+ if (player.isInCombat())
+ return;
+
+ if (player.isInOlympiadMode() || OlympiadManager.getInstance().isRegisteredInComp(player))
+ {
+ player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
+ return;
+ }
+
+ if (!player.destroyItemByItemId(
+ Config.CHANGESEX_COIN_ID,
+ Config.CHANGESEX_COIN_AMOUNT,
+ true))
+ return;
+
+ // Troca real do sexo (aCis 409)
+ Sex current = player.getAppearance().getSex();
+ player.getAppearance().setSex(current == Sex.MALE ? Sex.FEMALE : Sex.MALE);
+
+ player.broadcastUserInfo();
+ player.decayMe();
+ player.spawnMe();
+
+ // Logout forçado após 3 segundos
+ ThreadPool.schedule(() -> player.logout(false), 3000);
+ }
+}
Index: config/custom/jextreme.properties
===================================================================
+# =================================================================
+# ChangeSex Item
+# =================================================================
+
+EnableChangeSexItem = True
+ChangeSexCoinId = 20000
+ChangeSexCoinAmount = 1
+