Unequip item after porting to oly stadium

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Unequip item after porting to oly stadium

Post by Naonah »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:
L2JDP Revision Number:

Hi:)

I have custom items as circlets (with custom stats).
I would like to restrict them at olympiad.
How I want it to work: when a player is going to be ported to olympiad stadium, a circlet is auto unequipped. (similar to hero's Wings od Destiny)

..but I have a small problem.

I edited OlympiadGame.java

Code: Select all

    protected void removals()    {        if (_aborted)            return;                if (_playerOne == null || _playerTwo == null)            return;        if (_playerOneDisconnected || _playerTwoDisconnected)            return;                for (L2PcInstance player : _players)        {            try            {                // Remove Buffs                player.stopAllEffectsExceptThoseThatLastThroughDeath();                                // Remove Clan Skills                if (player.getClan() != null)                {                    for (L2Skill skill : player.getClan().getAllSkills())                        player.removeSkill(skill, false, true);                    if (player.getClan().getHasCastle() > 0)                        CastleManager.getInstance().getCastleByOwner(player.getClan()).removeResidentialSkills(player);                    if (player.getClan().getHasFort() > 0)                        FortManager.getInstance().getFortByOwner(player.getClan()).removeResidentialSkills(player);                }                int itemId = getItemId();                if (itemId == 13511)                {                    for (L2ItemInstance specialitem : player.getInventory().getItems())                        if (specialitem.isEquipped())                        {                            player.getInventory().unEquipItemInSlotAndRecord(specialitem.getLocationSlot());                        }
I have a problem here: int itemId = getItemId(); Info: The method getItemId() is undefined for the type OlympiadGame.

Please help me a bit cuz I dont know well this project :P

Thank you.
Best regards.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unequip item after porting to oly stadium

Post by _DS_ »

# Restrict specified items in Olympiad. ItemID's need to be separated with a comma (ex. 1,200,350)
# Default: 0
AltOlyRestrictedItems = 0
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Unequip item after porting to oly stadium

Post by SolidSnake »

DS, he wants to unequip the equipable item, too
Image
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Unequip item after porting to oly stadium

Post by SolidSnake »

Code: Select all

Index: java/com/l2jserver/gameserver/model/entity/Hero.java===================================================================--- java/com/l2jserver/gameserver/model/entity/Hero.java  (revision 4415)+++ java/com/l2jserver/gameserver/model/entity/Hero.java  (working copy)@@ -734,7 +734,79 @@                    for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)                    {                        L2ItemInstance equippedItem = player.getInventory().getPaperdollItem(i);-                       if ((equippedItem != null) && equippedItem.isHeroItem())+                       if ((equippedItem != null) && equippedItem.isHeroItem() || equippedItem.isOlyRestrictedItem())                        {                            player.getInventory().unEquipItemInSlotAndRecord(i);                        }                    }
Then write the items ID as _DS_ said
_DS_ wrote:# Restrict specified items in Olympiad. ItemID's need to be separated with a comma (ex. 1,200,350)
# Default: 0
AltOlyRestrictedItems = 0
Image
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unequip item after porting to oly stadium

Post by _DS_ »

Maybe should be committed...
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unequip item after porting to oly stadium

Post by _DS_ »

SolidSnake, this is a wrong part of the code :D
It used only during computing new heroes. Easiest way of restricting - add xml condition, like for hero items.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unequip item after porting to oly stadium

Post by Naonah »

Thank you for replies:)

I have these items restricted like DS said.

All is OK if item is unequipped because a player cant equip it during oly match.

The problem is when he has this item equipped before oly registration. After porting an item is still in a slot (here HAIRALL). If you click on this item ofc y have info that item is restricted but this item features are still applied (like for exemple: P. Att. +25%)

About SolidSnake solution: I will try to move these code (ofc modified) from Hero.java to OlympiadGame.java and test it.

Anyway I will try to test your solutions and give a feedback here :)
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
User avatar
SolidSnake
Posts: 865
Joined: Wed Jan 20, 2010 6:54 pm
Location: Italy

Re: Unequip item after porting to oly stadium

Post by SolidSnake »

Ops sorry :shock: Try this one

Code: Select all

Index: java/com/l2jserver/gameserver/model/olympiad/OlympiadGame.java===================================================================--- java/com/l2jserver/gameserver/model/olympiad/OlympiadGame.java  (revision 4415)+++ java/com/l2jserver/gameserver/model/olympiad/OlympiadGame.java  (working copy)@@ -39,1 +39,68 @@import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;+import com.l2jserver.gameserver.model.itemcontainer.Inventory;import com.l2jserver.gameserver.model.olympiad.Olympiad.COMP_TYPE;import com.l2jserver.gameserver.network.SystemMessageId;@@ -285,5 +285,6 @@                    player.getActiveWeaponInstance().setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);                }++               for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)+               {+                   L2ItemInstance equippedItem = player.getInventory().getPaperdollItem(i);+                   if ((equippedItem != null) && equippedItem.isOlyRestrictedItem())+                   {+                       player.getInventory().unEquipItemInSlotAndRecord(i);+                   }+               }                 // enable skills with cool time <= 15 minutes
Image
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unequip item after porting to oly stadium

