}
@Override
protected void runImpl()
{
L2PcInstance activeChar = getClient().getActiveChar();
if (activeChar == null)
{
_log.warning("EnterWorld failed! activeChar is null...");
getClient().closeNow();
return;
}
// Set lock at login
activeChar.setLocked(true);
// Register in flood protector
//FloodProtector.getInstance().registerNewPlayer(activeChar.getObjectId());
if (L2World.getInstance().findObject(activeChar.getObjectId()) != null)
{
if (Config.DEBUG)
{
_log.warning("DEBUG "+getType()+": User already exist in OID map! User " + activeChar.getName() + " is character clone");
//activeChar.closeNetConnection(); // Do nothing?
}
}
if (!activeChar.isGM() && !activeChar.isDonator() && Config.CHECK_NAME_ON_LOGIN)
{
if (activeChar.getName().length() < 3 || activeChar.getName().length() > 16 || !Util.isAlphaNumeric(activeChar.getName()) || !isValidName(activeChar.getName()))
{
_log.warning("Charname: " + activeChar.getName() + " is invalid. EnterWorld failed.");
getClient().closeNow();
return;
}
}
// Set online status
activeChar.setOnlineStatus(true);
activeChar.setRunning(); // running is default
activeChar.standUp(); // standing is default
activeChar.broadcastKarma(); //include UserInfo
// Engage and notify Partner
if (Config.L2JMOD_ALLOW_WEDDING)
{
engage(activeChar);
notifyPartner(activeChar, activeChar.getPartnerId());
}
if (LastManStanding.isInActive())
{
if (activeChar.isInsideZone(L2Character.ZONE_EVENT))
{
if (activeChar.isDead())
{
activeChar.doRevive();
}
activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
}
}
if (DM._joining || DM.is_started())
{
if (activeChar.isInsideZone(L2Character.ZONE_DM))
{
if (activeChar.isDead())
{
activeChar.doRevive();
}
activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
}
}
if (activeChar.isInsideZone(L2Character.ZONE_KAMALOKA) && !activeChar.isInKamaloka())
{
if (activeChar.isDead())
{
activeChar.doRevive();
}
activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
}
EnterGM(activeChar);
Quest.playerEnter(activeChar);
activeChar.sendPacket(new QuestList());
if (Config.PLAYER_SPAWN_PROTECTION > 0)
activeChar.setProtection(true);
activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
if (SevenSigns.getInstance().isSealValidationPeriod())
sendPacket(new SignsSky());
// Buff and Status icons
if(Config.STORE_SKILL_COOLTIME)
{
activeChar.restoreEffects();
}
activeChar.sendPacket(new EtcStatusUpdate(activeChar));
final L2Effect[] effects = activeChar.getAllEffects();
if (effects != null)
{
for (L2Effect e : effects)
{
if (e.getEffectType() == L2Effect.EffectType.HEAL_OVER_TIME)
{
activeChar.stopEffects(L2Effect.EffectType.HEAL_OVER_TIME);
activeChar.removeEffect(e);
}
if (e.getEffectType() == L2Effect.EffectType.COMBAT_POINT_HEAL_OVER_TIME)
{
activeChar.stopEffects(L2Effect.EffectType.COMBAT_POINT_HEAL_OVER_TIME);
activeChar.removeEffect(e);
}
}
}
// Apply augmentation boni for equipped items
for (L2ItemInstance temp : activeChar.getInventory().getAugmentedItems())
if (temp != null && temp.isEquipped())
temp.getAugmentation().applyBoni(activeChar);
// Apply death penalty
activeChar.restoreDeathPenaltyBuffLevel();
if(L2Event.active && L2Event.connectionLossData.containsKey(activeChar.getName()) && L2Event.isOnEvent(activeChar))
L2Event.restoreChar(activeChar);
else if (L2Event.connectionLossData.containsKey(activeChar.getName()))
L2Event.restoreAndTeleChar(activeChar);
// SECURE FIX - Anti Overenchant Cheat!!
if(Config.MAX_ITEM_ENCHANT_KICK >0)
{
for (L2ItemInstance i : activeChar.getInventory().getItems())
{
if (!activeChar.isGM())
{
if (i.isEquipable())
{
if (i.getEnchantLevel() > Config.MAX_ITEM_ENCHANT_KICK)
{
//Delete Item Over enchanted
activeChar.getInventory().destroyItem(null, i, activeChar, null);
//Message to Player
activeChar.sendMessage("[Server]: You have over enchanted items you will be kicked from server!");
activeChar.sendMessage("[Server]: Respect our server rules.");
//Message with screen
sendPacket(new ExShowScreenMessage(" You have an over enchanted item, you will be kicked from server! ", 6000));
//Punishment e log in audit
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " has Overenchanted item! Kicked! ", Config.DEFAULT_PUNISH);
//Logger in console
_log.info("#### ATTENTION ####");
_log.info(i+" item has been removed from "+activeChar);
}
}
}
}
}
// Restores custom status
activeChar.restoreCustomStatus();
// Restores custom statuses and hwid bind
StatusDbUpdater.updatePlayer(activeChar);
ColorSystem(activeChar);
// Expand Skill
ExStorageMaxCount esmc = new ExStorageMaxCount(activeChar);
activeChar.sendPacket(esmc);
activeChar.getMacroses().sendUpdate();
// Send packets info
sendPacket(new ClientSetTime()); // SetClientTime
sendPacket(new UserInfo(activeChar)); //
sendPacket(new HennaInfo(activeChar));
sendPacket(new FriendList(activeChar));
sendPacket(new ItemList(activeChar, false));
sendPacket(new ShortCutInit(activeChar));
// Send all skills to char
activeChar.sendSkillList();
if(RankPvpSystemConfig.NICK_COLOR_ENABLED || RankPvpSystemConfig.TITLE_COLOR_ENABLED)
{
KillerPvpStats activeCharPvpStats = PvpTable.getInstance().getKillerPvpStats(activeChar.getObjectId());
if(RankPvpSystemConfig.NICK_COLOR_ENABLED)
{
if (!activeChar.isGM())
{
activeChar.getAppearance().setNameColor(activeCharPvpStats.getRank().getNickColor());
activeChar.sendPacket(new UserInfo(activeChar));
activeChar.broadcastUserInfo();
}
}
if(RankPvpSystemConfig.TITLE_COLOR_ENABLED)
{
if (!activeChar.isGM())
{
activeChar.getAppearance().setTitleColor(activeCharPvpStats.getRank().getTitleColor());
activeChar.broadcastUserInfo();
}
}
}
// Reload inventory to give SA skill
activeChar.getInventory().reloadEquippedItems();
// Welcome to Lineage II
sendPacket(new SystemMessage(SystemMessageId.WELCOME_TO_LINEAGE));
SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);
Announcements.getInstance().showAnnouncements(activeChar);
loadTutorial(activeChar);
// Check for crowns
CrownManager.getInstance().checkCrowns(activeChar);
// Check player skills
if (Config.CHECK_SKILLS_ON_ENTER && !Config.ALT_GAME_SKILL_LEARN)
{
if (!activeChar.isAio())
{
activeChar.checkAllowedSkills();
}
}
PetitionManager.getInstance().checkPetitionMessages(activeChar);
// Send user info again .. just like the real client
//sendPacket(ui);
if (activeChar.getClanId() != 0 && activeChar.getClan() != null)
{
sendPacket(new PledgeShowMemberListAll(activeChar.getClan(), activeChar));
sendPacket(new PledgeStatusChanged(activeChar.getClan()));
}
if (activeChar.isAlikeDead())
sendPacket(new Die(activeChar)); // No broadcast needed since the player will already spawn dead to others
if (Config.ALLOW_WATER)
activeChar.checkWaterState();
if (Hero.getInstance().getHeroes() != null && Hero.getInstance().getHeroes().containsKey(activeChar.getObjectId()))
activeChar.setHero(true);
setPledgeClass(activeChar);
for (String name : activeChar.getFriendList())
{
L2PcInstance friend = L2World.getInstance().getPlayer(name);
if (friend != null) //friend logged in.
friend.sendPacket(new SystemMessage(SystemMessageId.FRIEND_S1_HAS_LOGGED_IN).addString(activeChar.getName()));
}
notifyClanMembers(activeChar);
notifySponsorOrApprentice(activeChar);