Jump to content

Question

2 answers to this question

Recommended Posts

  • 0
Posted

pou akribos

/*
public class EnterWorld extends L2GameClientPacket
{
private static final String	_C__ENTERWORLD	= "[C] 11 EnterWorld c[bddddbdcccccccccccccccccccc] (unk)";

@Override
protected void readImpl()
{
	/* 16 leading and trailing null bytes and a block of bytes inside.
	 * The block seems not to change (same IP, diff chars/accounts)
	byte[] b = new byte[104];
	readB(b);
	_log.info("EW: " + HexUtil.printData(b));
	*/
	skip(104);
}

@Override
protected void runImpl()
{
	L2PcInstance activeChar = getActiveChar();
	if (activeChar == null)
	{
		_log.warn("EnterWorld failed! activeChar is null...");
		getClient().closeNow();
		return;
	}

	getClient().initServerPacketQueue();

	if (Config.GM_EVERYBODY_HAS_ADMIN_RIGHTS && !(activeChar.isGM()))
		activeChar.setAccessLevel(200);

	// restore instance
	Instance ins = InstanceManager.getInstance().getDynamicInstance(activeChar);
	if (ins != null)
	{
		if (Config.RESTORE_PLAYER_INSTANCE)
			activeChar.setInstanceId(ins.getId());
		else
			ins.removePlayer(activeChar.getObjectId());
	}

	// Restore Vitality
	if (Config.ENABLE_VITALITY && Config.RECOVER_VITALITY_ON_RECONNECT)
	{
		float points = Config.RATE_RECOVERY_ON_RECONNECT * (System.currentTimeMillis() - activeChar.getLastAccess()) / 60000;
		if (points > 0)
			activeChar.updateVitalityPoints(points, false, true);
	}

	if (Config.PLAYER_SPAWN_PROTECTION > 0)
		activeChar.setProtection(true);
	activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());

	activeChar.getKnownList().updateKnownObjects();

	sendPacket(new SSQInfo());
	sendPacket(new UserInfo(activeChar));
	sendPacket(new ItemList(activeChar, false));
	activeChar.getMacroses().sendUpdate();
	sendPacket(new ShortCutInit(activeChar));
	activeChar.sendSkillList();
	sendPacket(SystemMessageId.WELCOME_TO_LINEAGE);
	if (Config.SERVER_AGE_LIM >= 18 || Config.SERVER_PVP)
		sendPacket(SystemMessageId.ENTERED_ADULTS_ONLY_SERVER);
	else if (Config.SERVER_AGE_LIM >= 15)
		sendPacket(SystemMessageId.ENTERED_COMMON_SERVER);
	else
		sendPacket(SystemMessageId.ENTERED_JUVENILES_SERVER);
	sendPacket(new HennaInfo(activeChar));

	Announcements.getInstance().showAnnouncements(activeChar);
	SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);

	activeChar.updateNameTitleColor();

	if (activeChar.isGM())
	{
		if (Config.SHOW_GM_LOGIN)
			Announcements.getInstance().announceToAll("GM " + activeChar.getName() + " has logged on.");

		if (Config.GM_STARTUP_INVISIBLE)
			AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_invisible");

		if (Config.GM_STARTUP_SILENCE)
			AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_silence");

		if (Config.GM_STARTUP_INVULNERABLE)
			AdminCommandHandler.getInstance().useAdminCommand(activeChar, "admin_invul on");

		if (Config.GM_STARTUP_AUTO_LIST)
			GmListTable.addGm(activeChar, false);
		else
			GmListTable.addGm(activeChar, true);
	}

	Siege quickfix = SiegeManager.getInstance().getSiege(activeChar);
	if (quickfix != null && quickfix.getIsInProgress()
			&& !quickfix.checkIsDefender(activeChar.getClan()))
	{
		if (activeChar.isInsideZone(L2Zone.FLAG_NO_HQ) // no such zones yet, so
				|| activeChar.isInsideZone(L2Zone.FLAG_CASTLE))
			activeChar.teleToLocation(TeleportWhereType.Town);
	}

	// send user info again .. just like the real client
	sendPacket(new UserInfo(activeChar));

	if (activeChar.getClanId() != 0 && activeChar.getClan() != null)
	{
		sendPacket(new PledgeShowMemberListAll(activeChar.getClan()));
		sendPacket(new PledgeStatusChanged(activeChar.getClan()));

		// Residential skills support
		activeChar.enableResidentialSkills(true);
	}

	if (activeChar.getStatus().getCurrentHp() < 0.5) // is dead
		activeChar.setIsDead(true);
	if (activeChar.isAlikeDead()) // dead or fake dead
		// no broadcast needed since the player will already spawn dead to others
		sendPacket(new Die(activeChar));

	// engage and notify Partner
	if (Config.ALLOW_WEDDING)
	{
		engage(activeChar);
		notifyPartner(activeChar);

		// Check if player is married and remove if necessary Cupid's Bow
		if (!activeChar.isMaried())
		{
			L2ItemInstance item = activeChar.getInventory().getItemByItemId(9140);
			// Remove Cupid's Bow
			if (item != null)
			{
				activeChar.destroyItem("Removing Cupid's Bow", item, activeChar, true);

				// No need to update every item in the inventory
				//activeChar.getInventory().updateDatabase();

				// Log it
				if (_log.isDebugEnabled())
					_log.debug("Character " + activeChar.getName() + " of account " + activeChar.getAccountName() + " got Cupid's Bow removed.");
			}
		}
	}

	L2ItemInstance weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
	if (weapon == null)
		weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
	if (weapon != null)
	{
		if ((weapon.isHeroItem() && !activeChar.isHero() && !activeChar.isGM())
				|| (activeChar.getPkKills() > 0 && weapon.getItemId() > 7815 && weapon.getItemId() < 7832))
			activeChar.getInventory().unEquipItemInBodySlotAndRecord(weapon.getItem().getBodyPart());
	}

	activeChar.updateEffectIcons();
	activeChar.sendSkillCoolTime();

	Quest.playerEnter(activeChar);
	loadTutorial(activeChar);
	for (Quest quest : QuestManager.getInstance().getAllManagedScripts())
	{
		if (quest != null && quest.getOnEnterWorld())
			quest.notifyEnterWorld(activeChar);
	}

	notifyFriends(activeChar);
	notifyClanMembers(activeChar);
	notifySponsorOrApprentice(activeChar);

	L2Clan clan = activeChar.getClan();
	if (clan != null)
		sendPacket(new PledgeSkillList(clan));

	sendPacket(new ExStorageMaxCount(activeChar));
	sendPacket(new QuestList(activeChar));

	activeChar.broadcastUserInfo();

	if (Olympiad.getInstance().playerInStadia(activeChar))
	{
		activeChar.doRevive();
		activeChar.teleToLocation(TeleportWhereType.Town);
		activeChar.sendMessage("You have been teleported to the nearest town due to you being in an Olympiad Stadium.");
	}

	activeChar.revalidateZone(true);
	activeChar.sendEtcStatusUpdate();

	if (DimensionalRiftManager.getInstance().checkIfInRiftZone(activeChar.getX(), activeChar.getY(), activeChar.getZ(), true)) // Exclude waiting room
		DimensionalRiftManager.getInstance().teleportToWaitingRoom(activeChar);

	// Wherever these should be?
	sendPacket(new ShortCutInit(activeChar));

	if (Hero.getInstance().getHeroes() != null && Hero.getInstance().getHeroes().containsKey(activeChar.getObjectId()))
		activeChar.setHero(true);

	// Restore character's siege state
	if (activeChar.getClan() != null)
	{
		for (Siege siege : SiegeManager.getInstance().getSieges())
		{
			if (!siege.getIsInProgress())
				continue;
			if (siege.checkIsAttacker(activeChar.getClan()))
				activeChar.setSiegeState((byte) 1);
			else if (siege.checkIsDefender(activeChar.getClan()))
				activeChar.setSiegeState((byte) 2);
		}

		for (FortSiege fsiege : FortSiegeManager.getInstance().getSieges())
		{
			if (!fsiege.getIsInProgress())
				continue;
			if (fsiege.checkIsAttacker(activeChar.getClan()))
				activeChar.setSiegeState((byte) 1);
			else if (fsiege.checkIsDefender(activeChar.getClan()))
				activeChar.setSiegeState((byte) 2);
		}
	}

	//Updating Seal of Strife Buff/Debuff
	if (SevenSigns.getInstance().isSealValidationPeriod())
	{
		int owner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE);
		if (owner != SevenSigns.CABAL_NULL)
		{
			int cabal = SevenSigns.getInstance().getPlayerCabal(activeChar);
			if (cabal == owner)
				activeChar.addSkill(SkillTable.getInstance().getInfo(5074, 1), false);
			else if (cabal != SevenSigns.CABAL_NULL)
				activeChar.addSkill(SkillTable.getInstance().getInfo(5075, 1), false);
		}
	}

	for (L2ItemInstance i : activeChar.getInventory().getItems())
		if (i.isTimeLimitedItem())
			i.scheduleLifeTimeTask();

	activeChar.queryGameGuard();

	sendPacket(new FriendList(activeChar));

	if (Config.SHOW_LICENSE)
		CoreInfo.versionInfo(activeChar);

	if (Config.SHOW_HTML_NEWBIE && activeChar.getLevel() < Config.LEVEL_HTML_NEWBIE)
	{
		String Newbie_Path = "data/html/newbie.htm";
		if (HtmCache.getInstance().pathExists(Newbie_Path))
		{
			NpcHtmlMessage html = new NpcHtmlMessage(1);
			html.setFile(Newbie_Path);
			html.replace("%name%", activeChar.getName()); // replaces %name%, so you can say like "welcome to the server %name%"
			sendPacket(html);
		}
	}
	else if (Config.SHOW_HTML_GM && activeChar.isGM())
	{
		String Gm_Path = "data/html/gm.htm";
		if (HtmCache.getInstance().pathExists(Gm_Path))
		{
			NpcHtmlMessage html = new NpcHtmlMessage(1);
			html.setFile(Gm_Path);
			html.replace("%name%", activeChar.getName()); // replaces %name%, so you can say like "welcome to the server %name%"
			sendPacket(html);
		}
	}
	else if (Config.SHOW_HTML_WELCOME)
	{
		String Welcome_Path = "data/html/welcome.htm";
		if (HtmCache.getInstance().pathExists(Welcome_Path))
		{
			NpcHtmlMessage html = new NpcHtmlMessage(1);
			html.setFile(Welcome_Path);
			html.replace("%name%", activeChar.getName()); // replaces %name%, so you can say like "welcome to the server %name%"
			sendPacket(html);
		}
	}

	// Resume paused restrictions
	ObjectRestrictions.getInstance().resumeTasks(activeChar.getObjectId());

	// check player skills
	activeChar.checkAllowedSkills();

	// check for academy
	activeChar.academyCheck(activeChar.getClassId().getId());

	// check for crowns
	CrownManager.checkCrowns(activeChar);

	if (Config.ONLINE_PLAYERS_AT_STARTUP)
	{
		SystemMessage sm = new SystemMessage(SystemMessageId.S1);
		if (L2World.getInstance().getAllPlayers().size() == 1)
			sm.addString("Player online: " + L2World.getInstance().getAllPlayers().size());
		else
			sm.addString("Players online: " + L2World.getInstance().getAllPlayers().size());
		sendPacket(sm);
	}

	PetitionManager.getInstance().checkPetitionMessages(activeChar);

	activeChar.onPlayerEnter();

	if (activeChar.getClanJoinExpiryTime() > System.currentTimeMillis())
		sendPacket(SystemMessageId.CLAN_MEMBERSHIP_TERMINATED);
