09-17-2011, 05:23 AM
(Сообщение последний раз редактировалось: 09-17-2011, 09:02 AM NightAngel.)
кто может помочь сделать профили в бафере Community Board?
сборка L2jServer HF
сборка L2jServer HF
===>
package com.l2jserver.gameserver.communitybbs.Manager;
import javolution.text.TextBuilder;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.BuffBBSTable;
import com.l2jserver.gameserver.datatables.BuffBBSTable.BBSGroupBuffStat;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Logger;
public class BuffBBSManager extends BaseBBSManager
{
private static BuffBBSManager _instance = new BuffBBSManager();
private static Logger _log = Logger.getLogger(BuffBBSManager.class.getName());
public BuffBBSManager(){}
public static BuffBBSManager getInstance()
{
if(_instance == null)
_instance = new BuffBBSManager();
return _instance;
}
// back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"
public void parsecmd(String command, L2PcInstance activeChar)
{
int priceRebuff;
TextBuilder html = new TextBuilder("");
L2Skill skill;
int bufPet = 0;
String buffer_top, buffer_body, buffer_bottom;
int idGroup = 0;
String name = "";
html.clear();
html.append("<center>");
html.append("<table>");
html.append("<tr>");
for (Map.Entry<Integer, BBSGroupBuffStat> entry: BuffBBSTable.getInstance().getBBSGroups().entrySet())
{
idGroup= entry.getKey();
name = entry.getValue().getName();
html.append("<td>");
//html.append("<button value=\""+name+"\" action=\"bypass -h _bbs_buff;"+idGroup+"\" width=80 height=20 back=\"sek.cbui36\" fore=\"sek.cbui75\">");
html.append("<button value=\""+name+"\" action=\"bypass -h _bbs_buff;"+idGroup+"\" width=90 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
html.append("</td>");
}
html.append("</tr>");
html.append("</table>");
html.append("</center><br><br>");
buffer_top = html.toString();
html.clear();
html.append("<center>");
html.append("<table>");
html.append("<tr>");
html.append("<td>");
html.append("<button value=\"Сохранить баф\" action=\"bypass -h _bbs_buff_save\" width=200 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
html.append("</td>");
html.append("<td>");
html.append("<button value=\"Востановить баф\" action=\"bypass -h _bbs_buff_load\" width=200 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
html.append("</td>");
html.append("</tr>");
html.append("</table>");
html.append("</center>");
buffer_bottom = html.toString();
if((activeChar.getPet() != null) && (activeChar.getTarget() == activeChar.getPet()))bufPet = 1;
if (command.startsWith("_bbs_buff;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
int idGrp = Integer.parseInt(st.nextToken());
if (idGrp == 0)
idGrp = 1;
int idSkill= 0;
int lvlSkill= 0;
int column = 0;
String StringSkill = "";
String skillIcon = "";
String skillName = "";
html.clear();
html.append("<center>Стоимость бафа в данной группе: <font color=F2C202>" + BuffBBSTable.getInstance().getPriceGroup(idGrp) +"</font>.</center><br>");
html.append("<table width=600>");
html.append("<tr>");
for (Map.Entry<Integer, Integer> entry: BuffBBSTable.getInstance().getBBSBuffsForGoup(idGrp).entrySet())
{
column ++;
idSkill= entry.getKey();
lvlSkill= entry.getValue();
StringSkill = Integer.toString(idSkill);
switch(StringSkill.length())
{
case 1:
skillIcon = "icon.skill000" + idSkill;
break;
case 2:
skillIcon = "icon.skill00" + idSkill;
break;
case 3:
skillIcon = "icon.skill0" + idSkill;
break;
case 4:
skillIcon = "icon.skill" + idSkill;
break;
}
L2Skill skillBuff = SkillTable.getInstance().getInfo(idSkill, 1);
if(skillBuff == null)
{
_log.warning("BuffBBSManager: skill id: "+ idSkill +" not found");
continue;
}
skillName = skillBuff.getName();
html.append("<td width=150>");
html.append("<center><img src=\""+skillIcon+"\" width=32 height=32 align=center></center><br><center><a action=\"bypass -h _bbs_buff_skill;"+idGrp+";"+idSkill+";"+lvlSkill+"\">"+skillName+"</a></center>");
html.append("</td>");
if(column == 4)
{
html.append("</tr>");
html.append("<tr>");
column = 0;
}
}
html.append("</tr>");
html.append("</table>");
buffer_body = html.toString();
String content = HtmCache.getInstance().getHtmForce(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/60.htm");
content = content.replace("%buffer_top%", buffer_top);
content = content.replace("%buffer_bottom%", buffer_bottom);
content = content.replace("%buffer_body%", buffer_body);
separateAndSend(content, activeChar);
}
else if (command.startsWith("_bbs_buff_skill;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken(); //_bbs_buff_skill
int sGrp = Integer.parseInt(st.nextToken()); //1
int sId = Integer.parseInt(st.nextToken()); //100
int sLvl = Integer.parseInt(st.nextToken()); //1
int price = BuffBBSTable.getInstance().getPriceGroup(sGrp);
if(!activeChar.destroyItemByItemId("BuffBBS", 57, (long)price, activeChar, true))
return;
L2Character target = (L2Character) activeChar.getTarget();
if (bufPet != 0)
{
skill = SkillTable.getInstance().getInfo(sId, sLvl);
skill.getEffects(target, target);
}
else
{
skill = SkillTable.getInstance().getInfo(sId, sLvl);
skill.getEffects(activeChar, activeChar);
}
}
else if (command.startsWith("_bbs_buff_save"))
{
activeChar.updateBBSBuff(bufPet);
activeChar.sendMessage("Buffs saved.");
}
else if (command.startsWith("_bbs_buff_load"))
{
priceRebuff = activeChar.calcBBSBuff(bufPet);
if(priceRebuff > 0)
if(activeChar.destroyItemByItemId("BuffBBS", 57, (long)priceRebuff, activeChar, true))
activeChar.cactBBSBuff(bufPet);
}
}
public void parsewrite(String s, String s1, String s2, String s3, String s4, L2PcInstance l2pcinstance){}
}
import javolution.text.TextBuilder;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.BuffBBSTable;
import com.l2jserver.gameserver.datatables.BuffBBSTable.BBSGroupBuffStat;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Logger;
public class BuffBBSManager extends BaseBBSManager
{
private static BuffBBSManager _instance = new BuffBBSManager();
private static Logger _log = Logger.getLogger(BuffBBSManager.class.getName());
public BuffBBSManager(){}
public static BuffBBSManager getInstance()
{
if(_instance == null)
_instance = new BuffBBSManager();
return _instance;
}
// back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"
public void parsecmd(String command, L2PcInstance activeChar)
{
int priceRebuff;
TextBuilder html = new TextBuilder("");
L2Skill skill;
int bufPet = 0;
String buffer_top, buffer_body, buffer_bottom;
int idGroup = 0;
String name = "";
html.clear();
html.append("<center>");
html.append("<table>");
html.append("<tr>");
for (Map.Entry<Integer, BBSGroupBuffStat> entry: BuffBBSTable.getInstance().getBBSGroups().entrySet())
{
idGroup= entry.getKey();
name = entry.getValue().getName();
html.append("<td>");
//html.append("<button value=\""+name+"\" action=\"bypass -h _bbs_buff;"+idGroup+"\" width=80 height=20 back=\"sek.cbui36\" fore=\"sek.cbui75\">");
html.append("<button value=\""+name+"\" action=\"bypass -h _bbs_buff;"+idGroup+"\" width=90 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
html.append("</td>");
}
html.append("</tr>");
html.append("</table>");
html.append("</center><br><br>");
buffer_top = html.toString();
html.clear();
html.append("<center>");
html.append("<table>");
html.append("<tr>");
html.append("<td>");
html.append("<button value=\"Сохранить баф\" action=\"bypass -h _bbs_buff_save\" width=200 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
html.append("</td>");
html.append("<td>");
html.append("<button value=\"Востановить баф\" action=\"bypass -h _bbs_buff_load\" width=200 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
html.append("</td>");
html.append("</tr>");
html.append("</table>");
html.append("</center>");
buffer_bottom = html.toString();
if((activeChar.getPet() != null) && (activeChar.getTarget() == activeChar.getPet()))bufPet = 1;
if (command.startsWith("_bbs_buff;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
int idGrp = Integer.parseInt(st.nextToken());
if (idGrp == 0)
idGrp = 1;
int idSkill= 0;
int lvlSkill= 0;
int column = 0;
String StringSkill = "";
String skillIcon = "";
String skillName = "";
html.clear();
html.append("<center>Стоимость бафа в данной группе: <font color=F2C202>" + BuffBBSTable.getInstance().getPriceGroup(idGrp) +"</font>.</center><br>");
html.append("<table width=600>");
html.append("<tr>");
for (Map.Entry<Integer, Integer> entry: BuffBBSTable.getInstance().getBBSBuffsForGoup(idGrp).entrySet())
{
column ++;
idSkill= entry.getKey();
lvlSkill= entry.getValue();
StringSkill = Integer.toString(idSkill);
switch(StringSkill.length())
{
case 1:
skillIcon = "icon.skill000" + idSkill;
break;
case 2:
skillIcon = "icon.skill00" + idSkill;
break;
case 3:
skillIcon = "icon.skill0" + idSkill;
break;
case 4:
skillIcon = "icon.skill" + idSkill;
break;
}
L2Skill skillBuff = SkillTable.getInstance().getInfo(idSkill, 1);
if(skillBuff == null)
{
_log.warning("BuffBBSManager: skill id: "+ idSkill +" not found");
continue;
}
skillName = skillBuff.getName();
html.append("<td width=150>");
html.append("<center><img src=\""+skillIcon+"\" width=32 height=32 align=center></center><br><center><a action=\"bypass -h _bbs_buff_skill;"+idGrp+";"+idSkill+";"+lvlSkill+"\">"+skillName+"</a></center>");
html.append("</td>");
if(column == 4)
{
html.append("</tr>");
html.append("<tr>");
column = 0;
}
}
html.append("</tr>");
html.append("</table>");
buffer_body = html.toString();
String content = HtmCache.getInstance().getHtmForce(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/60.htm");
content = content.replace("%buffer_top%", buffer_top);
content = content.replace("%buffer_bottom%", buffer_bottom);
content = content.replace("%buffer_body%", buffer_body);
separateAndSend(content, activeChar);
}
else if (command.startsWith("_bbs_buff_skill;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken(); //_bbs_buff_skill
int sGrp = Integer.parseInt(st.nextToken()); //1
int sId = Integer.parseInt(st.nextToken()); //100
int sLvl = Integer.parseInt(st.nextToken()); //1
int price = BuffBBSTable.getInstance().getPriceGroup(sGrp);
if(!activeChar.destroyItemByItemId("BuffBBS", 57, (long)price, activeChar, true))
return;
L2Character target = (L2Character) activeChar.getTarget();
if (bufPet != 0)
{
skill = SkillTable.getInstance().getInfo(sId, sLvl);
skill.getEffects(target, target);
}
else
{
skill = SkillTable.getInstance().getInfo(sId, sLvl);
skill.getEffects(activeChar, activeChar);
}
}
else if (command.startsWith("_bbs_buff_save"))
{
activeChar.updateBBSBuff(bufPet);
activeChar.sendMessage("Buffs saved.");
}
else if (command.startsWith("_bbs_buff_load"))
{
priceRebuff = activeChar.calcBBSBuff(bufPet);
if(priceRebuff > 0)
if(activeChar.destroyItemByItemId("BuffBBS", 57, (long)priceRebuff, activeChar, true))
activeChar.cactBBSBuff(bufPet);
}
}
public void parsewrite(String s, String s1, String s2, String s3, String s4, L2PcInstance l2pcinstance){}
}