Jump to content

Newbies Helper Npc [Acis]


Recommended Posts

- 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
Link to comment
Share on other sites

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'
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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'
Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • CLExt Re-Captcha Anti-Bot System    
    • OUR OFFICIAL WEBSITE / FORUM - MILLENNIUM-HOOK.NET CHEAT DESCRIPTION: Our cheat for Valorant is the best and safest solution for this game. The cheat supports all the most necessary functions such as aimbot. We also support esp, since our esp (visual) is not displayed in screenshots or videos, for example when streaming. Therefore, we cannot be detected by the Riot Vanguard anti-cheat. We offer you the best value for money cheats on the market for this game. SUPPORTED ANTI-CHEATS: (read more on official website) - Riot Vanguard AC: Undetected & Safe Our Valorant cheat has a limited number of slots to ensure greater product security! (Available slots check on official website) FEATURES: AIMBOT: - Bone (Head, Neck, Body, Arms, Stomach) - Customizable Smooth - Customizable Fov Size / Fov Circle - Anti Shake Aim - Aimkey - Auto Shot - RCS ESP: - ESP Players - Player Corpse - Player Box - Filled Box - Line ESP - Player Skeleton - Player Health - Distance ESP MISC: - Online config - No Recoil - Radar (A Separate Radar that shows locations of the enemies) REQUIREMENTS: - Included HWID Spoofer: Yes - Stream Bypass: Yes - Supported game modes: Windowed, Borderless - Supported CPU: Intel & AMD - Supported OS: Windows 10 (1903,1909,2004,20H2,21H1, 22H2), Windows 11 (All version). Supported OS change and are added periodically. More check on official website. SCREENSHOTS: - Check on official website.
    • Welcome to my store : https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 60.99 $ 2016 Discord Account : 10.50 $ 2017 Discord Account :4.99 $ 2018 Discord Account : 3.99 $ 2019 Discord Account : 2.99 $ 2020 Discord Account :1.99$ 2021 Discord Account :1.50$ 2022 Discord Account :0.99$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore11 Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore11 Welcome to my store :  https://topestore.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10$ 2017 Discord Account :3.99 $ 2018 Discord Account : 3.50$ 2019 Discord Account : 2.70 $ 2020 Discord Account :1.50$ 2021 Discord Account :0.99$ 2022 Discord Account :0.70$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord : @ultrasstore11 Telegram : https://t.me/ultrastore11
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hoodservices https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...