Jump to content
  • 0

Spawnar fakeplayer when starting server.


Question

Posted (edited)

Hello friends, as always I come to doubt that I really could not find a solution and always someone here from the forum helps me, I would like to leave my gratitude here.
Today I'm trying to cause elfocrash mod fakesplayers to start at a specified amount in a specified location by an .ini file, however, I've been having problems since I'm surrounding this code below and not how to make it work when I start server much less put amount to spawn, see below the code in which spawna the fakes.

# AdminFakePlayers.java#
if (command.startsWith("admin_fakepvp"))
		{
			FakePlayer fakePlayer = FakePlayerManager.spawnPlayer(activeChar.getX(), activeChar.getY(), activeChar.getZ());
			fakePlayer.assignDefaultAI();
			if (command.contains(" "))
			{
				String arg = command.split(" ")[1];
				if (arg.equalsIgnoreCase("htm"))
					showFakeDashboard(activeChar);
			}
			return true;
		}

# FakePlayerManager.java # 
public static FakePlayer spawnPlayer(int x, int y, int z)
	{
		final L2GameClient client = new L2GameClient(null);
		client.setDetached(true);
		final FakePlayer activeChar = FakeHelpers.createRandomFakePlayer();
		activeChar.setClient(client);
		client.setActiveChar(activeChar);
		activeChar.setOnlineStatus(true, false);
		client.setState(L2GameClient.GameClientState.IN_GAME);
		client.setAccountName(activeChar.getAccountName());
		World.getInstance().addPlayer(activeChar);
		if (Config.PLAYER_SPAWN_PROTECTION > 0)
		{
			activeChar.setSpawnProtection(true);
		}
			activeChar.getAppearance().setNameColor(Integer.decode("0x" + getNameColor()));
			activeChar.getAppearance().setTitleColor(Integer.decode("0x" + getTitleColor()));
		
		if (Config.FAKE_TITLE_PHANTOM_ATK)
		{
			if (Rnd.get(100) < Config.FAKE_CHANCE_TITLE)
			{
				activeChar.setTitle(getTitle());
			}
			else
			{
				activeChar.setTitle("");
			}
		}
		activeChar.addSkill(SkillTable.getInstance().getInfo(9901, 1), true);
		
		activeChar.spawnMe(55269,85153,-3587);
		
		activeChar.onPlayerEnter();
		if (!activeChar.isGM() && (!activeChar.isInSiege() || (activeChar.getSiegeState() < 2)) && activeChar.isInsideZone(ZoneId.SIEGE))
		{
			activeChar.teleToLocation(MapRegionTable.TeleportType.TOWN);
		}
		activeChar.heal();
		return activeChar;
	}

I imagine I should create a public void spawnfake ();
Somewhere make a code using some of these spawn codes, put some amount of it and use that spawnfake (); no gameserver.java to start, but I made a few attempts and failed, if anyone can help I'll be grateful.

 

Translated by google translate

Edited by N0K3
Resolved, I was able to finish the code.

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..