Jump to content
  • 0

Frozen - Shadow Item


Question

Posted

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)

 

 

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

  • 0
Posted

anyone can help ? code below 

 

        /** 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);
    }
    
    /**
     * Returns false cause item can't be attacked.
     * @param attacker the attacker
     * @return boolean false
     */
    @Override
    public boolean isAutoAttackable(final L2Character attacker)
    {
        return false;
    }

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

    • so whitch plan is it? because in here is one price and in ur websit is another...
    • Ты настолько смешон, что создал специально для этого левый аккаунт?)))  ты не стоишь даже капли с моего члена что бы я ради тебя писал что-то на анг)  Человек видимо облажался с запуском, слил бабки в помойку теперь с горящей жопой бегает по форуму и не знает кого обвинить))))) перечитай что я тебе написал, мне насрать на тебя на твой сервер и на то что ты там выложил)  это все дерьмо неактуально уже давно, скажу тебе если твоя тупая голова это не поняла, АКТУАЛЬНОЕ НИКТО НЕ ПРОДАЕТ, потому что любая продажа это = шара, все что продается ЭТО ОТЪЕЗЖЕННОЕ ГОВНО которое не нужно хозяину, старое как твои обвисшие от гнева сиськи    
    • L2 HARMONY - BANNERS & ICONS       L2 COLD - NPC ANIMATED BANNER
    • LA ERA DE EINHASAD - Lineage 2 en Castellano Lineage II Crónica 4: Vástagos del Destino x5 - Main Class - Full Craft ───────────────────────────── La diosa Einhasad ha despertado... Una nueva era comienza para los verdaderos aventureros. Un mundo completamente traducido al español, fiel al Lineage II original, creado para una comunidad hispanohablante unida por la nostalgia y la pasión. ───────────────────────────── APERTURA OFICIAL: 14 de NOVIEMBRE - 20:00hs (GMT-3) ───────────────────────────── INFORMACIÓN PRINCIPAL Rates: x5 Tipo: Main Class Sistema: Full Craft Idioma: 100% Español (traducción completa del juego) Comunidad hispanohablante Balance original con mínimas modificaciones Buffer Offline, los jugadores pueden crear sus tiendas de buffs Progresión de crónicas cada 4 meses aprox. Economía estable - Sin Pay to Win - No venta de items/adena por donación Comunidad de 1.000 personas Anterior versión x1 duro casi 3 años con 952 IPs distintas de pico ───────────────────────────── CARACTERÍSTICAS DESTACADAS Experiencia fiel al Lineage II clásico, sin alteraciones invasivas Interfaz, diálogos y objetos completamente en español Ventana de comunidad con servicios personalizados y comercio por Monedas de Oro Olimpiadas, Épicos y Asedios originales Recompensas por votación, Eventos TVT con 3 arenas diferentes. Participan todos sin importar el nivel, pero dentro de la arena solo se atacan por rango cercano Soporte activo y presencia constante del administrador Tickets de soporte con atención rápida en Discord ante cualquier problema ───────────────────────────── ENLACES OFICIALES Website: La Era de Einhasad Discord: https://discord.com/invite/A6PtCCN2SF ───────────────────────────── Una comunidad unida por el idioma, la pasión y la nostalgia. Redescubrí Aden… en tu propio idioma. Bienvenido a La Era de Einhasad.  
    • English you belarus retard ) Seems you so desperate and angry cant even speak back in EN, well guys you see how its easy to destroy scammer xD
  • 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