SHOW:
|
|
- or go back to the newest paste.
1 | diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java | |
2 | index ba3ddff..389d92a 100644 | |
3 | --- a/java/net/sf/l2j/Config.java | |
4 | +++ b/java/net/sf/l2j/Config.java | |
5 | @@ -36,6 +36,7 @@ | |
6 | public static final String SERVER_FILE = "./config/server.properties"; | |
7 | public static final String SIEGE_FILE = "./config/siege.properties"; | |
8 | public static final String SPECIAL_MODS = "./config/CustomMods/SpecialMods.ini"; | |
9 | + public static final String NEWBIECHAR = "./config/CustomMods/NewbieCharacters.ini"; | |
10 | // -------------------------------------------------- | |
11 | // Clans settings | |
12 | // -------------------------------------------------- | |
13 | @@ -530,12 +531,18 @@ | |
14 | public static double PET_XP_RATE; | |
15 | public static int PET_FOOD_RATE; | |
16 | public static double SINEATER_XP_RATE; | |
17 | - | |
18 | + public static boolean CHAR_TITLE; | |
19 | + public static String ADD_CHAR_TITLE; | |
20 | public static double RATE_DROP_COMMON_HERBS; | |
21 | public static double RATE_DROP_HP_HERBS; | |
22 | public static double RATE_DROP_MP_HERBS; | |
23 | public static double RATE_DROP_SPECIAL_HERBS; | |
24 | - | |
25 | + public static boolean STARTING_BUFFS; | |
26 | + public static List<int[]> STARTING_BUFFS_M = new ArrayList<>(); | |
27 | + public static List<int[]> STARTING_BUFFS_F = new ArrayList<>(); | |
28 | + public static boolean CUSTOM_STARTER_ITEMS_ENABLED; | |
29 | + public static List<int[]> STARTING_CUSTOM_ITEMS_F = new ArrayList<>(); | |
30 | + public static List<int[]> STARTING_CUSTOM_ITEMS_M = new ArrayList<>(); | |
31 | /** Allow types */ | |
32 | public static boolean ALLOW_FREIGHT; | |
33 | public static boolean ALLOW_WAREHOUSE; | |
34 | @@ -568,7 +575,15 @@ | |
35 | /** Community Board */ | |
36 | public static boolean ENABLE_COMMUNITY_BOARD; | |
37 | public static String BBS_DEFAULT; | |
38 | - | |
39 | + public static boolean ALLOW_CREATE_LVL; | |
40 | + public static int CHAR_CREATE_LVL; | |
41 | + public static boolean SPAWN_CHAR; | |
42 | + /** X Coordinate of the SPAWN_CHAR setting. */ | |
43 | + public static int SPAWN_X; | |
44 | + /** Y Coordinate of the SPAWN_CHAR setting. */ | |
45 | + public static int SPAWN_Y; | |
46 | + /** Z Coordinate of the SPAWN_CHAR setting. */ | |
47 | + public static int SPAWN_Z; | |
48 | /** Flood Protectors */ | |
49 | public static int ROLL_DICE_TIME; | |
50 | public static int HERO_VOICE_TIME; | |
51 | @@ -880,6 +895,124 @@ | |
52 | } | |
53 | } | |
54 | ||
55 | + private static final void loadNewChar() | |
56 | + { | |
57 | + final ExProperties newChar = initProperties(NEWBIECHAR); | |
58 | + CHAR_TITLE = Boolean.parseBoolean(newChar.getProperty("CharTitle", "false")); | |
59 | + ADD_CHAR_TITLE = newChar.getProperty("CharAddTitle", "Welcome"); | |
60 | + ALLOW_CREATE_LVL = Boolean.parseBoolean(newChar.getProperty("CustomStartingLvl", "False")); | |
61 | + CHAR_CREATE_LVL = Integer.parseInt(newChar.getProperty("CharLvl", "80")); | |
62 | + SPAWN_CHAR = Boolean.parseBoolean(newChar.getProperty("CustomSpawn", "false")); | |
63 | + SPAWN_X = Integer.parseInt(newChar.getProperty("SpawnX", "")); | |
64 | + SPAWN_Y = Integer.parseInt(newChar.getProperty("SpawnY", "")); | |
65 | + SPAWN_Z = Integer.parseInt(newChar.getProperty("SpawnZ", "")); | |
66 | + STARTING_BUFFS = Boolean.parseBoolean(newChar.getProperty("StartingBuffs", "True")); | |
67 | + String[] startingBuffsSplit = newChar.getProperty("StartingBuffsMage", "1204,2").split(";"); | |
68 | + STARTING_BUFFS_M.clear(); | |
69 | + for (String buff : startingBuffsSplit) | |
70 | + { | |
71 | + String[] buffSplit = buff.split(","); | |
72 | + if (buffSplit.length != 2) | |
73 | + LOGGER.warn("StartingBuffsMage[Config.load()]: invalid config property -> StartingBuffsMage \"" + buff + "\""); | |
74 | + else | |
75 | + { | |
76 | + try | |
77 | + { | |
78 | + STARTING_BUFFS_M.add(new int[] | |
79 | + { | |
80 | + Integer.parseInt(buffSplit[0]), | |
81 | + Integer.parseInt(buffSplit[1]) | |
82 | + }); | |
83 | + } | |
84 | + catch (NumberFormatException nfe) | |
85 | + { | |
86 | + if (STARTING_BUFFS_M.equals("")) | |
87 | + System.out.println("EROOOOOOOOOOOR WITH STARTING BUFS"); | |
88 | + } | |
89 | + } | |
90 | + } | |
91 | + startingBuffsSplit = newChar.getProperty("StartingBuffsFighter", "1204,2").split(";"); | |
92 | + STARTING_BUFFS_F.clear(); | |
93 | + for (String buff : startingBuffsSplit) | |
94 | + { | |
95 | + String[] buffSplit = buff.split(","); | |
96 | + if (buffSplit.length != 2) | |
97 | + LOGGER.warn("StartingBuffsFighter[Config.load()]: invalid config property -> StartingBuffsFighter \"" + buff + "\""); | |
98 | + else | |
99 | + { | |
100 | + try | |
101 | + { | |
102 | + STARTING_BUFFS_F.add(new int[] | |
103 | + { | |
104 | + Integer.parseInt(buffSplit[0]), | |
105 | + Integer.parseInt(buffSplit[1]) | |
106 | + }); | |
107 | + } | |
108 | + catch (NumberFormatException nfe) | |
109 | + { | |
110 | + if (STARTING_BUFFS_F.equals("")) | |
111 | + System.out.println("EROOOOOOOOOOOR WITH STARTING BUFS"); | |
112 | + } | |
113 | + } | |
114 | + } | |
115 | + CUSTOM_STARTER_ITEMS_ENABLED = Boolean.parseBoolean(newChar.getProperty("CustomStarterItemsEnabled", "False")); | |
116 | + if (Config.CUSTOM_STARTER_ITEMS_ENABLED) | |
117 | + { | |
118 | + String[] propertySplit = newChar.getProperty("StartingCustomItemsMage", "57,0").split(";"); | |
119 | + STARTING_CUSTOM_ITEMS_M.clear(); | |
120 | + for (final String reward : propertySplit) | |
121 | + { | |
122 | + final String[] rewardSplit = reward.split(","); | |
123 | + if (rewardSplit.length != 2) | |
124 | + LOGGER.warn("StartingCustomItemsMage[Config.load()]: invalid config property -> StartingCustomItemsMage \"" + reward + "\""); | |
125 | + else | |
126 | + { | |
127 | + try | |
128 | + { | |
129 | + STARTING_CUSTOM_ITEMS_M.add(new int[] | |
130 | + { | |
131 | + Integer.parseInt(rewardSplit[0]), | |
132 | + Integer.parseInt(rewardSplit[1]) | |
133 | + }); | |
134 | + } | |
135 | + catch (final NumberFormatException nfe) | |
136 | + { | |
137 | + nfe.printStackTrace(); | |
138 | + if (!reward.isEmpty()) | |
139 | + LOGGER.warn("StartingCustomItemsMage[Config.load()]: invalid config property -> StartingCustomItemsMage \"" + reward + "\""); | |
140 | + } | |
141 | + } | |
142 | + } | |
143 | + | |
144 | + propertySplit = newChar.getProperty("StartingCustomItemsFighter", "57,0").split(";"); | |
145 | + STARTING_CUSTOM_ITEMS_F.clear(); | |
146 | + for (final String reward : propertySplit) | |
147 | + { | |
148 | + final String[] rewardSplit = reward.split(","); | |
149 | + if (rewardSplit.length != 2) | |
150 | + LOGGER.warn("StartingCustomItemsFighter[Config.load()]: invalid config property -> StartingCustomItemsFighter \"" + reward + "\""); | |
151 | + else | |
152 | + { | |
153 | + try | |
154 | + { | |
155 | + STARTING_CUSTOM_ITEMS_F.add(new int[] | |
156 | + { | |
157 | + Integer.parseInt(rewardSplit[0]), | |
158 | + Integer.parseInt(rewardSplit[1]) | |
159 | + }); | |
160 | + } | |
161 | + catch (final NumberFormatException nfe) | |
162 | + { | |
163 | + nfe.printStackTrace(); | |
164 | + | |
165 | + if (!reward.isEmpty()) | |
166 | + LOGGER.warn("StartingCustomItemsFighter[Config.load()]: invalid config property -> StartingCustomItemsFighter \"" + reward + "\""); | |
167 | + } | |
168 | + } | |
169 | + } | |
170 | + } | |
171 | + } | |
172 | + | |
173 | private static final void loadSpecial() | |
174 | { | |
175 | final ExProperties Special = initProperties(SPECIAL_MODS); | |
176 | @@ -1327,6 +1460,7 @@ | |
177 | // NPCs/monsters settings | |
178 | loadNpcs(); | |
179 | loadSpecial(); | |
180 | + loadNewChar(); | |
181 | // players settings | |
182 | loadPlayers(); | |
183 | ||
184 | diff --git a/java/net/sf/l2j/gameserver/data/xml/ItemData.java b/java/net/sf/l2j/gameserver/data/xml/ItemData.java | |
185 | index a6f5da2..e2884d0 100644 | |
186 | --- a/java/net/sf/l2j/gameserver/data/xml/ItemData.java | |
187 | +++ b/java/net/sf/l2j/gameserver/data/xml/ItemData.java | |
188 | @@ -7,6 +7,7 @@ | |
189 | import net.sf.l2j.commons.logging.CLogger; | |
190 | ||
191 | import net.sf.l2j.gameserver.data.DocumentItem; | |
192 | +import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
193 | import net.sf.l2j.gameserver.model.item.kind.Armor; | |
194 | import net.sf.l2j.gameserver.model.item.kind.EtcItem; | |
195 | import net.sf.l2j.gameserver.model.item.kind.Item; | |
196 | @@ -73,7 +74,19 @@ | |
197 | ||
198 | LOGGER.info("Loaded items."); | |
199 | } | |
200 | - | |
201 | + /** | |
202 | + * Dummy item is created by setting the ID of the object in the world at null value | |
203 | + * @param itemId : int designating the item | |
204 | + * @return ItemInstance designating the dummy item created | |
205 | + */ | |
206 | + public ItemInstance createDummyItem(int itemId) | |
207 | + { | |
208 | + final Item item = getTemplate(itemId); | |
209 | + if (item == null) | |
210 | + return null; | |
211 | + | |
212 | + return new ItemInstance(0, item); | |
213 | + } | |
214 | /** | |
215 | * @param id : the item id to check. | |
216 | * @return the {@link Item} corresponding to the item id. | |
217 | diff --git a/java/net/sf/l2j/gameserver/model/base/Experience.java b/java/net/sf/l2j/gameserver/model/base/Experience.java | |
218 | new file mode 100644 | |
219 | index 0000000..9a48e7b | |
220 | --- /dev/null | |
221 | +++ b/java/net/sf/l2j/gameserver/model/base/Experience.java | |
222 | @@ -0,0 +1,97 @@ | |
223 | +package net.sf.l2j.gameserver.model.base; | |
224 | + | |
225 | +public class Experience | |
226 | +{ | |
227 | + public static final long LEVEL[] = | |
228 | + { | |
229 | + -1L, // level 0 (unreachable) | |
230 | + 0L, | |
231 | + 68L, | |
232 | + 363L, | |
233 | + 1168L, | |
234 | + 2884L, | |
235 | + 6038L, | |
236 | + 11287L, | |
237 | + 19423L, | |
238 | + 31378L, | |
239 | + 48229L, // level 10 | |
240 | + 71201L, | |
241 | + 101676L, | |
242 | + 141192L, | |
243 | + 191452L, | |
244 | + 254327L, | |
245 | + 331864L, | |
246 | + 426284L, | |
247 | + 539995L, | |
248 | + 675590L, | |
249 | + 835854L, // level 20 | |
250 | + 1023775L, | |
251 | + 1242536L, | |
252 | + 1495531L, | |
253 | + 1786365L, | |
254 | + 2118860L, | |
255 | + 2497059L, | |
256 | + 2925229L, | |
257 | + 3407873L, | |
258 | + 3949727L, | |
259 | + 4555766L, // level 30 | |
260 | + 5231213L, | |
261 | + 5981539L, | |
262 | + 6812472L, | |
263 | + 7729999L, | |
264 | + 8740372L, | |
265 | + 9850111L, | |
266 | + 11066012L, | |
267 | + 12395149L, | |
268 | + 13844879L, | |
269 | + 15422851L, // level 40 | |
270 | + 17137002L, | |
271 | + 18995573L, | |
272 | + 21007103L, | |
273 | + 23180442L, | |
274 | + 25524751L, | |
275 | + 28049509L, | |
276 | + 30764519L, | |
277 | + 33679907L, | |
278 | + 36806133L, | |
279 | + 40153995L, // level 50 | |
280 | + 45524865L, | |
281 | + 51262204L, | |
282 | + 57383682L, | |
283 | + 63907585L, | |
284 | + 70852742L, | |
285 | + 80700339L, | |
286 | + 91162131L, | |
287 | + 102265326L, | |
288 | + 114038008L, | |
289 | + 126509030L, // level 60 | |
290 | + 146307211L, | |
291 | + 167243291L, | |
292 | + 189363788L, | |
293 | + 212716741L, | |
294 | + 237351413L, | |
295 | + 271973532L, | |
296 | + 308441375L, | |
297 | + 346825235L, | |
298 | + 387197529L, | |
299 | + 429632402L, // level 70 | |
300 | + 474205751L, | |
301 | + 532692055L, | |
302 | + 606319094L, | |
303 | + 696376867L, | |
304 | + 804219972L, | |
305 | + 931275828L, | |
306 | + 1151275834L, | |
307 | + 1511275834L, | |
308 | + 2099275834L, | |
309 | + 4200000000L, // level 80 | |
310 | + 6299994999L | |
311 | + }; | |
312 | + | |
313 | + /** | |
314 | + * This is the first UNREACHABLE level.<BR> | |
315 | + * ex: If you want a max at 80 & 99.99%, you have to put 81.<BR> | |
316 | + * <BR> | |
317 | + */ | |
318 | + public static final byte MAX_LEVEL = 81; | |
319 | +} | |
320 | diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java b/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java | |
321 | index 3d4cfae..ea403a1 100644 | |
322 | --- a/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java | |
323 | +++ b/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java | |
324 | @@ -2,7 +2,10 @@ | |
325 | ||
326 | import net.sf.l2j.commons.lang.StringUtil; | |
327 | ||
328 | +import net.sf.l2j.Config; | |
329 | +import net.sf.l2j.gameserver.data.SkillTable; | |
330 | import net.sf.l2j.gameserver.data.sql.PlayerInfoTable; | |
331 | +import net.sf.l2j.gameserver.data.xml.ItemData; | |
332 | import net.sf.l2j.gameserver.data.xml.NpcData; | |
333 | import net.sf.l2j.gameserver.data.xml.PlayerData; | |
334 | import net.sf.l2j.gameserver.data.xml.ScriptData; | |
335 | @@ -14,13 +17,17 @@ | |
336 | import net.sf.l2j.gameserver.model.World; | |
337 | import net.sf.l2j.gameserver.model.actor.Player; | |
338 | import net.sf.l2j.gameserver.model.actor.template.PlayerTemplate; | |
339 | +import net.sf.l2j.gameserver.model.base.Experience; | |
340 | import net.sf.l2j.gameserver.model.holder.ItemTemplateHolder; | |
341 | import net.sf.l2j.gameserver.model.holder.skillnode.GeneralSkillNode; | |
342 | import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
343 | +import net.sf.l2j.gameserver.network.SystemMessageId; | |
344 | import net.sf.l2j.gameserver.network.serverpackets.CharCreateFail; | |
345 | import net.sf.l2j.gameserver.network.serverpackets.CharCreateOk; | |
346 | import net.sf.l2j.gameserver.network.serverpackets.CharSelectInfo; | |
347 | +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; | |
348 | import net.sf.l2j.gameserver.scripting.Quest; | |
349 | +import net.sf.l2j.gameserver.skills.L2Skill; | |
350 | ||
351 | public final class RequestCharacterCreate extends L2GameClientPacket | |
352 | { | |
353 | @@ -133,8 +140,71 @@ | |
354 | ||
355 | World.getInstance().addObject(player); | |
356 | ||
357 | - player.getPosition().set(template.getRandomSpawn()); | |
358 | - player.setTitle(""); | |
359 | + if (Config.ALLOW_CREATE_LVL) | |
360 | + player.getStatus().addExp(Experience.LEVEL[Config.CHAR_CREATE_LVL]); | |
361 | + | |
362 | + | |
363 | + if (Config.SPAWN_CHAR) | |
364 | + player.setXYZInvisible(Config.SPAWN_X, Config.SPAWN_Y, Config.SPAWN_Z); | |
365 | + else | |
366 | + player.setXYZInvisible(template.getRandomSpawn()); | |
367 | + if (Config.CUSTOM_STARTER_ITEMS_ENABLED) | |
368 | + { | |
369 | + if (player.isMageClass()) | |
370 | + { | |
371 | + for (final int[] reward : Config.STARTING_CUSTOM_ITEMS_M) | |
372 | + { | |
373 | + if (ItemData.getInstance().createDummyItem(reward[0]).isStackable()) | |
374 | + player.getInventory().addItem("Starter Items Mage", reward[0], reward[1], player, null); | |
375 | + else | |
376 | + for (int i = 0; i < reward[1]; ++i) | |
377 | + player.getInventory().addItem("Starter Items Mage", reward[0], 1, player, null); | |
378 | + } | |
379 | + } | |
380 | + else | |
381 | + { | |
382 | + for (final int[] reward : Config.STARTING_CUSTOM_ITEMS_F) | |
383 | + { | |
384 | + if (ItemData.getInstance().createDummyItem(reward[0]).isStackable()) | |
385 | + player.getInventory().addItem("Starter Items Fighter", reward[0], reward[1], player, null); | |
386 | + else | |
387 | + for (int i = 0; i < reward[1]; ++i) | |
388 | + player.getInventory().addItem("Starter Items Fighter", reward[0], 1, player, null); | |
389 | + } | |
390 | + } | |
391 | + } | |
392 | + if (Config.STARTING_BUFFS) | |
393 | + { | |
394 | + if (!player.isMageClass()) | |
395 | + { | |
396 | + for (int[] buff : Config.STARTING_BUFFS_F) // Custom buffs for fighters | |
397 | + { | |
398 | + L2Skill skill = SkillTable.getInstance().getInfo(buff[0], buff[1]); | |
399 | + if (skill != null) | |
400 | + { | |
401 | + skill.getEffects(player, player); | |
402 | + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(buff[0])); | |
403 | + } | |
404 | + } | |
405 | + } | |
406 | + else | |
407 | + { | |
408 | + for (int[] buff : Config.STARTING_BUFFS_M) // Custom buffs for mystics | |
409 | + { | |
410 | + L2Skill skill = SkillTable.getInstance().getInfo(buff[0], buff[1]); | |
411 | + if (skill != null) | |
412 | + { | |
413 | + skill.getEffects(player, player); | |
414 | + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(buff[0])); | |
415 | + } | |
416 | + } | |
417 | + } | |
418 | + } | |
419 | + //player.getPosition().set(template.getRandomSpawn()); | |
420 | + if (Config.CHAR_TITLE) | |
421 | + player.setTitle(Config.ADD_CHAR_TITLE); | |
422 | + else | |
423 | + player.setTitle(""); | |
424 | ||
425 | // Register shortcuts. | |
426 | player.getShortcutList().addShortcut(new Shortcut(0, 0, ShortcutType.ACTION, 2, -1, 1)); // attack shortcut | |
427 | @@ -176,4 +246,5 @@ | |
428 | sendPacket(csi); | |
429 | getClient().setCharSelectSlot(csi.getCharacterSlots()); | |
430 | } | |
431 | + | |
432 | } | |
433 | \ No newline at end of file | |
434 | ||
435 | ||
436 | +#=============================================================== | |
437 | +# Spawn New Character | |
438 | +#=============================================================== | |
439 | +# Custom starting spawn location. | |
440 | +CustomSpawn = True | |
441 | +SpawnX = 149999 | |
442 | +SpawnY = 46728 | |
443 | +SpawnZ = -3414 | |
444 | + | |
445 | +# Custom title on new chars. | |
446 | +CharTitle = True | |
447 | +CharAddTitle = NewChar | |
448 | + | |
449 | +# Custom Level New Character. | |
450 | +CustomStartingLvl = True | |
451 | +# Character Level You Want | |
452 | +CharLvl = 10 | |
453 | + | |
454 | +#=============================================================== | |
455 | +# Spawn New Itens for Character | |
456 | +#=============================================================== | |
457 | +# Default: False | |
458 | +CustomStarterItemsEnabled = True | |
459 | +# Starting itens for fighter's classes | |
460 | +StartingCustomItemsFighter = 57,1000; | |
461 | +# Starting itens for mage's classes | |
462 | +StartingCustomItemsMage = 57,1000; | |
463 | + | |
464 | +#=============================================================== | |
465 | +# Spawn New Character for Buffs | |
466 | +#=============================================================== | |
467 | +# Newbie Characters have starting buffs | |
468 | +StartingBuffs = True | |
469 | + | |
470 | +# Starting Buffs for Mystics. | |
471 | +StartingBuffsMage = 1204,2;1085,3; | |
472 | + | |
473 | +# Starting Buffs for Fighters. | |
474 | +StartingBuffsFighter = 1204,2;1086,2; | |
475 |