Jump to content

Acacia

Members
  • Posts

    55
  • Credits

  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by Acacia

  1. Okay , a simple drop event coded on l2j Sources 
    it multiplies the drops of item only if its 100% rate 

     

    you type //dropevent to start the event after 15 mins ex. 

    and re-type //dropevent if you wish to force stop it 

     

    there is a configuration on the rate default is x1.2 

     

    the event will last for 60 minutes , and it will announce back when it ends 

     

    if event is active and a player logs in he will get a notification by pm 🙂

     

    Create a new class : DropEvent 

    package com.event;
    
    import net.sf.l2j.Config;
    import net.sf.l2j.gameserver.Announcements;
    import net.sf.l2j.gameserver.ThreadPoolManager;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    import net.sf.l2j.gameserver.network.clientpackets.Say2;
    import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
    
    /**
     * @author Kishin
     */
    public class DropEvent {
    
       private int startIn = Config.DROP_EVENT_START;
       private int stopIn = Config.DROP_EVENT_END;
    
    
       public void sendDropEventInfo(L2PcInstance player) {
               player.broadcastPacket(new CreatureSay(player.getObjectId() ,Say2.TELL," "+player.getName()+":","Drop Event is currently running!"));
               player.sendMessage("Drop event is currently running!");
       }
    
    public void startEvent()
    {
        Announcements.getInstance().announceToAll("Double drop event will start in "+startIn+" minutes");
        ThreadPoolManager.getInstance().scheduleGeneral(new startTimer(), (startIn *60 * 1000));
    }
    
        public void forceStop()
        {
                setDoubleDrop(false);
        }
    
        public class startTimer implements Runnable {
    
            public void run() {
                setDoubleDrop(true);
                Announcements.getInstance().announceToAll("Double drop event has started !");
                Announcements.getInstance().announceToAll("Event will end in "+stopIn+" minutes !");
                ThreadPoolManager.getInstance().scheduleGeneral(new stopTimer(), (stopIn * 60 * 1000));
    
            }
        }
    
        public class stopTimer implements Runnable {
    
            public void run() {
                if (isDoubleDrop()) {
                    setDoubleDrop(false);
                    Announcements.getInstance().announceToAll("Double drop event has ended");
                }
            }
        }
    
        public static DropEvent getInstance() {
            return DropEvent.SingletonHolder._instance;
        }
    
        private static class SingletonHolder {
            protected static final DropEvent _instance = new DropEvent();
        }
    
        private boolean _isDoubleDrop;
    
        public void setDoubleDrop(boolean isDoubleDrop)
        {
            _isDoubleDrop = isDoubleDrop;
        }
    
        public boolean isDoubleDrop()
        {
            return _isDoubleDrop;
        }
    }


    L2Attackable.java search this -> 

    private RewardItem calculateCategorizedRewardItem
    

     

     and under this :

    dropChance *= Config.L2JMOD_CHAMPION_REWARDS;

    paste :

     

    if (DropEvent.getInstance().isDoubleDrop())
    {
       if ( dropChance == 1000000) {
          dropChance *= Config.DROP_EVENT_RATE;
       }
    }

    EnterWorld.java ->

    paste somewhere 

     

    if (DropEvent.getInstance().isDoubleDrop()) {
       DropEvent.getInstance().sendDropEventInfo(activeChar);
    }

    in Config.java 
    paste somewhere this :
     

     

    public static int DROP_EVENT_START;
    public static int DROP_EVENT_END;
    public static float DROP_EVENT_RATE;


    pick your destination file  mine is customSettings 

    paste

    DROP_EVENT_START = Integer.parseInt(customsSettings.getProperty("dropEventStart", "15"));
    DROP_EVENT_END = Integer.parseInt(customsSettings.getProperty("dropEventEnd", "60"));
    DROP_EVENT_RATE =  Float.parseFloat(customsSettings.getProperty("dropEventRate", "1.2"));

    Create a new class in admincommandhandlers 

    AdminDropEvent <-

    package net.sf.l2j.gameserver.handler.admincommandhandlers;
    
    import com.event.DropEvent;
    import net.sf.l2j.gameserver.Announcements;
    import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
    
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
    
    /**
     * @author Kishin
     */
    public class AdminDropEvent implements IAdminCommandHandler {
    
        private static final String[] ADMIN_COMMANDS = {
                        "admin_dropevent"   };
    
        @Override
        public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    
            try
            {
                if (command.equals("admin_dropevent"))
                {
                    if (DropEvent.getInstance().isDoubleDrop())
                    {
                        DropEvent.getInstance().forceStop();
                        Announcements.getInstance().announceToAll("Admin has ended the drop event");
                    }
                    else
                    {
                        DropEvent.getInstance().startEvent();
                    }
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
            return false;
        }
    
        @Override
        public String[] getAdminCommandList()
        {
            return ADMIN_COMMANDS;
        }
    }
    Have fun :)

    register the command handler  and good to go 🙂

    • Thanks 1
  2. On 1/14/2020 at 1:47 AM, xFranky said:

    Wouldn't it be better to have a simple config location, where you would specify the different pvp's and pk's as follows?:

    ExampleSystemPvPs = 300,00ff00;

    300 is the amount of pvp's you need and then the colour in Hexa. This is what I've personally done to make it easier, rather than reading an XML code.

    why running the code all over than have it catched? though this one not just rewards color name or title but skill reward aswell , also its more readable than 123,ff0000;1234,ff01234

    you can add and do w/e you want with the templates ->

    <list>
           <template pvp_amount="50" name_color="FFAA00" title_color="FFFF00" learn_skill="0,0;" />
           <template pvp_amount="100" name_color="FF0000" title_color="FFAA00" learn_skill="2106,1;" />
           <template pvp_amount="150" name_color="FF0000" title_color="FFFFAA" learn_skill="0,0;" />
    </list>

     

  3. Color name - title system + Skill Reward coded on 374 acis . cheers

     

    package net.sf.l2j.gameserver.datatables;
    
    import net.sf.l2j.gameserver.templates.L2Pvp;
    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.logging.Logger;
    
    import net.sf.l2j.gameserver.model.holder.IntIntHolder;
    import net.sf.l2j.gameserver.templates.StatsSet;
    import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
    import org.w3c.dom.*;
    
    public class PvpTable
    {
    
        public PvpTable()
        {
        }
        
        public static void load()
        {
            try
            {
                File f = new File("./data/xml/pvp.xml");
                Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
                Node n = doc.getFirstChild();
                for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
                    if(d.getNodeName().equalsIgnoreCase("template"))
                    {
                        NamedNodeMap attrs = d.getAttributes();
                        int pvpAmount = Integer.valueOf(attrs.getNamedItem("pvp_amount").getNodeValue()).intValue();
                        int nameColor = Integer.decode((new StringBuilder()).append("0x").append(attrs.getNamedItem("name_color").getNodeValue()).toString()).intValue();
                        int titleColor = Integer.decode((new StringBuilder()).append("0x").append(attrs.getNamedItem("title_color").getNodeValue()).toString()).intValue();
                        String learnSkill = attrs.getNamedItem("learn_skill").getNodeValue().trim();
                        StatsSet set = new StatsSet();
                        set.set("pvp_amount", pvpAmount);
                        set.set("name_color", nameColor);
                        set.set("title_color", titleColor);
                        L2Pvp template = new L2Pvp(set);
                        if(learnSkill != null)
                        {
                            String property[] = learnSkill.split(";");
                            String as[] = property;
                            int i = as.length;
                            for(int j = 0; j < i; j++)
                            {
                                String data = as[j];
                                String holder[] = data.split(",");
                                template.addLearnSkill(new IntIntHolder(Integer.parseInt(holder[0]), Integer.parseInt(holder[1])));
                            }
    
                        }
                        _templates.add(template);
                    }
    
            }
            catch(Exception e)
            {
                _log.severe((new StringBuilder()).append("Exception: PvpTable load: ").append(e).toString());
            }
            _log.info((new StringBuilder()).append("PvpTable: Loaded ").append(_templates.size()).append(" template(s).").toString());
        }
    
        public static List<L2Pvp> getTemplate()
        {
            return _templates;
        }
    
        private static final Logger _log = Logger.getLogger(PvpTable.class.getName());
        private static final List<L2Pvp> _templates = new ArrayList<>();
    
    }

     

     

     

    package net.sf.l2j.gameserver.templates;
    
    import java.util.ArrayList;
    import java.util.List;
    import net.sf.l2j.gameserver.model.holder.IntIntHolder;
    import net.sf.l2j.gameserver.templates.StatsSet;
    
    public class L2Pvp
    {
    
        public L2Pvp(StatsSet set)
        {
            _pvpAmount = set.getInteger("pvp_amount");
            _nameColor = set.getInteger("name_color");
            _titleColor = set.getInteger("title_color");
        }
    
        public int getPvpAmount()
        {
            return _pvpAmount;
        }
    
        public int getNameColor()
        {
            return _nameColor;
        }
    
        public int getTitleColor()
        {
            return _titleColor;
        }
    
        public List<IntIntHolder> getLearnSkills()
        {
            return _learnSkill;
        }
    
        public void addLearnSkill(IntIntHolder holder)
        {
            _learnSkill.add(holder);
        }
    
        private final int _pvpAmount;
        private final int _nameColor;
        private final int _titleColor;
        private final List<IntIntHolder> _learnSkill = new ArrayList<>();
    }

     

    Open : Gameserver.java
    add somewhere this PvpTable.load();

    Open : Player.java
    add somewhere this

        public static void updatePvp(Player player)
        {
            for(Iterator<L2Pvp> iterator = PvpTable.getTemplate().iterator(); iterator.hasNext();)
            {
                L2Pvp template = iterator.next();
                if(template.getPvpAmount() <= player.getPvpKills())
                {
                    player.getAppearance().setNameColor(template.getNameColor());
                    player.getAppearance().setTitleColor(template.getTitleColor());
                    Iterator<IntIntHolder> iterator1 = template.getLearnSkills().iterator();
                    while(iterator1.hasNext()) 
                    {
                        IntIntHolder holder = iterator1.next();
                        net.sf.l2j.gameserver.model.L2Skill skill = SkillTable.getInstance().getInfo(holder.getId(), holder.getValue());
                        if(skill != null)
                            player.addSkill(skill, false);
                    }
                }
            }
    
            player.broadcastUserInfo();
        }

    find in Player.java
    below this line setPvpKills(getPvpKills() + 1);  add ->  updatePvp(this);

    find  : public boolean setActiveClass(int classIndex)
    under this line  restoreSkills(); add - > updatePvp(this);

    find : public void onPlayerEnter() add somewhere under : updatePvp(this);

    XML

    loc : data/xml/pvp.xml

    <?xml version='1.0' encoding='utf-8'?>
    <list>
    	<!-- <template pvp_amount="100" name_color="FFAA00" title_color="FFFF77" learn_skill="0,0;" /> -->
    		<template pvp_amount="5" name_color="FFAA00" title_color="FFFF77" learn_skill="0,0;" />
    </list>

     

    • Thanks 1
  4. 21 minutes ago, Deazertir said:

    I don't have any  intentions to talk to you guys. You are a rat army, liars and so on. 

    80% of this community are using shared packs. People who contribute on it and restore those shared packs for their own needs is a big work and time consuming. If you still don't understand it so please just move back into your cave and talk bullshits to each other not to me.  I don't care about xDem or you. Yes i had some support from him 2 years ago and it is not a bad thing to ask someone for a help when you don't understand.  Yeah i am doing all kind of servers because as i mentioned i was doing those server for fun to enjoy within small community. I am not a money hunter and doesn't care about it at all.  Also let me to open your eyes a bit. I didn't download files from L2jBrasil :) i have my own place where i can get files when i need.  All what you can is just to talk a shit nothing else. What are you trying to do by posting here my Facebook address ? :D You are so funny man. Respect yourself! My childhood was good enough, that is why i am not with full of hatred against to others like you :D

    i didn't really used hatred or something , if you label it as hatred its a reflection of you , i just pointed out ur ' work ' when you already pointed ur finger to other's peoples childhood . One more thing i didnt used any lies here , i just brought all things to the surface that it seems you really didnt like and tried t cover , well yeah there is not only l2jbrasil that have this crap stolen pack shared you can find it everywhere even a lil kid can or so , anyway  if you really want to prove your self and do something really fun start something from 0 , even if the idea comes from somewhere else pride or w/e !
    xdem aswell building a pridelike server , but he didnt used a base of any stolen or shared pack , he started it from 0 and thats for me proves a lot . so dont point ur finger at him and mention about ' childhoods ' cause the difference between you and him is really big .

    One more thing as you mention this 
    ** Yeah i am doing all kind of servers because as i mentioned i was doing those server for fun to enjoy within small community.**
    you really managed to make bad reputation of you even on a small community , making all those GRAND OPENINGS AND GRAND ENDINGS on the next days .. 

    Anyway brother i wish you good luck on ur server

  5. 23 hours ago, Deazertier said:

    Apparently you had a bad childhood. Oh, i forgot that you have it right now too. Grow up! If you do not respect the work of others, at least shut up and do not bother at all.

    Work of others ? is this really your work ? you did use a base of some STOLEN files you probably " NOT PROBABLY " downloaded from l2jbrasil :happyforever:  ,  You did launched over 4? 5? 6? server and all of them Failed and shut on the next day of the grand opening ,  let me remind you something dear Rifah Mammadli , L2 Kaya or Kaiya or w/e name u used , next you went pride , next eternal sin c4 mix interlude guess what ! not even 2 or 3 days lasted there was one more interlude pride like  i dont remember the name right now im sure there were more that lasted even less than an hour :forever_alone_like_a_boss:, but its really doesn't matter . Dont talk about xdem having bad childhood, cause the one that really had those ' bad childhood ; was you ! You tried to lick and asked xdem to work together on AePvP and he turned you down , i guess he knew something more ... then you went emo ' im going to ddos aepvp when it'll launch or more swears . well he still waiting ! go for it :angel:

    • Like 2
    • Downvote 1
  6. On 1/6/2017 at 11:03 PM, Reborn12 said:

    Just a spam in your chat :D


    could be like this to avoid spam chat :D
     

    if (_ctrlPressed && activeChar.isGM()) activeChar.sendPacket(new CreatureSay(0, Say2.PARTY, "Name", ":" + item.getItemName() + " | Item ID:" +  
    			item.getItemId()));

     

  7. 2 hours ago, Tryskell said:

    isDigit(String text)  is already part of StringUtil.

     

    You got already ingame, a way to see inventories using alt+g > Inventory (redundant with show_inventory).

     

    I introduced a way to easy cut pages (see //knownlist for exemple - but it's used on any page system normally).

     

    It's optional, but there is no way to remove a quantity for a stackable.

     

    For wiping all items, you should use ItemContainer#destroyAllItems(String process, Player actor, WorldObject reference) and introduces a new admincommand (delete_all_items, I guess) rather than clicking on every single item from inventory (up to 120 items for dwarves, 80 for regular ppls).

    didnt knew about the isDigit in string , i updated post , as for others its just handfull on pvp server to wipe a specific farm item or more from inv ,  can be edited to support iconstable .


    wipAAkw.png

  8. This code show up a window with a list of ur target's inventory  , and removes an item or more .

    code is not mine i found it on net i think credits go to Zealar , i just readapted it to 374 aCis rev .
    anyway it may come usefull for wiping bot's inv or ... w/e 

    code tested and workin .

     

    package net.sf.l2j.gameserver.handler.admincommandhandlers;
    
    import java.util.Set;
    
    import net.sf.l2j.commons.lang.StringUtil;
    
    import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
    import net.sf.l2j.gameserver.model.actor.instance.Player;
    import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
    import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    
    
    /**
     * This class handles following admin commands:
     * <ul>
     * <li>show_ivetory</li>
     * <li>delete_item</li>
     * </ul>
     * @author Zealar
     */
    
    public class AdminInventory implements IAdminCommandHandler
    {
    	private static final String[] ADMIN_COMMANDS =
    	{
    		"admin_show_inventory",
    		"admin_delete_item"
    	};
    	
    	@Override
    	public boolean useAdminCommand(String command, Player activeChar)
    	{
    		if ((activeChar.getTarget() == null))
    		{
    			activeChar.sendMessage("Select a target");
    			return false;
    		}
    		
    		if (!(activeChar.getTarget() instanceof Player))
    		{
    			activeChar.sendMessage("Target need to be player");
    			return false;
    		}
    		
    		Player player = activeChar.getTarget().getActingPlayer();
    		
    		if (command.startsWith(ADMIN_COMMANDS[0]))
    		{
    			if (command.length() > ADMIN_COMMANDS[0].length())
    			{
    				String com = command.substring(ADMIN_COMMANDS[0].length() + 1);
    				if (StringUtil.isDigit(com))
    				{
    					showItemsPage(activeChar, Integer.parseInt(com));
    				}
    			}
    			
    			else
    			{
    				showItemsPage(activeChar, 0);
    			}
    		}
    		else if (command.contains(ADMIN_COMMANDS[1]))
    		{
    			String val = command.substring(ADMIN_COMMANDS[1].length() + 1);
    			
    			player.destroyItem("GM Destroy", Integer.parseInt(val), player.getInventory().getItemByObjectId(Integer.parseInt(val)).getCount(), null, true);
    			showItemsPage(activeChar, 0);
    		}
    		
    		return true;
    	}
    	
    	private static void showItemsPage(Player activeChar, int page)
    	{
    		final Player target = activeChar.getTarget().getActingPlayer();
    		
    
    		final Set<ItemInstance> items = target.getInventory().getItems();
    		
    		int maxItemsPerPage = 16;
    		int maxPages = items.size() / maxItemsPerPage;
    		if (items.size() > (maxItemsPerPage * maxPages))
    		{
    			maxPages++;
    		}
    	
    		if (page > maxPages)
    		{
    			page = maxPages;
    		}
    		
    		int itemsStart = maxItemsPerPage * page;
    		int itemsEnd = items.size();
    		if ((itemsEnd - itemsStart) > maxItemsPerPage)
    		{
    			itemsEnd = itemsStart + maxItemsPerPage;
    		}
    		
    	final NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
    		adminReply.setFile("data/html/admin/inventory.htm");
    		adminReply.replace("%PLAYER_NAME%", target.getName());
    		
    		StringBuilder sbPages = new StringBuilder();
    		for (int x = 0; x < maxPages; x++)
    		{
    			int pagenr = x + 1;
    			sbPages.append("<td><button value=\"" + String.valueOf(pagenr) + "\" action=\"bypass -h admin_show_inventory " + String.valueOf(x) + "\" width=14 height=14 back=\"sek.cbui67\" fore=\"sek.cbui67\"></td>");
    		}
    		
    		adminReply.replace("%PAGES%", sbPages.toString());
    		
    		StringBuilder sbItems = new StringBuilder();
    		
    		for (ItemInstance item: items)
    		{
    			sbItems.append("<tr><td><button action=\"bypass -h admin_delete_item " + String.valueOf(item.getObjectId()) + "\" width=16 height=16 back=\"L2UI.bbs_delete\" fore=\"L2UI.bbs_delete\">" + "</td>");
    			sbItems.append("<td width=60>" + item.getName() + "</td></tr><br>");
    		}
    		
    		adminReply.replace("%ITEMS%", sbItems.toString());
    		
    		activeChar.sendPacket(adminReply);
    	}
    	
    	@Override
    	public String[] getAdminCommandList()
    	{
    		return ADMIN_COMMANDS;
    	}
    } 

    register the handler

     

     

    and  create inventory.htm into  gameserver/data/html/admin 


    <html><body><title>Inventory : %PLAYER_NAME%</title>
    <center>
    <table width=270>
     <tr>
     %PAGES%
     </tr>
    </table>

    ___________________________________
    </center>
    <br>
    <table width=270>
     %ITEMS%
    </table>
    </body>
    </html>

     

    • Upvote 2
  9. 3 minutes ago, melron said:

    as reborn said, it requires client modification. You have to add the new grade in tooltip class of interface.u file of your system folder . remake the code so it can handle the new grade and then you have to parse the new item grade example 6.

     

    or you can just edit the D grade to your S80 for example.

    gr8 so i'll have to look at interface.u 

    thank you , lock

×
×
  • 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