Jump to content

Recommended Posts

  • 3 weeks later...
  • 11 months later...
Posted
package net.sf.l2j.gameserver.handler.admincommandhandlers;

import java.util.Collection;

import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance;

/**
 * @author Ventic
 *
 */
public class AdminSit implements IAdminCommandHandler
{
    private static final String[] ADMIN_COMMANDS = { "admin_sit" , "admin_stand", "admin_rangesit", "admin_rangestand" };

    @Override
    public boolean useAdminCommand(String command, L2PcInstance activeChar)
    {
        if (command.startsWith("admin_sit"))
        {
            L2Object target = activeChar.getTarget();
            if (target instanceof L2NpcInstance)
            {
               activeChar.sendMessage("You can not use it on NPCs!");
               return false;
            }
            L2Object targetm = activeChar.getTarget();
            if (targetm instanceof L2MonsterInstance)
            {
                activeChar.sendMessage("You can not use it on Monsters/RaidBosses!");
                return false;
            }
            L2Object targets = activeChar.getTarget();
            if (targets instanceof L2SummonInstance)
            {
                activeChar.sendMessage("You can not use it on Summons!");
                return false;
            }
            else if (target == null)
            {
                activeChar.sendMessage("You have no target!");
                return false;
            }
            else
            {
                ((L2PcInstance) target).sitDown();
            }
        }
        
        if (command.startsWith("admin_stand"))
        {
            L2Object target = activeChar.getTarget();
            if (target instanceof L2NpcInstance)
            {
               activeChar.sendMessage("You can not use it on NPCs!");
               return false;
            }
            L2Object targetm = activeChar.getTarget();
            if (targetm instanceof L2MonsterInstance)
            {
                activeChar.sendMessage("You can not use it on Monsters/RaidBosses!");
                return false;
            }
            L2Object targets = activeChar.getTarget();
            if (targets instanceof L2SummonInstance)
            {
                activeChar.sendMessage("You can not use it on Summons!");
                return false;
            }
            else if (target == null)
            {
                activeChar.sendMessage("You have no target!");
                return false;
            }
            else
            {
                ((L2PcInstance) target).standUp();
            }
        }
        
        if (command.startsWith("admin_rangesit"))
        {
            Collection<L2Character> players = activeChar.getKnownList().getKnownTypeInRadius(L2Character.class, 480);
            for (L2Character p : players)
            {
                if (p instanceof L2PcInstance)
                {
                    ((L2PcInstance) p).sitDown();
                }
            }
        }
        
        if (command.startsWith("admin_rangestand"))
        {
            Collection <L2Character> players = activeChar.getKnownList().getKnownTypeInRadius(L2Character.class, 480);
            for (L2Character p : players)
            {
                if (p instanceof L2PcInstance)
                {
                    ((L2PcInstance) p).standUp();
                }
            }
                
        }
    return true;

    }

    @Override
    public String[] getAdminCommandList()
    {
        return ADMIN_COMMANDS;
    }
}

I just fixed a bit for acis and added some check for summons and monsters now.

  • 3 weeks later...
Posted (edited)

package l2r.gameserver.scripts.handlers.admincommandhandlers;

import l2r.gameserver.handler.IAdminCommandHandler;
import l2r.gameserver.model.L2Object;
import l2r.gameserver.model.actor.instance.L2PcInstance;

/**
 * @author Ventic
 */
public class AdminSit implements IAdminCommandHandler
{
	private static final String[] ADMIN_COMMANDS =
	{
		"sit",
		"stand",
		"rangesit",
		"rangestand"
	};
	
	@Override
	public boolean useAdminCommand(String command, L2PcInstance activeChar)
	{
		if (command.startsWith("sit"))
		{
			L2Object target = activeChar.getTarget();
			L2PcInstance player = null;
			if (target instanceof L2PcInstance)
			{
				player = (L2PcInstance) target;
			}
			else
			{
				activeChar.sendMessage("No target found");
				return false;
			}
			if (!activeChar.isSitting())
			{
				player.sitDown();
			}
		}
		else if (command.startsWith("stand"))
		{
			L2Object target = activeChar.getTarget();
			L2PcInstance player = null;
			if (target instanceof L2PcInstance)
			{
				player = (L2PcInstance) target;
			}
			else
			{
				activeChar.sendMessage("No target found");
				return false;
			}
			if (activeChar.isSitting())
			{
				player.standUp();
			}
		}
		else if (command.startsWith("rangesit"))
		{
			for (L2PcInstance p : activeChar.getKnownList().getKnownPlayersInRadius(240))
			{
				if ((p != null) && !p.isSitting())
				{
					p.sitDown();
				}
			}
		}
		else if (command.startsWith("rangestand"))
		{
			
			for (L2PcInstance pPc : activeChar.getKnownList().getKnownPlayersInRadius(240))
			{
				if ((pPc != null) && pPc.isSitting())
				{
					pPc.standUp();
				}
			}
			
		}
		return true;
	}
	
	@Override
	public String[] getAdminCommandList()
	{
		return ADMIN_COMMANDS;
	}
}

Better so many casts for nothing..

Edited by Ovenuç®

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Stop paying for files that are already public and free. Here you can download a fully working Interlude server with C4-like gameplay, including source code so you can compile it yourself and verify everything. People will try to convince you that free releases are “broken”, “full of backdoors”, etc. That’s exactly why I’m also providing the SVN with the full source – so you can: Review the code yourself Remove / modify whatever you don’t like Compile your own binaries What’s included GX-EXT Interlude server (C4-style gameplay) – L2Off Client Interlude tweaked for C4 gameplay Public SVN with source code Downloads: Server GX-EXT: https://www.mediafire.com/file/aktanlwyuqc9jsa/L2OFF_C4_C4_ACU_GXEXT.rar/file Client Interlude C4 Gameplay: https://www.mediafire.com/file/5iaosvnwspbuky4/Cliente_Interlude_Jugabilidad_C4.rar/file SVN (source code, delayed a couple of months to avoid reselling fresh work): https://svn.l2servers.com.ar/!/#GX-EXT_INTERLUDE User: gx Pass: gx How to compile To compile the source you will need: Visual Studio 2005 (x64 toolset) (Classic L2Off toolchain – yes, it’s old, but that’s what the original server uses.) Use this as you want: learn, test, open your own server, or just audit the code. But please, stop buying the same leaked/resold files over and over when you can get them here for free, with source, and actually know what you’re running.  
    • @GX-Ext Please reupload the pack+web+client because all the links inside that post or in the https://l2servers.com.ar/ are dead
    • Weapon dat is not the same for all, since you have custom things for sure no. You can contact @NevesOma
    • hello guys im facing a problem with the weapons .. i want to add hero glow on s weapons arcana ,dragonic bow etc.. some weapons are work peftect .. some not for example i add the line  LineageEffect.e_u092_h for fists and didnt work didnt even get the hero glow.. and the arcana the glow is on the top of weapon not down side like hero zeus mace any ideas?.. or does anybody has the weapongrp.dat file ready ?
  • Topics

×
×
  • 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