/*
	if (activeChar.getClan() != null)
	{
		// Add message if clanHall not paid. Possibly this is custom...
		ClanHall clanHall = ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan());
		if (clanHall != null && !clanHall.getPaid())
		{
			SystemMessage sm = new SystemMessage(SystemMessageId.MAKE_CLAN_HALL_PAYMENT_BY_S1_TOMORROW);
			sm.addNumber(???);
			sendPacket(sm);
		}
	}
*/
	//Sets the appropriate Pledge Class for the clannie (e.g. Viscount, Count, Baron, Marquiz)
	activeChar.setPledgeClass(L2ClanMember.getCurrentPledgeClass(activeChar));

	L2ShortCut[] allShortCuts = activeChar.getAllShortCuts();
	for (L2ShortCut sc : allShortCuts)
		sendPacket(new ShortCutRegister(sc));

	// remove combat flag before teleporting
	L2ItemInstance flag = activeChar.getInventory().getItemByItemId(9819);
	if (flag != null)
	{
		Fort fort = FortManager.getInstance().getFort(activeChar);
		if (fort != null)
		{
			FortSiegeManager.getInstance().dropCombatFlag(activeChar);
		}
		else
		{
			int slot = flag.getItem().getBodyPart();
			activeChar.getInventory().unEquipItemInBodySlotAndRecord(slot);
			activeChar.destroyItem("CombatFlag", flag, null, true);
		}
	}
	if (!activeChar.isGM()
	// inside siege zone
			&& activeChar.isInsideZone(L2Zone.FLAG_SIEGE)
			// but non-participant or attacker
			&& (!activeChar.isInSiege() || activeChar.getSiegeState() < 2))
	{
		// Attacker or spectator logging in to a siege zone. Actually should be checked for inside castle only?
		activeChar.teleToLocation(TeleportWhereType.Town);
		//activeChar.sendMessage("You have been teleported to the nearest town due to you being in siege zone"); - custom
	}

	RegionBBSManager.changeCommunityBoard(activeChar, PlayerStateOnCommunity.NONE);

	if (!activeChar.isTransformed())
		activeChar.regiveTemporarySkills();

	// Send Teleport Bookmark List
	sendPacket(new ExGetBookMarkInfoPacket(activeChar));

	ExBasicActionList.sendTo(activeChar);

	int daysLeft = activeChar.canReceiveAnnualPresent();
	if (daysLeft < 8 && daysLeft != -1)
	{
		if (daysLeft == 0)
			sendPacket(ExNotifyBirthDay.PACKET);
		else
			sendPacket(new SystemMessage(SystemMessageId.S1_DAYS_UNTIL_BIRTHDAY).addNumber(daysLeft));
	}

	L2ClassMasterInstance.showQuestionMark(activeChar);

	if (activeChar.getLevel() == 28)
		sendPacket(new TutorialShowQuestionMark(1002));

	GlobalRestrictions.playerLoggedIn(activeChar);
}

