Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Sell Buff Command (Lobillo & LioNa)

Iniciado por Swarlog, Ago 31, 2022, 08:40 PM

Tema anterior - Siguiente tema

Swarlog




#########################################
######### Algunas Cosillas Mejoradas #########
#########################################
1ª | Command Buff to Sell .SellBuffs
2ª | New Command to Rise .CancelSellBuffs
3ª | You can change the title from Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate
4ª | When you see Buff and no need to remove the Target and give again and give him only with k leaves you to buff new tab.
5ª | Fixed error Adena

CitarCODE:

===================================================================
--- head-src/com/l2jserver/Config.java
+++ head-src/com/l2jserver/Config.java

  public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;
+  public static String ADD_TITULO_PJ_SELLBUFS;

===================================================================

       L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
+      ADD_TITULO_PJ_SELLBUFS = L2JModSettings.getProperty("TituloPjSellBuffs", "BUFF");


===================================================================
--- head-src/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
+++ head-src/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
@@ -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 com.l2jserver.Config;
@@ -451,6 +452,8 @@
 
    private boolean _noble = false;
    private boolean _hero = false;
+  private boolean _sellbuff = false;
+  private int _buffprize = 0;
+ private String _oldtitle = "";
+ private int _oldnamecolor = 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>Hola <font color=LEVEL>Campesin@</font> Quieres Buff!</center>");
+            tb.append("<br><center>Mis Buff Cuestan: <font color=LEVEL>"+t.getBuffPrize()+"</font> Adenas cada uno!</center><br><center><table><tr>");
+           
+            L2Skill[] skills = t.getAllSkills();
+            FastList<L2Skill> ba = new FastList<L2Skill>();
+           
+            for(L2Skill s : skills){
+              if(s == null)
+                  continue;
+             
+             
+              if(s.getSkillType() == L2SkillType.BUFF && s.isActive() && s.getId() != 970 && s.getId() != 357 && s.getId() != 1323 && s.getId() != 327 && s.getId() != 1325 && s.getId() != 1326 && s.getId() != 1327)
+                  ba.add(s);
+            }
+           
+            for(L2Skill p : ba){
+                tb.append("<td><button action=\"bypass -h buff "+p.getId()+"\" width=32 height=32 back=\"Icon.skill"+p.getId()+"\" fore=\"Icon.skill"+p.getId()+"\"></td>");
+                tb.append("<td><button value=\""+p.getName()+"\" action=\"bypass -h buff "+p.getId()+"\" width=200 height=32 back=\"L2UI_CT1.Windows_DF_Drawer_Bg_Darker\" fore=\"L2UI_CT1.Windows_DF_Drawer_Bg_Darker\"></td>");
+                tb.append("<td><button action=\"bypass -h buff "+p.getId()+"\" width=32 height=32 back=\"Icon.skill"+p.getId()+"\" fore=\"Icon.skill"+p.getId()+"\"></td></tr><tr>");
+            }
+           
+            tb.append("</tr></table></center></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 String getOldTitle()
+    {
+       return _oldtitle;
+    }
+   
+    public int getOldNameColor()
+    {
+       return _oldnamecolor;
+    }
+   
+    public void setOldTitle(String title)
+    {
+       _oldtitle = title;
+    }
+   
+    public void setOldNameColor(int color)
+    {
+       _oldnamecolor = color;
+    }
+   
    public boolean isNoble()
    {
      return _noble;





===================================================================
--- head-src/com/l2jserver/gameserver/clientpackets/RequestBypassToServer.java
+++ head-src/com/l2jserver/gameserver/clientpackets/RequestBypassToServer.java
@@ -18,16 +18,20 @@
  */
 package com.l2jserver.gameserver.network.clientpackets;
 
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.communitybbs.CommunityBoard;
 import com.l2jserver.gameserver.datatables.AdminCommandAccessRights;
+import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.handler.AdminCommandHandler;
 import com.l2jserver.gameserver.handler.BypassHandler;
 import com.l2jserver.gameserver.handler.IAdminCommandHandler;
 import com.l2jserver.gameserver.handler.IBypassHandler;
 import com.l2jserver.gameserver.model.L2CharPosition;
 import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.L2Skill;
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
@@ -85,6 +89,57 @@
          {
            comeHere(activeChar);
          }
+        else if(_command.startsWith("buff")){
+           String[] val = _command.split(" ");
+            String x = val[1];
+            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) == null || activeChar.getInventory().getItemByItemId(57).getCount() < ((L2PcInstance) activeChar.getTarget()).getBuffPrize()){
+              activeChar.sendMessage("* No tienes adena!");
+              return;
+            }
+           
+       
+            try{
+            L2Skill s = SkillTable.getInstance().getInfo(id, 3);
+            s.getEffects(activeChar, activeChar);
+            activeChar.sendMessage("* Has Comprado: "+s.getName());
+            activeChar.getInventory().destroyItemByItemId("", 57, target.getBuffPrize(), activeChar, null);
+            target.getInventory().addItem("", 57, target.getBuffPrize(), target, null);
+            TextBuilder tb = new TextBuilder();
+            NpcHtmlMessage n = new NpcHtmlMessage(0);
+           
+            tb.append("<html><body>");
+            tb.append("<br><br>");
+            tb.append("<center>Hola <font color=LEVEL>Campesin@</font> Quieres Buff!</center>");
+            tb.append("<br><center>Mis Buff Cuestan: <font color=LEVEL>"+target.getBuffPrize()+"</font> Adenas cada uno!</center><br><center><table><tr>");
+           
+           
+            L2Skill[] skills = target.getAllSkills();
+            FastList<L2Skill> ba = new FastList<L2Skill>();
+           
+            for(L2Skill skill : skills){
+              if(skill == null)
+                  continue;
+             
+             
+              if(skill.getSkillType() == L2SkillType.BUFF && skill.isActive() && skill.getId() != 970 && skill.getId() != 357 && skill.getId() != 1323 && skill.getId() != 327 && skill.getId() != 1325 && skill.getId() != 1326 && skill.getId() != 1327)
+                  ba.add(skill);
+            }
+           
+            for(L2Skill p : ba){
+                tb.append("<td><button action=\"bypass -h buff "+p.getId()+"\" width=32 height=32 back=\"Icon.skill"+p.getId()+"\" fore=\"Icon.skill"+p.getId()+"\"></td>");
+                tb.append("<td><button value=\""+p.getName()+"\" action=\"bypass -h buff "+p.getId()+"\" width=200 height=32 back=\"L2UI_CT1.Windows_DF_Drawer_Bg_Darker\" fore=\"L2UI_CT1.Windows_DF_Drawer_Bg_Darker\"></td>");
+                tb.append("<td><button action=\"bypass -h buff "+p.getId()+"\" width=32 height=32 back=\"Icon.skill"+p.getId()+"\" fore=\"Icon.skill"+p.getId()+"\"></td></tr><tr>");
+            }
+           
+            tb.append("</tr></table></center></body></html>");
+           
+            n.setHtml(tb.toString());
+            activeChar.sendPacket(n);
+            }
+            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("* Te has colado el limite de Adena!");
+              return;
+            }
+           
+              activeChar.setBuffPrize(p);
+              activeChar.sitDown();
+              activeChar.setTeam(1);
+              activeChar.setSellBuff(true);
+              activeChar.setOldTitle(activeChar.getTitle());
+              activeChar.setOldNameColor(activeChar.getAppearance().getNameColor());
+              /*activeChar.getAppearance().setNameColor(0x55155);*/
+              activeChar.getAppearance().setNameColor(99, 22, 11);
+              activeChar.setTitle(Config.ADD_TITULO_PJ_SELLBUFS);
+              activeChar.broadcastUserInfo();
+              activeChar.broadcastTitleInfo();
+        }
          else if (_command.startsWith("player_help "))
          {
            playerHelp(activeChar, _command.substring(12));

import handlers.voicedcommandhandlers.stats;
  import handlers.voicedcommandhandlers.VisualArmor;
+import handlers.voicedcommandhandlers.sellbuff;

  import java.util.logging.Logger;

  import com.l2jserver.Config;

##############################


      VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new stats());
