void CParty::PushMember(CBattleEntity* PEntity) { DSP_DEBUG_BREAK_IF(PEntity == nullptr); DSP_DEBUG_BREAK_IF(PEntity->PParty != nullptr); PEntity->PParty = this; members.push_back(PEntity); auto info = GetPartyInfo(); for (auto&& memberinfo : info) { if (memberinfo.id == PEntity->id) { if (memberinfo.flags & PARTY_LEADER) { m_PLeader = PEntity; } if (memberinfo.flags & PARTY_QM) { m_PQuaterMaster = PEntity; } if (memberinfo.flags & PARTY_SYNC) { m_PSyncTarget = PEntity; } } } ReloadTreasurePool((CCharEntity*)PEntity); }
void CParty::AddMember(CBattleEntity* PEntity) { DSP_DEBUG_BREAK_IF(PEntity == NULL); DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL); PEntity->PParty = this; members.push_back(PEntity); if (m_PartyType == PARTY_PCS) { DSP_DEBUG_BREAK_IF(PEntity->objtype != TYPE_PC); CCharEntity* PChar = (CCharEntity*)PEntity; ReloadParty(); ReloadTreasurePool(PChar); if (PChar->nameflags.flags == FLAG_INVITE) { PChar->nameflags.flags = 0; //charutils::SaveCharStats(PChar); PChar->status = STATUS_UPDATE; PChar->pushPacket(new CMenuConfigPacket(PChar)); PChar->pushPacket(new CCharUpdatePacket(PChar)); PChar->pushPacket(new CCharSyncPacket(PChar)); } PChar->PTreasurePool->UpdatePool(PChar); Sql_Query(SqlHandle,"UPDATE accounts_sessions SET partyid = %u WHERE charid = %u", m_PartyID, PChar->id); } }
void CParty::AddMember(CBattleEntity* PEntity, Sql_t* sql) { DSP_DEBUG_BREAK_IF(PEntity == NULL); DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL); PEntity->PParty = this; members.push_back(PEntity); if (m_PartyType == PARTY_PCS) { DSP_DEBUG_BREAK_IF(PEntity->objtype != TYPE_PC); CCharEntity* PChar = (CCharEntity*)PEntity; uint32 allianceid = 0; if (m_PAlliance) { allianceid = m_PAlliance->m_AllianceID; } Sql_Query(sql, "INSERT INTO accounts_parties (charid, partyid, allianceid, partyflag) VALUES (%u, %u, %u, %u);", PChar->id, m_PartyID, allianceid, GetMemberFlags(PChar)); uint8 data[4]; WBUFL(data, 0) = m_PartyID; message::send(MSG_PT_RELOAD, data, sizeof data, NULL); ReloadTreasurePool(PChar); if (PChar->nameflags.flags & FLAG_INVITE) { PChar->nameflags.flags ^= FLAG_INVITE; charutils::SaveCharStats(PChar); PChar->status = STATUS_UPDATE; PChar->pushPacket(new CMenuConfigPacket(PChar)); PChar->pushPacket(new CCharUpdatePacket(PChar)); PChar->pushPacket(new CCharSyncPacket(PChar)); } PChar->PTreasurePool->UpdatePool(PChar); //Apply level sync if the party is level synced if (m_PSyncTarget != NULL) { if (PChar->getZone() == m_PSyncTarget->getZone() ) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, m_PSyncTarget->GetMLevel(), 540)); PChar->StatusEffectContainer->AddStatusEffect(new CStatusEffect( EFFECT_LEVEL_SYNC, EFFECT_LEVEL_SYNC, m_PSyncTarget->GetMLevel(), 0, 0), true); PChar->StatusEffectContainer->DelStatusEffectsByFlag(EFFECTFLAG_DISPELABLE | EFFECTFLAG_ON_ZONE); PChar->loc.zone->PushPacket(PChar, CHAR_INRANGE, new CCharSyncPacket(PChar)); } } } }
void CParty::PushMember(CBattleEntity* PEntity) { DSP_DEBUG_BREAK_IF(PEntity == NULL); DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL); PEntity->PParty = this; members.push_back(PEntity); //TODO: get flags from db, set leader/qm/etc appropriately ReloadTreasurePool((CCharEntity*)PEntity); }
void CParty::AddMember(CBattleEntity* PEntity) { DSP_DEBUG_BREAK_IF(PEntity == NULL); DSP_DEBUG_BREAK_IF(PEntity->PParty != NULL); PEntity->PParty = this; members.push_back(PEntity); if (m_PartyType == PARTY_PCS) { DSP_DEBUG_BREAK_IF(PEntity->objtype != TYPE_PC); CCharEntity* PChar = (CCharEntity*)PEntity; ReloadParty(); ReloadTreasurePool(PChar); if (PChar->nameflags.flags & FLAG_INVITE) { PChar->nameflags.flags ^= FLAG_INVITE; charutils::SaveCharStats(PChar); PChar->status = STATUS_UPDATE; PChar->pushPacket(new CMenuConfigPacket(PChar)); PChar->pushPacket(new CCharUpdatePacket(PChar)); PChar->pushPacket(new CCharSyncPacket(PChar)); } PChar->PTreasurePool->UpdatePool(PChar); //Apply level sync if the party is level synced if (m_PSyncTarget != NULL) { if (PChar->getZone() == m_PSyncTarget->getZone() ) { PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, m_PSyncTarget->GetMLevel(), 540)); PChar->StatusEffectContainer->AddStatusEffect(new CStatusEffect( EFFECT_LEVEL_SYNC, EFFECT_LEVEL_SYNC, m_PSyncTarget->GetMLevel(), 0, 0), true); PChar->StatusEffectContainer->DelStatusEffectsByFlag(EFFECTFLAG_DEATH); PChar->loc.zone->PushPacket(PChar, CHAR_INRANGE, new CCharSyncPacket(PChar)); } } Sql_Query(SqlHandle,"UPDATE accounts_sessions SET partyid = %u WHERE charid = %u", m_PartyID, PChar->id); } }