I find that its already disuss about this on this forum, but for aCis project, I just want to know how to edit code for Frozen Pack to make: Shadow items taking mana also in inventory not only equiped.
I am newbie in this, and trying to find how the think conected / working.
I am find this code, I am supposed that should be changed somehow.
I will be glad for any help. Thank you
(sorry for my bad english)
Spoiler
/** The _shadow item. */
private final L2ItemInstance _shadowItem;
/**
* Instantiates a new schedule consume mana task.
* @param item the item
*/
public ScheduleConsumeManaTask(final L2ItemInstance item)
{
_shadowItem = item;
}
/*
* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run()
{
try
{
// decrease mana
if (_shadowItem != null)
{
_shadowItem.decreaseMana(true);
}
}
catch (final Throwable t)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
t.printStackTrace();
}
}
}
/**
* Returns true if this item is a shadow item Shadow items have a limited life-time.
* @return true, if is shadow item
*/
public boolean isShadowItem()
{
return _mana >= 0;
}
/**
* Sets the mana for this shadow item <b>NOTE</b>: does not send an inventory update packet.
* @param mana the new mana
*/
public void setMana(final int mana)
{
_mana = mana;
}
/**
* Returns the remaining mana of this shadow item.
* @return lifeTime
*/
public int getMana()
{
return _mana;
}
/**
* Decreases the mana of this shadow item, sends a inventory update schedules a new consumption task if non is running optionally one could force a new task.
* @param resetConsumingMana the reset consuming mana
*/
public void decreaseMana(final boolean resetConsumingMana)
{
if (!isShadowItem())
return;
if (_mana > 0)
_mana--;
if (_storedInDb)
_storedInDb = false;
if (resetConsumingMana)
_consumingMana = false;
L2PcInstance player = (L2PcInstance) L2World.getInstance().findObject(getOwnerId());
if (player != null)
{
SystemMessage sm;
switch (_mana)
{
case 10:
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_10);
sm.addString(getItemName());
player.sendPacket(sm);
break;
case 5:
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_5);
sm.addString(getItemName());
player.sendPacket(sm);
break;
case 1:
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_1);
sm.addString(getItemName());
player.sendPacket(sm);
break;
}
if (_mana == 0) // The life time has expired
{
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_0);
sm.addString(getItemName());
player.sendPacket(sm);
// unequip
if (isEquipped())
{
L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getEquipSlot());
InventoryUpdate iu = new InventoryUpdate();
for (final L2ItemInstance element : unequiped)
{
player.checkSSMatch(null, element);
iu.addModifiedItem(element);
}
// send update
InventoryUpdate iu = new InventoryUpdate();
iu.addRemovedItem(this);
player.sendPacket(iu);
iu = null;
StatusUpdate su = new StatusUpdate(player.getObjectId());
su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
player.sendPacket(su);
su = null;
}
else
{
player.getWarehouse().destroyItem("L2ItemInstance", this, player, null);
}
// delete from world
L2World.getInstance().removeObject(this);
}
else
{
// Reschedule if still equipped
if (!_consumingMana && isEquipped())
scheduleConsumeManaTask();
if (getLocation() != ItemLocation.WAREHOUSE)
{
InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(this);
player.sendPacket(iu);
iu = null;
}
}
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Aos Brasileiros curiosos e Lisos, o link para baixar esta apenas por premium, custa 5$ por mes, para testar minha interface antiga e cheia de bugs kkkkk
Outra coisa, eu deletei o link do patch, entao nao vai funcionar mesmo que voces baixem kkkk
Se quiserem comprar ela de mim, atualizada e funcional para LUCERA, chamem no facebook ou na DM com o numero do whatsapp
Lineage 2 Interlude L2OFF
Server Based on H5 Files
Are you looking to start your own Lineage 2 server? This is your chance! I’m selling a 100% functional server based on Official L2OFF H5 files, adapted to the Interlude version.
Main Features:
Based on official L2OFF H5 files, perfectly configured for Interlude.
Includes the full source code, allowing you to fully customize the server to fit your needs.
Fully working events, such as:
TvT (Team vs. Team)
CTF (Capture the Flag)
Tons of custom content added, keeping the balance and original essence of the game.
Why choose this project?
The server is fully functional and optimized, ready to launch.
You can test the server before purchasing, with access to a GM character to explore all features.
Comes with everything you need to make your project a success, both technically and in terms of content.
Interested?
Feel free to contact me! If you need more information or would like to schedule a test, I’m happy to answer any questions.
Auto Create Accounts
Client Test Server: DOWNLOAD
Price: 600 usd
Source price: send pm.
Discord: Guytis#6760
Skype: gustavoorellano@hotmail.com
Question
luckies
Hello everyone,
I find that its already disuss about this on this forum, but for aCis project, I just want to know how to edit code for Frozen Pack to make: Shadow items taking mana also in inventory not only equiped.
I am newbie in this, and trying to find how the think conected / working.
I am find this code, I am supposed that should be changed somehow.
I will be glad for any help. Thank you
(sorry for my bad english)
/** The _shadow item. */
private final L2ItemInstance _shadowItem;
/**
* Instantiates a new schedule consume mana task.
* @param item the item
*/
public ScheduleConsumeManaTask(final L2ItemInstance item)
{
_shadowItem = item;
}
/*
* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run()
{
try
{
// decrease mana
if (_shadowItem != null)
{
_shadowItem.decreaseMana(true);
}
}
catch (final Throwable t)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
t.printStackTrace();
}
}
}
/**
* Returns true if this item is a shadow item Shadow items have a limited life-time.
* @return true, if is shadow item
*/
public boolean isShadowItem()
{
return _mana >= 0;
}
/**
* Sets the mana for this shadow item <b>NOTE</b>: does not send an inventory update packet.
* @param mana the new mana
*/
public void setMana(final int mana)
{
_mana = mana;
}
/**
* Returns the remaining mana of this shadow item.
* @return lifeTime
*/
public int getMana()
{
return _mana;
}
/**
* Decreases the mana of this shadow item, sends a inventory update schedules a new consumption task if non is running optionally one could force a new task.
* @param resetConsumingMana the reset consuming mana
*/
public void decreaseMana(final boolean resetConsumingMana)
{
if (!isShadowItem())
return;
if (_mana > 0)
_mana--;
if (_storedInDb)
_storedInDb = false;
if (resetConsumingMana)
_consumingMana = false;
L2PcInstance player = (L2PcInstance) L2World.getInstance().findObject(getOwnerId());
if (player != null)
{
SystemMessage sm;
switch (_mana)
{
case 10:
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_10);
sm.addString(getItemName());
player.sendPacket(sm);
break;
case 5:
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_5);
sm.addString(getItemName());
player.sendPacket(sm);
break;
case 1:
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_1);
sm.addString(getItemName());
player.sendPacket(sm);
break;
}
if (_mana == 0) // The life time has expired
{
sm = new SystemMessage(SystemMessageId.S1S_REMAINING_MANA_IS_NOW_0);
sm.addString(getItemName());
player.sendPacket(sm);
// unequip
if (isEquipped())
{
L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getEquipSlot());
InventoryUpdate iu = new InventoryUpdate();
for (final L2ItemInstance element : unequiped)
{
player.checkSSMatch(null, element);
iu.addModifiedItem(element);
}
player.sendPacket(iu);
unequiped = null;
iu = null;
}
if (getLocation() != ItemLocation.WAREHOUSE)
{
// destroy
player.getInventory().destroyItem("L2ItemInstance", this, player, null);
// send update
InventoryUpdate iu = new InventoryUpdate();
iu.addRemovedItem(this);
player.sendPacket(iu);
iu = null;
StatusUpdate su = new StatusUpdate(player.getObjectId());
su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
player.sendPacket(su);
su = null;
}
else
{
player.getWarehouse().destroyItem("L2ItemInstance", this, player, null);
}
// delete from world
L2World.getInstance().removeObject(this);
}
else
{
// Reschedule if still equipped
if (!_consumingMana && isEquipped())
scheduleConsumeManaTask();
if (getLocation() != ItemLocation.WAREHOUSE)
{
InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(this);
player.sendPacket(iu);
iu = null;
}
}
sm = null;
}
player = null;
}
/**
* Schedule consume mana task.
*/
private void scheduleConsumeManaTask()
{
_consumingMana = true;
ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleConsumeManaTask(this), MANA_CONSUMPTION_RATE);
}
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.