Jump to content

Recommended Posts

Guest Elfocrash
Posted

There is a faster and better way to do with with chance and not with switch and cases.

 

Good idea though.

Posted

There is a faster and better way to do with with chance and not with switch and cases.

 

Good idea though.

ty elfo :P i like this way :) by the way you mean this faster way?

 

int rnd = Rnd.get(100);

 

if(rnd < chance)?

 

anyway i like the case more

Posted

The chance should have been made in the proper way. I mean the way you enchant with scrolls.

 

Also the check for the gold bars must be put before the switch statement, otherwise the player might get trolled :P.

 

Good job.

Posted

The chance should have been made in the proper way. I mean the way you enchant with scrolls.

 

Also the check for the gold bars must be put before the switch statement, otherwise the player might get trolled :P.

 

Good job.

ty An4rchy :)

 

if i will put it before they will lose 4 gold bars for nothing, hmmm i don't know think about it and answer me... :P

Edit:i forgot that: i don't want with the "clasic" way i want something mine, because if i will add the "clasic" way they will say that i just copy it from the client packet... && is custom :P

Posted

Edit:i forgot that: i don't want with the "clasic" way i want something mine, because if i will add the "clasic" way they will say that i just copy it from the client packet... && is custom :P

Oh ok then :)

 

if i will put it before they will lose 4 gold bars for nothing, hmmm i don't know think about it and answer me... :P

Not really, you can do it like this:

if (activeChar.getInventory().getItemByItemId(3470) == null || activeChar.getInventory().getItemByItemId(3470).getCount() < 4)

{

      activeChar.sendMessage("You need 4 gold bars to use this.");

      return false;

}

 

And under case 5, you will remove this GoldBars boolean.

 

This is just to inform players that they don't have the gold bars before the switch statement. Otherwise they might be pressing the command for 2 minutes(till they get case 5) and get trolled :P

 

Another thing i just checked... Do you want players to use it whenever they want, or if they use it 4 gold bars to be taken(despite if they got case 5)?

Posted

Oh ok then :)

Not really, you can do it like this:

if (activeChar.getInventory().getItemByItemId(3470) == null || activeChar.getInventory().getItemByItemId(3470).getCount() < 4)

{

      activeChar.sendMessage("You need 4 gold bars to use this.");

      return false;

}

 

And under case 5, you will remove this GoldBars boolean.

 

This is just to inform players that they don't have the gold bars before the switch statement. Otherwise they might be pressing the command for 2 minutes(till they get case 5) and get trolled :P

 

Another thing i just checked... Do you want players to use it whenever they want, or if they use it 4 gold bars to be taken(despite if they got case 5)?

updated :)
Posted

    final int GoldBarID = 3470;

    final int GoldBarCount = 4;

 

    final L2ItemInstance Weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

    final int MaxEnchant = Config.ENCHANT_WEAPON_MAX; 

    final boolean CheckGoldBars = activeChar.getInventory().getItemByItemId(GoldBarID) == null || activeChar.getInventory().getItemByItemId(GoldBarID).getCount() < GoldBarCount;

    final boolean ActiveWeapon = activeChar.getActiveWeaponInstance() != null;

    final boolean MaxEnchantAllowed = activeChar.getActiveWeaponInstance().getEnchantLevel() < MaxEnchant;

    final boolean isNotRoDWeapon = activeChar.getActiveWeaponInstance().getItem().getItemType() != L2WeaponType.ROD;

    final boolean isInInvetory = Weapon.getLocation() == L2ItemInstance.ItemLocation.INVENTORY;    

    final boolean isParedol = Weapon.getLocation() == L2ItemInstance.ItemLocation.PAPERDOLL;

    final boolean itsMyWeapon = Weapon.getOwnerId() == activeChar.getObjectId();

 