+      VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new sellbuff());
      if (Config.L2JMOD_ALLOW_WEDDING)
        VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Wedding());
      if (Config.BANKING_SYSTEM_ENABLED)
        VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Banking());

package handlers.voicedcommandhandlers;

import javolution.text.TextBuilder;
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;

/**
*
* @author  Iratus
*/
public class sellbuff implements IVoicedCommandHandler
{

  private static final String[] VOICED_COMMANDS = {"sellbuffs","cancelsellbuffs"};

  public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  {
      if(activeChar == null)
        return false;
   
      if (command.equals(VOICED_COMMANDS[0]))
    {
        if(activeChar.isDead() || activeChar.isAlikeDead()){
          activeChar.sendMessage("You are dead , 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><center>");
        tb.append("<table><tr>");
        tb.append("<td><img src=\"icon.etc_alphabet_b_i00\" width=32 height=32 align=left></td><td><img src=\"icon.etc_alphabet_u_i00\" width=32 height=32 align=left></td>");
        tb.append("<td><img src=\"icon.etc_alphabet_f_i00\" width=32 height=32 align=left></td><td><img src=\"icon.etc_alphabet_f_i00\" width=32 height=32 align=left></td>");
        tb.append("</tr></table><br>");
        tb.append("<br><font color=LEVEL>Hola</font>, completando este formulario<br>");
        tb.append("<br>usted podra de <font color=LEVEL>vender</font> tus <font color=LEVEL>Buff</font>.<br>");
        tb.append("<br>Los <font color=LEVEL>Players</font> Podran Echarse tus <font color=LEVEL>Buff</font>.<br>");
        tb.append("<br><font color=LEVEL>Tu Pones la Cantidad</font><br>");
        tb.append("<br>de adena para echarse los Buff<br>");
        tb.append("<p><font color=LEVEL>Precio de Buff:</font></p>");
        tb.append("<p><edit var=\"pri\" width=120 height=15></p>");
        tb.append("<button value=\"Confirmar\" action=\"bypass -h actr $pri\" width=160 height=32 back=\"L2UI_CT1.Windows_DF_Drawer_Bg_Darker\" fore=\"L2UI_CT1.Windows_DF_Drawer_Bg_Darker\">");
        tb.append("</center><br>");
        tb.append("<center>.:<font color=LEVEL>Lineage II</font>:.</center>");
        tb.append("</body></html>");
        NpcHtmlMessage n = new NpcHtmlMessage(0);
        n.setHtml(tb.toString());
        activeChar.sendPacket(n);
    }
    else if (command.equals(VOICED_COMMANDS[1]))
    {
      if (activeChar.isSellBuff())
      {
        activeChar.setSellBuff(false);
        activeChar.standUp();
        activeChar.setTeam(0);
        activeChar.getAppearance().setNameColor(activeChar.getOldNameColor());
            activeChar.setTitle(activeChar.getOldTitle());
            activeChar.broadcastUserInfo();
            activeChar.broadcastTitleInfo();
      }
    }
   
    return true;
  }


  @Override
  public String[] getVoicedCommandList()
  {
      return VOICED_COMMANDS;
  }

}

CitarDebes de estar registrado para poder ver el contenido indicado. Registrate o Conectate:

EnableWarehouseSortingPrivate = False
+
+###########################
+#### TITULO SELLBUFFS #####
+###########################
+# TITULO PARA VENDER BUFF
+TituloPjSellBuffs = * VENDO BUFF *

Creditos : Lobillo , LioNa