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

    • SocNet is now on Medium! Check out our new article showcasing the full potential of our store and SMM Panel! Article: Click   🚀 Promo code: MEDIUM5 (5% Discount)   ➡️ Online Store: Click ✅ ➡️ Telegram Bot: Click ✅ ➡️ SMM Panel: Click ✅   Regular customers receive additional 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 contact us for: — Wholesale inquiries — Partnership opportunities (Current partners: https://socnet.bgng.io/partners )  — Becoming a supplier   SocNet — your store for digital goods and premium subscriptions ✅
    • SocNet is now on Medium! Check out our new article showcasing the full potential of our store and SMM Panel! Article: Click Promo code: MEDIUM5 (5% Discount) Online Store: Click Telegram Bot: Click SMM Panel: Click Regular customers receive additional 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 contact us for: — Wholesale inquiries — Partnership opportunities (Current partners: https://socnet.bgng.io/partners ) — Becoming a supplier SocNet — your store for digital goods and premium subscriptions  Want to expand your business network or promote services through the largest B2B platform? LinkedIn accounts are your tool for marketing, recruiting, and outreach automation. Perfect for SMM, hiring, lead generation, and business scaling. ➡ Ready-made accounts — fast, convenient, no hassle. Promo code: LINKEDIN5 (5% discount) Payment: Bank cards · Cryptocurrency · Other popular methods How to buy: ➡ Online Store: Click ➡ Telegram Bot: Click Other services: ➡ SMM Panel: Click Product range: ➡ LINKEDIN.COM ACCOUNTS | EMAIL INCLUDED @OUTLOOK.COM / @HOTMAIL.COM / @FIRSTMAIL.COM, MALE OR FEMALE, PARTIALLY FILLED PROFILES, REGISTERED FROM USA IP | Price from: $2.5 ➡ LINKEDIN.COM ACCOUNTS | EMAIL INCLUDED @OUTLOOK.COM / @HOTMAIL.COM / @FIRSTMAIL.COM, MALE OR FEMALE, PARTIALLY FILLED PROFILES, REGISTERED FROM EUROPE IP | Price from: $2.5 ➡ LINKEDIN.COM ACCOUNTS | EMAIL INCLUDED @OUTLOOK.COM / @HOTMAIL.COM / @FIRSTMAIL.COM, MALE OR FEMALE, PARTIALLY FILLED PROFILES, REGISTERED FROM MIX IP | Price from: $2.5 ➡ LinkedIn Old Brute Account with Real Connections (0 connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $10 ➡ LinkedIn Premium Brute Account (Premium) with active 1-month Premium subscription | Geo: MIX | Registered on real device | Full account access | Price from: $20 ➡ LinkedIn Old Brute Account with Real Connections (50 connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $20 ➡ LinkedIn Old Brute Account with Real Connections (100+ connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $39 ➡ LinkedIn Old Brute Account with Real Connections (500+ connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $69 ➡ LinkedIn Verified Brute Account with verified documents | Geo: MIX | Registered on real device | Full account access | Price from: $89 Loyal customers — additional 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 Also via these contacts you can: — Consult about wholesale purchases — Set up a partnership (current partners: https://socnet.bgng.io/partners ) — Become our supplier SocNet — Digital Goods and Premium Subscriptions Store
    • SocNet is now on Medium! Check out our new article showcasing the full potential of our store and SMM Panel! Article: Click Promo code: MEDIUM5 (5% Discount) Online Store: Click Telegram Bot: Click SMM Panel: Click Regular customers receive additional 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 contact us for: — Wholesale inquiries — Partnership opportunities (Current partners: https://socnet.bgng.io/partners ) — Becoming a supplier SocNet — your store for digital goods and premium subscriptions  Want to expand your business network or promote services through the largest B2B platform? LinkedIn accounts are your tool for marketing, recruiting, and outreach automation. Perfect for SMM, hiring, lead generation, and business scaling. ➡ Ready-made accounts — fast, convenient, no hassle. Promo code: LINKEDIN5 (5% discount) Payment: Bank cards · Cryptocurrency · Other popular methods How to buy: ➡ Online Store: Click ➡ Telegram Bot: Click Other services: ➡ SMM Panel: Click Product range: ➡ LINKEDIN.COM ACCOUNTS | EMAIL INCLUDED @OUTLOOK.COM / @HOTMAIL.COM / @FIRSTMAIL.COM, MALE OR FEMALE, PARTIALLY FILLED PROFILES, REGISTERED FROM USA IP | Price from: $2.5 ➡ LINKEDIN.COM ACCOUNTS | EMAIL INCLUDED @OUTLOOK.COM / @HOTMAIL.COM / @FIRSTMAIL.COM, MALE OR FEMALE, PARTIALLY FILLED PROFILES, REGISTERED FROM EUROPE IP | Price from: $2.5 ➡ LINKEDIN.COM ACCOUNTS | EMAIL INCLUDED @OUTLOOK.COM / @HOTMAIL.COM / @FIRSTMAIL.COM, MALE OR FEMALE, PARTIALLY FILLED PROFILES, REGISTERED FROM MIX IP | Price from: $2.5 ➡ LinkedIn Old Brute Account with Real Connections (0 connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $10 ➡ LinkedIn Premium Brute Account (Premium) with active 1-month Premium subscription | Geo: MIX | Registered on real device | Full account access | Price from: $20 ➡ LinkedIn Old Brute Account with Real Connections (50 connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $20 ➡ LinkedIn Old Brute Account with Real Connections (100+ connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $39 ➡ LinkedIn Old Brute Account with Real Connections (500+ connections) | Mix Geo | Filled Profile | Registered on real device | Price from: $69 ➡ LinkedIn Verified Brute Account with verified documents | Geo: MIX | Registered on real device | Full account access | Price from: $89 Loyal customers — additional 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 Also via these contacts you can: — Consult about wholesale purchases — Set up a partnership (current partners: https://socnet.bgng.io/partners ) — Become our supplier SocNet — Digital Goods and Premium Subscriptions Store
    • Buying & Selling Torn City Cash
  • 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