SHOW:
|
|
- or go back to the newest paste.
1 | ### Eclipse Workspace Patch 1.0 | |
2 | #P aCis_gameserver | |
3 | Index: config/players.properties | |
4 | =================================================================== | |
5 | --- config/players.properties (revision 3) | |
6 | +++ config/players.properties (working copy) | |
7 | @@ -42,6 +42,9 @@ | |
8 | # Death Penalty chance if killed by mob (in %), 20 by default | |
9 | DeathPenaltyChance = 20 | |
10 | ||
11 | +# Each X minutes the server will count the player as AFK when he don't act. | |
12 | +TimerAFK = 10 | |
13 | + | |
14 | #============================================================= | |
15 | # Inventory / Warehouse | |
16 | #============================================================= | |
17 | Index: java/net/sf/l2j/Config.java | |
18 | =================================================================== | |
19 | --- java/net/sf/l2j/Config.java (revision 3) | |
20 | +++ java/net/sf/l2j/Config.java (working copy) | |
21 | @@ -356,6 +356,7 @@ | |
22 | public static boolean DEEPBLUE_DROP_RULES; | |
23 | public static boolean ALT_GAME_DELEVEL; | |
24 | public static int DEATH_PENALTY_CHANCE; | |
25 | + public static int AFK_TIMER; | |
26 | ||
27 | /** Inventory & WH */ | |
28 | public static int INVENTORY_MAXIMUM_NO_DWARF; | |
29 | @@ -1028,6 +1029,7 @@ | |
30 | DEEPBLUE_DROP_RULES = players.getProperty("UseDeepBlueDropRules", true); | |
31 | ALT_GAME_DELEVEL = players.getProperty("Delevel", true); | |
32 | DEATH_PENALTY_CHANCE = players.getProperty("DeathPenaltyChance", 20); | |
33 | + AFK_TIMER = players.getProperty("TimerAFK", 10); | |
34 | ||
35 | INVENTORY_MAXIMUM_NO_DWARF = players.getProperty("MaximumSlotsForNoDwarf", 80); | |
36 | INVENTORY_MAXIMUM_DWARF = players.getProperty("MaximumSlotsForDwarf", 100); | |
37 | Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminCreateItem.java | |
38 | =================================================================== | |
39 | --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminCreateItem.java (revision 3) | |
40 | +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminCreateItem.java (working copy) | |
41 | @@ -53,7 +53,8 @@ | |
42 | ||
43 | final Collection<Player> players = World.getInstance().getPlayers(); | |
44 | for (Player player : players) | |
45 | - createItem(activeChar, player, id, count, 0, false); | |
46 | + if (!player.isAFK()) | |
47 | + createItem(activeChar, player, id, count, 0, false); | |
48 | ||
49 | activeChar.sendMessage(players.size() + " players rewarded with " + ItemTable.getInstance().getTemplate(id).getName()); | |
50 | } | |
51 | Index: java/net/sf/l2j/gameserver/model/actor/instance/Player.java | |
52 | =================================================================== | |
53 | --- java/net/sf/l2j/gameserver/model/actor/instance/Player.java (revision 3) | |
54 | +++ java/net/sf/l2j/gameserver/model/actor/instance/Player.java (working copy) | |
55 | @@ -569,6 +569,8 @@ | |
56 | ||
57 | private Door _requestedGate; | |
58 | ||
59 | + private long _lastAction; | |
60 | + | |
61 | /** | |
62 | * Constructor of Player (use Creature constructor). | |
63 | * <ul> | |
64 | @@ -9703,6 +9705,16 @@ | |
65 | _requestedGate = door; | |
66 | } | |
67 | ||
68 | + public boolean isAFK() | |
69 | + { | |
70 | + return _lastAction < System.currentTimeMillis(); | |
71 | + } | |
72 | + | |
73 | + public void updateLastAction() | |
74 | + { | |
75 | + _lastAction = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(Config.AFK_TIMER); | |
76 | + } | |
77 | + | |
78 | @Override | |
79 | public boolean polymorph(PolyType type, int npcId) | |
80 | { | |
81 | Index: java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java | |
82 | =================================================================== | |
83 | --- java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 3) | |
84 | +++ java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (working copy) | |
85 | @@ -55,6 +55,8 @@ | |
86 | if (activeChar == null) | |
87 | return; | |
88 | ||
89 | + activeChar.updateLastAction(); | |
90 | + | |
91 | if (activeChar.isOutOfControl()) | |
92 | { | |
93 | activeChar.sendPacket(ActionFailed.STATIC_PACKET); | |
94 | Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java | |
95 | =================================================================== | |
96 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java (revision 3) | |
97 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java (working copy) | |
98 | @@ -34,6 +34,8 @@ | |
99 | if (player == null) | |
100 | return; | |
101 | ||
102 | + player.updateLastAction(); | |
103 | + | |
104 | if (player.isFakeDeath()) | |
105 | { | |
106 | player.stopFakeDeath(true); | |
107 | Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestSocialAction.java | |
108 | =================================================================== | |
109 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestSocialAction.java (revision 3) | |
110 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestSocialAction.java (working copy) | |
111 | @@ -27,6 +27,8 @@ | |
112 | if (activeChar == null) | |
113 | return; | |
114 | ||
115 | + activeChar.updateLastAction(); | |
116 | + | |
117 | if (activeChar.isFishing()) | |
118 | { | |
119 | activeChar.sendPacket(SystemMessageId.CANNOT_DO_WHILE_FISHING_3); | |
120 | Index: java/net/sf/l2j/gameserver/network/clientpackets/Say2.java | |
121 | =================================================================== | |
122 | --- java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (revision 3) | |
123 | +++ java/net/sf/l2j/gameserver/network/clientpackets/Say2.java (working copy) | |
124 | @@ -115,6 +115,8 @@ | |
125 | if (player == null) | |
126 | return; | |
127 | ||
128 | + player.updateLastAction(); | |
129 | + | |
130 | if (_type < 0 || _type >= CHAT_NAMES.length) | |
131 | return; | |
132 | ||
133 | Index: java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java | |
134 | =================================================================== | |
135 | --- java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (revision 3) | |
136 | +++ java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (working copy) | |
137 | @@ -28,6 +28,8 @@ | |
138 | if (player == null) | |
139 | return; | |
140 | ||
141 | + player.updateLastAction(); | |
142 | + | |
143 | if (!player.getAccessLevel().allowTransaction()) | |
144 | { | |
145 | player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT); | |
146 | Index: java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java | |
147 | =================================================================== | |
148 | --- java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java (revision 3) | |
149 | +++ java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java (working copy) | |
150 | @@ -42,6 +42,8 @@ | |
151 | if (activeChar == null) | |
152 | return; | |
153 | ||
154 | + activeChar.updateLastAction(); | |
155 | + | |
156 | if (activeChar.isInStoreMode()) | |
157 | { | |
158 | activeChar.sendPacket(SystemMessageId.ITEMS_UNAVAILABLE_FOR_STORE_MANUFACTURE); |