bool ClientListEntry::CheckStale() { stale++; if (stale > 20) { if (pOnline > CLE_Status_Offline) SetOnline(CLE_Status_Offline); else return true; } return false; }
void ClientListEntry::LeavingZone(ZoneServer* iZS, int8 iOnline) { if (iZS != 0 && iZS != pzoneserver) return; SetOnline(iOnline); if (pzoneserver){ pzoneserver->RemovePlayer(); LSUpdate(pzoneserver); } pzoneserver = 0; pzone = 0; }
void ClientListEntry::Update(ZoneServer* iZS, ServerClientList_Struct* scl, int8 iOnline) { if (pzoneserver != iZS) { if (pzoneserver){ pzoneserver->RemovePlayer(); LSUpdate(pzoneserver); } if (iZS){ iZS->AddPlayer(); LSUpdate(iZS); } } pzoneserver = iZS; pzone = scl->zone; pinstance = scl->instance_id; pcharid = scl->charid; strcpy(pname, scl->name); if (paccountid == 0) { paccountid = scl->AccountID; strcpy(paccountname, scl->AccountName); strcpy(plsname, scl->AccountName); pIP = scl->IP; pLSID = scl->LSAccountID; strn0cpy(plskey, scl->lskey, sizeof(plskey)); } padmin = scl->Admin; plevel = scl->level; pclass_ = scl->class_; prace = scl->race; panon = scl->anon; ptellsoff = scl->tellsoff; pguild_id = scl->guild_id; pLFG = scl->LFG; gm = scl->gm; pClientVersion = scl->ClientVersion; // Fields from the LFG Window if((scl->LFGFromLevel != 0) && (scl->LFGToLevel != 0)) { pLFGFromLevel = scl->LFGFromLevel; pLFGToLevel = scl->LFGToLevel; pLFGMatchFilter = scl->LFGMatchFilter; memcpy(pLFGComments, scl->LFGComments, sizeof(pLFGComments)); } SetOnline(iOnline); }
bool CMOOSNavTopDownCalEngine::OnStart() { //start with a clean slate... m_pStore->Flush(); if(m_nSelectedChan==-1) { AddToOutput("TDC: no focus channel specified"); return false; } //the minute we start we are gathering data... SetState(GATHERING); SetOnline(true); return true; }
bool CMOOSNavTopDownCalEngine::OnRxTopDownControl(string sInstruction) { MOOSToUpper(sInstruction); if(MOOSStrCmp(sInstruction,"STOP")) { SetOnline(false); SetState(OFFLINE); return true; } else if(MOOSStrCmp(sInstruction,"START")) { OnStart(); return true; } else if(MOOSStrCmp(sInstruction,"CALCULATE")) { //ok try and calculate now.... return Calculate(MOOSTime()); } else if(sInstruction.find("FOCUS")!=string::npos) { MOOSChomp(sInstruction,"="); int nNew = atoi(sInstruction.c_str()); if(nNew!=0) { m_nActiveChannel = nNew; AddToOutput("Manual set of TDC focus to channel %d",nNew); SetFocus(nNew); } } else { AddToOutput("Unknown top down cal control command"); return false; } return true; }
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList_Struct* scl, int8 iOnline) : id(in_id) { ClearVars(true); pIP = 0; pLSID = scl->LSAccountID; strn0cpy(plsname, scl->name, sizeof(plsname)); strn0cpy(plskey, scl->lskey, sizeof(plskey)); pworldadmin = 0; paccountid = scl->AccountID; strn0cpy(paccountname, scl->AccountName, sizeof(paccountname)); padmin = scl->Admin; pinstance = 0; if (iOnline >= CLE_Status_Zoning) Update(iZS, scl, iOnline); else SetOnline(iOnline); }
void WorldSession::HandlePlayerReconnect() { // stop logout timer if need LogoutRequest(0); // set loading flag m_playerLoading = true; // reset all visible objects to be able to resend them _player->m_clientGUIDs.clear(); SetOnline(); WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20); data << _player->GetMapId(); data << _player->GetPositionX(); data << _player->GetPositionY(); data << _player->GetPositionZ(); data << _player->GetOrientation(); SendPacket(data); data.Initialize(SMSG_ACCOUNT_DATA_TIMES, 128); for (int i = 0; i < 32; ++i) data << uint32(0); SendPacket(data); // Send Spam records SendExpectedSpamRecords(); SendMotd(_player); if (_player->GetGuildId() != 0) { Guild* guild = sGuildMgr.GetGuildById(_player->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, _player->GetObjectGuid(), _player->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.", _player->GetName(), _player->GetGUIDLow(), _player->GetGuildId()); _player->SetInGuild(0); } } if (!_player->isAlive()) _player->SendCorpseReclaimDelay(true); _player->SendInitialPacketsBeforeAddToMap(); _player->GetMap()->CreatePlayerOnClient(_player); _player->GetSocial()->SendFriendList(); _player->GetSocial()->SendIgnoreList(); _player->SendInitWorldStates(_player->GetZoneId()); _player->CastSpell(_player, 836, TRIGGERED_OLD_TRIGGERED); // LOGINEFFECT _player->SendEnchantmentDurations(); // must be after add to map _player->SendItemDurations(); // must be after add to map // announce group about member online (must be after add to player list to receive announce to self) if (Group* group = _player->GetGroup()) group->UpdatePlayerOnlineStatus(_player); // friend status sSocialMgr.SendFriendStatus(_player, FRIEND_ONLINE, _player->GetObjectGuid(), true); // show time before shutdown if shutdown planned. if (sWorld.IsShutdowning()) sWorld.ShutdownMsg(true, _player); if (sWorld.getConfig(CONFIG_BOOL_ALL_TAXI_PATHS)) _player->SetTaxiCheater(true); if (_player->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(), _player->GetName(), _player->GetGUIDLow()); // sync client auras timer _player->UpdateClientAuras(); // sync client control (if taxi flying the client is already sync) if (_player->IsTaxiFlying()) _player->TaxiFlightResume(true); else if (!_player->IsClientControlled(_player)) _player->UpdateClientControl(_player, false); // initialize client pet bar if need _player->SendPetBar(); // send mirror timers _player->SendMirrorTimers(true); m_playerLoading = false; }
void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) { ObjectGuid playerGuid = holder->GetGuid(); Player* pCurrChar = new Player(this); pCurrChar->GetMotionMaster()->Initialize(); SetPlayer(pCurrChar); m_playerLoading = true; SetOnline(); // "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; sLog.outError("HandlePlayerLogin> LoadFromDB failed to load %s, AccountId = %u", pCurrChar->GetGuidStr().c_str(), GetAccountId()); WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); data << (uint8)CHAR_LOGIN_NO_CHARACTER; SendPacket(data, true); return; } WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20); data << pCurrChar->GetMapId(); data << pCurrChar->GetPositionX(); data << pCurrChar->GetPositionY(); data << pCurrChar->GetPositionZ(); data << pCurrChar->GetOrientation(); SendPacket(data); data.Initialize(SMSG_ACCOUNT_DATA_TIMES, 128); for (int i = 0; i < 32; ++i) data << uint32(0); SendPacket(data); // Send Spam records SendExpectedSpamRecords(); SendMotd(pCurrChar); // 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); } } if (!pCurrChar->isAlive()) pCurrChar->SendCorpseReclaimDelay(true); pCurrChar->SendInitialPacketsBeforeAddToMap(); // Show cinematic at the first time that player login if (!pCurrChar->getCinematic()) { pCurrChar->setCinematic(1); if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace())) pCurrChar->SendCinematicStart(rEntry->CinematicSequence); } uint32 miscRequirement = 0; AreaLockStatus lockStatus = AREA_LOCKSTATUS_OK; if (AreaTrigger const* at = sObjectMgr.GetMapEntranceTrigger(pCurrChar->GetMapId())) lockStatus = pCurrChar->GetAreaTriggerLockStatus(at, miscRequirement); else { // Some basic checks in case of a map without areatrigger MapEntry const* mapEntry = sMapStore.LookupEntry(pCurrChar->GetMapId()); if (!mapEntry) lockStatus = AREA_LOCKSTATUS_UNKNOWN_ERROR; } 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()); if (at) lockStatus = pCurrChar->GetAreaTriggerLockStatus(at, miscRequirement); if (!at || lockStatus != AREA_LOCKSTATUS_OK || !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->GetSocial()->SendFriendList(); pCurrChar->GetSocial()->SendIgnoreList(); pCurrChar->SendInitialPacketsAfterAddToMap(); static SqlStatementID updChars; static SqlStatementID updAccount; SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 1 WHERE guid = ?"); stmt.PExecute(pCurrChar->GetGUIDLow()); stmt = LoginDatabase.CreateStatement(updAccount, "UPDATE account SET active_realm_id = ? WHERE id = ?"); stmt.PExecute(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->UpdatePlayerOnlineStatus(pCurrChar); // 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, TRIGGERED_OLD_TRIGGERED); // 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, TRIGGERED_OLD_TRIGGERED); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?) pCurrChar->SetWaterWalk(true); } pCurrChar->TaxiFlightResume(); // 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->SetPvPFreeForAll(true); if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) pCurrChar->UpdatePvPContested(true); // 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); SendNotification(LANG_RESET_TALENTS); // we can use SMSG_TALENTS_INVOLUNTARILY_RESET here } if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_TAXINODES)) { pCurrChar->InitTaxiNodes(); pCurrChar->RemoveAtLoginFlag(AT_LOGIN_RESET_TAXINODES, true); SendNotification("Your taxi nodes have been reset."); } 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 = sSpellTemplate.LookupEntry<SpellEntry>(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA)); if (invisibleAuraInfo && IsSpellAppliesAura(invisibleAuraInfo)) pCurrChar->CastSpell(pCurrChar, invisibleAuraInfo, TRIGGERED_OLD_TRIGGERED); } 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 ClientListEntry::SetOnline(ZoneServer* iZS, int8 iOnline) { if (iZS == this->Server()) SetOnline(iOnline); }
bool CMOOSNavEngine::Initialise(STRING_LIST sParams) { //make a store for observations.. m_pStore = new CMOOSNavObsStore; //we may be being asked to map thrust to velocity string sVal; if(MOOSGetValueFromToken(sParams,"THRUST2VELOCITY",sVal)) { if(MOOSStrCmp(sVal,"TRUE")) { if(MOOSGetValueFromToken(sParams,"THRUST2VELOCITY_GAIN",sVal)) { m_bThrust2Vel = true; m_dfThrust2VelGain = atof(sVal.c_str()); } } } if(MOOSGetValueFromToken(sParams,"SV",sVal)) { double dfNewSV = atof(sVal.c_str()); if(dfNewSV !=0) { m_dfSV=dfNewSV; } } //set up navigation filter logging.... bool bLog = false; if(MOOSGetValueFromToken(sParams,"NAV_LOG",sVal)) { bLog = MOOSStrCmp(sVal,"TRUE"); } if(bLog) { string sPath=""; //do we have a globally defined path? CProcessConfigReader Reader; Reader.SetFile(m_sMissionFileName); if(!Reader.GetValue("GLOBALLOGPATH",sPath)) { //no..get it locally MOOSGetValueFromToken(sParams,"NAV_LOG_PATH",sPath); } bool bTimeStamp=false; if(MOOSGetValueFromToken(sParams,"NAV_LOG_TIMESTAMP",sVal)) { bTimeStamp = MOOSStrCmp(sVal,"TRUE"); } m_Logger.Initialise(m_sName,sPath,bTimeStamp); } //Allocate Global states.. SetUpGlobalStates(); AddTheVehicle(sParams); //fixed observations are attached to the COG... AddSensor("FIXED","COG", CMOOSNavSensor::FIXED,0,0,0); //set our default start up state... //set in constructor of derived classes SetOnline(m_bInitialOnline); return true; }