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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...