This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..
Question
SkySkase
[gr]Geia xara
Geia xara
Loipon xrisimopoio l2jServer Epilogue kai evala to java code tou iRat ^^Sell buff mod^^
(http://maxcheaters.com/forum/index.php?topic=238116.0)
Ola mia xara mexri pou....
Otan pataw .sellbuffs
1on epilego poso ta poulaw
2o kathomai katw (aftomata)
To problima einai oti prepei na kanw target allou aftou parw ena buff kai meta apli ston buffer gia to defter
na kai o code
### Eclipse Workspace Patch 1.0 #P Chr.6GMS Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -31,6 +31,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; +import javolution.text.TextBuilder; import javolution.util.FastList; import javolution.util.FastMap; import net.sf.l2j.Config; @@ -451,6 +452,8 @@ private boolean _noble = false; private boolean _hero = false; + private boolean _sellbuff = false; + private int _buffprize = 0; /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */ private L2FolkInstance _lastFolkNpc = null; @@ -2375,6 +2378,9 @@ */ public void standUp() { + if(isSellBuff()) + return; + if (L2Event.active && eventSitForced) { sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ..."); @@ -3945,6 +3951,42 @@ // Target the new L2Object (add the target to the L2PcInstance _target, _knownObject and L2PcInstance to _KnownObject of the L2Object) super.setTarget(newTarget); + + L2PcInstance t = null; + if(newTarget instanceof L2PcInstance) + t = (L2PcInstance) newTarget; + + if(t != null){ + if(t.isSellBuff() && t != this){ + TextBuilder tb = new TextBuilder(); + NpcHtmlMessage n = new NpcHtmlMessage(0); + + tb.append("<html><body>"); + tb.append("<br><br>"); + tb.append("<center>Hi, I am "+t.getName()+" and i sell my buffs</center>"); + tb.append("<br><center>Buffs Prize:"+t.getBuffPrize()+"</center>"); + + L2Skill[] skills = t.getAllSkills(); + FastList<L2Skill> ba = new FastList<L2Skill>(); + + for(L2Skill s : skills){ + if(s == null) + continue; + + if(s.getSkillType() == SkillType.BUFF && s.isActive()) + ba.add(s); + } + + for(L2Skill p : ba){ + tb.append("<center><button value=\""+p.getName()+"\" action=\"bypass -h buff"+p.getId()+"\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\"></center>"); + } + + tb.append("</body></html>"); + + n.setHtml(tb.toString()); + sendPacket(n); + } + } } /** @@ -8214,7 +8256,23 @@ } return true; } + + public boolean isSellBuff(){ + return _sellbuff; + } + + public void setSellBuff(boolean j){ + _sellbuff = j; + } + public int getBuffPrize(){ + return _buffprize; + } + + public void setBuffPrize(int x){ + _buffprize = x; + } + public boolean isNoble() { return _noble; Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/sellbuff.java =================================================================== --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/sellbuff.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/sellbuff.java (revision 0) @@ -0,0 +1,76 @@ + +package net.sf.l2j.gameserver.handler.voicedcommandhandlers; + +import javolution.text.TextBuilder; +import javolution.util.FastList; +import net.sf.l2j.gameserver.Olympiad; +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; +import net.sf.l2j.gameserver.model.L2Skill; +import net.sf.l2j.gameserver.model.L2Skill.SkillType; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage; + +/** + * + * @author Iratus + */ +public class sellbuff implements IVoicedCommandHandler +{ + + private static final String[] VOICED_COMMANDS = {"sellbuffs"}; + + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) + { + if(activeChar == null) + return false; + + + if(activeChar.isDead() || activeChar.isAlikeDead()){ + activeChar.sendMessage("You are dead , you can't sell at the moment"); + return false; + } + else if(activeChar.isInOlympiadMode() || Olympiad.getInstance().isRegistered(activeChar)){ + activeChar.sendMessage("You are in olympiad , you can't sell at the moment"); + return false; + } + else if(activeChar.atEvent){ + activeChar.sendMessage("You are in event , you can't sell at the moment"); + return false; + } + else if(!activeChar.isInsideZone(L2PcInstance.ZONE_PEACE)){ + activeChar.sendMessage("You are not in peacefull zone , you can sell only in peacefull zones"); + return false; + } + else if(activeChar.getPvpFlag() > 0 || activeChar.isInCombat() || activeChar.getKarma() > 0){ + activeChar.sendMessage("You are in combat mode , you can't sell at the moment"); + return false; + } + else if(activeChar.getClassId().getId() != 98){ + activeChar.sendMessage("You must be a buffer class to sell buffs"); + return false; + } + + TextBuilder tb = new TextBuilder(0); + tb.append("<html><body>"); + tb.append("Hello , by completing this form you will be able to sell buffs."); + tb.append("<br>Players will be able , targeting you to take your buff services<br>"); + tb.append("<br>You will be rewarded with adenas for each buff a player takes."); + tb.append("<br><center>Now choose the prize:</center><br>"); + tb.append("<edit var=\"pri\" width=120 height=15>"); + tb.append("<center><button value=\"Confirm\" action=\"bypass -h actr $pri\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">"); + tb.append("</body></html>"); + NpcHtmlMessage n = new NpcHtmlMessage(0); + n.setHtml(tb.toString()); + activeChar.sendPacket(n); + + return true; + } + + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } + +} Index: java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 5263) +++ java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (working copy) @@ -18,16 +18,20 @@ */ package net.sf.l2j.gameserver.clientpackets; +import java.util.NoSuchElementException; +import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; import net.sf.l2j.Config; import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.communitybbs.CommunityBoard; +import net.sf.l2j.gameserver.datatables.SkillTable; import net.sf.l2j.gameserver.handler.AdminCommandHandler; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.L2CharPosition; import net.sf.l2j.gameserver.model.L2Object; +import net.sf.l2j.gameserver.model.L2Skill; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; @@ -85,6 +89,57 @@ { comeHere(activeChar); } + else if(_command.startsWith("buff")){ + String x = _command.substring(4); + int id = Integer.parseInt(x); + L2PcInstance target = null; + + if(activeChar.getTarget() instanceof L2PcInstance) + target = (L2PcInstance) activeChar.getTarget(); + + if(target == null) + return; + + if(activeChar.getInventory().getItemByItemId(57).getCount() < ((L2PcInstance) activeChar.getTarget()).getBuffPrize()){ + activeChar.sendMessage("not enought adena"); + } + + + try{ + L2Skill s = SkillTable.getInstance().getInfo(id, 3); + s.getEffects(activeChar, activeChar); + activeChar.sendMessage("You buyed: "+s.getName()); + activeChar.getInventory().destroyItemByItemId("", 57, target.getBuffPrize(), activeChar, null); + target.getInventory().addItem("", 57, target.getBuffPrize(), target, null); + } + catch(Exception e){ + e.printStackTrace(); + } + } + else if(_command.startsWith("actr")){ + String l = _command.substring(5); + + int p = 0; + + p = Integer.parseInt(l); + + + if(p == 0) + return; + + if(p > 2000000000){ + activeChar.sendMessage("Too big prize"); + return; + } + + activeChar.setBuffPrize(p); + activeChar.sitDown(); + activeChar.setSellBuff(true); + activeChar.getAppearance().setNameColor(0x1111); + activeChar.setTitle("=SELL BUFFS="); + activeChar.broadcastUserInfo(); + activeChar.broadcastTitleInfo(); + } else if (_command.startsWith("player_help ")) { playerHelp(activeChar, _command.substring(12)); Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 5263) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@ -199,6 +199,7 @@ import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo; import net.sf.l2j.gameserver.handler.usercommandhandlers.Time; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding; +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.sellbuff; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats; import net.sf.l2j.gameserver.idfactory.IdFactory; import net.sf.l2j.gameserver.instancemanager.AuctionManager; @@ -592,6 +593,7 @@ _voicedCommandHandler = VoicedCommandHandler.getInstance(); _voicedCommandHandler.registerVoicedCommandHandler(new stats()); + _voicedCommandHandler.registerVoicedCommandHandler(new sellbuff()); if(Config.L2JMOD_ALLOW_WEDDING) _voicedCommandHandler.registerVoicedCommandHandler(new Wedding());[eng]Hello
Hello
So i am using l2jServer Epilogue and i wanted to ad ^^sell buff mode ^^ of iRat
(http://maxcheaters.com/forum/index.php?topic=238116.0)
So Everything went good but .....
When i press .sellbuffs
1st step i put price
2nd i sit
But when someone klik on me to buy he dont see anything no window with buffs....
### Eclipse Workspace Patch 1.0 #P Chr.6GMS Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -31,6 +31,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; +import javolution.text.TextBuilder; import javolution.util.FastList; import javolution.util.FastMap; import net.sf.l2j.Config; @@ -451,6 +452,8 @@ private boolean _noble = false; private boolean _hero = false; + private boolean _sellbuff = false; + private int _buffprize = 0; /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */ private L2FolkInstance _lastFolkNpc = null; @@ -2375,6 +2378,9 @@ */ public void standUp() { + if(isSellBuff()) + return; + if (L2Event.active && eventSitForced) { sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ..."); @@ -3945,6 +3951,42 @@ // Target the new L2Object (add the target to the L2PcInstance _target, _knownObject and L2PcInstance to _KnownObject of the L2Object) super.setTarget(newTarget); + + L2PcInstance t = null; + if(newTarget instanceof L2PcInstance) + t = (L2PcInstance) newTarget; + + if(t != null){ + if(t.isSellBuff() && t != this){ + TextBuilder tb = new TextBuilder(); + NpcHtmlMessage n = new NpcHtmlMessage(0); + + tb.append("<html><body>"); + tb.append("<br><br>"); + tb.append("<center>Hi, I am "+t.getName()+" and i sell my buffs</center>"); + tb.append("<br><center>Buffs Prize:"+t.getBuffPrize()+"</center>"); + + L2Skill[] skills = t.getAllSkills(); + FastList<L2Skill> ba = new FastList<L2Skill>(); + + for(L2Skill s : skills){ + if(s == null) + continue; + + if(s.getSkillType() == SkillType.BUFF && s.isActive()) + ba.add(s); + } + + for(L2Skill p : ba){ + tb.append("<center><button value=\""+p.getName()+"\" action=\"bypass -h buff"+p.getId()+"\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\"></center>"); + } + + tb.append("</body></html>"); + + n.setHtml(tb.toString()); + sendPacket(n); + } + } } /** @@ -8214,7 +8256,23 @@ } return true; } + + public boolean isSellBuff(){ + return _sellbuff; + } + + public void setSellBuff(boolean j){ + _sellbuff = j; + } + public int getBuffPrize(){ + return _buffprize; + } + + public void setBuffPrize(int x){ + _buffprize = x; + } + public boolean isNoble() { return _noble; Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/sellbuff.java =================================================================== --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/sellbuff.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/sellbuff.java (revision 0) @@ -0,0 +1,76 @@ + +package net.sf.l2j.gameserver.handler.voicedcommandhandlers; + +import javolution.text.TextBuilder; +import javolution.util.FastList; +import net.sf.l2j.gameserver.Olympiad; +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; +import net.sf.l2j.gameserver.model.L2Skill; +import net.sf.l2j.gameserver.model.L2Skill.SkillType; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage; + +/** + * + * @author Iratus + */ +public class sellbuff implements IVoicedCommandHandler +{ + + private static final String[] VOICED_COMMANDS = {"sellbuffs"}; + + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) + { + if(activeChar == null) + return false; + + + if(activeChar.isDead() || activeChar.isAlikeDead()){ + activeChar.sendMessage("You are dead , you can't sell at the moment"); + return false; + } + else if(activeChar.isInOlympiadMode() || Olympiad.getInstance().isRegistered(activeChar)){ + activeChar.sendMessage("You are in olympiad , you can't sell at the moment"); + return false; + } + else if(activeChar.atEvent){ + activeChar.sendMessage("You are in event , you can't sell at the moment"); + return false; + } + else if(!activeChar.isInsideZone(L2PcInstance.ZONE_PEACE)){ + activeChar.sendMessage("You are not in peacefull zone , you can sell only in peacefull zones"); + return false; + } + else if(activeChar.getPvpFlag() > 0 || activeChar.isInCombat() || activeChar.getKarma() > 0){ + activeChar.sendMessage("You are in combat mode , you can't sell at the moment"); + return false; + } + else if(activeChar.getClassId().getId() != 98){ + activeChar.sendMessage("You must be a buffer class to sell buffs"); + return false; + } + + TextBuilder tb = new TextBuilder(0); + tb.append("<html><body>"); + tb.append("Hello , by completing this form you will be able to sell buffs."); + tb.append("<br>Players will be able , targeting you to take your buff services<br>"); + tb.append("<br>You will be rewarded with adenas for each buff a player takes."); + tb.append("<br><center>Now choose the prize:</center><br>"); + tb.append("<edit var=\"pri\" width=120 height=15>"); + tb.append("<center><button value=\"Confirm\" action=\"bypass -h actr $pri\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">"); + tb.append("</body></html>"); + NpcHtmlMessage n = new NpcHtmlMessage(0); + n.setHtml(tb.toString()); + activeChar.sendPacket(n); + + return true; + } + + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } + +} Index: java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java =================================================================== --- java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 5263) +++ java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (working copy) @@ -18,16 +18,20 @@ */ package net.sf.l2j.gameserver.clientpackets; +import java.util.NoSuchElementException; +import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; import net.sf.l2j.Config; import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.communitybbs.CommunityBoard; +import net.sf.l2j.gameserver.datatables.SkillTable; import net.sf.l2j.gameserver.handler.AdminCommandHandler; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.L2CharPosition; import net.sf.l2j.gameserver.model.L2Object; +import net.sf.l2j.gameserver.model.L2Skill; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; @@ -85,6 +89,57 @@ { comeHere(activeChar); } + else if(_command.startsWith("buff")){ + String x = _command.substring(4); + int id = Integer.parseInt(x); + L2PcInstance target = null; + + if(activeChar.getTarget() instanceof L2PcInstance) + target = (L2PcInstance) activeChar.getTarget(); + + if(target == null) + return; + + if(activeChar.getInventory().getItemByItemId(57).getCount() < ((L2PcInstance) activeChar.getTarget()).getBuffPrize()){ + activeChar.sendMessage("not enought adena"); + } + + + try{ + L2Skill s = SkillTable.getInstance().getInfo(id, 3); + s.getEffects(activeChar, activeChar); + activeChar.sendMessage("You buyed: "+s.getName()); + activeChar.getInventory().destroyItemByItemId("", 57, target.getBuffPrize(), activeChar, null); + target.getInventory().addItem("", 57, target.getBuffPrize(), target, null); + } + catch(Exception e){ + e.printStackTrace(); + } + } + else if(_command.startsWith("actr")){ + String l = _command.substring(5); + + int p = 0; + + p = Integer.parseInt(l); + + + if(p == 0) + return; + + if(p > 2000000000){ + activeChar.sendMessage("Too big prize"); + return; + } + + activeChar.setBuffPrize(p); + activeChar.sitDown(); + activeChar.setSellBuff(true); + activeChar.getAppearance().setNameColor(0x1111); + activeChar.setTitle("=SELL BUFFS="); + activeChar.broadcastUserInfo(); + activeChar.broadcastTitleInfo(); + } else if (_command.startsWith("player_help ")) { playerHelp(activeChar, _command.substring(12)); Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 5263) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@ -199,6 +199,7 @@ import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo; import net.sf.l2j.gameserver.handler.usercommandhandlers.Time; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding; +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.sellbuff; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats; import net.sf.l2j.gameserver.idfactory.IdFactory; import net.sf.l2j.gameserver.instancemanager.AuctionManager; @@ -592,6 +593,7 @@ _voicedCommandHandler = VoicedCommandHandler.getInstance(); _voicedCommandHandler.registerVoicedCommandHandler(new stats()); + _voicedCommandHandler.registerVoicedCommandHandler(new sellbuff()); if(Config.L2JMOD_ALLOW_WEDDING) _voicedCommandHandler.registerVoicedCommandHandler(new Wedding());7 answers to this question
Recommended Posts