void CParty::DisbandParty(bool playerInitiated, Sql_t* sql) { DisableSync(); SetQuarterMaster(NULL); m_PLeader = NULL; m_PAlliance = NULL; if (m_PartyType == PARTY_PCS) { PushPacket(NULL, 0, new CPartyDefinePacket(NULL)); for (uint8 i = 0; i < members.size(); ++i) { CCharEntity* PChar = (CCharEntity*)members.at(i); PChar->PParty = NULL; PChar->PLatentEffectContainer->CheckLatentsPartyJobs(); PChar->PLatentEffectContainer->CheckLatentsPartyMembers(members.size()); PChar->PLatentEffectContainer->CheckLatentsPartyAvatar(); PChar->pushPacket(new CPartyMemberUpdatePacket(PChar, 0, PChar->getZone())); // TODO: TreasurePool должен оставаться у последнего персонажа, но сейчас это не критично if (PChar->PTreasurePool != NULL && PChar->PTreasurePool->GetPoolType() != TREASUREPOOL_ZONE) { PChar->PTreasurePool->DelMember(PChar); PChar->PTreasurePool = new CTreasurePool(TREASUREPOOL_SOLO); PChar->PTreasurePool->AddMember(PChar); PChar->PTreasurePool->UpdatePool(PChar); } CStatusEffect* sync = PChar->StatusEffectContainer->GetStatusEffect(EFFECT_LEVEL_SYNC); if (sync && sync->GetDuration() == 0) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 30, 553)); sync->SetStartTime(gettick()); sync->SetDuration(30000); } Sql_Query(sql, "DELETE FROM accounts_parties WHERE charid = %u;", PChar->id); } // make sure chat server isn't notified of a disband if this came from the chat server already if (playerInitiated) { uint8 data[4]; WBUFL(data, 0) = m_PartyID; message::send(MSG_PT_DISBAND, data, sizeof data, NULL); } } delete this; }
void LoadDefaultTabs () { InOut log (_T("LoadDefaultTabs")); CString lastFolder; DisableSync(); switch (gOptions.m_OnStart) { case ONSTART_NOTHING: break; case ONSTART_MYCOMP: OpenFolder (CONST_MYCOMPUTER); break; case ONSTART_LASTSAVED: for (unsigned int i = 0 ; i < gOptions.m_LastTabs.size (); i++) //if (IsDirectory (gOptions.m_LastTabs[i].m_Name)) { SureBackSlashEx (gOptions.m_LastTabs[i].m_Name); OpenFolder (gOptions.m_LastTabs[i].m_Name); lastFolder = gOptions.m_LastTabs[i].m_Name; } if (!gOptions.m_LastTabsActiveView.IsEmpty()) lastFolder = gOptions.m_LastTabsActiveView; break; case ONSTART_DEFAULT: for (unsigned int i = 0 ; i < gOptions.m_DefaultTabs.size (); i++) { SureBackSlashEx (gOptions.m_DefaultTabs[i].m_Name); OpenFolder (gOptions.m_DefaultTabs[i].m_Name); lastFolder = gOptions.m_DefaultTabs[i].m_Name; } break; } EnableSync(); if (!lastFolder.IsEmpty()) { SureBackSlashEx (lastFolder); OpenFolder (lastFolder); SyncUI (lastFolder); } }
void CParty::DisbandParty() { DisableSync(); SetQuaterMaster(NULL); m_PLeader = NULL; m_PAlliance = NULL; if (m_PartyType == PARTY_PCS) { PushPacket(NULL, 0, new CPartyDefinePacket(NULL)); for (uint8 i = 0; i < members.size(); ++i) { CCharEntity* PChar = (CCharEntity*)members.at(i); PChar->PParty = NULL; PChar->PLatentEffectContainer->CheckLatentsPartyJobs(); PChar->PLatentEffectContainer->CheckLatentsPartyMembers(members.size()); PChar->PLatentEffectContainer->CheckLatentsPartyAvatar(); PChar->pushPacket(new CPartyMemberUpdatePacket(PChar, 0, PChar->getZone())); // TODO: TreasurePool должен оставаться у последнего персонажа, но сейчас это не критично if (PChar->PTreasurePool != NULL && PChar->PTreasurePool->GetPoolType() != TREASUREPOOL_ZONE) { PChar->PTreasurePool->DelMember(PChar); PChar->PTreasurePool = new CTreasurePool(TREASUREPOOL_SOLO); PChar->PTreasurePool->AddMember(PChar); PChar->PTreasurePool->UpdatePool(PChar); } CStatusEffect* sync = PChar->StatusEffectContainer->GetStatusEffect(EFFECT_LEVEL_SYNC); if (sync && sync->GetDuration() == 0) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 30, 553)); sync->SetStartTime(gettick()); sync->SetDuration(30000); } } Sql_Query(SqlHandle,"UPDATE accounts_sessions SET partyid = %u WHERE partyid = %u", 0, m_PartyID); } delete this; }
void CParty::DelMember(CBattleEntity* PEntity) { DSP_DEBUG_BREAK_IF(PEntity == NULL); DSP_DEBUG_BREAK_IF(PEntity->PParty != this); if (m_PLeader == PEntity) { RemovePartyLeader(PEntity); } else { for (uint32 i = 0; i < members.size(); ++i) { if (PEntity == members.at(i)) { members.erase(members.begin() + i); if (m_PartyType == PARTY_PCS) { CCharEntity* PChar = (CCharEntity*)PEntity; if (m_PQuaterMaster == PChar) { SetQuarterMaster(NULL); } if (m_PSyncTarget == PChar) { SetSyncTarget(NULL, 553); CStatusEffect* sync = PChar->StatusEffectContainer->GetStatusEffect(EFFECT_LEVEL_SYNC); if (sync && sync->GetDuration() == 0) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 30, 553)); sync->SetStartTime(gettick()); sync->SetDuration(30000); } DisableSync(); } if (m_PSyncTarget != NULL && m_PSyncTarget != PChar) { if (PChar->status != STATUS_DISAPPEAR && PChar->getZone() == m_PSyncTarget->getZone()) { CStatusEffect* sync = PChar->StatusEffectContainer->GetStatusEffect(EFFECT_LEVEL_SYNC); if (sync && sync->GetDuration() == 0) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 30, 553)); sync->SetStartTime(gettick()); sync->SetDuration(30000); } } } PChar->PLatentEffectContainer->CheckLatentsPartyMembers(members.size()); PChar->pushPacket(new CPartyDefinePacket(NULL)); PChar->pushPacket(new CPartyMemberUpdatePacket(PChar, 0, PChar->getZone())); PChar->pushPacket(new CCharUpdatePacket(PChar)); PChar->PParty = NULL; if (PChar->PTreasurePool != NULL && PChar->PTreasurePool->GetPoolType() != TREASUREPOOL_ZONE) { PChar->PTreasurePool->DelMember(PChar); PChar->PTreasurePool = new CTreasurePool(TREASUREPOOL_SOLO); PChar->PTreasurePool->AddMember(PChar); PChar->PTreasurePool->UpdatePool(PChar); } } break; } } } }
void CParty::RemoveMember(CBattleEntity* PEntity) { DSP_DEBUG_BREAK_IF(PEntity == nullptr); DSP_DEBUG_BREAK_IF(PEntity->PParty != this); if (m_PLeader == PEntity) { RemovePartyLeader(PEntity); } else { for (uint32 i = 0; i < members.size(); ++i) { if (PEntity == members.at(i)) { members.erase(members.begin() + i); if (m_PartyType == PARTY_PCS) { CCharEntity* PChar = (CCharEntity*)PEntity; if (m_PQuaterMaster == PChar) { SetQuarterMaster(nullptr); } if (m_PSyncTarget == PChar) { SetSyncTarget(nullptr, 553); CStatusEffect* sync = PChar->StatusEffectContainer->GetStatusEffect(EFFECT_LEVEL_SYNC); if (sync && sync->GetDuration() == 0) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 30, 553)); sync->SetStartTime(server_clock::now()); sync->SetDuration(30000); } DisableSync(); } if (m_PSyncTarget != nullptr && m_PSyncTarget != PChar) { if (PChar->status != STATUS_DISAPPEAR) { CStatusEffect* sync = PChar->StatusEffectContainer->GetStatusEffect(EFFECT_LEVEL_SYNC); if (sync && sync->GetDuration() == 0) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 30, 553)); sync->SetStartTime(server_clock::now()); sync->SetDuration(30000); } } } PChar->PLatentEffectContainer->CheckLatentsPartyMembers(members.size()); PChar->pushPacket(new CPartyDefinePacket(nullptr)); PChar->pushPacket(new CPartyMemberUpdatePacket(PChar, 0, 0, PChar->getZone())); PChar->pushPacket(new CCharUpdatePacket(PChar)); PChar->PParty = nullptr; Sql_Query(SqlHandle, "DELETE FROM accounts_parties WHERE charid = %u;", PChar->id); uint8 data[4] {}; ref<uint32>(data, 0) = m_PartyID; message::send(MSG_PT_RELOAD, data, sizeof data, nullptr); if (PChar->PTreasurePool != nullptr && PChar->PTreasurePool->GetPoolType() != TREASUREPOOL_ZONE) { PChar->PTreasurePool->DelMember(PChar); PChar->PTreasurePool = new CTreasurePool(TREASUREPOOL_SOLO); PChar->PTreasurePool->AddMember(PChar); PChar->PTreasurePool->UpdatePool(PChar); } } break; } } } }