Page 1 of 1
Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 1:15 am
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
Thank you.
Best regards.
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 4:54 am
by _DS_
# Restrict specified items in Olympiad. ItemID's need to be separated with a comma (ex. 1,200,350)
# Default: 0
AltOlyRestrictedItems = 0
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 7:42 am
by SolidSnake
DS, he wants to unequip the equipable item, too
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 8:07 am
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
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 9:17 am
by _DS_
Maybe should be committed...
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 9:53 am
by _DS_
SolidSnake, this is a wrong part of the code
It used only during computing new heroes. Easiest way of restricting - add xml condition, like for hero items.
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 10:01 am
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

Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 10:39 am
by SolidSnake
Ops sorry

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
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 11:39 am
by Naonah
@SolidSnake - Thank you. Works fine
@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
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 3:25 pm
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.
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 6:52 pm
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.
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 7:06 pm
by _DS_
Press "guess" button. Ofc my current l2pcinstance far from epilogue.
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 7:09 pm
by Probe
don't search for line number, search for the actual line removed.
Re: Unequip item after porting to oly stadium
Posted: Sun Sep 19, 2010 8:45 pm
by Naonah
Probe wrote:don't search for line number, search for the actual line removed.
oops, yes you are right

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);