Quantcast
Channel: L2JBrasil RSS
Viewing all articles
Browse latest Browse all 543

[L2jFrozen] Core Buffer by Baksteen

$
0
0

Coded this shit when i was bored last week. Here you go. 

 

What it does? Watch here.

 

 

Create a file in gameserver/model/actor/instance called L2NpcBufferInstance.java

 

/*
* This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package com.l2jfrozen.gameserver.model.actor.instance;

import java.util.StringTokenizer;

import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.powerpak.PowerPakConfig;
/**
 * @author Trance, Bluur
 */
public final class L2NpcBufferInstance extends L2NpcInstance
{
 public L2NpcBufferInstance(int objectId, L2NpcTemplate template)
    {
        super(objectId, template);
    }
      
    @Override
    public void onBypassFeedback(L2PcInstance player, String command)
    {
     StringTokenizer st = new StringTokenizer(command, " ");
     String actualCommand = st.nextToken();
     
     int buffid = 0, bufflevel = 1;
     if (st.countTokens() == 2)
     {
      buffid = Integer.valueOf(st.nextToken());
      bufflevel = Integer.valueOf(st.nextToken());
     }
     else if (st.countTokens() == 1)
      buffid = Integer.valueOf(st.nextToken());
     
     if (actualCommand.equalsIgnoreCase("getbuff"))
     {
      SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
      broadcastPacket(new MagicSkillUser(this, player, buffid, bufflevel, 500, 0));
      showChatWindow(player);    
     }
     if (actualCommand.equalsIgnoreCase("FighterList"))
 	{
 		for (final int skillId : PowerPakConfig.FIGHTER_SKILL_LIST.keySet())
 		{
 		      SkillTable.getInstance().getInfo(skillId, PowerPakConfig.FIGHTER_SKILL_LIST.get(skillId)).getEffects(this, player);
 		      broadcastPacket(new MagicSkillUser(this, player, skillId, PowerPakConfig.FIGHTER_SKILL_LIST.get(skillId), 5, 0));
 		      showChatWindow(player);
 		}
 	}
     else if (actualCommand.equalsIgnoreCase("restore"))
     {
   player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
   player.setCurrentCp(player.getMaxCp());
   
      broadcastPacket(new MagicSkillUser(this, player, 1258, 4, 500, 0));
      showChatWindow(player);      
     }
     else if (actualCommand.equalsIgnoreCase("cancel"))
     {
    player.stopAllEffects();
      broadcastPacket(new MagicSkillUser(this, player, 1056, 12, 500, 0));
      showChatWindow(player);
     }
     else
      super.onBypassFeedback(player, command);
    }
    
   
    public void showMessageWindow(L2PcInstance player)
    {
    String filename = "data/html/buffer/" + getNpcId() + ".htm";
    
    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
    html.setFile(filename);
    html.replace("%objectId%", String.valueOf(getObjectId()));
    html.replace("%npcname%", getName());
    player.sendPacket(html);
    }
    
  
    @Override
	public String getHtmlPath(int npcId, int val)
    {
    String pom = "";
    if (val == 0)
    pom = "" + npcId;
    else
    pom = npcId + "-" + val;
    
    return "data/html/buffer/" + pom + ".htm";
    }
}

 


Viewing all articles
Browse latest Browse all 543

Trending Articles