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

    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market
    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market
    • 📈 X (Twitter) — Promotion for all purposes  🚀 Boost reach, likes, views, and retweets with the best rates on the market!   🧠 Available services:  🔹 Likes, retweets, comments  🔹 Tweet and video views  🔹 Mentions and polls  🔹 Followers   💼 Perfect for:  ✔️ SMM specialists  ✔️ Arbitrage experts  ✔️ Crypto, NFT, and news account owners  ✔️ Agencies promoting businesses and personal brands ...and much more! Use our SMM Panel to boost on Facebook, Instagram, Telegram, Spotify, Soundcloud, YouTube, Reddit, Threads, Kick, Discord, LinkedIn, Likee, VK, Twitch, Kwai, Reddit, website traffic, TikTok, TrustPilot, Apple Music, Tripadvisor, Snapchat, and other digital products.   🎁 Promo code: XBOOST5 (5% discount)   🎁 Get $1 trial bonus:  Simply open a ticket titled “Get Trial Bonus” on our website (Support)  ➡ Go to SMM Panel (clickable)  Or contact support via bot 🎁   How to order:  ➡ SMM Panel: Click ✅  ➡ SMM Panel directly inside our Telegram bot: Click ✅ (Menu ➡ SMM Panel)   Our Digital Goods Store:  ➡ Online Store: Click ✅  ➡ Telegram Bot: Click ✅    Regular customers get extra discounts and promo codes!   Support:  ➡ Telegram: https://t.me/solomon_bog ✅  ➡ Discord: https://discord.gg/y9AStFFsrh ✅  ➡ WhatsApp: https://wa.me/79051904467 ✅  ➡ ✉ Email: solomonbog@socnet.store ✅   ➡ Telegram Channel: https://t.me/accsforyou_shop ✅   Use these contacts to:  — Discuss wholesale purchases  — Propose partnerships (current partners: https://socnet.bgng.io/partners )   — Become a supplier 🧩 SocNet — Digital Goods & Premium Subscriptions Store ✅
    • Want Telegram Premium at the best prices and with zero hassle? You’ve come to the right place! Premium subscriptions from 1 to 12 months — with or without account authorization. Full guarantee for the entire subscription period. Promo code: TGJULY (10% discount) Payment methods: bank cards · cryptocurrency · other popular options How to buy: ➡ Online Store: Click ➡ Telegram Bot: Click Other services: ➡ SMM Panel: Click Available options: ➡ Telegram Premium subscription for 1 month to your account | Authorization in your account is required (via TDATA or phone number) | Price from: $6 ➡ Telegram Premium subscription for 3 months on your account | No authorization required | Full guarantee for the entire period | Price from: $19 ➡ Telegram Premium subscription for 6 months on your account | No authorization required | Full guarantee for the entire period | Price from: $23 ➡ Telegram Premium subscription for 12 months on your account | No authorization required | Full guarantee for the entire period | Price from: $37 Regular customers receive extra discounts and promo codes! Support: ➡ Telegram: https://t.me/solomon_bog ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ ✉ Email: solomonbog@socnet.store ➡ Telegram Channel: https://t.me/accsforyou_shop You can also use these contacts to: — Discuss wholesale orders — Propose partnerships (current partners: https://socnet.bgng.io/partners ) — Become a supplier SocNet — Digital Goods & Premium Subscriptions Store
    • Want Telegram Premium at the best prices and with zero hassle? You’ve come to the right place! Premium subscriptions from 1 to 12 months — with or without account authorization. Full guarantee for the entire subscription period. Promo code: TGJULY (10% discount) Payment methods: bank cards · cryptocurrency · other popular options How to buy: ➡ Online Store: Click ➡ Telegram Bot: Click Other services: ➡ SMM Panel: Click Available options: ➡ Telegram Premium subscription for 1 month to your account | Authorization in your account is required (via TDATA or phone number) | Price from: $6 ➡ Telegram Premium subscription for 3 months on your account | No authorization required | Full guarantee for the entire period | Price from: $19 ➡ Telegram Premium subscription for 6 months on your account | No authorization required | Full guarantee for the entire period | Price from: $23 ➡ Telegram Premium subscription for 12 months on your account | No authorization required | Full guarantee for the entire period | Price from: $37 Regular customers receive extra discounts and promo codes! Support: ➡ Telegram: https://t.me/solomon_bog ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ ✉ Email: solomonbog@socnet.store ➡ Telegram Channel: https://t.me/accsforyou_shop You can also use these contacts to: — Discuss wholesale orders — Propose partnerships (current partners: https://socnet.bgng.io/partners ) — Become a supplier SocNet — Digital Goods & Premium Subscriptions Store
  • 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