Post by Naonah »

@SolidSnake - Thank you. Works fine :D

@DS - I think you can commit this. It is a good solution. Adding conditions to items also work but I think core solution is better :)

Once again thank you.
/closed
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unequip item after porting to oly stadium

Post by _DS_ »

Code: Select all

Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java===================================================================--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 5229)+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)@@ -13694,7 +13694,8 @@        for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)        {            L2ItemInstance equippedItem = getInventory().getPaperdollItem(i);-           if (equippedItem != null && !equippedItem.getItem().checkCondition(this, this, false))+           if (equippedItem != null && (!equippedItem.getItem().checkCondition(this, this, false)+                   || (isInOlympiadMode() && equippedItem.isOlyRestrictedItem())))            {                getInventory().unEquipItemInSlotAndRecord(i);  
Test this. For Freya, but should apply.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unequip item after porting to oly stadium

Post by Naonah »

_DS_ wrote:

Code: Select all

Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java===================================================================--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 5229)+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)@@ -13694,7 +13694,8 @@        for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)        {            L2ItemInstance equippedItem = getInventory().getPaperdollItem(i);-           if (equippedItem != null && !equippedItem.getItem().checkCondition(this, this, false))+           if (equippedItem != null && (!equippedItem.getItem().checkCondition(this, this, false)+                   || (isInOlympiadMode() && equippedItem.isOlyRestrictedItem())))            {                getInventory().unEquipItemInSlotAndRecord(i);  
Test this. For Freya, but should apply.
You mean to put this into L2PcInstance.java or OlympiadGame.java?

... because in L2PcInstance (rev. 4415) there is no such method.

Line 13694 is inside public static boolean checkSummonTargetStatus(L2Object target, L2PcInstance summonerChar) :)

Thank you.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unequip item after porting to oly stadium

Post by _DS_ »

Press "guess" button. Ofc my current l2pcinstance far from epilogue.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
Probe
Posts: 915
Joined: Thu Sep 03, 2009 6:36 pm
Location: Israel
Contact:

Re: Unequip item after porting to oly stadium

Post by Probe »

don't search for line number, search for the actual line removed.
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unequip item after porting to oly stadium

Post by Naonah »

Probe wrote:don't search for line number, search for the actual line removed.
oops, yes you are right :P I am just a bit tired :)

@_DS_: Works fine. Can be committed to Epilogue project

Code: Select all

    public void checkItemRestriction()    {        for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)        {            L2ItemInstance equippedItem = getInventory().getPaperdollItem(i);            if (equippedItem != null && (!equippedItem.getItem().checkCondition(this, this, false) || (isInOlympiadMode() && equippedItem.isOlyRestrictedItem())))            {                getInventory().unEquipItemInSlotAndRecord(i);
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
Post Reply