These should be under the if (command bla bla check. There isn't something wrong with them, just saying for cleaner code.

 

Also, what about that ; at the end of this check:

if(command.startsWith("WepEnchant") && activeChar != null && activeChar.isOnline() == 1 && !activeChar.isOffline() || !activeChar.isFlying() || !activeChar.isAlikeDead() || !activeChar.is-beep-ted() || !activeChar.isInOlympiadMode() || !activeChar.isSitting());

:S

 

Another error:

else if (CheckGoldBars)

{

      activeChar.sendMessage("You need "+GoldBarCount+" gold bars to use this voiced command ");

      return false;

}

else

 

It needs to be if .... else. It can't start with else if.

Posted

    final int GoldBarID = 3470;

    final int GoldBarCount = 4;

 

    final L2ItemInstance Weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

    final int MaxEnchant = Config.ENCHANT_WEAPON_MAX; 

    final boolean CheckGoldBars = activeChar.getInventory().getItemByItemId(GoldBarID) == null || activeChar.getInventory().getItemByItemId(GoldBarID).getCount() < GoldBarCount;

    final boolean ActiveWeapon = activeChar.getActiveWeaponInstance() != null;

    final boolean MaxEnchantAllowed = activeChar.getActiveWeaponInstance().getEnchantLevel() < MaxEnchant;

    final boolean isNotRoDWeapon = activeChar.getActiveWeaponInstance().getItem().getItemType() != L2WeaponType.ROD;

    final boolean isInInvetory = Weapon.getLocation() == L2ItemInstance.ItemLocation.INVENTORY;    

    final boolean isParedol = Weapon.getLocation() == L2ItemInstance.ItemLocation.PAPERDOLL;

    final boolean itsMyWeapon = Weapon.getOwnerId() == activeChar.getObjectId();

 

These should be under the if (command bla bla check. There isn't something wrong with them, just saying for cleaner code.

 

Also, what about that ; at the end of this check:

if(command.startsWith("WepEnchant") && activeChar != null && activeChar.isOnline() == 1 && !activeChar.isOffline() || !activeChar.isFlying() || !activeChar.isAlikeDead() || !activeChar.is-beep-ted() || !activeChar.isInOlympiadMode() || !activeChar.isSitting());

:S

 

Another error:

else if (CheckGoldBars)

{

      activeChar.sendMessage("You need "+GoldBarCount+" gold bars to use this voiced command ");

      return false;

}

else

 

It needs to be if .... else. It can't start with else if.

check the code again is not error

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

    • Lineage 2 Interlude Developer – Cliente + Datapack Hola, soy developer especializado en Lineage 2 Interlude con experiencia tanto en cliente como datapack/core. ✔ Desarrollo datapack (Java, scripts, quests, balance PvP/PvE) ✔ Fixes core / geodata / exploits ✔ Sistemas custom (events, Olympiad, instancias, mods PvP) ✔ Cliente: interface mods, system patches, .dat edits, UI personalizada ✔ Optimización y estabilidad de servidor ✔ Trabajo freelance o colaboración fija Si necesitáis soporte dev o mejoras para vuestro servidor Interlude, podéis contactarme por DM. Portfolio y ejemplos disponibles bajo petición.
    • THEY DON’T COME BACK FOR NO REASON. HERE’S WHY Our clients come from different countries and with very different tasks. But the strongest indicator of quality is simple — when a client comes back **for a second time**. This case is exactly that. The client returned with a request for a **German ID**. The requirement was clear: a document **in a male hand**, with a natural live scene and correct geographic context. What we did: ▪ accepted source files and data without unnecessary bureaucracy ▪ selected a **real street**, not a generic background ▪ built a print-ready mockup with correct scene logic ▪ sent it for approval ▪ after confirmation, delivered the **final file for printing** No templates. No “good enough”. Only solutions tailored to a specific task. Result: ▪ mockup approved on the first try ▪ client fully satisfied ▪ stays in touch We work **worldwide** — and that’s exactly why clients return. Contact us › TG: @mustang_service ( https:// t.me/ mustang_service ) › Channel: Mustang Service ( https:// t.me/ +6RAKokIn5ItmYjEx ) *All data is published with the client’s consent.* #redraw #verification #documents #case #ID
    • Lineage 2 Interlude Developer – Cliente + Datapack Hola, soy developer especializado en Lineage 2 Interlude con experiencia tanto en cliente como datapack/core. ✔ Desarrollo datapack (Java, scripts, quests, balance PvP/PvE) ✔ Fixes core / geodata / exploits ✔ Sistemas custom (events, Olympiad, instancias, mods PvP) ✔ Cliente: interface mods, system patches, .dat edits, UI personalizada ✔ Optimización y estabilidad de servidor ✔ Trabajo freelance o colaboración fija Si necesitáis soporte dev o mejoras para vuestro servidor Interlude, podéis contactarme por DM. Portfolio y ejemplos disponibles bajo petición.
  • 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..