/**
 * @param activeChar
 */
private void engage(L2PcInstance cha)
{
	int _chaid = cha.getObjectId();

	for (Couple cl : CoupleManager.getInstance().getCouples())
	{
		if (cl.getPlayer1Id() == _chaid || cl.getPlayer2Id() == _chaid)
		{
			if (cl.getMaried())
				cha.setMaried(true);

			cha.setCoupleId(cl.getId());

			if (cl.getPlayer1Id() == _chaid)
				cha.setPartnerId(cl.getPlayer2Id());
			else
				cha.setPartnerId(cl.getPlayer1Id());
		}
	}
}

/**
 * @param activeChar partnerid
 */
private void notifyPartner(L2PcInstance cha)
{
	if (cha.getPartnerId() != 0)
	{
		L2PcInstance partner = L2World.getInstance().getPlayer(cha.getPartnerId());
		if (partner != null)
			partner.sendMessage("Your Partner " + cha.getName() + " has logged in.");
	}
}

/**
 * @param activeChar
 */
private void notifyFriends(L2PcInstance cha)
{
	SystemMessage sm = new SystemMessage(SystemMessageId.FRIEND_S1_HAS_LOGGED_IN);
	sm.addPcName(cha);

	for (Integer objId : cha.getFriendList().getFriendIds())
	{
		L2PcInstance friend = L2World.getInstance().findPlayer(objId);
		if (friend != null)
		{
			friend.sendPacket(new FriendList(friend));
			friend.sendPacket(sm);
		}
	}
}

