Siga-nos em...
Follow us on Twitter Follow us on Facebook Watch us on YouTube
Registro


HGIDC
Resultados 1 a 1 de 1

Tópico: Mass Creat

  1. #1

    Avatar de UnderZone
    Data de Ingresso
    Feb 2012
    Localização
    Sao goncalo
    Idade
    24
    Posts
    58
    Agradecido
    1
    Peso da Avaliação
    0

    Padrão Mass Creat

    Ele cria o Item para Todos os players online.e Também remove todos os itens do inventory do Char.


    Código:
    Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCreateItem.java<div>===================================================================--- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCreateItem.java (revision 741)
    +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCreateItem.java (working copy)@@ -19,11 +19,17 @@ package com.l2jfrozen.gameserver.handler.admincommandhandlers;  import java.util.StringTokenizer;+import java.util.logging.Logger;  import com.l2jfrozen.gameserver.datatables.sql.ItemTable; import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
    +import com.l2jfrozen.gameserver.model.L2World;+import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;+import com.l2jfrozen.gameserver.network.SystemMessageId;
    +import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate; import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
    +import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage; import com.l2jfrozen.gameserver.templates.L2Item;  /**@@ -34,15 +40,18 @@  */ public class AdminCreateItem implements IAdminCommandHandler {
    +       private static Logger _log = Logger.getLogger(AdminCreateItem.class.getName());        private static final String[] ADMIN_COMMANDS =        {
    -                       "admin_itemcreate", "admin_create_item"
    +                       "admin_itemcreate", "admin_create_item", "admin_mass_create", "admin_clear_inventory"        };         private enum CommandEnum        {                admin_itemcreate,-               admin_create_item
    +               admin_create_item,
    +               admin_mass_create,
    +               admin_clear_inventory        }         @Override@@ -74,14 +83,15 @@                                switch(comm)                {-                       case admin_itemcreate:{
    +                       case admin_itemcreate:
    +                                AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm");                                return true;-                       }
    +                        case admin_create_item:
    -                               
    -                               if(st.hasMoreTokens()){ 
    +                               if(st.hasMoreTokens())
    +                               {                                        if(st.countTokens() == 2)                                        {                                                String id = st.nextToken();@@ -130,16 +140,85 @@                                                }                                        } -                               }else{
    -                                       
    +                               }
    +                               else
    +                               {                                                                               AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm");                                        //activeChar.sendMessage("Usage: //itemcreate <itemId> [amount]");                                        return true;                                }
    -                               
    -                       default:{                                return false;-                       }
    +
    +                       case admin_mass_create:
    +
    +                               if(st.hasMoreTokens())
    +                               {
    +                                       if(st.countTokens() == 2)
    +                                       {
    +                                               String id = st.nextToken();
    +                                               String num = st.nextToken();
    +                                               
    +                                               int idval = 0;
    +                                               int numval = 0;
    +                                               
    +                                               try
    +                                               {
    +                                                       idval = Integer.parseInt(id);
    +                                                       numval = Integer.parseInt(num);
    +                                               }
    +                                               catch(NumberFormatException e)
    +                                               {                                                       
    +                                                       activeChar.sendMessage("Usage: //mass_create <itemId> <amount>");
    +                                                       return false;
    +                                               }
    +                                               
    +                                               if(idval > 0 && numval > 0)
    +                                               {
    +                                                       massCreateItem(activeChar, idval, numval);
    +                                                       return true;
    +                                               }
    +                                               else{
    +                                                       activeChar.sendMessage("Usage: //mass_create <itemId> <amount>");
    +                                                       return false;
    +                                               }
    +                                       }
    +                                       else if(st.countTokens() == 1)
    +                                       {
    +                                               String id = st.nextToken();
    +                                               int idval = 0; 
    +                                               
    +                                               try
    +                                               {
    +                                                       idval = Integer.parseInt(id);
    +                                               
    +                                               }
    +                                               catch(NumberFormatException e)
    +                                               {                                                       
    +                                                       activeChar.sendMessage("Usage: //mass_create <itemId> <amount>");
    +                                                       return false;
    +                                               }
    +
    +                                               if(idval > 0)
    +                                               {
    +                                                       massCreateItem(activeChar, idval, 1);
    +                                                       return true;
    +                                               }
    +                                               else
    +                                               {
    +                                                       activeChar.sendMessage("Usage: //mass_create <itemId> <amount>");
    +                                                       return false;
    +                                               }
    +                                       }
    +                               }
    +                               return false;
    +
    +                       case admin_clear_inventory:
    +
    +                               removeAllItems(activeChar);
    +                               return true;
    +
    +                       default:
    +                               return false;                }                        }@@ -201,10 +280,52 @@                else                {                        activeChar.sendMessage("You have spawned " 
    + num 
    + " item(s) number "
     + id
    + " in " 
    + Player.getName() 
    + "'s inventory.");-                       Player.sendMessage("Admin have spawned " + num + " item(s) number " + id + " in your inventory.");
    +                       Player.sendMessage("Admin has spawned " 
    + num 
    + " item(s) number " + id + " in your inventory.");                }                 Player = null;                il = null;        }
    +
    +       private void massCreateItem(L2PcInstance activeChar, int id, int num)
    +       {
    +               if(num > 20)
    +               {
    +                       L2Item template = ItemTable.getInstance().getTemplate(id);
    +                       if(template != null && !template.isStackable())
    +                       {
    +                               activeChar.sendMessage("This item does not stack - Creation aborted.");
    +                               return;
    +                       }
    +               }
    +
    +               int i = 0;
    +               L2ItemInstance item = null;
    +               for(L2PcInstance player : L2World.getInstance().getAllPlayers())
    +               {
    +                       player.sendMessage("Admin is rewarding all online players.");
    +                       item = player.getInventory().addItem("Admin", id, num, null, null);
    +            InventoryUpdate iu = new InventoryUpdate();
    +            iu.addItem(item);
    +                       player.sendPacket(iu);
    +            SystemMessage sm = new SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2);
    +            sm.addItemName(item.getItemId());
    +            sm.addNumber(num);
    +            player.sendPacket(sm);
    +                       i
    +
    +;+               }+               activeChar.sendMessage("Mass-created items in the inventory of " 
    + i + " player(s).");
    +               _log.info("GM " + activeChar.getName() 
    + " mass_created " + item.getItemName() 
    + " (" + num + ")");
    +       }
    +
    +       private void removeAllItems(L2PcInstance activeChar)
    +       {
    +               for (L2ItemInstance item : activeChar.getInventory().getItems())
    +               {
    +                       if(item.getLocation() == L2ItemInstance.ItemLocation.INVENTORY)
    +                               activeChar.getInventory().destroyItem("Destroy", item.getObjectId(), item.getCount(), activeChar, null);
    +               }
    +               activeChar.sendPacket(new ItemList(activeChar, false));
    +               activeChar.sendMessage("Your inventory has been cleared.");
    +       } }Index: data/html/admin/itemcreation.htm===================================================================--- data/html/admin/itemcreation.htm    (revision 742)
    +++ data/html/admin/itemcreation.htm    (working copy)@@ -10,9 +10,10 @@ <tr><td>Fill the ID number in item-id to create the item that</td></tr> <tr><td>you want, use amount if you need more than one.</td></tr> <tr><td><br></td></tr>-<tr><td>Caution:</td></tr>-<tr><td>Do not use amount with non-stackable items.</td></tr>
    +<tr><td>Caution: Max amount for stackable items is 20</td></tr> <tr><td><br></td></tr>
    +<tr><td>Use //mass_create to spawn items in every online character</td></tr>
    +<tr><td><br></td></tr> </table> <center> <table>@@ -21,10 +22,20 @@ <td>Amount: <edit var="itemnum" width=50></td> <td> <button value="Create Item" action="bypass -h admin_create_item $itemid $itemnum" width=70 height=15 back="sek.cbui94" fore="sek.cbui92"></td> </tr>-</table>-</center><br><br>
    +<tr>
    +<td><edit var="massitemid" width=50></td>
    +<td><edit var="massitemnum" width=50></td>
    +<td><button value="Mass Create" action="bypass -h admin_mass_create $massitemid $massitemnum" width=70 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
    +</tr></table></center><br><br>
    +<table width=270>
    +<tr><td>Use //clear_inventory to delete all unequiped items in your inventory.</td></tr>
    +</table><br> <center> <table>
    +<tr><td>
    +<button value="Clear Inventory" action="bypass -h admin_clear_inventory" width=95 height=15 back="sek.cbui94" fore="sek.cbui92"></td>+</tr>
    +<tr><td><br></td></tr> <tr><td><center>Assets: <edit var="asset" width=70 height=11></center></td></tr> </table><br>  <table><span class="Apple-style-span" style="background-color: rgb(13, 13, 13); "></span>

    Creditos : L2jFrozen
    Última edição por UnderZone; 14-03-2012 às 02:05 PM.

 

 

Informações de Tópico

Usuários Navegando neste Tópico

Há 1 usuários navegando neste tópico. (0 registrados e 1 visitantes)

Tópicos Similares

  1. |Novidade| Trailer "Mass Effect Trilogy" e Informações
    Por Hunter no fórum PC Games
    Respostas: 0
    Último Post: 06-11-2012, 12:02 PM

Marcadores

Permissões de Postagem

  • Você não pode iniciar novos tópicos
  • Você não pode enviar respostas
  • Você não pode enviar anexos
  • Você não pode editar suas mensagens
  •