Jump to content
  • 0

Help fix ScrollDonate code for acis 388


Question

Posted

Here's the code.

package net.sf.l2j.gameserver.handler.itemhandlers;

import net.sf.l2j.gameserver.data.SkillTable;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.handler.ItemHandler;
import net.sf.l2j.gameserver.model.actor.Playable;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;

import java.util.HashMap;

public class DonateScrolls implements IItemHandler
{
    private final static HashMap<Integer, Integer[]> SCROLLS = new HashMap<Integer, Integer[]>();
    private static int[] ITEM_IDS = null;

    public DonateScrolls()
    {
        /**
		  * SCROLLS.put(item_id, new Integer[] { id_buffa, buffa level, id_skilla_animation, animation duration(ms)), take the item(1 yes, 0 no)) });
          */
        SCROLLS.put(11986, new Integer[] { 8001, 1, 7038, 1, 1 });
        SCROLLS.put(11987, new Integer[] { 8002, 1, 7038, 1, 1 });
        SCROLLS.put(11988, new Integer[] { 8003, 1, 7038, 1, 1 });
        SCROLLS.put(11989, new Integer[] { 8004, 1, 7038, 1, 1 });
        SCROLLS.put(11469, new Integer[] { 11510, 1, 7038, 1, 0 });
        SCROLLS.put(11470, new Integer[] { 11510, 2, 7038, 1, 0 });
        SCROLLS.put(11471, new Integer[] { 11510, 3, 7038, 1, 0 });
        SCROLLS.put(11472, new Integer[] { 11510, 4, 7038, 1, 0 });
        SCROLLS.put(11473, new Integer[] { 11510, 5, 7038, 1, 0 });
        SCROLLS.put(11474, new Integer[] { 11515, 1, 7038, 1, 0 });
        SCROLLS.put(11475, new Integer[] { 11515, 2, 7038, 1, 0 });
        SCROLLS.put(11476, new Integer[] { 11515, 3, 7038, 1, 0 });
        SCROLLS.put(11477, new Integer[] { 11515, 4, 7038, 1, 0 });
        SCROLLS.put(11478, new Integer[] { 11515, 5, 7038, 1, 0 });
        SCROLLS.put(11479, new Integer[] { 11520, 1, 7038, 1, 0 });
        SCROLLS.put(11480, new Integer[] { 11520, 2, 7038, 1, 0 });
        SCROLLS.put(11481, new Integer[] { 11520, 3, 7038, 1, 0 });
        SCROLLS.put(11482, new Integer[] { 11520, 4, 7038, 1, 0 });
        SCROLLS.put(11483, new Integer[] { 11520, 5, 7038, 1, 0 });
        SCROLLS.put(11484, new Integer[] { 11525, 1, 7038, 1, 0 });
        SCROLLS.put(11485, new Integer[] { 11525, 2, 7038, 1, 0 });
        SCROLLS.put(11486, new Integer[] { 11525, 3, 7038, 1, 0 });
        SCROLLS.put(11487, new Integer[] { 11525, 4, 7038, 1, 0 });
        SCROLLS.put(11488, new Integer[] { 11525, 5, 7038, 1, 0 });
        SCROLLS.put(11489, new Integer[] { 11530, 1, 7038, 1, 0 });
        SCROLLS.put(11490, new Integer[] { 11530, 2, 7038, 1, 0 });
        SCROLLS.put(11491, new Integer[] { 11530, 3, 7038, 1, 0 });
        SCROLLS.put(11492, new Integer[] { 11530, 4, 7038, 1, 0 });
        SCROLLS.put(11493, new Integer[] { 11530, 5, 7038, 1, 0 });
        SCROLLS.put(11494, new Integer[] { 11535, 1, 7038, 1, 0 });
        SCROLLS.put(11495, new Integer[] { 11535, 2, 7038, 1, 0 });
        SCROLLS.put(11496, new Integer[] { 11535, 3, 7038, 1, 0 });
        SCROLLS.put(11497, new Integer[] { 11535, 4, 7038, 1, 0 });
        SCROLLS.put(11498, new Integer[] { 11535, 5, 7038, 1, 0 });
        SCROLLS.put(11499, new Integer[] { 11540, 1, 7038, 1, 0 });
        SCROLLS.put(11500, new Integer[] { 11540, 2, 7038, 1, 0 });
        SCROLLS.put(11501, new Integer[] { 11540, 3, 7038, 1, 0 });
        SCROLLS.put(11502, new Integer[] { 11540, 4, 7038, 1, 0 });
        SCROLLS.put(11503, new Integer[] { 11540, 5, 7038, 1, 0 });

        //
        Integer[] tmp_ids = (Integer[]) SCROLLS.keySet().toArray(new Integer[SCROLLS.size()]);
        ITEM_IDS = toIntArray(tmp_ids);
        tmp_ids = null;
        ItemHandler.getInstance().getHandler(null);
    }

