Core Buffer
1 ответов3,307 просмотровСейчас просматривают: 1
· 20.08.2008, 09:01
ниже предоставлен исходник бафака каторыйвстраиваеццо непосредственно в ядро.
преимуществопосравнению с питоном-производительность и простото установки (для тех кто еклипс умеет держать)
был какбе писан под сф,но при небольших изминениях будет работать где угодно.
вообще он писался для расширения кругозора какбе,но выложить я думаю стоит,малоли.
Код
/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.model.actor.instance;
import javolution.text.TextBuilder;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.templates.L2NpcTemplate;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.serverpackets.MagicSkillUse;
/**
*
* @author Z0mbie!
*/
public class L2NpcbuffInstance extends L2FolkInstance
{
public L2NpcbuffInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}
public void onAction(L2PcInstance player)
{
player.setTarget(player);
htmls("glange",player);
}
public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("mage_buff"))
{
htmls("mage",player);
}
else if (command.startsWith("voene_buff"))
{
htmls("voene",player);
}
else if (command.startsWith("shar_buff"))
{
htmls("shar",player);
}
else if (command.startsWith("glange"))
{
htmls("glange",player);
}
//warriors buffs-start
else if (command.startsWith("mig_buff")) { buffer(4345,3,player,"voene");}
else if (command.startsWith("hast_buff")){ buffer(4357,2,player,"voene");}
else if (command.startsWith("vmr_buff")){ buffer(4354,4,player,"voene");}
else if (command.startsWith("gue_buff")){ buffer(4358,3,player,"voene");}
else if (command.startsWith("focus_buff")){ buffer(4359,3,player,"voene");}
else if (command.startsWith("dw_buff")){ buffer(4360,3,player,"voene");}
//warriors buffs-end
//mages buffs-start
else if (command.startsWith("emp_buff")) { buffer(4356,2,player,"mage");}
else if (command.startsWith("acum_buff")) { buffer(4355,2,player,"mage");}
else if (command.startsWith("conc_buff")) { buffer(4351,6,player,"mage");}
else if (command.startsWith("wm_buff")) { buffer(1303,2,player,"mage");}
//mages buffs-end
//Общие баффы начало
else if (command.startsWith("ww_buff")) { buffer(4342,2,player,"shar");}
else if (command.startsWith("dwe_buff")) { buffer(4343,3,player,"shar");}
else if (command.startsWith("sh_buff")) { buffer(4344,3,player,"shar");}
else if (command.startsWith("ms_buff")) { buffer(4346,4,player,"shar");}
else if (command.startsWith("bb_buff")) { buffer(4347,6,player,"shar");}
else if (command.startsWith("bs_buff")) { buffer(4348,6,player,"shar");}
else if (command.startsWith("mb_buff")) { buffer(4349,2,player,"shar");}
else if (command.startsWith("rs_buff")) { buffer(4350,4,player,"shar");}
else if (command.startsWith("bers_buff")) { buffer(4352,2,player,"shar");}
else if (command.startsWith("blss_buff")) { buffer(4353,6,player,"shar");}
//Общие баффы канец
else {super.onBypassFeedback(player, command);}
}
public void buffer(int skillid, int lvl, L2PcInstance player,String last)
{
L2Skill skill;
skill = SkillTable.getInstance().getInfo(skillid,lvl);
skill.getEffects(player, player);
player.broadcastPacket(new MagicSkillUse(player, player, skillid, lvl, 1, 0));
htmls(last,player);
}
/**
*Return HTML chat to player<BR><BR>
* @param type : Type of HTML. voene,mage,dance and songe
*/
public void htmls(String type, L2PcInstance player)
{
if (type==("voene"))
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_mig_buff\">Might</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_hast_buff\">Haste</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_vmr_buff\">Vampiric Rage</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_gue_buff\">Guidance</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_focus_buff\">Focus</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_dw_buff\">Death Whisper</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_glange\">Главное меню</a>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
return;
}
else if (type==("mage"))
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_emp_buff\">Empower</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_acum_buff\">Acumen</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_conc_buff\">Concentration</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_wm_buff\">Wild Magic</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_glange\">Главное меню</a>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
return;
}
else if (type==("shar"))
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_ww_buff\">Wind Walk</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_dwe_buff\">Decrease Weight</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_sh_buff\">Shield</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_ms_buff\">Mental Shield</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_bb_buff\">Bless the Body</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_bs_buff\">Bless the Soul</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_mb_buff\">Magic Barrier</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_rs_buff\">Resist Shock</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_bers_buff\">Berserker Spirit</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_blss_buff\">Bless Shield</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_glange\">Главное меню</a>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
return;
}
else if (type=="glange")
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><td><a action=\"bypass -h npc_"+getObjectId()+"_mage_buff\">Баффы для мага</a></td>");
sb.append("<br><font color=\"LEVEL\">Acumen,Empower,Wild Magic,Concentration</font>");
sb.append("<br>");
sb.append("<br><td><a action=\"bypass -h npc_"+getObjectId()+"_voene_buff\">Баффы для война</a></td>");
sb.append("<br><font color=\"LEVEL\">Migth,Vampiric Rage,Haste,Guidance,Focus,Death Whisper</font>");
sb.append("<br>");
sb.append("<br><td><a action=\"bypass -h npc_"+getObjectId()+"_shar_buff\">Общие баффы</a></td>");
sb.append("<br><font color=\"LEVEL\">Wind Walk,Decrease Weight,Shield,Mental Shield,Bless the Body,</font>");
sb.append("<br><font color=\"LEVEL\">Bless the Soul,Magic Barrier,Resist Shock,Berserker Spirit,Bless Shield</font>");
sb.append("<br>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
}
}
}
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.model.actor.instance;
import javolution.text.TextBuilder;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.templates.L2NpcTemplate;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.serverpackets.MagicSkillUse;
/**
*
* @author Z0mbie!
*/
public class L2NpcbuffInstance extends L2FolkInstance
{
public L2NpcbuffInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}
public void onAction(L2PcInstance player)
{
player.setTarget(player);
htmls("glange",player);
}
public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("mage_buff"))
{
htmls("mage",player);
}
else if (command.startsWith("voene_buff"))
{
htmls("voene",player);
}
else if (command.startsWith("shar_buff"))
{
htmls("shar",player);
}
else if (command.startsWith("glange"))
{
htmls("glange",player);
}
//warriors buffs-start
else if (command.startsWith("mig_buff")) { buffer(4345,3,player,"voene");}
else if (command.startsWith("hast_buff")){ buffer(4357,2,player,"voene");}
else if (command.startsWith("vmr_buff")){ buffer(4354,4,player,"voene");}
else if (command.startsWith("gue_buff")){ buffer(4358,3,player,"voene");}
else if (command.startsWith("focus_buff")){ buffer(4359,3,player,"voene");}
else if (command.startsWith("dw_buff")){ buffer(4360,3,player,"voene");}
//warriors buffs-end
//mages buffs-start
else if (command.startsWith("emp_buff")) { buffer(4356,2,player,"mage");}
else if (command.startsWith("acum_buff")) { buffer(4355,2,player,"mage");}
else if (command.startsWith("conc_buff")) { buffer(4351,6,player,"mage");}
else if (command.startsWith("wm_buff")) { buffer(1303,2,player,"mage");}
//mages buffs-end
//Общие баффы начало
else if (command.startsWith("ww_buff")) { buffer(4342,2,player,"shar");}
else if (command.startsWith("dwe_buff")) { buffer(4343,3,player,"shar");}
else if (command.startsWith("sh_buff")) { buffer(4344,3,player,"shar");}
else if (command.startsWith("ms_buff")) { buffer(4346,4,player,"shar");}
else if (command.startsWith("bb_buff")) { buffer(4347,6,player,"shar");}
else if (command.startsWith("bs_buff")) { buffer(4348,6,player,"shar");}
else if (command.startsWith("mb_buff")) { buffer(4349,2,player,"shar");}
else if (command.startsWith("rs_buff")) { buffer(4350,4,player,"shar");}
else if (command.startsWith("bers_buff")) { buffer(4352,2,player,"shar");}
else if (command.startsWith("blss_buff")) { buffer(4353,6,player,"shar");}
//Общие баффы канец
else {super.onBypassFeedback(player, command);}
}
public void buffer(int skillid, int lvl, L2PcInstance player,String last)
{
L2Skill skill;
skill = SkillTable.getInstance().getInfo(skillid,lvl);
skill.getEffects(player, player);
player.broadcastPacket(new MagicSkillUse(player, player, skillid, lvl, 1, 0));
htmls(last,player);
}
/**
*Return HTML chat to player<BR><BR>
* @param type : Type of HTML. voene,mage,dance and songe
*/
public void htmls(String type, L2PcInstance player)
{
if (type==("voene"))
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_mig_buff\">Might</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_hast_buff\">Haste</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_vmr_buff\">Vampiric Rage</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_gue_buff\">Guidance</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_focus_buff\">Focus</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_dw_buff\">Death Whisper</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_glange\">Главное меню</a>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
return;
}
else if (type==("mage"))
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_emp_buff\">Empower</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_acum_buff\">Acumen</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_conc_buff\">Concentration</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_wm_buff\">Wild Magic</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_glange\">Главное меню</a>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
return;
}
else if (type==("shar"))
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_ww_buff\">Wind Walk</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_dwe_buff\">Decrease Weight</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_sh_buff\">Shield</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_ms_buff\">Mental Shield</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_bb_buff\">Bless the Body</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_bs_buff\">Bless the Soul</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_mb_buff\">Magic Barrier</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_rs_buff\">Resist Shock</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_bers_buff\">Berserker Spirit</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_blss_buff\">Bless Shield</a>");
sb.append("<br><a action=\"bypass -h npc_"+getObjectId()+"_glange\">Главное меню</a>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
return;
}
else if (type=="glange")
{
NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
TextBuilder sb = new TextBuilder();
sb.append("<html><title>Core Buffer:</title><body>");
sb.append("<br><td><a action=\"bypass -h npc_"+getObjectId()+"_mage_buff\">Баффы для мага</a></td>");
sb.append("<br><font color=\"LEVEL\">Acumen,Empower,Wild Magic,Concentration</font>");
sb.append("<br>");
sb.append("<br><td><a action=\"bypass -h npc_"+getObjectId()+"_voene_buff\">Баффы для война</a></td>");
sb.append("<br><font color=\"LEVEL\">Migth,Vampiric Rage,Haste,Guidance,Focus,Death Whisper</font>");
sb.append("<br>");
sb.append("<br><td><a action=\"bypass -h npc_"+getObjectId()+"_shar_buff\">Общие баффы</a></td>");
sb.append("<br><font color=\"LEVEL\">Wind Walk,Decrease Weight,Shield,Mental Shield,Bless the Body,</font>");
sb.append("<br><font color=\"LEVEL\">Bless the Soul,Magic Barrier,Resist Shock,Berserker Spirit,Bless Shield</font>");
sb.append("<br>");
sb.append("</body></html>");
html.setHtml(sb.toString());
player.sendPacket(html);
html=null;
sb=null;
}
}
}
0
Тема закрыта для ответов

