Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java b/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
- index e1c4275..e2cf06b 100644
- --- a/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
- +++ b/head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
- @@ -35,6 +35,7 @@
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.FarmPvpCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.OfflineShop;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online;
- +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.SellBuff;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.StatsCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.TvTCmd;
- import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting;
- @@ -65,7 +66,7 @@
- private VoicedCommandHandler()
- {
- _datatable = new FastMap<>();
- -
- + registerVoicedCommandHandler(new SellBuff());
- registerVoicedCommandHandler(new Voting());
- if (Config.BANKING_SYSTEM_ENABLED)
- diff --git a/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/SellBuff.java b/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/SellBuff.java
- new file mode 100644
- index 0000000..41516d2
- --- /dev/null
- +++ b/head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/SellBuff.java
- @@ -0,0 +1,71 @@
- +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
- +
- +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
- +import com.l2jfrozen.gameserver.model.L2Character;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
- +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- +import javolution.text.TextBuilder;
- +
- +public class SellBuff implements IVoicedCommandHandler
- +{
- +
- + private static final String[] VOICED_COMMANDS = {"sellbuffs"};
- +
- + @Override
- + 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(L2Character.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;
- + }
- +
- +}
- \ No newline at end of file
- diff --git a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
- index a281692..bf3cab7 100644
- --- a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
- +++ b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
- @@ -301,7 +301,8 @@
- /** The _last teleport action. */
- private long _lastTeleportAction = 0;
- -
- + private boolean _sellbuff = false;
- + private int _buffprize = 0;
- /** The TOGGLE_USE time. */
- protected long TOGGLE_USE = 0;
- @@ -4427,6 +4428,8 @@
- */
- public void standUp()
- {
- + if(isSellBuff())
- + return;
- if (isFakeDeath())
- {
- broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_STANDING));
- @@ -6982,6 +6985,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);
- + }
- + }
- }
- /**
- @@ -19625,6 +19664,21 @@
- {
- _lastAction = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(Config.AFK_TIMER);
- }
- + public boolean isSellBuff(){
- + return _sellbuff;
- + }
- +
- + public void setSellBuff(boolean j){
- + _sellbuff = j;
- + }
- +
- + public int getBuffPrize(){
- + return _buffprize;
- + }
- +
- + public void setBuffPrize(int x){
- + _buffprize = x;
- + }
- /**
- * Create a new SkillDat object and set the player _currentPetSkill.<br>
- * <br>
- diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
- index 921c087..fd4f816 100644
- --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
- +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
- @@ -25,11 +25,13 @@
- import com.l2jfrozen.Config;
- import com.l2jfrozen.gameserver.ai.CtrlIntention;
- import com.l2jfrozen.gameserver.communitybbs.CommunityBoard;
- +import com.l2jfrozen.gameserver.datatables.SkillTable;
- import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights;
- import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
- import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
- import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
- import com.l2jfrozen.gameserver.model.L2Object;
- +import com.l2jfrozen.gameserver.model.L2Skill;
- import com.l2jfrozen.gameserver.model.L2World;
- import com.l2jfrozen.gameserver.model.actor.instance.L2ClassMasterInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
- @@ -314,6 +316,57 @@
- final L2PcInstance player = getClient().getActiveChar();
- CustomBypassHandler.getInstance().handleBypass(player, _command);
- }
- + 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("OlympiadArenaChange"))
- {
- Olympiad.bypassChangeArena(_command, activeChar);
Advertisement
Comments
-
- tem um problema con o mod, que os buffs que sao menor a lv3 nao da, da error na console, e os buffs que sao malhores a lv3, ese so da la no lvl3, estaria bom poder corregir isso o fazer que mediante a config.java e un archivo .ini la config seleccionar a lista de buffs e os lvl que estarian permitidos, agradeceria muito esa ajuda e actualizacao do mod
Add Comment
Please, Sign In to add comment
Advertisement