    public static void main (String... arguments )
    {
        new DonateScrolls();
    }

    public void useItem(Playable playable, ItemInstance item, boolean forceUse)
    {
        if (playable instanceof Player)
            return;

        Player player = (Player) playable;
        if (player.isAllSkillsDisabled())
        {
            player.sendMessage("");
            return;
        }

        if (player.isInOlympiadMode())
        {
            player.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
            player.sendMessage("");
            return;
        }

        Integer[] data = SCROLLS.get(item.getItemId());
        if(data != null)
        {
            player.stopSkillEffects(data[0]);
            SkillTable.getInstance().getInfo(data[0], data[1]).getEffects(player, player);
            player.broadcastPacket(new MagicSkillUse(player, player, data[2], 1, data[3], 0));
            if (data[4] == 1) {
                player.destroyItem("Consume", item.getObjectId(), 1, null, false);
            }
        }
    }

    private int[] toIntArray(Integer[] arr)
    {
        int[] ret = new int[arr.length];
        int i = 0;
        for (Integer e : arr)
            ret[i++] = e.intValue();
        return ret;
    }

    public int[] getItemIds()
    {
        return ITEM_IDS;
    }
}

Here are some xml items

should remain in inventory
	<item id="11469" type="EtcItem" name="MIGHT1">
		<set name="default_action" val="capsule" />
		<set name="material" val="PAPER" />
		<set name="weight" val="100" />
		<set name="is_stackable" val="true" />
		<set name="is_oly_restricted" val="true" />
		<set name="handler" val="DonateScrolls" />
		<set name="item_skill" val="11510-1" />
	</item>
this one should disappear.
	<item id="11987" type="EtcItem" name="Speed">
		<set name="default_action" val="capsule" />
		<set name="material" val="PAPER" />
		<set name="weight" val="100" />
		<set name="is_stackable" val="true" />
		<set name="is_oly_restricted" val="true" />
		<set name="handler" val="DonateScrolls" />
		<set name="item_skill" val="8002-1" />
	</item>

 

This code must make the object constant which lies in the inventory and, when using it, imposes a buffer if the value 0 is set in the code. If the value is set to 1, the item puts a buffer and disappears. How to make the code work. You need help.

4 answers to this question

Recommended Posts

  • 0
Posted

If i am not wrong,  you want player use that scrolls like others. So copy xml from might buff for exemple, and make a second xml skill for scroll with scroll image. Or simple edit with status existing scrolls.

  • 0
Posted (edited)

Copy xml from original scroll, if you make that xml for scroll. 
open L2-file edit and search in ItemName-e.dat "Scroll of Might" And copy or edit that xml. Just change Item_Skill with your skill id.

Also check this line if you have. i don;t work with aCis.

 


 <set name="default_action" val="SKILL_REDUCE" />

 

Edited by 0flee

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt
    • Why adena in this sever so expensive 🙂
  • Topics

×
×
  • Create New...