📄 party.cpp
字号:
m_sClassCount = (sClass & 0x0001) + (sClass >> 1 & 0x0001) + (sClass >> 2 & 0x0001) + (sClass >> 3 & 0x0001) ;
///////////////////////////////////////////////////////////////////
// 2瞒 函券 = (A->B狼 函券啦) / SUM(i->B捞 函券啦,i俊 措茄 钦)
//
// 3瞒 函券 = (1+牢盔荐*0.1)*函券伏
///////////////////////////////////////////////////////////////////
for( i =0; i < MAX_PARTY_NUM ; i ++ )
{
if( m_pPartySocket[i] && m_pPartySocket[i]->pPlayer )
{
m_pPartySocket[i]->pPlayer->m_nPartyType = m_nType;
m_pPartySocket[i]->pPlayer->m_sPartyClass = sClass ;
}
for( j =0; j < MAX_PARTY_NUM ; j ++ )
{
// 2瞒 函券
double fTemp = m_fTempMatrix[i][j] / (
m_fTempMatrix[i][0] +
m_fTempMatrix[i][1] +
m_fTempMatrix[i][2] +
m_fTempMatrix[i][3] +
m_fTempMatrix[i][4]
);
// 3瞒 函券
// 3 辆幅捞惑狼 努饭胶搁
if ( m_sClassCount >= 3 )
m_fExpMatrix[i][j] = ( 1 + m_pPartyMember->nCount * 0.15 ) * fTemp;
else
m_fExpMatrix[i][j] = ( 1 + m_pPartyMember->nCount * 0.12 ) * fTemp;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////
// 颇萍盔 硼厘 / 呕硼
//
// - 颇萍 呕硼盔俊霸档 皋矫瘤甫 焊晨
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Member_Leave( DWORD pPlayerHandle )
{
// 颇萍 盔阑 茫澜
for( int i=0; i < MAX_PARTY_NUM ; i ++ )
{
// 秦寸 荤侩磊甫 茫篮版快
if( m_pPartyMember->PARTYLIST[i].dwPlayerHandle == pPlayerHandle )
{
memset( &m_pPartyMember->PARTYLIST[i], 0x0, sizeof( _PARTYLIST_ ) );
// Party呕硼 贸府
if( m_pPartySocket[i] )
{
m_pPartySocket[i]->pPlayer->Party_Break();
}
m_pPartySocket[i] = NULL;
m_pPartyMember->nCount --;
SetPartyExpMatrix(); // 颇萍 版氰摹 盒硅伏 拌魂
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////
// 秦寸 Player Map 捞悼矫 贸府
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Member_MapMove( DWORD pPlayerHandle )
{
// --------------------------------------------------------------------------------
// 泅犁 MAP俊 荤侩磊 粮犁 咯何甫 魄沥
// - 颇萍盔捞 绝绰 版快 Memory馆券 矫糯
// --------------------------------------------------------------------------------
bool bFindMember = false ;
for(int i=0; i < MAX_PARTY_NUM ; i ++ )
{
if( m_pPartyMember->PARTYLIST[i].dwPlayerHandle == pPlayerHandle )
{
m_pPartySocket[i] = NULL ;
continue;
}
if( m_pPartyMember->PARTYLIST[i].dwMapID == _Module.m_nMapSeq )
{
bFindMember = true;
}
}
// 泅犁 MAP俊 颇萍盔捞 粮犁 窍瘤 臼绰 版快 Party 按眉 馆券
if (false == bFindMember)
{
for(int i=0; i < MAX_PARTY_NUM ; i ++ )
{
if( m_pPartySocket[i] )
{
ErrorMsg( "(X)Member_MapMove - Exist : %d", m_pPartyMember->PARTYLIST[i].dwPlayerHandle );
}
}
g_pMap->Party_Delete( m_pPartyMember->dwPartyHandle, false );
}
}
////////////////////////////////////////////////////////////////////////////////////////
// 鞍篮 MAP郴俊辑 颇萍 眉泼 皋矫瘤 焊尘锭
// - Error贸府 风凭 眠啊
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Send_ChatMsg_Map(_LPZP_PARTYCHAT_ASK pPacket)
{
#ifdef DEF_KUMA_PARTYQUEST_GM
_LPSOCKET_FD pSocketFD = g_pMap->Find_Player( pPacket->strPlayerID );
if( ( pSocketFD ) &&
( m_pPartySocket[0] == pSocketFD ) &&
( pSocketFD->pPlayer->m_nAdminDiv >= DEF_DEMOPLAYER ) )
{
char szTmp[100];
strcpy( szTmp, pPacket->strMessage );
char* token = strtok( szTmp, " " );
if ( token != NULL )
{
if ( strcmp( token, "!qm" ) == 0 )
{
token = strtok( NULL, " " );
if ( token != NULL )
{
int nQuestIdx = atoi( token );
if ( (nQuestIdx > 0 ) && ( m_pPartySocket[0]->pPlayer->m_dwPartyQuest != 0 ) )
{
int nOldQuestIdx = m_pPartySocket[0]->pPlayer->m_dwPartyQuest;
PartyQuest_RemoveQuest(nOldQuestIdx);
PartyQuest_Request( nQuestIdx, m_pPartySocket[0], false );
PartyQuest_Gate( nOldQuestIdx, 0, 1 );
}
}
return;
}
else if ( strcmp( token, "!ci" ) == 0 )
{
token = strtok( NULL, " " );
if ( token != NULL )
{
int nBaseItem = atoi( token );
if ( nBaseItem > 0 )
{
CItem * pItem = (CItem *)g_pMap->Pool_Item_Pop();
pItem->QuestCreateItem2( nBaseItem, 0, 0, OPTIONNUMBER_NORMAL, m_pPartySocket[0]->pPlayer, QUEST_PARTY );
pItem->SetChannel( m_pPartySocket[0]->pPlayer->GetChannel() );
g_pServer->ItemCreateMemory( pItem, m_pPartySocket[0]->pPlayer->m_Tile );
}
}
return;
}
else if ( strcmp( token, "!rq" ) == 0 )
{
token = strtok( NULL, " " );
if ( token != NULL )
{
int nQuest = atoi( token );
if ( ( nQuest >= 23001 ) && ( nQuest <= 23004 ) &&
( m_pPartySocket[0]->pPlayer->m_dwPartyQuest == 0 ) )
{
PartyQuest_ClearGlobal( 0 );
PartyQuest_Request( nQuest, m_pPartySocket[0], true );
if ( nQuest == 23001 )
PartyQuest_SetGlobal( 0, 0, 0 );
else if ( nQuest == 23002 )
PartyQuest_SetGlobal( 0, 0, 1 );
else if ( nQuest == 23003 )
PartyQuest_SetGlobal( 0, 0, 2 );
else if ( nQuest == 23004 )
PartyQuest_SetGlobal( 0, 0, 3 );
}
}
return;
}
}
}
#endif
bool bWorldSend = false;
for( int i = 0; i < MAX_PARTY_NUM; i ++ )
{
if( m_pPartyMember->PARTYLIST[i].dwMapID == _Module.m_nMapSeq )
{
g_pServer->PacketSend_PartyChat (m_pPartySocket[i], pPacket );
}
else
{
if( m_pPartyMember->PARTYLIST[i].dwMapID )
{
bWorldSend = true;
}
}
}
// --------------------------------------------------------------------------------
// 促弗 MAP荤侩磊 粮犁矫
// --------------------------------------------------------------------------------
if( bWorldSend )
{
pPacket->dwMapID = _Module.m_nMapSeq; // World Server备盒侩
g_lpUdpSock->PartyChat( pPacket ); // UDP肺 World Server俊 Party Chat傈价
}
}
////////////////////////////////////////////////////////////////////////////////////////
// WORLD SERVER俊辑 罐酒辑 眉泼 皋矫瘤 葛尘锭
//
// - Error贸府 风凭 眠啊
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Send_ChatMsg_World( _LPZW_PARTYCHAT_ASK pPacket )
{
for( int i = 0; i < MAX_PARTY_NUM; i ++ )
{
if( m_pPartyMember->PARTYLIST[i].dwMapID != _Module.m_nMapSeq) continue;
if(!m_pPartySocket[i] ) continue;
if( m_pPartySocket[i]->dwMagicNum != MAGIC_NUM ) continue;
if( m_pPartySocket[i]->bClose ) continue;
g_pServer->PacketSend_PartyChat (m_pPartySocket[i], pPacket );
}
}
////////////////////////////////////////////////////////////////////////////////////////
// 颇萍盔阑 眠啊 矫糯
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Party_Join(_LPZW_PARTYJOIN_REP pPacket)
{
Member_Add( &pPacket->PARTYLIST ); // MEMBER LIST甫 傈价
SetPartyExpMatrix();
for( int i=0; i < MAX_PARTY_NUM ; i ++ )
{
if( m_pPartySocket[i] )
{
// Player ID啊 鞍篮 版快
// 颇萍 府胶飘甫 傈价
if( m_pPartySocket[i]->pPlayer->m_dwHandle == pPacket->PARTYLIST.dwPlayerHandle )
{
g_pServer->PacketSend_PartyList( m_pPartySocket[i], m_pPartyMember );
g_pServer->PacketSend_PartyJoin( m_pPartySocket[i], pPacket );
m_pPartySocket[i]->pPlayer->m_bWaitForPartyReq = false;
}
else
{
g_pServer->PacketSend_PartyJoin( m_pPartySocket[i], pPacket );
}
// 促弗 版快 Join阑 舅覆
// Party JOIN Msg傈价
}
}
}
////////////////////////////////////////////////////////////////////////////////////////
// 颇萍盔阑 呕硼 矫糯
//
// - 眠饶 坷幅 皋矫瘤 贸府
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Party_Leave(_LPZW_PARTYLEAVE_REP pPacket)
{
for( int i=0; i < MAX_PARTY_NUM ; i ++ )
{
if( IsSocketValidity( m_pPartySocket[i] ) )
{
g_pServer->PacketSend_PartyLeave( m_pPartySocket[i], pPacket );
}
if(m_pPartyMember->PARTYLIST[i].dwPlayerHandle == pPacket->dwPlayerHandle)
{
if( IsSocketValidity( m_pPartySocket[i] ) )
{
g_pServer->PacketSend_PartyDelete( m_pPartySocket[i] ) ;
}
Member_Leave( pPacket->dwPlayerHandle ); // 秦寸 颇萍盔阑 呕硼 矫糯
}
}
// --------------------------------------------------------------------------------
// 泅犁 MAP俊 荤侩磊 粮犁 咯何甫 魄沥
//
// - 颇萍盔捞 绝绰 版快 Memory馆券 矫糯
// --------------------------------------------------------------------------------
for( i=0; i < MAX_PARTY_NUM ; i ++ )
{
if( m_pPartyMember->PARTYLIST[i].dwMapID == _Module.m_nMapSeq ) return;
}
for( i=0; i < MAX_PARTY_NUM ; i ++ )
{
if( m_pPartySocket[i] )
{
ErrorMsg( "(X)Party_Leave - Exist : %d", m_pPartyMember->PARTYLIST[i].dwPlayerHandle );
}
}
// 泅犁 MAP俊 颇萍盔捞 粮犁 窍瘤 臼绰 版快 Party 按眉 馆券
g_pMap->Party_Delete( pPacket->dwPartyHandle, false );
}
////////////////////////////////////////////////////////////////////////////////////////
// 颇萍甫 辆丰 矫糯
//
// - 颇萍盔俊霸 辆丰 Msg傈价
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Close(bool bForce)
{
m_bPartyDelete = true;
if ( bForce )
{
for( int i=0; i < MAX_PARTY_NUM ; i ++ )
{
if(!m_pPartySocket[i] ) continue;
if( m_pPartySocket[i]->dwMagicNum != MAGIC_NUM ) continue;
// ----------------------------------------------------------------------------
// NOTENOTE: 甘辑滚啊 磷绢辑 眠啊 累诀窃
// Player啊 NULL 牢版快 眉农窃
// ----------------------------------------------------------------------------
if(!m_pPartySocket[i]->pPlayer ) continue;
if( m_pPartySocket[i]->bClose ) continue;
// ----------------------------------------------------------------------------
// NOTENOTE: 甘辑滚啊 磷绢辑 眠啊 累诀窃
// 皋技瘤甫 焊郴绊 唱辑 m_pPartySocket[i]->pPlayer->m_dwPartyHandle = 0;
// 亲格捞 乐菌绰单 弊凡版快 荤侩磊啊 立加阑 辆丰茄巴阑
// ----------------------------------------------------------------------------
m_pPartySocket[i]->pPlayer->Party_Break();
g_pServer->PacketSend_PartyDelete( m_pPartySocket[i] );
}
}
Clear_Party();
}
////////////////////////////////////////////////////////////////////////////////////////
//
//
////////////////////////////////////////////////////////////////////////////////////////
bool CParty::Check_PartyIsValid()
{
if ( m_pPartyMember->dwPartyHandle == 0 )
{
ErrorMsg( "(X) PARTY HANDLE IS 0" );
return false;
}
for( int i=0; i < MAX_PARTY_NUM ; i ++ )
{
if ( IsSocketValidity( m_pPartySocket[i] ) )
{
if ( m_pPartySocket[i]->pPlayer->m_dwPartyHandle != m_pPartyMember->dwPartyHandle )
{
ErrorMsg( "(X) PARTY HANDLE IS WRONG Party(%d) PlayerParty(%d)",m_pPartyMember->dwPartyHandle, m_pPartySocket[i]->pPlayer->m_dwPartyHandle );
return false;
}
}
}
return true;
}
////////////////////////////////////////////////////////////////////////////////////////
// Party狼 函版 郴开阑 涝仿 矫糯
//
// - Map 捞悼矫父 单捞鸥 傈价
////////////////////////////////////////////////////////////////////////////////////////
void CParty::Party_Refresh(_LPZW_PARTYREFRESH_REP pPacket)
{
for( int i=0; i < MAX_PARTY_NUM ; i ++ )
{
// 秦寸 荤侩磊甫 茫篮版快
if( m_pPartyMember->PARTYLIST[i].dwPlayerHandle == pPacket->PARTYLIST.dwPlayerHandle )
{
DWORD dwOldMapID = m_pPartyMember->PARTYLIST[i].dwMapID;
memcpy( &m_pPartyMember->PARTYLIST[i], &pPacket->PARTYLIST, sizeof( _PARTYLIST_ ) );
// SOCKET FD甫 掘澜
if( m_pPartyMember->PARTYLIST[i].dwMapID == _Module.m_nMapSeq )
{
m_pPartySocket[i] = g_pMap->Find_Player( m_pPartyMember->PARTYLIST[i].strPlayerID );
}
// Map ID啊 撇赴 版快
if( dwOldMapID != m_pPartyMember->PARTYLIST[i].dwMapID )
{
Send_Refresh( pPacket ); // 葛电 备己盔俊霸 皋矫瘤 傈价
}
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -