Jump to content

luzzifer

Members
  • Posts

    10
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by luzzifer

  1. Hello, I am adapting it to acis 401, and when I run it in the game it tells me:

    No rights defined for admin command 'admin_search'.
    Admin tried to use admin command 'admin_search', but has no access to use it.

     

    Also try to adapt it in AdminAdmin.java with else in the last lines using it as admin_buscar (buscar = search in spanish)
    and I get the same error:
    No rights defined for admin command 'admin_buscar'.
    Admin tried to use admin command 'admin_search', but has no access to use it.


    I have the AdminSearch.java like this:

    package net.sf.l2j.gameserver.handler.admincommandhandlers;
    
    import java.util.Arrays;
    import java.util.List;
    import java.util.StringTokenizer;
    
    import net.sf.l2j.commons.lang.StringUtil;
    import net.sf.l2j.commons.math.MathUtil;
    
    import net.sf.l2j.gameserver.data.xml.ItemData;
    import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
    import net.sf.l2j.gameserver.model.WorldObject;
    import net.sf.l2j.gameserver.model.actor.Player;
    import net.sf.l2j.gameserver.model.item.kind.Item;
    import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
    
    public class AdminSearch implements IAdminCommandHandler
    {
    	private static final String[] ADMIN_COMMANDS =
    	{
    		"admin_search"
    	};
    	private static final int PAGE_LIMIT = 15;
    	
    	@Override
    	public void useAdminCommand(String command, Player activeChar)
    	{
    		if (command.startsWith("admin_search"))
    		{
    			StringTokenizer st = new StringTokenizer(command, " ");
    			st.nextToken();
    			
    			if (!st.hasMoreTokens())
    			{
    				final NpcHtmlMessage html = new NpcHtmlMessage(0);
    				html.setFile("data/html/admin/search.htm");
    				html.replace("%items%", "");
    				html.replace("%pages%", "");
    				activeChar.sendPacket(html);
    				
    			}
    			else
    			{
    				final String item = st.nextToken();
    				int page = 1;
    				if (st.hasMoreTokens())
    				{
    					
    					try
    					{
    						page = Integer.parseInt(st.nextToken());
    					}
    					catch (NumberFormatException e)
    					{
    						page = 1;
    					}
    				}
    				results(activeChar, item, page);
    			}
    		}
    		return;
    	}
    	
    	private static void results(Player activeChar, String item, int page)
    	{
    		final NpcHtmlMessage html = new NpcHtmlMessage(0);
    		html.setFile("data/html/admin/search.htm");
    		
    		//List<Item> items = new ArrayList<>();//no sirvio
    		List<Object> items = Arrays.asList(ItemData.getInstance().getAllItems());
    		
    		for (Object itemName : items)
    			if (itemName != null)
    				if (((WorldObject) itemName).getName().toLowerCase().contains(item.toLowerCase()))
    					items.add(itemName);
    				
    		if (items.isEmpty())
    		{
    			html.replace("%items%", "<tr><td>No items found with word " + item + ".</td></tr>");
    			html.replace("%pages%", "");
    			activeChar.sendPacket(html);
    			return;
    		}
    		
    		final int max = Math.min(100, MathUtil.countPagesNumber(items.size(), PAGE_LIMIT));
    		items = items.subList((page - 1) * PAGE_LIMIT, Math.min(page * PAGE_LIMIT, items.size()));
    		
    		final StringBuilder sb = new StringBuilder();
    		
    		for (Object itemName : items)
    		{
    			String actualName = getFontedWord(item, ((WorldObject) itemName).getName());
    			StringUtil.append(sb, "<tr><td>", actualName, " (", ((Item) itemName).getItemId(), ")", "</td></tr>");
    		}
    		html.replace("%items%", sb.toString());
    		
    		sb.setLength(0);
    		
    		for (int i = 0; i < max; i++)
    		{
    			final int pagenr = i + 1;
    			if (page == pagenr)
    				StringUtil.append(sb, pagenr, "&nbsp;");
    			else
    				StringUtil.append(sb, "<a action=\"bypass -h admin_search ", item, " ", pagenr, "\">", pagenr, "</a>&nbsp;");
    			
    		}
    		
    		html.replace("%pages%", sb.toString());
    		activeChar.sendPacket(html);
    	}
    	
    	private static String getFontedWord(String word, String tt)
    	{
    		
    		int position = tt.toLowerCase().indexOf(word.toLowerCase());
    		StringBuilder str = new StringBuilder(tt);
    		
    		String font = "<FONT COLOR=\"LEVEL\">";
    		str.insert(position, font);
    		str.insert(position + (font.length() + word.length()), "</FONT>");
    		
    		return str.toString();
    	}
    	
    	@Override
    	public String[] getAdminCommandList()
    	{
    		return ADMIN_COMMANDS;
    	}
    }

    Can someone give me a hand and tell me what I'm doing wrong?

     

  2. I am adapting a php code that allows new players to create accounts, the issue is that it generates the keys in a way that when they try to enter the server, it does not allow them to enter due to a password error.
     

    function encPass($pass){
      return base64_encode(pack("H*",sha1(utf8_encode($pass))));
    }
    
    function HashAleatorio($tamanho = 70){
      $chars = "abcdefghijkmnopqrstuvwxyz023456789";
      srand((double)microtime() * 1000000);
      $i = 1;
      $pass = '';
      while($i <= $tamanho){
        $num = rand() % 33;
        $tmp = substr($chars,$num,1);
        $pass = $pass.$tmp;
        $i++;
      }
      return $pass;
    }

    And from what I see Acis rev401 uses Bcrypt to encrypt the keys generated by the game's self-account. Since I don't understand anything about keys, I would like to know if someone can help me adapt the PHP code so that it generates keys that can be used to log into the game. Or I wonder if there is any other alternative method that I am not aware of.
    Bcrypt example code:
     

     * String strong_salt = BCrypt.gensalt(10)<br />
     * String stronger_salt = BCrypt.gensalt(12)<br />
     * </code>
     * <p>
     * The amount of work increases exponentially (2**log_rounds), so each increment is twice as much work. The default log_rounds is 10, and the valid range is 4 to 30.
     * @author Damien Miller
     * @version 0.2
     */
    public class BCrypt
    {
    	// BCrypt parameters
    	private static final int GENSALT_DEFAULT_LOG2_ROUNDS = 10;
    	private static final int BCRYPT_SALT_LEN = 16;
    
    	// Blowfish parameters
    	private static final int BLOWFISH_NUM_ROUNDS = 16;
    
    	// Initial contents of key schedule
    	private static final int[] P_ORIG =
    	{
    		0x243f6a88,
    		0x85a308d3,
    		0x13198a2e,
    		0x03707344,

     

  3. Hi, I'm trying to add a new command to use /xpoff or /xpon and I'm stuck. As I see the Unstuck has a command identifier which is 52.
    Example unstuck:
     

    public class Escape implements IUserCommandHandler
    {
    	private static final int[] COMMAND_IDS =
    	{
    		52
    	};

    And the NoExp.java that I am creating is like this:
     

    package net.sf.l2j.gameserver.handler.usercommandhandlers;
    
    import net.sf.l2j.gameserver.handler.IUserCommandHandler;
    import net.sf.l2j.gameserver.model.actor.Player;
    
    public class NoExp implements IUserCommandHandler {
    
        private static final int COMMAND_ID_XPOFF = 51;
        private static final int COMMAND_ID_XPON = 52;
    
        private static final int[] _userCommands = {COMMAND_ID_XPOFF, COMMAND_ID_XPON};
    
        @Override
        public void useUserCommand(int id, Player player) {
            switch (id) {
                case COMMAND_ID_XPOFF:
                    player.setCantGainXP(true);
                    player.sendMessage("¡Has desactivado la ganancia de XP!");
                    break;
                case COMMAND_ID_XPON:
                    player.setCantGainXP(false);
                    player.sendMessage("¡Has activado la ganancia de XP!");
                    break;
                default:
                    // Comando no reconocido
                    break;
            }
        }
    
        @Override
        public int[] getUserCommandList() {
            return _userCommands;
        }
    }

    I need to know how to obtain or generate the IDs for the two commands I need. Since I can't find any XML about it, could you guide me how to do it? Thank you very much in advance.

    postscript, I have not yet been able to test that the command works and therefore I do not know if the implementation I am doing will work since it was from another non-acis project.
    I'm sorry for my English if it is not expressed well.

  4. I found this code for frozen, someone help me adapt to acis 340 ?, have no idea that changes to the code to work properly in ACIS.

    ### Eclipse Workspace Patch 1.0
    #P trunk2
    Index: gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
    ===================================================================
    --- gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java   (revision 1004)
    +++ gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
    @@ -678,7 +678,8 @@
         private int heroConsecutiveKillCount = 0;
         private boolean isPVPHero = false;
         
    -   
    +   /** Pvp enchant System **/
    +    private int rewardConsecutiveKillCount = 0;
        /** character away mode **/
        private boolean _awaying = false;
        private boolean _isAway = false;
    @@ -6822,6 +6823,10 @@
            // Increase the kill count for a special hero aura
            heroConsecutiveKillCount++;
           
    +       
    +        // Increase item +1 enchant as a reward
    +        rewardConsecutiveKillCount++;
    +        
            // If heroConsecutiveKillCount == 30 give hero aura
            if(heroConsecutiveKillCount == Config.KILLS_TO_GET_WAR_LEGEND_AURA && Config.WAR_LEGEND_AURA)
            {
    @@ -6830,6 +6835,85 @@
               
            }
            
    +   //====================== Enchant PvP =============================   
    +   //=========== Adaptacion y Modificacion CaiFacu ==================
    +if (rewardConsecutiveKillCount >= Config.PVP_COUNT_TILL_ENCHANTMENT && Config.ENABLE_PVP_ENCHANTMENT)  
    +                          {
    +                          
    +                             switch (Rnd.get(9))
    +                             {
    +                                   case 0:
    +                                   {
    +                                      /** Weapon **/     
    +                                    final L2ItemInstance pvpwep = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
    +                                 
    +                                      if (pvpwep.getEnchantLevel() < Config.ENCHANT_WEAPON_MAX)
    +                                      {
    +                                      pvpwep.setEnchantLevel(pvpwep.getEnchantLevel() + 1);
    +                                      sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) + "has been enchanted by +1 due to your pvp kills");
    +                                      rewardConsecutiveKillCount = 0;
    +                                      break;
    +                                      }
    +                                   }
    +                                   case 1:
    +                                  {
    +                                     /** Armor **/
    +                                   final L2ItemInstance pvphead = getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);
    +                               if (pvphead.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
    +                                      {
    +                                     pvphead.setEnchantLevel(pvphead.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                                   case 2:
    +                                  {
    +                                     /** Armor **/
    +                                   final L2ItemInstance pvpgloves = getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
    +                                   if (pvpgloves.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
    +                                      {
    +                                     pvpgloves.setEnchantLevel(pvpgloves.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                                   case 3:
    +                                  {
    +                                     /** Armor **/
    +                                   final L2ItemInstance pvpchest = getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
    +                                   if (pvpchest.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
    +                                      {
    +                                     pvpchest.setEnchantLevel(pvpchest.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                                   case 4:
    +                                  {
    +                                     /** Armor **/
    +                                   final L2ItemInstance pvplegs = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
    +                                   if (pvplegs.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
    +                                      {
    +                                     pvplegs.setEnchantLevel(pvplegs.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                                   case 5:
    +                                  {
    +                                     /** Armor **/
    +                                   final L2ItemInstance pvpfeet = getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);
    +                                if (pvpfeet.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
    +                                      {
    +                                     pvpfeet.setEnchantLevel(pvpfeet.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                                   case 6:
    +                                  {
    +                                     /** Jewel **/
    +                                   final L2ItemInstance pvpneck = getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK);
    +                                   if (pvpneck.getEnchantLevel() < Config.ENCHANT_JEWELRY_MAX)
    +                                      {
    +                                     pvpneck.setEnchantLevel(pvpneck.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                                   case 7:
    +                                  {
    +                                     /** Jewel **/
    +                                   final L2ItemInstance pvplf = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER);
    +                                   if (pvplf.getEnchantLevel() < Config.ENCHANT_JEWELRY_MAX)
    +                                      {
    +                                     pvplf.setEnchantLevel(pvplf.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                                   case 8:
    +                                  {
    +                                     /** Jewel **/
    +                                   final L2ItemInstance pvprf = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER);
    +                               if (pvprf.getEnchantLevel() < Config.ENCHANT_JEWELRY_MAX)
    +                                      {
    +                                     pvprf.setEnchantLevel(pvprf.getEnchantLevel() + 1);
    +                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER) + "has been enchanted by +1 due to your pvp kills");
    +                                     rewardConsecutiveKillCount = 0;
    +                                     break;
    +                                  }}
    +                       } 
    +                   }         }
    +   //====================== Enchant PvP =============================   
    +   //=========== Adaptacion y Modificacion CaiFacu ==================
           if(Config.PVPEXPSP_SYSTEM)
           {
    Index: gameserver/head-src/com/l2jfrozen/Config.java
    ===================================================================
    --- gameserver/head-src/com/l2jfrozen/Config.java   (revision 1004)
    +++ gameserver/head-src/com/l2jfrozen/Config.java   (working copy)
    @@ -2091,6 +2091,8 @@
        public static String PM_TEXT1;
        public static String PM_TEXT2;
        public static boolean NEW_PLAYER_EFFECT;
    +   public static boolean ENABLE_PVP_ENCHANTMENT;
    +   public static int PVP_COUNT_TILL_ENCHANTMENT;
        
     
        //============================================================
    @@ -2113,7 +2115,9 @@
              PM_TEXT1  = frozenSettings.getProperty("PMText1", "Have Fun and Nice Stay on");
              PM_TEXT2  = frozenSettings.getProperty("PMText2", "Vote for us every 24h");
              NEW_PLAYER_EFFECT = Boolean.parseBoolean(frozenSettings.getProperty("NewPlayerEffect", "True"));
    -
    +         ENABLE_PVP_ENCHANTMENT = Boolean.parseBoolean(frozenSettings.getProperty("EnablePvpEnchantSystem", "False"));
    +         PVP_COUNT_TILL_ENCHANTMENT = Integer.parseInt(frozenSettings.getProperty("PvpCountTillEnchanment", "20"));
    +         
           }
           catch(Exception e)
           {
     
        //============================================================
        public static void loadL2JFrozenConfig()
    @@ -2467,6 +2475,10 @@
              FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
              PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
              PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
    +         
    +         SKILL_GIVER_SKILL_ID = Integer.parseInt(L2JFrozenSettings.getProperty("SkillGiverSkillId", "1"));
    +         SKILL_GIVER_SKILL_LEVEL = Integer.parseInt(L2JFrozenSettings.getProperty("SkillGiverSkillLevel", "1"));
    +         SKILL_GIVER_ID = Integer.parseInt(L2JFrozenSettings.getProperty("SkillGiverItemId", "3470"));
           }
           catch(Exception e)
           {
    Index: gameserver/config/frozen/frozen.properties
    ===================================================================
    --- gameserver/config/frozen/frozen.properties   (revision 1004)
    +++ gameserver/config/frozen/frozen.properties   (working copy)
    @@ -21,4 +21,17 @@
     
     # New players get fireworks the first time they log in
     # Default: False
    -NewPlayerEffect = False
    \ No newline at end of file
    +NewPlayerEffect = False
    +
    +#=================================#
    +#=Elfocrash's Pvp Enchant System==#
    +#=================================#
    +#By enabling this then every X pvp
    +#in a row the player will get randomly
    +#a part of his armor,weapon or jewel that
    +#is currently equiped automatically enchanted
    +#To enable the system set True below
    +EnablePvpEnchantSystem = True
    +#Every how many kills you want the chars to be
    +#awared with +1?
    +PvpCountTillEnchanment = 20
    \ No poner lineas nuevas al final del codigo
    
  5. Hi I need help to configure a npc schemes buffe so that only the clans that are donors.

    In the db I created a new column called clan_donador. to identify the families who donate to number 1, and the clans that do not donate with the number 0, but you have to edit the file options trading.

    \ Buffer's new v1.0 \ 20702_Buffer \ __init__.py

    For this or not allow access to the scheme

    Pardon my English, I speak Spanish.

    I need a guide or someone tell me how to edit the file, many thanks from now, and if there is a npc to bring this option and provide a link me much better.


    Thank you very much in advance.

     

    C6 Interlude - L2JFrozen

    20702_Buffer.zip

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock