Jump to content

Recommended Posts

Posted (edited)

- Each time you use giveItems, you generate useless arrays DaggerArmors, etc. You have to define static int arrays OUT of the method > http://stackoverflow.com/questions/10645914/are-local-variables-in-static-methods-also-static

- DaggerArmors.length == 0 is pointless as arrays you are referring are filled by yourself (you know the content) and never null/empty (supposed to be "final static" data).

- ItemInstance items = null; integrate it on the for loop, you earn nothing putting it here (except adding one line of code for nothing).

- NewbiesNpc class got no use, at all, as there is only one static method and (supposedly) a private static final int[] array. Content can be moved on L2NewbieNpcInstance or at least on L2NpcInstance if it has to be used on other classes.

 

--------------

+           ClassId classes = player.getClassId();
+           switch (classes)
+           {
+               case adventurer:
+               case sagittarius:
+               case duelist:
+               case titan:
+               case grandKhauatari:
+               case phoenixKnight:
+               case moonlightSentinel:
+               case fortuneSeeker:
+               case maestro:
+               case dreadnought:
+               case hellKnight:
+               case evaTemplar:
+               case swordMuse:
+               case windRider:
+               case shillienTemplar:
+               case spectralDancer:
+               case ghostHunter:
+               case ghostSentinel:
+               case soultaker:
+               case mysticMuse:
+               case archmage:
+               case arcanaLord:
+               case elementalMaster:
+               case cardinal:
+               case stormScreamer:
+               case spectralMaster:
+               case shillienSaint:
+               case dominator:
+               case doomcryer:
+                   NewbiesNpc.giveItems(0, player);
+                   break;
+           }

got strictly no use, as you just check few lines above :

+           if (currentClassId.level() < 3)
+           {

-------------------------

 

+           if (player.isMageClass() || player.getClassId() == ClassId.dominator || player.getClassId() == ClassId.doomcryer)
+           {
+               int mageSet[] = Config.NEWBIE_MAGE_BUFFS;
+               L2Skill buff;
+               for (int id : mageSet)
+               {
+                   buff = SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id));
+                   buff.getEffects(this, player);
+                   player.setCurrentHp(player.getMaxHp());
+                   player.setCurrentCp(player.getMaxCp());
+                   player.setCurrentMp(player.getMaxMp());
+                   player.broadcastPacket(new MagicSkillUse(this, player, id, buff.getLevel(), 0, 0));
+               }
+           }
+           else
+           {
+               int fighterSet[] = Config.NEWBIE_FIGHTER_BUFFS;
+               L2Skill buff;
+               for (int id : fighterSet)
+               {
+                   buff = SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id));
+                   buff.getEffects(this, player);
+                   player.setCurrentHp(player.getMaxHp());
+                   player.setCurrentCp(player.getMaxCp());
+                   player.setCurrentMp(player.getMaxMp());
+                   player.broadcastPacket(new MagicSkillUse(this, player, id, buff.getLevel(), 0, 0));
+               }
+           }

can be shortcuted to (on last aCis, isMageClass() is working as intented, but I leave your "hotfix")).

+               for (int id : (player.isMageClass() || player.getClassId() == ClassId.dominator || player.getClassId() == ClassId.doomcryer) ? Config.NEWBIE_MAGE_BUFFS : Config.NEWBIE_FIGHTER_BUFFS)
+               {
+                   L2Skill buff = SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id));
+                   buff.getEffects(this, player);
+                   player.broadcastPacket(new MagicSkillUse(this, player, id, buff.getLevel(), 0, 0));
+               }

----

+ player.setCurrentHp(player.getMaxHp());
+ player.setCurrentCp(player.getMaxCp());
+ player.setCurrentMp(player.getMaxMp());

has to be setted up OUT of buff loop, otherwise you heal on every buff (which is pointless you only need one heal at the end).

Edited by Tryskell
Posted (edited)

Thanks for your reply Tryskell..

Let me go home tomorrow, and I will give the second version..

I will try to use your reply about int arrays..

 

