Skip to content

Spawnar fakeplayer when starting server.

Featured Replies

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.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.