/**
 * @param activeChar
 */
private void notifyClanMembers(L2PcInstance activeChar)
{
	L2Clan clan = activeChar.getClan();
	if (clan != null)
	{
		L2ClanMember clanmember = clan.getClanMember(activeChar.getObjectId());
		if (clanmember != null)
		{
			clanmember.setPlayerInstance(activeChar);
			SystemMessage msg = new SystemMessage(SystemMessageId.CLAN_MEMBER_S1_LOGGED_IN);
			msg.addString(activeChar.getName());
			clan.broadcastToOtherOnlineMembers(msg, activeChar);
			clan.broadcastToOtherOnlineMembers(new PledgeShowMemberListUpdate(activeChar), activeChar);
			if (clan.isNoticeEnabled() && !clan.getNotice().isEmpty())
			{
				NpcHtmlMessage notice = new NpcHtmlMessage(clan.getClanId());
				notice.setFile("data/html/clanNotice.htm");
				notice.replace("%clan_name%", clan.getName());
				// perhaps <br> is in retail?
				notice.replace("%notice_text%", clan.getNotice().replaceAll("\r\n", "<br1>"));
				activeChar.sendPacket(notice);
			}
		}
	}
}

/**
 * @param activeChar
 */
private void notifySponsorOrApprentice(L2PcInstance activeChar)
{
	if (activeChar.getSponsor() != 0)
	{
		L2PcInstance sponsor = L2World.getInstance().getPlayer(activeChar.getSponsor());

		if (sponsor != null)
		{
			SystemMessage msg = new SystemMessage(SystemMessageId.YOUR_APPRENTICE_S1_HAS_LOGGED_IN);
			msg.addString(activeChar.getName());
			sponsor.sendPacket(msg);
		}
	}
	else if (activeChar.getApprentice() != 0)
	{
		L2PcInstance apprentice = L2World.getInstance().getPlayer(activeChar.getApprentice());

		if (apprentice != null)
		{
			SystemMessage msg = new SystemMessage(SystemMessageId.YOUR_SPONSOR_C1_HAS_LOGGED_IN);
			msg.addString(activeChar.getName());
			apprentice.sendPacket(msg);
		}
	}
}