About heal yes.. I give the heal in every buff. I saw it yesterday..

I tried to add it without else but domi and doomcryer get fighter buffs..

I know on the latest aCis are mageclass.

 

About NewbiesNpc class, I put it here only because I won't it in L2NewbieNpcInstance.

 

In second version I have it on Startup class.

Edited by 'Baggos'
Posted (edited)

You should keep methods, variables and stuff in the "shortest range possible". Reading giveItems method, in fact you can even see there is no specific npc parameter. That method isn't related to npc, but player, as it holds 2 player parameters to work. Everything should be moved to L2PcInstance, as it's the shortest range. Rename giveItems to something more... "Catchy". It's way too much generic and can lead to huge mistakes.

 

A Startup class got no meaning, both as description (it doesn't startup anything or even load something, a static method being static) and concept - Startup.giveItems got no logic when you "say it loud", while player.giveNewbieItems() got a sense.

Edited by Tryskell
Posted (edited)

I have everything in one class. Startup.

No need to throw anything to PcInstance I guess. Better to be everything in one place.

As you said contain only to player..

Easier for everyone to find it if they want to change the Items. (I won't put config for that.. Seems ugly because of many classes. Isn't only fighters/mages).

 

I hope the second version thanks to you, to be more cleaned and without more unnecessary checks/class.

 

Also, the second version doesn't contain npc.. Just a window onEnter..

Edited by 'Baggos'
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Website: https://l2aurum.com/ Discord: https://discord.gg/ngaD9DJRjE   Dear Players, We are excited to announce that the x300 Summer Season Beta server will open on 19‑06‑2026 at 20:00 GMT+2. As previously mentioned, there will be no wipe and no account deletion. All accounts, characters, items, and progress from Season 1 will remain completely safe. To ensure a fair and competitive start for new players, all Season 1 accounts will be temporarily locked. The official Summer Season launch will take place on 26‑06‑2026 at 20:00 GMT+2. A few weeks after the official launch, Season 1 accounts will be unlocked so previous players can access their characters and continue their journey. This approach allows new players to enjoy a fresh start while preserving the progress and achievements of our long-term community. Thank you for your continued support, and we look forward to welcoming everyone to the new Summer Season. L2Aurum Team   Explore L2 Aurum Features Discover the Enhancements that set us apart!   Information Server Version: Interlude - PvP Server Client Interface: Unique Interface   Rates     Additional Features and changes When you create a new character, you will start in Giran Harbor at Level 1, equipped with full No-Grade items. Auto Farm is available for free for 2 hour daily without VIP. VIP players receive 4 hours of Auto Farm per day. The Auto Farm time resets with the server restart at 5:30 AM. Status Noblesse: Last hit Barakiel. Player Spawn Protection: 7 seconds. Geodata + Pathnodes: Enabled. All commands are available in the Community Board. Maximum 3 Bishops Per Party: Enabled. Boss Protect - Anti-Zerg: Enabled. Shift + click on monsters to see the droplist. Offline shop. Mana Potion Restores 1000 MP with a cooldown of 8 seconds. Inventory Slots: 250.   Weapon Information Lv1 Black Chaotic Weapons. Lv2 Aurum Weapons.   Armor Information Lv1 Blue Apella Armor. Lv2 Aurum Apella Armor. Misc additions Accessories +50 and +150 pdef|mdef. Tattoos: Resolve | Soul | Avadon. Agathions: Cosmetic only (no stats).   Buffs / Dances / Songs / Prophecies Duration: 2 hours. Total Buff Slots: 32 + 4 (Divine Inspiration). Vote Buff: You must vote on 3 of 6 vote sites to get the vote buff blessing. Castle Reward Every clan that captures a castle receives the castle owner clan blessing buff. To receive it, the clan leader must be online.   Events   Raid Bosses Epic Bosses Final Bosses     For full server information please visit website PvP: Server Features   Website: https://l2aurum.com/ Discord: https://discord.gg/ngaD9DJRjE      
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..