Jump to content
  • 0

I Am Stuck And My Code Doesnt Work


Question

Posted (edited)

I still get mastery penalty even with this 

if (!_bow_mastery && !_blunt_mastery && !_dagger_mastery && !_fist_mastery && !_dual_mastery && !_pole_mastery && !_sword_mastery && !_2hands_mastery)
{ // not completed 1st class transfer or not acquired yet the mastery skills
newMasteryPenalty = 0;
}
else
{
for (L2ItemInstance item : getInventory().getItems())
{
if (item != null && item.isEquipped() && item.getItem() instanceof L2Weapon && !isCursedWeaponEquiped())
{
// No penality for cupid's bow

+if (item.isCupidBow() || item.getItemId() == 10010 || item.getItemId() == 10011) 
continue;
Edited by Akken

13 answers to this question

Recommended Posts

  • 0
Posted (edited)

Hello 

 

Your check is fine Akken, try to search xmls you might have something custom that gives you a penalty like some skills that are using 

usekind="sword,bow" and such stuff

Edited by Ayami-
  • 0
Posted

mastery penalty for weapon , so if you wear cupid bow it doesnt give you a penalty i want to add  2 more weapons so you cant get a mastery penalty  but i guess my code is wrong?

  • 0
Posted (edited)

it is interlude and l2jbroken (frozen) just learning making some tries   :P  i am just so curious why it doesnt work it is L2PcInstance

Edited by Akken
  • 0
Posted (edited)

Just need to add a check for 2 weapons so they wont get penalty and i am stuck

/**
* Refresh mastery weap penality.
*/
public void refreshMasteryWeapPenality()
{
if (!Config.MASTERY_WEAPON_PENALTY || this.getLevel() <= Config.LEVEL_TO_GET_WEAPON_PENALITY)
return;
 
_blunt_mastery = false;
_bow_mastery = false;
_dagger_mastery = false;
_fist_mastery = false;
_dual_mastery = false;
_pole_mastery = false;
_sword_mastery = false;
_2hands_mastery = false;
 
L2Skill[] char_skills = this.getAllSkills();
 
for (L2Skill actual_skill : char_skills)
{
 
if (actual_skill.getName().contains("Sword Blunt Mastery"))
{
_sword_mastery = true;
_blunt_mastery = true;
continue;
}
 
if (actual_skill.getName().contains("Blunt Mastery"))
{
_blunt_mastery = true;
continue;
}
 
if (actual_skill.getName().contains("Bow Mastery"))
{
_bow_mastery = true;
continue;
}
 
if (actual_skill.getName().contains("Dagger Mastery"))
{
_dagger_mastery = true;
continue;
}
 
if (actual_skill.getName().contains("Fist Mastery"))
{
_fist_mastery = true;
continue;
}
 
if (actual_skill.getName().contains("Dual Weapon Mastery"))
{
_dual_mastery = true;
continue;
}
 
if (actual_skill.getName().contains("Polearm Mastery"))
{
_pole_mastery = true;
continue;
}
 
if (actual_skill.getName().contains("Two-handed Weapon Mastery"))
{
_2hands_mastery = true;
continue;
}
}
 
int newMasteryPenalty = 0;
 
if (!_bow_mastery && !_blunt_mastery && !_dagger_mastery && !_fist_mastery && !_dual_mastery && !_pole_mastery && !_sword_mastery && !_2hands_mastery)
{ // not completed 1st class transfer or not acquired yet the mastery skills
newMasteryPenalty = 0;
}
else
{
for (L2ItemInstance item : getInventory().getItems())
{
if (item != null && item.isEquipped() && item.getItem() instanceof L2Weapon && !isCursedWeaponEquiped())
{
// No penality for cupid's bow
if (item.isCupidBow())
continue;
 
L2Weapon weap_item = (L2Weapon) item.getItem();
 
switch (weap_item.getItemType())
{
 
case BIGBLUNT:
case BIGSWORD:
{
if (!_2hands_mastery)
newMasteryPenalty++;
}
break;
case BLUNT:
{
if (!_blunt_mastery)
newMasteryPenalty++;
}
break;
case BOW:
{
if (!_bow_mastery)
newMasteryPenalty++;
}
break;
case DAGGER:
{
if (!_dagger_mastery)
newMasteryPenalty++;
}
break;
case DUAL:
{
if (!_dual_mastery)
newMasteryPenalty++;
}
break;
case DUALFIST:
case FIST:
{
if (!_fist_mastery)
newMasteryPenalty++;
}
break;
case POLE:
{
if (!_pole_mastery)
newMasteryPenalty++;
}
break;
case SWORD:
{
if (!_sword_mastery)
newMasteryPenalty++;
}
break;
 
}
}
}
 
}
Edited by Akken
  • 0
Posted
if (!_bow_mastery && !_blunt_mastery && !_dagger_mastery && !_fist_mastery && !_dual_mastery && !_pole_mastery && !_sword_mastery && !_2hands_mastery)
{ // not completed 1st class transfer or not acquired yet the mastery skills
newMasteryPenalty = 0;
}
else if (item.isCupidBow() || item.getItemId() == 10010 || item.getItemId() == 10011)  {
newMasteryPenalty = 0;
}
else
{
for (L2ItemInstance item : getInventory().getItems())
{
if (item != null && item.isEquipped() && item.getItem() instanceof L2Weapon && !isCursedWeaponEquiped())
{

something like that dunno ;D

  • 0
Posted

his code is working i tested it on my local practise project just mine isnt l2jfrozen 

 

he propably has something custom i am sure for this.

Guest
This topic is now closed to further replies.


  • Posts

    • WTB Character on Lineage 2 Reborn - Origins 1x Server   Looking for lvl 80+ character (3 subclasses )+ clean email  Classes im mostly intrested about are: Mystic Muse Adventurer Ghost Hunter Soul Hound Grand Khavatari Titan   Im looking forward for your PM's here on Max website or leave a comment down below with your discord or any contact in case you have any of those classes. If you have any other class that are not mentioned drop a PM aswell might be intrested in other classes i haven't mentioned aswell if its high lvl and has good potential.
    • Thanks for showing us this post, it is clearly seen that some user names pulling hate in that post, have the same name here in maxcheaters.... it is very interesting information, as it shows that the same users here at maxcheaters are scouring other forum posts to spew their hate. this does not affect much, as the customers understand, that there are only 4 or 5 people globally trying to harm our project.... the rest are all happy, luckily 🙂   Greetings. PD: You still don't understand that this is going to spread to many servers and it's something you can't avoid... you understand that, don't you? By the way, if you used an extender like ours, maybe you wouldn't have to reopen your server hundreds of times over the years.
    • 🚨 L2MID RETURNS IN 2025! 🚨 After 3 long years… The wait is FINALLY over! One of the most legendary Lineage 2 server is coming back stronger, sharper, and more competitive than ever before. 💎 All users who vote will receive exclusive gifts in the future! 👉 Cast your vote now!  https://l2mid.com/vote/ Let’s make this the most epic comeback ever! Stay tuned for more updates and invite your friends L2Mid is BACK!
    • Yeah I also “heard” you are pretty popular over there 🙂 especially in Ukraine/RU   https://mmo-dev.info/threads/⭐-l2off-h5-gx-ext⭐.33144/
    • I do not disclose information about my clients 🙂 you will see them online for example, in brazil, argentina and chile. Have great sales.   Best regards.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock