void data_dpt::dp_analysis( const datat& read, bool local_read, const datat& write, bool local_write) { const_iterator it; for(it=begin(); it!=end(); ++it) { if(local_read && it->id==read.id) { insert(datat(write.id, (local_write?source_locationt():write.loc), it->eq_class)); continue; } if(local_write && it->id==write.id) { insert(datat(read.id, (local_read?source_locationt():read.loc), it->eq_class)); continue; } } if(it==end()) { ++class_nb; insert(datat(read.id, (local_read?source_locationt():read.loc), class_nb)); insert(datat(write.id, (local_write?source_locationt():write.loc), class_nb)); } }
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 plr->movement_packet[0] = m_MoverWoWGuid.GetNewGuidMask(); memcpy(&plr->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 datac(MSG_SET_RAID_DIFFICULTY, 20); datac << plr->iRaidType; datac << uint32(0x01); datac << uint32(0x00); SendPacket(&datac); // Send first line of MOTD WorldPacket datat(SMSG_MOTD, sizeof(sWorld.GetMotd()) + 4); 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 |.. | // ------------------------------------------------------------------- // // // Old packetdump is OLD. This is probably from 2.2.0 (that was the patch when it was added to wow)! // ////////////////////////////////////////////////////////////////////////////////////////////////////// plr->UpdateAttackSpeed(); // Make sure our name exists (for premade system) PlayerInfo * info = objmgr.GetPlayerInfo(plr->GetLowGUID()); if(info == NULL) { 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 if(sWorld.m_useAccountData) { WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4); MD5Hash md5hash; data << uint32(UNIXTIME) << uint8(1) << uint32(0xEA); for (int i = 0; i < 8; i++) { AccountDataEntry* acct_data = GetAccountData(i); if(0xEA & (1 << i)) data << uint32(acct_data->Time); md5hash.Initialize(); md5hash.UpdateData((const uint8*)acct_data->data, acct_data->sz); md5hash.Finalize(); } SendPacket(&data); } else { WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4); MD5Hash md5hash; data << uint32(UNIXTIME) << uint8(1) << uint32(0xEA); for (int i = 0; i < 8; i++) { if(0xEA & (1 << i)) data << uint32(0); AccountDataEntry* acct_data = GetAccountData(i); if(acct_data) { md5hash.Initialize(); md5hash.UpdateData((const uint8*)acct_data->data, acct_data->sz); md5hash.Finalize(); } } SendPacket(&data); } // Set TIME OF LOGIN CharacterDatabase.Execute("UPDATE characters SET online = 1 WHERE guid = %u" , plr->GetLowGUID()); _player->ResetTitansGrip(); 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_transportPosition->x; float c_tposy = pTrans->GetPositionY() + plr->m_transportPosition->y; float c_tposz = pTrans->GetPositionZ() + plr->m_transportPosition->z; 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 if(plr->m_CurrentVehicle) plr->m_CurrentVehicle->RemovePassenger(plr); 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("Core server: ArcEmu %s r%u/%s-Windows-%s (www.github.com/ArcEmudev)", MSG_COLOR_WHITE, BUILD_TAG, BUILD_REVISION, CONFIG, ARCH, MSG_COLOR_LIGHTBLUE); #else // _player->BroadcastMessage("Core server: ArcEmu %s r%u/%s-%s (www.github.com/ArcEmudev)", MSG_COLOR_WHITE, BUILD_TAG, BUILD_REVISION, PLATFORM_TEXT, ARCH, MSG_COLOR_LIGHTBLUE); #endif // Bugs _player->BroadcastMessage("Bugs: %s%s", MSG_COLOR_LIGHTBLUE, BUG_TRACKER); 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, "%s %s (%s) is now online.", CanUseCommand('z') ? "Admin" : "GameMaster", _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 if(plr->getLevel() > 10 && !GetPermissions()) { // Retroactive: Level achievement _player->GetAchievementInterface()->HandleAchievementCriteriaLevelUp( _player->getLevel() ); // Send achievement data! if( _player->GetAchievementInterface()->HasAchievements() ) { WorldPacket * data = _player->GetAchievementInterface()->BuildAchievementData(); _player->CopyAndSendDelayedPacket(data); delete data; } } if(enter_world && !_player->GetMapMgr()) plr->AddToWorld(); objmgr.AddPlayer(_player); }
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::FullLogin(Player* plr) { DEBUG_LOG("WorldSession", "Fully loading player %u", plr->GetLowGUID()); SetPlayer(plr); m_MoverWoWGuid.Init(plr->GetGUID()); // copy to movement array plr->movement_packet[0] = m_MoverWoWGuid.GetNewGuidMask(); memcpy(&plr->movement_packet[1], m_MoverWoWGuid.GetNewGuid(), m_MoverWoWGuid.GetNewGuidLen()); /* 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 |.. | ------------------------------------------------------------------- */ WorldPacket datab; datab.Initialize(SMSG_FEATURE_SYSTEM_STATUS); datab << uint8(2) << uint8(0); SendPacket(&datab); datab.Initialize(SMSG_LEARNED_DANCE_MOVES); datab << uint32(0); datab << uint32(0); SendPacket(&datab); plr->UpdateAttackSpeed(); // Anti max level hack. if(sWorld.LevelCap_Custom_All && (plr->getLevel() > sWorld.LevelCap_Custom_All)) plr->SetUInt32Value(UNIT_FIELD_LEVEL, sWorld.LevelCap_Custom_All); // Enable certain GM abilities on login. if(HasGMPermissions()) { plr->bGMTagOn = true; plr->m_isGmInvisible = true; plr->m_invisible = true; if(CanUseCommand('z')) { plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_DEVELOPER); plr->triggerpass_cheat = true; // Enable for admins automatically. } else plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM); } // Make sure our name exists (for premade system) PlayerInfo * info = objmgr.GetPlayerInfo(plr->GetLowGUID()); if(info == NULL) { 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(plr->m_playerInfo->arenaTeam[z] != NULL) { plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (z*6), plr->m_playerInfo->arenaTeam[z]->m_id); if(plr->m_playerInfo->arenaTeam[z]->m_leader == plr->GetLowGUID()) plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (z*6) + 1, 0); else plr->SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (z*6) + 1, 1); } } info->m_loggedInPlayer = plr; // account data == UI config if(sWorld.m_useAccountData) { WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4); MD5Hash md5hash; data << uint32(UNIXTIME) << uint8(1) << uint32(0xEA); for (int i = 0; i < 8; i++) { AccountDataEntry* acct_data = GetAccountData(i); if(0xEA & (1 << i)) data << uint32(acct_data->Time); md5hash.Initialize(); md5hash.UpdateData((const uint8*)acct_data->data, acct_data->sz); md5hash.Finalize(); } SendPacket(&data); } else { WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4+1+4+8*4); MD5Hash md5hash; data << uint32(UNIXTIME) << uint8(1) << uint32(0xEA); for (int i = 0; i < 8; i++) { if(0xEA & (1 << i)) data << uint32(0); AccountDataEntry* acct_data = GetAccountData(i); if(acct_data) { md5hash.Initialize(); md5hash.UpdateData((const uint8*)acct_data->data, acct_data->sz); md5hash.Finalize(); } } SendPacket(&data); } // 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_transportPosition->x; float c_tposy = pTrans->GetPositionY() + plr->m_transportPosition->y; float c_tposz = pTrans->GetPositionZ() + plr->m_transportPosition->z; 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 if(plr->GetVehicle()) plr->GetVehicle()->RemovePassenger(plr); DEBUG_LOG( "WorldSession","Player %s logged in.", plr->GetName()); if(plr->GetTeam() == 1) sWorld.HordePlayers++; else sWorld.AlliancePlayers++; if(sWorld.SendMovieOnJoin && plr->m_FirstLogin && !HasGMPermissions()) plr->SendCinematic(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(SMSG_GUILD_EVENT, 50); 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()) plr->Social_TellFriendsOnline(); // send friend list (for ignores) plr->Social_SendFriendList(7); // Send revision plr->BroadcastMessage("%sServer:|r%s Sandshroud Hearthstone|r %s r%u-%s-%s", MSG_COLOR_GOLD, MSG_COLOR_ORANGEY, MSG_COLOR_TORQUISEBLUE, BUILD_REVISION, ARCH, CONFIG); plr->BroadcastMessage("%sPlease report all bugs to |r%shttp://mantis.sandshroud.org|r", MSG_COLOR_GOLD, MSG_COLOR_TORQUISEBLUE); plr->BroadcastMessage("%sOnline Players:|r%s %u |r%sPeak:|r%s %u |r%sAccepted Connections:|r%s %u |r", MSG_COLOR_GOLD, MSG_COLOR_TORQUISEBLUE, sWorld.GetSessionCount(), MSG_COLOR_GOLD, MSG_COLOR_TORQUISEBLUE, sWorld.PeakSessionCount, MSG_COLOR_GOLD, MSG_COLOR_TORQUISEBLUE, sWorld.mAcceptedConnections); plr->BroadcastMessage("%sServer Uptime:|r%s %s|r", MSG_COLOR_GOLD, MSG_COLOR_TORQUISEBLUE, sWorld.GetUptimeString().c_str()); // send to gms if(HasGMPermissions()) sWorld.SendMessageToGMs(this, "%s%s %s (%s) is now online.|r", MSG_COLOR_GOLD, CanUseCommand('z') ? "Admin" : "GameMaster", plr->GetName(), GetAccountNameS(), GetPermissions()); // Send first line of MOTD WorldPacket datat(SMSG_MOTD, 10); datat << uint32(0x04); datat << sWorld.GetMotd(); SendPacket(&datat); // Send second line of MOTD WorldPacket datat2(SMSG_MOTD, 10); datat2 << uint32(0x04); datat2 << sWorld.GetMotd2(); SendPacket(&datat2); //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.OnFullLogin(plr); if(info->m_Group) info->m_Group->Update(); if(!sWorld.m_blockgmachievements || !HasGMPermissions()) { // Retroactive: Level achievement plr->GetAchievementInterface()->HandleAchievementCriteriaLevelUp( plr->getLevel() ); // Send achievement data! if( plr->GetAchievementInterface()->HasAchievements() ) { WorldPacket * data = plr->GetAchievementInterface()->BuildAchievementData(); plr->CopyAndSendDelayedPacket(data); delete data; } } if(enter_world && !plr->GetMapMgr()) plr->AddToWorld(true); sTracker.CheckPlayerForTracker(plr, true); // If we have the talent, it returns anyway, so just call the function. plr->ResetTitansGrip(); if(plr->GetItemInterface()) plr->GetItemInterface()->CheckAreaItems(); objmgr.AddPlayer(plr); }
void ThermalCalibrationHelper::calculate() { // baro int count = m_baroSamples.count(); Eigen::VectorXf datax(count); Eigen::VectorXf datay(1); Eigen::VectorXf dataz(1); Eigen::VectorXf datat(count); for (int x = 0; x < count; x++) { datax[x] = m_baroSamples[x].Pressure; datat[x] = m_baroSamples[x].Temperature; } m_results.baroCalibrated = ThermalCalibration::BarometerCalibration(datax, datat, m_results.baro, &m_results.baroInSigma, &m_results.baroOutSigma); if (m_results.baroCalibrated) { addInstructions(tr("Barometer is calibrated.")); } else { qDebug() << "Failed to calibrate baro!"; addInstructions(tr("Failed to calibrate barometer!"), WizardModel::Warn); } m_results.baroTempMin = datat.array().minCoeff(); m_results.baroTempMax = datat.array().maxCoeff(); // gyro count = m_gyroSamples.count(); datax.resize(count); datay.resize(count); dataz.resize(count); datat.resize(count); for (int x = 0; x < count; x++) { datax[x] = m_gyroSamples[x].x; datay[x] = m_gyroSamples[x].y; dataz[x] = m_gyroSamples[x].z; datat[x] = m_gyroSamples[x].temperature; } m_results.gyroCalibrated = ThermalCalibration::GyroscopeCalibration(datax, datay, dataz, datat, m_results.gyro, m_results.gyroBias, m_results.gyroInSigma, m_results.gyroOutSigma); if (m_results.gyroCalibrated) { addInstructions(tr("Gyro is calibrated.")); } else { qDebug() << "Failed to calibrate gyro!"; addInstructions(tr("Failed to calibrate gyro!"), WizardModel::Warn); } // accel m_results.accelGyroTempMin = datat.array().minCoeff(); m_results.accelGyroTempMax = datat.array().maxCoeff(); // TODO: sanity checks needs to be enforced before accel calibration can be enabled and usable. /* count = m_accelSamples.count(); datax.resize(count); datay.resize(count); dataz.resize(count); datat.resize(count); for(int x = 0; x < count; x++){ datax[x] = m_accelSamples[x].x; datay[x] = m_accelSamples[x].y; dataz[x] = m_accelSamples[x].z; datat[x] = m_accelSamples[x].temperature; } m_results.accelCalibrated = ThermalCalibration::AccelerometerCalibration(datax, datay, dataz, datat, m_results.accel); */ m_results.accelCalibrated = false; QString str = QStringLiteral("INFO::Calibration results") + "\n"; str += QStringLiteral("INFO::Baro cal {%1, %2, %3, %4}; initial variance: %5; Calibrated variance %6") .arg(m_results.baro[0]).arg(m_results.baro[1]).arg(m_results.baro[2]).arg(m_results.baro[3]) .arg(m_results.baroInSigma).arg(m_results.baroOutSigma) + "\n"; str += QStringLiteral("INFO::Gyro cal x{%1, %2, %3} y{%4, %5, %6} z{%7, %8, %9}; initial variance: {%10, %11, %12}; Calibrated variance {%13, %14, %15}") .arg(m_results.gyroBias[0]).arg(m_results.gyro[0]).arg(m_results.gyro[1]) .arg(m_results.gyroBias[1]).arg(m_results.gyro[2]).arg(m_results.gyro[3]) .arg(m_results.gyroBias[2]).arg(m_results.gyro[4]).arg(m_results.gyro[5]) .arg(m_results.gyroInSigma[0]).arg(m_results.gyroInSigma[1]).arg(m_results.gyroInSigma[2]) .arg(m_results.gyroOutSigma[0]).arg(m_results.gyroOutSigma[1]).arg(m_results.gyroOutSigma[2]) + "\n"; str += QStringLiteral("INFO::Accel cal x{%1} y{%2} z{%3}; initial variance: {%4, %5, %6}; Calibrated variance {%7, %8, %9}") .arg(m_results.accel[0]).arg(m_results.accel[1]).arg(m_results.accel[2]) .arg(m_results.accelInSigma[0]).arg(m_results.accelInSigma[1]).arg(m_results.accelInSigma[2]) .arg(m_results.accelOutSigma[0]).arg(m_results.accelOutSigma[1]).arg(m_results.accelOutSigma[2]) + "\n"; qDebug() << str; m_debugStream << str; emit calculationCompleted(); closeDebugLog(); }