private void loadTutorial(L2PcInstance player)
{
	QuestState qs = player.getQuestState("255_Tutorial");
	if (qs != null)
		qs.getQuest().notifyEvent("UC", null, player);
}

@Override
public String getType()
{
	return _C__ENTERWORLD;
}
}

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

    • 🔒 Zero Password Required: 1-Click upgrade link gives you instant 5TB + Gemini Pro without sharing sensitive account credentials!     FINAL CALL: Google is Shutting This Down After October 2026! Google will NEVER bring back this window of opportunity again. Once this month ends, this massive backdoor upgrade is gone permanently!  BUY 2, GET 1 FREE IS STILL LIVE! Stock up now for yourself, your family, your business, and your friends! Think about it: Every single person you know uses a Gmail account, and everyone is running out of storage. Don't let your loved ones get trapped paying $20–$30 every single month when you can set them up with 5TB Cloud Storage + Gemini Advanced (12–18 Months) right now for only $15! Why Buy Bulk Activations Today? Instant Gift Value: Perfect lifetime-style gift for clients, family, or team members. 100% Private & Safe: Activates on personal Gmails—zero passwords or logins required. Global Access: Works worldwide with zero VPN hassles. Instant Automated Delivery: Receive your activation links in seconds 24/7! ‍ Time is running out fast—secure your extra free licenses before the October deadline hits! Order Your Bundle Now on the Website
    • Update Oct 12, 2026   New - You can now view geodata on top of the game world and edit it.   Improvements - Screenshots (F12) now capture the window as you see it, with the interface, at full screen resolution. Shift+F12 takes a screenshot without the interface. In Options -> Interface you can choose which one F12 takes. Screenshots are saved to Pictures/Cruma/Screenshots, and each file is named with the date and time. After saving, a notice appears with a button that opens the folder.     Geodata   Geodata editing is experimental. Keep a copy of your geodata and pathnode files (if you plan to use the pathnode generator built into Cruma). The pathnode algorithm is restored from L2_TEST_LSERVER-r1.   What you can do - Open geodata. Use the Geodata tab on the right (G key) and choose a folder with *_conv.dat files (only the L2OFF format is supported). You can also set the path in the settings menu, with a separate folder for each client. - See geodata around the cursor: green is walkable, red is walls and closed sides. The radius is 2048 by default and can go up to 4096. X-ray (X) shows floors behind walls and under the ground. - Inspect cells. Click a cell to see its height, layers and open sides. Click again to go to the layer below (if there are several). You can show only one layer (Z) or only the area you can walk to from the cell (I). - Test routes. Drag the mouse from one cell to another to make a route from A to B. Modes: Path: finds the way like an L2OFF server does, with pathnode. Straight: walks in a straight line and shows where you get stuck. Sight: shows if A can see B (for skills and arrows). Reach: shows everywhere you can walk to from A. - Find problems. The Check tab checks an area for traps you can’t get out of, one-way passages and walls you can climb. Check results are hints, not exact errors. Some of these “problems” are normal in generated geodata. - Edit. Open and close cell sides (you can drag along a whole wall at once), paint Block, Open and Height with a brush or a rectangle and add or remove floors in a cell. Undo and redo are supported and changed cells are highlighted. - Save changes. Save straight into the geodata folder (with a backup), into a new folder, or as a small patch file with only your changes that you can load later. You can also rebuild pathnode at the same time. The panel shows where everything will be saved and you can choose the folder. A progress bar is shown while files are being written.   New version: 0.2.0 Previous version: 0.1.2
    • WDYM Glad you're enjoying some 16 y/o files.
  • Topics

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