SHOW:
|
|
- or go back to the newest paste.
1 | diff --git a/config/CustomMods/Events/PcBangEvent.ini b/config/CustomMods/Events/PcBangEvent.ini | |
2 | index e69de29..a488caf 100644 | |
3 | --- a/config/CustomMods/Events/PcBangEvent.ini | |
4 | +++ b/config/CustomMods/Events/PcBangEvent.ini | |
5 | @@ -0,0 +1,24 @@ | |
6 | +#============================================================= | |
7 | +# Pc Bang Event | |
8 | +#============================================================= | |
9 | +#Enable Pc Bang events? | |
10 | +PcBangPointEnable = true | |
11 | + | |
12 | +#Min Level Adquired Pc Bang | |
13 | +PcBangPointMinLevel = 20 | |
14 | + | |
15 | +#Minimum Reward Amount Pc Bang | |
16 | +PcBangPointMinCount = 10 | |
17 | + | |
18 | +#Maximum Reward Amount Pc Bang | |
19 | +PcBangPointMaxCount = 10 | |
20 | + | |
21 | +#Item ID Pc Bang Points, retail -> 65436 | |
22 | +PCBCoinId = 65436 | |
23 | + | |
24 | +#Chance To Double The Reward Pc Bang | |
25 | +PcBangPointDualChance = 0 | |
26 | + | |
27 | +#How long to receive each reward Pc Bang | |
28 | +#Retail 3600 = 1 Hour | |
29 | +PcBangPointTimeStamp = 3600 | |
30 | \ No newline at end of file | |
31 | diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java | |
32 | index 75b7cd9..95c380e 100644 | |
33 | --- a/java/net/sf/l2j/Config.java | |
34 | +++ b/java/net/sf/l2j/Config.java | |
35 | @@ -44,6 +44,7 @@ | |
36 | public static final String OFFLINEMOD = "./config/CustomMods/OfflineShop.ini"; | |
37 | public static final String PROTECTION_MODS = "./config/CustomMods/ProtectionMods.ini"; | |
38 | public static final String DONATEMODS = "./config/CustomMods/Donate.ini"; | |
39 | + public static final String PCBANGEVENT = "./config/CustomMods/Events/PcBangEvent.ini"; | |
40 | // -------------------------------------------------- | |
41 | // Clans settings | |
42 | // -------------------------------------------------- | |
43 | @@ -74,6 +75,13 @@ | |
44 | public static int BANKING_SYSTEM_ADENA; | |
45 | public static boolean ENABLE_COMMAND_GOLDBAR; | |
46 | public static boolean ENABLE_COMMAND_CASTLES; | |
47 | + public static int PCB_MIN_LEVEL; | |
48 | + public static int PCB_POINT_MIN; | |
49 | + public static int PCB_POINT_MAX; | |
50 | + public static int PCB_CHANCE_DUAL_POINT; | |
51 | + public static int PCB_INTERVAL; | |
52 | + public static int PCB_COIN_ID; | |
53 | + public static boolean PCB_ENABLE; | |
54 | /** Manor */ | |
55 | public static int MANOR_REFRESH_TIME; | |
56 | public static int MANOR_REFRESH_MIN; | |
57 | @@ -1218,6 +1226,24 @@ | |
58 | ||
59 | } | |
60 | ||
61 | + private static final void loadPcBangConfig() | |
62 | + { | |
63 | + final ExProperties PcBanG = initProperties(PCBANGEVENT); | |
64 | + PCB_ENABLE = Boolean.parseBoolean(PcBanG.getProperty("PcBangPointEnable", "true")); | |
65 | + PCB_MIN_LEVEL = Integer.parseInt(PcBanG.getProperty("PcBangPointMinLevel", "20")); | |
66 | + PCB_POINT_MIN = Integer.parseInt(PcBanG.getProperty("PcBangPointMinCount", "20")); | |
67 | + PCB_POINT_MAX = Integer.parseInt(PcBanG.getProperty("PcBangPointMaxCount", "1000000")); | |
68 | + PCB_COIN_ID = Integer.parseInt(PcBanG.getProperty("PCBCoinId", "0")); | |
69 | + if(PCB_POINT_MAX < 1) | |
70 | + { | |
71 | + PCB_POINT_MAX = Integer.MAX_VALUE; | |
72 | + | |
73 | + } | |
74 | + PCB_CHANCE_DUAL_POINT = Integer.parseInt(PcBanG.getProperty("PcBangPointDualChance", "20")); | |
75 | + PCB_INTERVAL = Integer.parseInt(PcBanG.getProperty("PcBangPointTimeStamp", "900")); | |
76 | + | |
77 | + } | |
78 | + | |
79 | private static final void loadDonate() | |
80 | { | |
81 | final ExProperties Donate = initProperties(DONATEMODS); | |
82 | @@ -1721,6 +1747,7 @@ | |
83 | ||
84 | // NPCs/monsters settings | |
85 | loadNpcs(); | |
86 | + loadPcBangConfig(); | |
87 | loadSpecial(); | |
88 | loadCommands(); | |
89 | loadScheme(); | |
90 | diff --git a/java/net/sf/l2j/gameserver/GameServer.java b/java/net/sf/l2j/gameserver/GameServer.java | |
91 | index fb95657..4c0ba28 100644 | |
92 | --- a/java/net/sf/l2j/gameserver/GameServer.java | |
93 | +++ b/java/net/sf/l2j/gameserver/GameServer.java | |
94 | @@ -223,6 +223,13 @@ | |
95 | RaidBossInfoManager.getInstance(); | |
96 | IconTable.getInstance(); | |
97 | ||
98 | + StringUtil.printSection("Events"); | |
99 | + if(Config.PCB_ENABLE) | |
100 | + { | |
101 | + System.out.println("############PCB_ENABLE################"); | |
102 | + ThreadPool.scheduleAtFixedRate(PcBang.getInstance(), Config.PCB_INTERVAL * 1000, Config.PCB_INTERVAL * 1000); | |
103 | + } | |
104 | + | |
105 | StringUtil.printSection("Auto Spawns"); | |
106 | AutoSpawnTable.getInstance(); | |
107 | ||
108 | diff --git a/java/net/sf/l2j/gameserver/PcBang.java b/java/net/sf/l2j/gameserver/PcBang.java | |
109 | new file mode 100644 | |
110 | index 0000000..065127b | |
111 | --- /dev/null | |
112 | +++ b/java/net/sf/l2j/gameserver/PcBang.java | |
113 | @@ -0,0 +1,64 @@ | |
114 | +package net.sf.l2j.gameserver; | |
115 | + | |
116 | +import java.util.logging.Logger; | |
117 | + | |
118 | +import net.sf.l2j.commons.random.Rnd; | |
119 | + | |
120 | +import net.sf.l2j.Config; | |
121 | +import net.sf.l2j.gameserver.model.World; | |
122 | +import net.sf.l2j.gameserver.model.actor.Player; | |
123 | + | |
124 | +public class PcBang implements Runnable | |
125 | +{ | |
126 | + Logger _log = Logger.getLogger(PcBang.class.getName()); | |
127 | + private static PcBang _instance; | |
128 | + | |
129 | + public static PcBang getInstance() | |
130 | + | |
131 | + { | |
132 | + if(_instance == null) | |
133 | + { | |
134 | + _instance = new PcBang(); | |
135 | + } | |
136 | + | |
137 | + return _instance; | |
138 | + } | |
139 | + | |
140 | + private PcBang() | |
141 | + { | |
142 | + _log.info("PcBang point event started."); | |
143 | + } | |
144 | + | |
145 | + @Override | |
146 | + public void run() | |
147 | + { | |
148 | + | |
149 | + int score = 0; | |
150 | + for (Player activeChar: World.getInstance().getPlayers()) | |
151 | + { | |
152 | + | |
153 | + if(activeChar.getStatus().getLevel() > Config.PCB_MIN_LEVEL ) | |
154 | + { | |
155 | + score = Rnd.get(Config.PCB_POINT_MIN, Config.PCB_POINT_MAX); | |
156 | + | |
157 | + if(Rnd.get(100) <= Config.PCB_CHANCE_DUAL_POINT) | |
158 | + { | |
159 | + score *= 2; | |
160 | + | |
161 | + activeChar.addPcBangScore(score); | |
162 | + | |
163 | + activeChar.sendMessage("Your PC Bang Point had doubled."); | |
164 | + activeChar.updatePcBangWnd(score, true, true); | |
165 | + } | |
166 | + else | |
167 | + { | |
168 | + activeChar.addPcBangScore(score); | |
169 | + activeChar.sendMessage("You recevied PC Bang Point."); | |
170 | + activeChar.updatePcBangWnd(score, true, false); | |
171 | + } | |
172 | + } | |
173 | + | |
174 | + activeChar = null; | |
175 | + } | |
176 | + } | |
177 | +} | |
178 | \ No newline at end of file | |
179 | diff --git a/java/net/sf/l2j/gameserver/model/actor/Player.java b/java/net/sf/l2j/gameserver/model/actor/Player.java | |
180 | index 6c99cca..30d6a30 100644 | |
181 | --- a/java/net/sf/l2j/gameserver/model/actor/Player.java | |
182 | +++ b/java/net/sf/l2j/gameserver/model/actor/Player.java | |
183 | @@ -160,6 +160,7 @@ | |
184 | import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate; | |
185 | import net.sf.l2j.gameserver.network.serverpackets.ExAutoSoulShot; | |
186 | import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode; | |
187 | +import net.sf.l2j.gameserver.network.serverpackets.ExPCCafePointInfo; | |
188 | import net.sf.l2j.gameserver.network.serverpackets.ExServerPrimitive; | |
189 | import net.sf.l2j.gameserver.network.serverpackets.ExSetCompassZoneCode; | |
190 | import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount; | |
191 | @@ -238,7 +239,7 @@ | |
192 | private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?"; | |
193 | ||
194 | private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
195 | - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,vip=?,vip_end=? WHERE obj_id=?"; | |
196 | + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,vip=?,vip_end=?,pc_point=? WHERE obj_id=?"; | |
197 | private static final String RESTORE_CHARACTER = "SELECT * FROM characters WHERE obj_id=?"; | |
198 | ||
199 | private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC"; | |
200 | @@ -4349,7 +4350,7 @@ | |
201 | player.setDeathPenaltyBuffLevel(rs.getInt("death_penalty_level")); | |
202 | player.setVip(rs.getInt("vip") == 1 ? true : false); | |
203 | player.setVipEndTime(rs.getLong("vip_end")); | |
204 | - | |
205 | + player.setPcBang(rs.getInt("pc_point")); | |
206 | // Set the position of the Player. | |
207 | player.getPosition().set(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"), rs.getInt("heading")); | |
208 | ||
209 | @@ -4581,7 +4582,8 @@ | |
210 | ps.setLong(46, getDeathPenaltyBuffLevel()); | |
211 | ps.setInt(47, isVip() ? 1 : 0); | |
212 | ps.setLong(48, getVipEndTime()); | |
213 | - ps.setInt(49, getObjectId()); | |
214 | + ps.setInt(49, getPcBangScore()); | |
215 | + ps.setInt(50, getObjectId()); | |
216 | ||
217 | ps.execute(); | |
218 | } | |
219 | @@ -7691,4 +7693,47 @@ | |
220 | } | |
221 | ||
222 | } | |
223 | + | |
224 | + private int pcBangPoint = 0; | |
225 | + public int getPcBang() | |
226 | + { | |
227 | + return pcBangPoint; | |
228 | + } | |
229 | + | |
230 | + public void setPcBang(int val) | |
231 | + { | |
232 | + pcBangPoint = val; | |
233 | + | |
234 | + ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, 0, false, 24, false); | |
235 | + sendPacket(wnd); | |
236 | + } | |
237 | + | |
238 | + | |
239 | + public int getPcBangScore() | |
240 | + { | |
241 | + return pcBangPoint; | |
242 | + } | |
243 | + | |
244 | + public void reducePcBangScore(int to) | |
245 | + { | |
246 | + pcBangPoint -= to; | |
247 | + updatePcBangWnd(to, false, false); | |
248 | + } | |
249 | + | |
250 | + public void addPcBangScore(int to) | |
251 | + { | |
252 | + pcBangPoint += to; | |
253 | + } | |
254 | + | |
255 | + public void updatePcBangWnd(int score, boolean add, boolean duble) | |
256 | + { | |
257 | + ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, score, add, 24, duble); | |
258 | + sendPacket(wnd); | |
259 | + } | |
260 | + | |
261 | + public void showPcBangWindow() | |
262 | + { | |
263 | + ExPCCafePointInfo wnd = new ExPCCafePointInfo(this, 0, false, 24, false); | |
264 | + sendPacket(wnd); | |
265 | + } | |
266 | } | |
267 | \ No newline at end of file | |
268 | diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
269 | index 9f6addd..be4efdf 100644 | |
270 | --- a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
271 | +++ b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
272 | @@ -230,6 +230,11 @@ | |
273 | player.sendPacket(SevenSignsManager.getInstance().getCurrentPeriod().getMessageId()); | |
274 | AnnouncementData.getInstance().showAnnouncements(player, false); | |
275 | ||
276 | + if(Config.PCB_ENABLE) | |
277 | + { | |
278 | + player.showPcBangWindow(); | |
279 | + } | |
280 | + | |
281 | if (Config.ALT_OLY_END_ANNOUNCE) | |
282 | { | |
283 | Olympiad.olympiadEnd(player); | |
284 | diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java b/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java | |
285 | index 04df5dc..12fe2db 100644 | |
286 | --- a/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java | |
287 | +++ b/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java | |
288 | @@ -24,6 +24,7 @@ | |
289 | // Special IDs. | |
290 | private static final int CLAN_REPUTATION = 65336; | |
291 | // private static final int PC_BANG_POINTS = 65436; | |
292 | + private static final int PC_BANG_POINTS = Config.PCB_COIN_ID; | |
293 | ||
294 | private int _listId; | |
295 | private int _entryId; | |
296 | @@ -192,6 +193,14 @@ | |
297 | return; | |
298 | } | |
299 | } | |
300 | + else if (e.getItemId() == PC_BANG_POINTS) | |
301 | + { | |
302 | + if (player.getPcBang() < (e.getItemCount() * _amount)) | |
303 | + { | |
304 | + player.sendMessage("You don't have enough Territory War Points."); | |
305 | + return; | |
306 | + } | |
307 | + } | |
308 | else | |
309 | { | |
310 | // if this is not a list that maintains enchantment, check the count of all items that have the given id. | |
311 | @@ -215,6 +224,11 @@ | |
312 | player.getClan().takeReputationScore(amount); | |
313 | player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_DEDUCTED_FROM_CLAN_REP).addNumber(amount)); | |
314 | } | |
315 | + else if (e.getItemId() == PC_BANG_POINTS) | |
316 | + { | |
317 | + int totalTWPoints = e.getItemCount() * _amount; | |
318 | + player.setPcBang(player.getPcBang()-totalTWPoints); | |
319 | + } | |
320 | else | |
321 | { | |
322 | ItemInstance itemToTake = inv.getItemByItemId(e.getItemId()); | |
323 | @@ -299,6 +313,8 @@ | |
324 | { | |
325 | if (e.getItemId() == CLAN_REPUTATION) | |
326 | player.getClan().addReputationScore(e.getItemCount() * _amount); | |
327 | + else if (e.getItemId() == PC_BANG_POINTS) | |
328 | + player.setPcBang(player.getPcBang()+(e.getItemCount()*_amount)); | |
329 | else | |
330 | { | |
331 | if (e.isStackable()) | |
332 | diff --git a/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java b/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java | |
333 | index 00458d2..4537420 100644 | |
334 | --- a/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java | |
335 | +++ b/java/net/sf/l2j/gameserver/network/serverpackets/ExPCCafePointInfo.java | |
336 | @@ -1,20 +1,41 @@ | |
337 | package net.sf.l2j.gameserver.network.serverpackets; | |
338 | ||
339 | +import net.sf.l2j.gameserver.model.actor.Player; | |
340 | + | |
341 | public class ExPCCafePointInfo extends L2GameServerPacket | |
342 | { | |
343 | - private final int _score; | |
344 | - private final int _modify; | |
345 | - private final int _remainingTime; | |
346 | - private final int _pointType; | |
347 | - private final int _periodType; | |
348 | + private Player _character; | |
349 | + private int m_AddPoint; | |
350 | + private int m_PeriodType; | |
351 | + private int RemainTime; | |
352 | + private int PointType; | |
353 | ||
354 | - public ExPCCafePointInfo(int score, int modify, boolean addPoint, boolean pointType, int remainingTime) | |
355 | + public ExPCCafePointInfo(Player user, int modify, boolean add, int hour, boolean _double) | |
356 | { | |
357 | - _score = score; | |
358 | - _modify = (addPoint) ? modify : modify * -1; | |
359 | - _remainingTime = remainingTime; | |
360 | - _pointType = (addPoint) ? (pointType ? 0 : 1) : 2; | |
361 | - _periodType = 1; | |
362 | + _character = user; | |
363 | + m_AddPoint = modify; | |
364 | + | |
365 | + if (add) | |
366 | + { | |
367 | + m_PeriodType = 1; | |
368 | + PointType = 1; | |
369 | + } | |
370 | + else | |
371 | + { | |
372 | + if (add && _double) | |
373 | + { | |
374 | + m_PeriodType = 1; | |
375 | + PointType = 0; | |
376 | + } | |
377 | + else | |
378 | + { | |
379 | + m_PeriodType = 2; | |
380 | + PointType = 2; | |
381 | + } | |
382 | + } | |
383 | + | |
384 | + RemainTime = hour; | |
385 | + | |
386 | } | |
387 | ||
388 | @Override | |
389 | @@ -22,10 +43,10 @@ | |
390 | { | |
391 | writeC(0xFE); | |
392 | writeH(0x31); | |
393 | - writeD(_score); | |
394 | - writeD(_modify); | |
395 | - writeC(_periodType); | |
396 | - writeD(_remainingTime); | |
397 | - writeC(_pointType); | |
398 | + writeD(_character.getPcBangScore()); | |
399 | + writeD(m_AddPoint); | |
400 | + writeC(m_PeriodType); | |
401 | + writeD(RemainTime); | |
402 | + writeC(PointType); | |
403 | } | |
404 | } | |
405 | \ No newline at end of file | |
406 | ||
407 | ||
408 | Datapack SQL executar no navicat na tabela characters | |
409 | + pc_point` int(5) NOT NULL DEFAULT '0', | |
410 |