SHOW:
|
|
- or go back to the newest paste.
1 | Index: net.sf.l2j.gameserver.handler.itemhandlers;ClanItem.java | |
2 | =================================================================== | |
3 | --- net.sf.l2j.gameserver.handler.itemhandlers;ClanItem.java (revision 84) | |
4 | +++ net.sf.l2j.gameserver.handler.itemhandlers;ClanItem.java (working copy) | |
5 | ||
6 | - | + package net.sf.l2j.gameserver.handler.itemhandlers; |
6 | + | package net.sf.l2j.gameserver.handler.itemhandlers; |
7 | - | + |
7 | + | |
8 | - | + import net.sf.l2j.gameserver.data.SkillTable; |
8 | + | import net.sf.l2j.Config; |
9 | - | + import net.sf.l2j.gameserver.handler.IItemHandler; |
9 | + | |
10 | - | + import net.sf.l2j.gameserver.model.L2Skill; |
10 | + | import net.sf.l2j.gameserver.data.SkillTable; |
11 | - | + import net.sf.l2j.gameserver.model.actor.Playable; |
11 | + | import net.sf.l2j.gameserver.handler.IItemHandler; |
12 | - | + import net.sf.l2j.gameserver.model.actor.instance.Player; |
12 | + | import net.sf.l2j.gameserver.skills.L2Skill; |
13 | - | + import net.sf.l2j.gameserver.model.item.instance.ItemInstance; |
13 | + | import net.sf.l2j.gameserver.model.actor.Playable; |
14 | - | + |
14 | + | import net.sf.l2j.gameserver.model.actor.Player; |
15 | - | + public class ClanItem implements IItemHandler |
15 | + | import net.sf.l2j.gameserver.model.item.instance.ItemInstance; |
16 | - | + { |
16 | + | |
17 | - | + private final int reputation = 150000; |
17 | + | public class ClanItem implements IItemHandler |
18 | - | + private final byte level = 8; |
18 | + | { |
19 | - | + |
19 | + | private final int reputation = 150000; |
20 | - | + // id skills |
20 | + | private final byte level = 8; |
21 | - | + private final int[] clanSkills = |
21 | + | |
22 | - | + { |
22 | + | // id skills |
23 | - | + 370, |
23 | + | private final int[] clanSkills = |
24 | - | + 371, |
24 | + | { |
25 | - | + 372, |
25 | + | 370, |
26 | - | + 373, |
26 | + | 371, |
27 | - | + 374, |
27 | + | 372, |
28 | - | + 375, |
28 | + | 373, |
29 | - | + 376, |
29 | + | 374, |
30 | - | + 377, |
30 | + | 375, |
31 | - | + 378, |
31 | + | 376, |
32 | - | + 379, |
32 | + | 377, |
33 | - | + 380, |
33 | + | 378, |
34 | - | + 381, |
34 | + | 379, |
35 | - | + 382, |
35 | + | 380, |
36 | - | + 383, |
36 | + | 381, |
37 | - | + 384, |
37 | + | 382, |
38 | - | + 385, |
38 | + | 383, |
39 | - | + 386, |
39 | + | 384, |
40 | - | + 387, |
40 | + | 385, |
41 | - | + 388, |
41 | + | 386, |
42 | - | + 389, |
42 | + | 387, |
43 | - | + 390, |
43 | + | 388, |
44 | - | + 391 |
44 | + | 389, |
45 | - | + }; |
45 | + | 390, |
46 | - | + |
46 | + | 391 |
47 | - | + @Override |
47 | + | }; |
48 | - | + public void useItem(Playable playable, ItemInstance item, boolean forceUse) |
48 | + | |
49 | - | + { |
49 | + | @Override |
50 | - | + if (!(playable instanceof Player)) |
50 | + | public void useItem(Playable playable, ItemInstance item, boolean forceUse) |
51 | - | + return; |
51 | + | { |
52 | - | + |
52 | + | if (Config.ENABLE_CLAN_ITEM) |
53 | - | + Player activeChar = (Player) playable; |
53 | + | { |
54 | - | + |
54 | + | |
55 | - | + if (activeChar.isClanLeader()) |
55 | + | if (!(playable instanceof Player)) |
56 | - | + { |
56 | + | return; |
57 | - | + if (activeChar.getClan().getLevel() == 8) |
57 | + | |
58 | - | + { |
58 | + | Player player = (Player) playable; |
59 | - | + activeChar.sendMessage("Your clan is already maximum level!"); |
59 | + | |
60 | - | + return; |
60 | + | if (player.isClanLeader()) |
61 | - | + } |
61 | + | { |
62 | - | + |
62 | + | if (player.getClan().getLevel() == 8) |
63 | - | + activeChar.getClan().changeLevel(level); |
63 | + | { |
64 | - | + activeChar.getClan().addReputationScore(reputation); |
64 | + | player.sendMessage("Your clan is already maximum level!"); |
65 | - | + |
65 | + | return; |
66 | - | + for (int s : clanSkills) |
66 | + | } |
67 | - | + { |
67 | + | |
68 | - | + L2Skill clanSkill = SkillTable.getInstance().getInfo(s, SkillTable.getInstance().getMaxLevel(s)); |
68 | + | player.getClan().changeLevel(level); |
69 | - | + activeChar.getClan().addNewSkill(clanSkill); |
69 | + | player.getClan().addReputationScore(reputation); |
70 | - | + } |
70 | + | |
71 | - | + |
71 | + | for (int s : clanSkills) |
72 | - | + activeChar.sendSkillList(); |
72 | + | { |
73 | - | + activeChar.getClan().updateClanInDB(); |
73 | + | L2Skill clanSkill = SkillTable.getInstance().getInfo(s, SkillTable.getInstance().getMaxLevel(s)); |
74 | - | + activeChar.sendMessage("Your clan Level/Skills/Reputation has been updated!"); |
74 | + | player.getClan().addClanSkill(clanSkill, forceUse); |
75 | - | + playable.destroyItem("Consume", item.getObjectId(), 1, null, false); |
75 | + | } |
76 | - | + activeChar.broadcastUserInfo(); |
76 | + | |
77 | - | + } |
77 | + | player.sendSkillList(); |
78 | - | + else |
78 | + | player.getClan().updateClanInDB(); |
79 | - | + activeChar.sendMessage("You are not the clan leader."); |
79 | + | player.sendMessage("Your clan Level/Skills/Reputation has been updated!"); |
80 | - | + |
80 | + | playable.destroyItem("Consume", Config.CLAN_ITEM_ID, 1, null, false); |
81 | - | + return; |
81 | + | player.broadcastUserInfo(); |
82 | - | + } |
82 | + | } |
83 | - | + } |
83 | + | else |
84 | - | + |
84 | + | player.sendMessage("You are not the clan leader."); |
85 | ||
86 | return; | |
87 | } | |
88 | } | |
89 | } | |
90 | ||
91 | ||
92 | Index: net.sf.l2j;Config.java | |
93 | =================================================================== | |
94 | --- net.sf.l2j;Config.java (revision 84) | |
95 | +++ net.sf.l2j;Config.java (working copy) | |
96 | ||
97 | + /** Clan full skills item */ | |
98 | + public static boolean ENABLE_CLAN_ITEM; | |
99 | + public static int CLAN_ITEM_ID; | |
100 | ||
101 | + ENABLE_CLAN_ITEM = Special.getProperty("EnableClanItem", false); | |
102 | + CLAN_ITEM_ID = Special.getProperty("ClanItem", 1831); | |
103 | - | + <item id="9505" type="EtcItem" name="Clan Full"> |
103 | + | |
104 | Index: net.sf.l2j.gameserver.handler;ItemHandler.java | |
105 | =================================================================== | |
106 | --- net.sf.l2j.gameserver.handler;ItemHandler.java (revision 84) | |
107 | +++ net.sf.l2j.gameserver.handler;ItemHandler.java (working copy) | |
108 | ||
109 | + import net.sf.l2j.gameserver.handler.itemhandlers.ClanItem; | |
110 | ||
111 | ||
112 | + registerItemHandler(new ClanItem()); | |
113 | ||
114 | Index: data/xml/ItemClan.xml | |
115 | =================================================================== | |
116 | --- data/xml/ItemClan.xml (revision 84) | |
117 | +++ data/xml/ItemClan.xml (working copy) | |
118 | ||
119 | + <?xml version="1.0" encoding="UTF-8"?> | |
120 | + <list> | |
121 | + <item id="1831" type="EtcItem" name="Clan Full"> | |
122 | + <set name="material" val="STEEL" /> | |
123 | + <set name="is_destroyable" val="false" /> | |
124 | + <set name="is_dropable" val="false" /> | |
125 | + <set name="is_sellable" val="false" /> | |
126 | + <set name="is_stackable" val="true" /> | |
127 | + <set name="handler" val="ClanItem" /> | |
128 | + </item> | |
129 | + </list> |