void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder) { uint64 playerGuid = holder->GetGuid(); Player *pCurrChar = new Player(this); pCurrChar->GetMotionMaster()->Initialize(); // "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) if(!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder)) { KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick delete pCurrChar; // delete it manually delete holder; // delete all unprocessed queries m_playerLoading = false; return; } SetPlayer(pCurrChar); pCurrChar->SendDungeonDifficulty(false); WorldPacket data( SMSG_LOGIN_VERIFY_WORLD, 20 ); data << pCurrChar->GetMapId(); data << pCurrChar->GetPositionX(); data << pCurrChar->GetPositionY(); data << pCurrChar->GetPositionZ(); data << pCurrChar->GetOrientation(); SendPacket(&data); // load player specific part before send times LoadAccountData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA),PER_CHARACTER_CACHE_MASK); SendAccountDataTimes(PER_CHARACTER_CACHE_MASK); data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0 data << uint8(2); // unknown value data << uint8(0); // enable(1)/disable(0) voice chat interface in client SendPacket(&data); // Send MOTD { data.Initialize(SMSG_MOTD, 50); // new in 2.0.1 data << (uint32)0; uint32 linecount=0; std::string str_motd = sWorld.GetMotd(); std::string::size_type pos, nextpos; pos = 0; while ( (nextpos= str_motd.find('@',pos)) != std::string::npos ) { if (nextpos != pos) { data << str_motd.substr(pos, nextpos-pos); ++linecount; } pos = nextpos + 1; } if (pos < str_motd.length()) { data << str_motd.substr(pos); ++linecount; } data.put(0, linecount); SendPacket( &data ); DEBUG_LOG( "WORLD: Sent motd (SMSG_MOTD)" ); } //QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow()); QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD); if(resultGuild) { Field *fields = resultGuild->Fetch(); pCurrChar->SetInGuild(fields[0].GetUInt32()); pCurrChar->SetRank(fields[1].GetUInt32()); delete resultGuild; } else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership { pCurrChar->SetInGuild(0); pCurrChar->SetRank(0); } if(pCurrChar->GetGuildId() != 0) { Guild* guild = objmgr.GetGuildById(pCurrChar->GetGuildId()); if(guild) { data.Initialize(SMSG_GUILD_EVENT, (2+guild->GetMOTD().size()+1)); data << (uint8)GE_MOTD; data << (uint8)1; data << guild->GetMOTD(); SendPacket(&data); DEBUG_LOG( "WORLD: Sent guild-motd (SMSG_GUILD_EVENT)" ); data.Initialize(SMSG_GUILD_EVENT, (5+10)); // we guess size data<<(uint8)GE_SIGNED_ON; data<<(uint8)1; data<<pCurrChar->GetName(); data<<pCurrChar->GetGUID(); guild->BroadcastPacket(&data); DEBUG_LOG( "WORLD: Sent guild-signed-on (SMSG_GUILD_EVENT)" ); // Increment online members of the guild guild->IncOnlineMemberCount(); } else { // remove wrong guild data sLog.outError("Player %s (GUID: %u) marked as member not existed guild (id: %u), removing guild membership for player.",pCurrChar->GetName(),pCurrChar->GetGUIDLow(),pCurrChar->GetGuildId()); pCurrChar->SetInGuild(0); } } data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4); data << uint32(0); data << uint32(0); SendPacket(&data); if(!pCurrChar->isAlive()) pCurrChar->SendCorpseReclaimDelay(true); pCurrChar->SendInitialPacketsBeforeAddToMap(); //Show cinematic at the first time that player login if( !pCurrChar->getCinematic() ) { pCurrChar->setCinematic(1); if(ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass())) { if (cEntry->CinematicSequence) pCurrChar->SendCinematicStart(cEntry->CinematicSequence); else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) pCurrChar->SendCinematicStart(rEntry->CinematicSequence); } } if (!pCurrChar->GetMap()->Add(pCurrChar)) { AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId()); if(at) pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation()); else pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation()); } ObjectAccessor::Instance().AddObject(pCurrChar); //sLog.outDebug("Player %s added to Map.",pCurrChar->GetName()); pCurrChar->SendInitialPacketsAfterAddToMap(); CharacterDatabase.PExecute("UPDATE characters SET online = 1 WHERE guid = '%u'", pCurrChar->GetGUIDLow()); loginDatabase.PExecute("UPDATE account SET active_realm_id = %d WHERE id = '%u'", realmID, GetAccountId()); pCurrChar->SetInGameTime( getMSTime() ); // announce group about member online (must be after add to player list to receive announce to self) if(Group *group = pCurrChar->GetGroup()) { //pCurrChar->groupInfo.group->SendInit(this); // useless group->SendUpdate(); } // friend status sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true); // Place character in world (and load zone) before some object loading pCurrChar->LoadCorpse(); // setting Ghost+speed if dead if (pCurrChar->m_deathState != ALIVE) { // not blizz like, we must correctly save and load player instead... if(pCurrChar->getRace() == RACE_NIGHTELF) pCurrChar->CastSpell(pCurrChar, 20584, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) pCurrChar->SetMovement(MOVE_WATER_WALK); } pCurrChar->ContinueTaxiFlight(); // reset for all pets before pet loading if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS)) Pet::resetTalentsForAllPetsOf(pCurrChar); // Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned) pCurrChar->LoadPet(); // Set FFA PvP for non GM in non-rest mode if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) ) pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); if(pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) pCurrChar->SetContestedPvP(); // Apply at_login requests if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS)) { pCurrChar->resetSpells(); SendNotification(LANG_RESET_SPELLS); } if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS)) { pCurrChar->resetTalents(true); pCurrChar->SendTalentsInfoData(false); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state SendNotification(LANG_RESET_TALENTS); } // show time before shutdown if shutdown planned. if(sWorld.IsShutdowning()) sWorld.ShutdownMsg(true,pCurrChar); if(sWorld.getConfig(CONFIG_ALL_TAXI_PATHS)) pCurrChar->SetTaxiCheater(true); if(pCurrChar->isGameMaster()) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid:%u)", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow()); if(!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); m_playerLoading = false; delete holder; }
void WorldSession::FullLogin(Player* plr) { DEBUG_LOG("WorldSession", "Fully loading player %u", plr->GetLowGUID()); SetPlayer(plr); m_MoverWoWGuid.Init(plr->GetGUID()); // copy to movement array //movement_packet[0] = m_MoverWoWGuid.GetNewGuidMask(); //memcpy(&movement_packet[1], m_MoverWoWGuid.GetNewGuid(), m_MoverWoWGuid.GetNewGuidLen()); WorldPacket datab(MSG_SET_DUNGEON_DIFFICULTY, 20); datab << plr->iInstanceType; datab << uint32(0x01); datab << uint32(0x00); SendPacket(&datab); WorldPacket datat(SMSG_MOTD, 50); datat << uint32(0x04); datat << sWorld.GetMotd(); SendPacket(&datat); /* world preload */ packetSMSG_LOGIN_VERIFY_WORLD vwpck; vwpck.MapId = plr->GetMapId(); vwpck.O = plr->GetOrientation(); vwpck.X = plr->GetPositionX(); vwpck.Y = plr->GetPositionY(); vwpck.Z = plr->GetPositionZ(); OutPacket( SMSG_LOGIN_VERIFY_WORLD, sizeof(packetSMSG_LOGIN_VERIFY_WORLD), &vwpck ); // send voicechat state - active/inactive /* {SERVER} Packet: (0x03C7) UNKNOWN PacketSize = 2 |------------------------------------------------|----------------| |00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF| |------------------------------------------------|----------------| |02 01 |.. | ------------------------------------------------------------------- */ #ifdef VOICE_CHAT datab.Initialize(SMSG_FEATURE_SYSTEM_STATUS); datab << uint8(2) << uint8(sVoiceChatHandler.CanUseVoiceChat() ? 1 : 0); SendPacket(&datab); #else datab.Initialize(SMSG_FEATURE_SYSTEM_STATUS); datab << uint8(2) << uint8(0); #endif plr->UpdateAttackSpeed(); /*if(plr->getLevel()>70) plr->SetUInt32Value(UNIT_FIELD_LEVEL,70);*/ // Enable trigger cheat by default //plr->triggerpass_cheat = HasGMPermissions(); // Make sure our name exists (for premade system) PlayerInfo * info = objmgr.GetPlayerInfo(plr->GetLowGUID()); if(info == 0) { info = new PlayerInfo; memset(info, 0, sizeof(PlayerInfo)); info->cl = plr->getClass(); info->gender = plr->getGender(); info->guid = plr->GetLowGUID(); info->name = strdup(plr->GetName()); info->lastLevel = plr->getLevel(); info->lastOnline = UNIXTIME; info->lastZone = plr->GetZoneId(); info->race = plr->getRace(); info->team = plr->GetTeam(); objmgr.AddPlayerInfo(info); } plr->m_playerInfo = info; if(plr->m_playerInfo->guild) { plr->m_uint32Values[PLAYER_GUILDID] = plr->m_playerInfo->guild->GetGuildId(); plr->m_uint32Values[PLAYER_GUILDRANK] = plr->m_playerInfo->guildRank->iId; } for(uint32 z = 0; z < NUM_ARENA_TEAM_TYPES; ++z) { if(_player->m_playerInfo->arenaTeam[z] != NULL) { _player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (z*7), _player->m_playerInfo->arenaTeam[z]->m_id); if(_player->m_playerInfo->arenaTeam[z]->m_leader == _player->GetLowGUID()) _player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (z*7) + 1, 0); else _player->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (z*7) + 1, 1); } } info->m_loggedInPlayer = plr; // account data == UI config SendAccountDataTimes(PER_CHARACTER_CACHE_MASK); _player->ResetTitansGrip(); // Set TIME OF LOGIN CharacterDatabase.Execute ( "UPDATE characters SET online = 1 WHERE guid = %u" , plr->GetLowGUID()); bool enter_world = true; #ifndef CLUSTERING // Find our transporter and add us if we're on one. if(plr->m_TransporterGUID != 0) { Transporter* pTrans = objmgr.GetTransporter(GUID_LOPART(plr->m_TransporterGUID)); if(pTrans) { if(plr->isDead()) { plr->RemoteRevive(); } float c_tposx = pTrans->GetPositionX() + plr->m_TransporterX; float c_tposy = pTrans->GetPositionY() + plr->m_TransporterY; float c_tposz = pTrans->GetPositionZ() + plr->m_TransporterZ; if(plr->GetMapId() != pTrans->GetMapId()) // loaded wrong map { plr->SetMapId(pTrans->GetMapId()); WorldPacket dataw(SMSG_NEW_WORLD, 20); dataw << pTrans->GetMapId() << c_tposx << c_tposy << c_tposz << plr->GetOrientation(); SendPacket(&dataw); // shit is sent in worldport ack. enter_world = false; } plr->SetPosition(c_tposx, c_tposy, c_tposz, plr->GetOrientation(), false); plr->m_CurrentTransporter = pTrans; pTrans->AddPlayer(plr); } } #endif DEBUG_LOG( "WorldSession","Player %s logged in.", plr->GetName()); if(plr->GetTeam() == 1) sWorld.HordePlayers++; else sWorld.AlliancePlayers++; if(plr->m_FirstLogin && !HasGMPermissions()) OutPacket(SMSG_TRIGGER_CINEMATIC, 4, &plr->myRace->cinematic_id); DEBUG_LOG( "WorldSession","Created new player for existing players (%s)", plr->GetName() ); // Login time, will be used for played time calc plr->m_playedtime[2] = (uint32)UNIXTIME; //Issue a message telling all guild members that this player has signed on if(plr->IsInGuild()) { Guild *pGuild = plr->m_playerInfo->guild; if(pGuild) { WorldPacket data(50); data.Initialize(SMSG_GUILD_EVENT); data << uint8(GUILD_EVENT_MOTD); data << uint8(0x01); if(pGuild->GetMOTD()) data << pGuild->GetMOTD(); else data << uint8(0); SendPacket(&data); pGuild->LogGuildEvent(GUILD_EVENT_HASCOMEONLINE, 1, plr->GetName()); } } // Send online status to people having this char in friendlist (excluding GM's) if(!HasGMPermissions()) _player->Social_TellFriendsOnline(); // send friend list (for ignores) _player->Social_SendFriendList(7); // Send revision (if enabled) #ifdef WIN32 _player->BroadcastMessage("Server: %sAscent %s r%u/%s-Win-%s %s(www.ascentemulator.net)", MSG_COLOR_WHITE, BUILD_REVISION, CONFIG, ARCH, MSG_COLOR_LIGHTBLUE); #else _player->BroadcastMessage("Server: %sAscent %s r%u/%s-%s %s(www.ascentemulator.net)", MSG_COLOR_WHITE, BUILD_REVISION, PLATFORM_TEXT, ARCH, MSG_COLOR_LIGHTBLUE); #endif if(sWorld.SendStatsOnJoin) { _player->BroadcastMessage("Online Players: %s%u |rPeak: %s%u|r Accepted Connections: %s%u", MSG_COLOR_WHITE, sWorld.GetSessionCount(), MSG_COLOR_WHITE, sWorld.PeakSessionCount, MSG_COLOR_WHITE, sWorld.mAcceptedConnections); _player->BroadcastMessage("Server Uptime: |r%s", sWorld.GetUptimeString().c_str()); } // send to gms if( HasGMPermissions() ) sWorld.SendMessageToGMs(this, "GM %s (%s) is now online. (Permissions: [%s])", _player->GetName(), GetAccountNameS(), GetPermissions()); //Set current RestState if( plr->m_isResting) // We are in a resting zone, turn on Zzz plr->ApplyPlayerRestState(true); //Check if there is a time difference between lastlogoff and now if( plr->m_timeLogoff > 0 && plr->GetUInt32Value(UNIT_FIELD_LEVEL) < plr->GetUInt32Value(PLAYER_FIELD_MAX_LEVEL)) // if timelogoff = 0 then it's the first login { uint32 currenttime = (uint32)UNIXTIME; uint32 timediff = currenttime - plr->m_timeLogoff; //Calculate rest bonus if( timediff > 0 ) plr->AddCalculatedRestXP(timediff); } sHookInterface.OnEnterWorld2(_player); if(info->m_Group) info->m_Group->Update(); // Retroactive: Level achievement _player->GetAchievementInterface()->HandleAchievementCriteriaLevelUp( _player->getLevel() ); // Retroactive: Bank slots: broken atm :( //_player->GetAchievementInterface()->HandleAchievementCriteriaBuyBankSlot(true); // Send achievement data! if( _player->GetAchievementInterface()->HasAchievements() ) { WorldPacket * data = _player->GetAchievementInterface()->BuildAchievementData(); _player->CopyAndSendDelayedPacket(data); delete data; } SendAccountDataTimes(GLOBAL_CACHE_MASK); if(enter_world && !_player->GetMapMgr()) plr->AddToWorld(); objmgr.AddPlayer(_player); }
void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) { ObjectGuid playerGuid = holder->GetGuid(); Player* pCurrChar = new Player(this); pCurrChar->GetMotionMaster()->Initialize(); // "GetAccountId()==db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools) if (!pCurrChar->LoadFromDB(playerGuid, holder)) { KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick delete pCurrChar; // delete it manually delete holder; // delete all unprocessed queries m_playerLoading = false; return; } SetPlayer(pCurrChar); WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20); data << pCurrChar->GetMapId(); data << pCurrChar->GetPositionX(); data << pCurrChar->GetPositionY(); data << pCurrChar->GetPositionZ(); data << pCurrChar->GetOrientation(); SendPacket(&data); // load player specific part before send times LoadAccountData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA), PER_CHARACTER_CACHE_MASK); SendAccountDataTimes(PER_CHARACTER_CACHE_MASK); data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0 data << uint8(2); // unknown value data << uint8(0); // enable(1)/disable(0) voice chat interface in client SendPacket(&data); // Send MOTD { data.Initialize(SMSG_MOTD, 50); // new in 2.0.1 data << (uint32)0; uint32 linecount = 0; std::string str_motd = sWorld.GetMotd(); std::string::size_type pos, nextpos; pos = 0; while ((nextpos = str_motd.find('@', pos)) != std::string::npos) { if (nextpos != pos) { data << str_motd.substr(pos, nextpos - pos); ++linecount; } pos = nextpos + 1; } if (pos < str_motd.length()) { data << str_motd.substr(pos); ++linecount; } data.put(0, linecount); SendPacket(&data); DEBUG_LOG("WORLD: Sent motd (SMSG_MOTD)"); } // QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow()); QueryResult* resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD); if (resultGuild) { Field* fields = resultGuild->Fetch(); pCurrChar->SetInGuild(fields[0].GetUInt32()); pCurrChar->SetRank(fields[1].GetUInt32()); delete resultGuild; } else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about nonexistent membership { pCurrChar->SetInGuild(0); pCurrChar->SetRank(0); } if (pCurrChar->GetGuildId() != 0) { Guild* guild = sGuildMgr.GetGuildById(pCurrChar->GetGuildId()); if (guild) { data.Initialize(SMSG_GUILD_EVENT, (1 + 1 + guild->GetMOTD().size() + 1)); data << uint8(GE_MOTD); data << uint8(1); data << guild->GetMOTD(); SendPacket(&data); DEBUG_LOG("WORLD: Sent guild-motd (SMSG_GUILD_EVENT)"); guild->BroadcastEvent(GE_SIGNED_ON, pCurrChar->GetObjectGuid(), pCurrChar->GetName()); } else { // remove wrong guild data sLog.outError("Player %s (GUID: %u) marked as member of nonexistent guild (id: %u), removing guild membership for player.", pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId()); pCurrChar->SetInGuild(0); } } data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4 + 4); data << uint32(0); data << uint32(0); SendPacket(&data); pCurrChar->SendInitialPacketsBeforeAddToMap(); // Show cinematic at the first time that player login if (!pCurrChar->getCinematic()) pCurrChar->setCinematic(1); AreaLockStatus lockStatus = pCurrChar->GetAreaTriggerLockStatus(sObjectMgr.GetMapEntranceTrigger(pCurrChar->GetMapId())); if (lockStatus != AREA_LOCKSTATUS_OK || !pCurrChar->GetMap()->Add(pCurrChar)) { // normal delayed teleport protection not applied (and this correct) for this case (Player object just created) AreaTrigger const* at = sObjectMgr.GetGoBackTrigger(pCurrChar->GetMapId()); // TODO Send something to client? if (!at || !pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation())) pCurrChar->TeleportToHomebind(); } sObjectAccessor.AddObject(pCurrChar); // DEBUG_LOG("Player %s added to Map.",pCurrChar->GetName()); pCurrChar->SendInitialPacketsAfterAddToMap(); static SqlStatementID updChars; SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 1 WHERE guid = ?"); stmt.PExecute(pCurrChar->GetGUIDLow()); // don't update active realm if is playerbot if (pCurrChar->GetSession()->GetRemoteAddress() != "bot") { static SqlStatementID updAccount; stmt = LoginDatabase.CreateStatement(updAccount, "UPDATE account SET active_realm_id = ? WHERE id = ?"); stmt.PExecute(sWorld.getConfig(CONFIG_UINT32_REALMID), GetAccountId()); } pCurrChar->SetInGameTime(WorldTimer::getMSTime()); // announce group about member online (must be after add to player list to receive announce to self) if (Group* group = pCurrChar->GetGroup()) group->SendUpdate(); // friend status sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetObjectGuid(), true); // Place character in world (and load zone) before some object loading pCurrChar->LoadCorpse(); // setting Ghost+speed if dead if (pCurrChar->m_deathState != ALIVE) { // not blizz like, we must correctly save and load player instead... if (pCurrChar->getRace() == RACE_NIGHTELF) pCurrChar->CastSpell(pCurrChar, 20584, true); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form) pCurrChar->CastSpell(pCurrChar, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) pCurrChar->SetWaterWalk(true); } pCurrChar->ContinueTaxiFlight(); // reset for all pets before pet loading if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS)) Pet::resetTalentsForAllPetsOf(pCurrChar); // Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned) pCurrChar->LoadPet(); // Set FFA PvP for non GM in non-rest mode if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) pCurrChar->SetFFAPvP(true); if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) pCurrChar->SetContestedPvP(); // Apply at_login requests if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS)) { pCurrChar->resetSpells(); SendNotification(LANG_RESET_SPELLS); } if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TALENTS)) { pCurrChar->resetTalents(true); pCurrChar->SendTalentsInfoData(); // original talents send already in to SendInitialPacketsBeforeAddToMap, resend reset state SendNotification(LANG_RESET_TALENTS); // we can use SMSG_TALENTS_INVOLUNTARILY_RESET here } if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST)) pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST); // show time before shutdown if shutdown planned. if (sWorld.IsShutdowning()) sWorld.ShutdownMsg(true, pCurrChar); if (sWorld.getConfig(CONFIG_BOOL_ALL_TAXI_PATHS)) pCurrChar->SetTaxiCheater(true); if (pCurrChar->isGameMaster()) SendNotification(LANG_GM_ON); if (!pCurrChar->isGMVisible()) { SendNotification(LANG_INVISIBLE_INVISIBLE); SpellEntry const* invisibleAuraInfo = sSpellStore.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); if (invisibleAuraInfo && IsSpellAppliesAura(invisibleAuraInfo)) pCurrChar->CastSpell(pCurrChar, invisibleAuraInfo, true); } std::string IP_str = GetRemoteAddress(); sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow()); if (!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); m_playerLoading = false; delete holder; }
void WorldSession::FullLogin(Player* plr) { Log.Debug("WorldSession", "Fully loading player %u", plr->GetLowGUID()); SetPlayer(plr); m_MoverWoWGuid.Init(plr->GetGUID()); MapMgr* mgr = sInstanceMgr.GetInstance(plr); if (mgr && mgr->m_battleground) { // Don't allow player to login into a bg that has ended or is full if (mgr->m_battleground->HasEnded() || mgr->m_battleground->HasFreeSlots(plr->GetTeamInitial(), mgr->m_battleground->GetType() == false)) mgr = NULL; } // Trying to log to an instance that doesn't exists anymore? if (!mgr) { if (!IS_INSTANCE(plr->m_bgEntryPointMap)) { plr->m_position.x = plr->m_bgEntryPointX; plr->m_position.y = plr->m_bgEntryPointY; plr->m_position.z = plr->m_bgEntryPointZ; plr->m_position.o = plr->m_bgEntryPointO; plr->m_mapId = plr->m_bgEntryPointMap; } else { plr->m_position.x = plr->GetBindPositionX(); plr->m_position.y = plr->GetBindPositionY(); plr->m_position.z = plr->GetBindPositionZ(); plr->m_position.o = 0; plr->m_mapId = plr->GetBindMapId(); } } // copy to movement array movement_packet[0] = m_MoverWoWGuid.GetNewGuidMask(); memcpy(&movement_packet[1], m_MoverWoWGuid.GetNewGuid(), m_MoverWoWGuid.GetNewGuidLen()); // world preload uint32 VMapId; float VO; float VX; float VY; float VZ; // GMs should start on GM Island and be bound there if (HasGMPermissions() && plr->m_FirstLogin && sWorld.gamemaster_startonGMIsland) { VMapId = 1; VO = 0; VX = 16222.6f; VY = 16265.9f; VZ = 14.2085f; plr->m_position.x = VX; plr->m_position.y = VY; plr->m_position.z = VZ; plr->m_position.o = VO; plr->m_mapId = VMapId; plr->SetBindPoint(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId(), plr->GetZoneId()); } else { VMapId = plr->GetMapId(); VO = plr->GetOrientation(); VX = plr->GetPositionX(); VY = plr->GetPositionY(); VZ = plr->GetPositionZ(); } plr->SendLoginVerifyWorld(VMapId, VX, VY, VZ, VO); /////////////////////////////////////////////////////////////////////////////////////////////////////// // send voicechat state - active/inactive // // {SERVER} Packet: (0x03C7) UNKNOWN PacketSize = 2 // |------------------------------------------------|----------------| // |00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF| // |------------------------------------------------|----------------| // |02 01 |.. | // ------------------------------------------------------------------- // // // Old packetdump is OLD. This is probably from 2.2.0 (that was the patch when it was added to wow)! // ////////////////////////////////////////////////////////////////////////////////////////////////////// StackWorldPacket<20> datab(SMSG_FEATURE_SYSTEM_STATUS); datab.Initialize(SMSG_FEATURE_SYSTEM_STATUS); datab << uint8(2); datab << uint8(0); SendPacket(&datab); WorldPacket dataldm(SMSG_LEARNED_DANCE_MOVES, 4 + 4); dataldm << uint32(0); dataldm << uint32(0); SendPacket(&dataldm); plr->UpdateAttackSpeed(); // Make sure our name exists (for premade system) PlayerInfo* info = objmgr.GetPlayerInfo(plr->GetLowGUID()); if (!info) { info = new PlayerInfo; info->class_ = plr->getClass(); info->gender = plr->getGender(); info->guid = plr->GetLowGUID(); info->name = strdup(plr->GetName()); info->lastLevel = plr->getLevel(); info->lastOnline = UNIXTIME; info->lastZone = plr->GetZoneId(); info->race = plr->getRace(); info->team = plr->GetTeam(); info->guild = NULL; info->guildRank = NULL; info->guildMember = NULL; info->m_Group = NULL; info->subGroup = 0; objmgr.AddPlayerInfo(info); } plr->m_playerInfo = info; if (plr->m_playerInfo->guild) { plr->SetGuildId(plr->m_playerInfo->guild->GetGuildId()); plr->SetGuildRank(plr->m_playerInfo->guildRank->iId); } info->m_loggedInPlayer = plr; // account data == UI config SendAccountDataTimes(PER_CHARACTER_CACHE_MASK); // Set TIME OF LOGIN CharacterDatabase.Execute("UPDATE characters SET online = 1 WHERE guid = %u", plr->GetLowGUID()); bool enter_world = true; // Find our transporter and add us if we're on one. if (plr->transporter_info.guid) { if (Transporter* pTrans = objmgr.GetTransporter(Arcemu::Util::GUID_LOPART(plr->transporter_info.guid))) { if (plr->IsDead()) { plr->ResurrectPlayer(); plr->SetHealth(plr->GetMaxHealth()); plr->SetPower(POWER_TYPE_MANA, plr->GetMaxPower(POWER_TYPE_MANA)); } float c_tposx = pTrans->GetPositionX() + plr->transporter_info.x; float c_tposy = pTrans->GetPositionY() + plr->transporter_info.y; float c_tposz = pTrans->GetPositionZ() + plr->transporter_info.z; if (plr->GetMapId() != pTrans->GetMapId()) // loaded wrong map { plr->SetMapId(pTrans->GetMapId()); StackWorldPacket<20> dataw(SMSG_NEW_WORLD); dataw << pTrans->GetMapId(); dataw << c_tposx; dataw << c_tposy; dataw << c_tposz; dataw << plr->GetOrientation(); SendPacket(&dataw); // shit is sent in worldport ack. enter_world = false; } plr->SetPosition(c_tposx, c_tposy, c_tposz, plr->GetOrientation(), false); plr->m_CurrentTransporter = pTrans; pTrans->AddPlayer(plr); } } Log.Debug("Login", "Player %s logged in.", plr->GetName()); sWorld.incrementPlayerCount(plr->GetTeam()); if (plr->m_FirstLogin) { if (PlayerCreateInfo* create_info = objmgr.GetPlayerCreateInfo(info->race, info->class_)) { uint32 introid = create_info->introid; OutPacket(SMSG_TRIGGER_CINEMATIC, 4, &introid); } if (sWorld.m_AdditionalFun) //cebernic: tells people who 's newbie :D { const int classtext[] = { 0, 5, 6, 8, 9, 11, 0, 4, 3, 7, 0, 10 }; sWorld.SendLocalizedWorldText(true, "{65}", classtext[(uint32)plr->getClass()], plr->GetName(), (plr->IsTeamHorde() ? "{63}" : "{64}")); } } LOG_DETAIL("WORLD: Created new player for existing players (%s)", plr->GetName()); // Login time, will be used for played time calc plr->m_playedtime[2] = uint32(UNIXTIME); //Issue a message telling all guild members that this player has signed on if (plr->IsInGuild()) { if (Guild* pGuild = plr->m_playerInfo->guild) { WorldPacket data(SMSG_GUILD_EVENT, 50); data << uint8(GUILD_EVENT_MOTD); data << uint8(1); if (pGuild->GetMOTD()) data << pGuild->GetMOTD(); else data << uint8(0); SendPacket(&data); pGuild->LogGuildEvent(GUILD_EVENT_HASCOMEONLINE, 1, plr->GetName()); } } // Send online status to people having this char in friendlist _player->Social_TellFriendsOnline(); // send friend list (for ignores) _player->Social_SendFriendList(7); plr->SendDungeonDifficulty(); plr->SendRaidDifficulty(); plr->SendEquipmentSetList(); #ifndef GM_TICKET_MY_MASTER_COMPATIBLE GM_Ticket* ticket = objmgr.GetGMTicketByPlayer(_player->GetGUID()); if (ticket != NULL) { //Send status change to gm_sync_channel Channel* chn = channelmgr.GetChannel(sWorld.getGmClientChannel().c_str(), _player); if (chn) { std::stringstream ss; ss << "GmTicket:" << GM_TICKET_CHAT_OPCODE_ONLINESTATE; ss << ":" << ticket->guid; ss << ":1"; chn->Say(_player, ss.str().c_str(), NULL, true); } } #endif // server Message Of The Day SendMOTD(); //Set current RestState if (plr->m_isResting) // We are resting at an inn , turn on Zzz plr->ApplyPlayerRestState(true); //Calculate rest bonus if there is time between lastlogoff and now if (plr->m_timeLogoff > 0 && plr->getLevel() < plr->GetMaxLevel()) // if timelogoff = 0 then it's the first login { uint32 currenttime = uint32(UNIXTIME); uint32 timediff = currenttime - plr->m_timeLogoff; //Calculate rest bonus if (timediff > 0) plr->AddCalculatedRestXP(timediff); } if (info->m_Group) info->m_Group->Update(); if (enter_world && !_player->GetMapMgr()) plr->AddToWorld(); sHookInterface.OnFullLogin(_player); objmgr.AddPlayer(_player); }