void CUser::PartyProcess(char *pBuf) { int index = 0, idlength = 0, memberid = -1; char strid[MAX_ID_SIZE+1]; memset( strid, 0x00, MAX_ID_SIZE+1 ); BYTE subcommand, result; CUser* pUser = NULL; subcommand = GetByte( pBuf, index ); switch( subcommand ) { case PARTY_CREATE: idlength = GetShort( pBuf, index ); if (idlength <= 0 || idlength > MAX_ID_SIZE) return ; GetString( strid, pBuf, idlength, index ); pUser = m_pMain->GetUserPtr(strid, TYPE_CHARACTER); if( pUser ) { memberid = pUser->GetSocketID(); PartyRequest( memberid, TRUE ); } break; case PARTY_PERMIT: result = GetByte( pBuf, index ); if( result ) PartyInsert(); else PartyCancel(); break; case PARTY_INSERT: idlength = GetShort( pBuf, index ); if (idlength <= 0 || idlength > MAX_ID_SIZE) return ; GetString( strid, pBuf, idlength, index ); pUser = m_pMain->GetUserPtr(strid, TYPE_CHARACTER); if( pUser ) { memberid = pUser->GetSocketID(); PartyRequest( memberid, FALSE ); } break; case PARTY_REMOVE: memberid = GetShort( pBuf, index ); PartyRemove( memberid ); break; case PARTY_DELETE: PartyDelete(); break; } }
void CParty::PartyProcess(Packet & pkt) { uint8 opcode = pkt.read<uint8>(); switch (opcode) { case PARTY_CREATE: PartyCreate(pkt); break; case PARTY_INSERT: PartyInsert(pkt); break; case PARTY_REMOVE: PartyRemove(pkt); break; case PARTY_DELETE: PartyDelete(pkt); break; } }
void CUser::PartyRemove(int memberid) { int index = 0, send_index = 0, count = 0, i = 0; CUser* pUser = NULL; _PARTY_GROUP* pParty = NULL; if (m_sPartyIndex == -1) return; pUser = m_pMain->GetUserPtr(memberid); if (pUser == NULL) return; pParty = m_pMain->m_PartyArray.GetData(m_sPartyIndex); if (!pParty) { pUser->m_sPartyIndex = -1; m_sPartyIndex = -1; return; } if (memberid != GetSocketID()) { if (pParty->uid[0] != GetSocketID()) return; } else { if (pParty->uid[0] == memberid) { PartyDelete(); return; } } for( i=0; i<8; i++ ) { if( pParty->uid[i] != -1 ) { if( pParty->uid[i] == memberid ) { count--; } count++; } } if( count == 1 ) { // ???? ??? ??? ??? ??? ???? PartyDelete(); return; } char send_buff[256]; memset( send_buff, 0x00, 256 ); SetByte( send_buff, WIZ_PARTY, send_index ); SetByte( send_buff, PARTY_REMOVE, send_index ); SetShort( send_buff, memberid, send_index ); m_pMain->Send_PartyMember( m_sPartyIndex, send_buff, send_index ); // ????? ???? ??e??????..??w? ???????? ??Y?? ????. for( i=0; i<8; i++ ) { // ????? ???? ??? ???? ??? ????T???? ????. if( pParty->uid[i] != -1 ) { if( pParty->uid[i] == memberid ) { pParty->uid[i] = -1; pParty->sHp[i] = 0; pParty->bLevel[i] = 0; pParty->sClass[i] = 0; pUser->m_sPartyIndex = -1; } } } // AI Server send_index = 0; memset( send_buff, 0x00, 256 ); SetByte( send_buff, AG_USER_PARTY, send_index ); SetByte( send_buff, PARTY_REMOVE, send_index ); SetShort( send_buff, pParty->wIndex, send_index ); SetShort( send_buff, memberid, send_index ); m_pMain->Send_AIServer(m_pUserData->m_bZone, send_buff, send_index); }