1501 lines
39 KiB
C++
1501 lines
39 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "TableFrameSink.h"
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|||
|
|
#define IDI_CHECK_TABLE 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
#define IDI_USER_OUT_TIME 6 //<2F><><EFBFBD>ҳ<EFBFBD>ʱ
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>캯<EFBFBD><ECBAAF>
|
|||
|
|
CTableFrameSink::CTableFrameSink()
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame=NULL;
|
|||
|
|
m_pGameCustomRule=NULL;
|
|||
|
|
m_pGameServiceOption=NULL;
|
|||
|
|
m_pGameServiceAttrib=NULL;
|
|||
|
|
m_bOffLineTrustee = false;
|
|||
|
|
|
|||
|
|
//ը<><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_wFirstUser=INVALID_CHAIR;
|
|||
|
|
m_wBankerUser=INVALID_CHAIR;
|
|||
|
|
m_wCurrentUser=INVALID_CHAIR;
|
|||
|
|
ZeroMemory(m_cbOutCardCount,sizeof(m_cbOutCardCount));
|
|||
|
|
|
|||
|
|
for (byte i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_bUserTrustee[i] = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
m_wTimerControl=0;
|
|||
|
|
m_cbBombCount=0;
|
|||
|
|
ZeroMemory(m_cbEachBombCount,sizeof(m_cbEachBombCount));
|
|||
|
|
|
|||
|
|
ZeroMemory(m_aryOverTime, sizeof(m_aryOverTime));
|
|||
|
|
|
|||
|
|
//<2F>з<EFBFBD><D0B7><EFBFBD>Ϣ
|
|||
|
|
m_cbBankerScore=0;
|
|||
|
|
ZeroMemory(m_cbScoreInfo,sizeof(m_cbScoreInfo));
|
|||
|
|
m_cbCallScoreCount=0;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_cbTurnCardCount=0;
|
|||
|
|
m_wTurnWiner=INVALID_CHAIR;
|
|||
|
|
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));
|
|||
|
|
|
|||
|
|
//<2F>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|||
|
|
ZeroMemory(m_cbBankerCard,sizeof(m_cbBankerCard));
|
|||
|
|
ZeroMemory(m_cbHandCardData,sizeof(m_cbHandCardData));
|
|||
|
|
ZeroMemory(m_cbHandCardCount,sizeof(m_cbHandCardCount));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_hControlInst = NULL;
|
|||
|
|
m_pServerControl = NULL;
|
|||
|
|
m_hControlInst = LoadLibrary(TEXT("LandServerControl.dll"));
|
|||
|
|
if ( m_hControlInst )
|
|||
|
|
{
|
|||
|
|
typedef void * (*CREATE)();
|
|||
|
|
CREATE ServerControl = (CREATE)GetProcAddress(m_hControlInst,"CreateServerControl");
|
|||
|
|
if ( ServerControl )
|
|||
|
|
{
|
|||
|
|
m_pServerControl = static_cast<IServerControl*>(ServerControl());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ZeroMemory(&m_PrivateEndInfo, sizeof(CMD_S_Private_End_Info));
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CTableFrameSink::~CTableFrameSink()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if( m_pServerControl )
|
|||
|
|
{
|
|||
|
|
delete m_pServerControl;
|
|||
|
|
m_pServerControl = NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if( m_hControlInst )
|
|||
|
|
{
|
|||
|
|
FreeLibrary(m_hControlInst);
|
|||
|
|
m_hControlInst = NULL;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ӿڲ<D3BF>ѯ
|
|||
|
|
VOID * CTableFrameSink::QueryInterface(REFGUID Guid, DWORD dwQueryVer)
|
|||
|
|
{
|
|||
|
|
QUERYINTERFACE(ITableFrameSink,Guid,dwQueryVer);
|
|||
|
|
QUERYINTERFACE(ITableUserAction,Guid,dwQueryVer);
|
|||
|
|
QUERYINTERFACE_IUNKNOWNEX(ITableFrameSink,Guid,dwQueryVer);
|
|||
|
|
return NULL;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
|||
|
|
VOID CTableFrameSink::RepositionSink()
|
|||
|
|
{
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
m_cbBombCount=0;
|
|||
|
|
m_wBankerUser=INVALID_CHAIR;
|
|||
|
|
m_wCurrentUser=INVALID_CHAIR;
|
|||
|
|
ZeroMemory(m_cbOutCardCount,sizeof(m_cbOutCardCount));
|
|||
|
|
ZeroMemory(m_cbEachBombCount,sizeof(m_cbEachBombCount));
|
|||
|
|
|
|||
|
|
ZeroMemory(m_aryOverTime, sizeof(m_aryOverTime));
|
|||
|
|
|
|||
|
|
for (byte i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_bUserTrustee[i] = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>з<EFBFBD><D0B7><EFBFBD>Ϣ
|
|||
|
|
m_cbBankerScore=0;
|
|||
|
|
ZeroMemory(m_cbScoreInfo,sizeof(m_cbScoreInfo));
|
|||
|
|
m_cbCallScoreCount=0;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_cbTurnCardCount=0;
|
|||
|
|
m_wTurnWiner=INVALID_CHAIR;
|
|||
|
|
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));
|
|||
|
|
|
|||
|
|
//<2F>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|||
|
|
ZeroMemory(m_cbBankerCard,sizeof(m_cbBankerCard));
|
|||
|
|
ZeroMemory(m_cbHandCardData,sizeof(m_cbHandCardData));
|
|||
|
|
ZeroMemory(m_cbHandCardCount,sizeof(m_cbHandCardCount));
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::Initialization(IUnknownEx * pIUnknownEx)
|
|||
|
|
{
|
|||
|
|
//<2F><>ѯ<EFBFBD>ӿ<EFBFBD>
|
|||
|
|
m_pITableFrame=QUERY_OBJECT_PTR_INTERFACE(pIUnknownEx,ITableFrame);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
if (m_pITableFrame==NULL)
|
|||
|
|
{
|
|||
|
|
CTraceService::TraceString(TEXT("<EFBFBD><EFBFBD>Ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> CTableFrameSink <20><>ѯ ITableFrame <20>ӿ<EFBFBD>ʧ<EFBFBD><CAA7>"),TraceLevel_Exception);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʼģʽ
|
|||
|
|
m_pITableFrame->SetStartMode(START_MODE_FULL_READY);
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
m_pGameServiceAttrib=m_pITableFrame->GetGameServiceAttrib();
|
|||
|
|
m_pGameServiceOption=m_pITableFrame->GetGameServiceOption();
|
|||
|
|
|
|||
|
|
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT(m_pITableFrame->GetCustomRule()!=NULL);
|
|||
|
|
m_pGameCustomRule=(tagCustomRule *)m_pITableFrame->GetCustomRule();
|
|||
|
|
|
|||
|
|
m_bOffLineTrustee = CServerRule::IsAllowOffLineTrustee(m_pGameServiceOption->dwServerRule);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
SCORE CTableFrameSink::QueryConsumeQuota(IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
return 0L;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ٻ<EFBFBD><D9BB><EFBFBD>
|
|||
|
|
SCORE CTableFrameSink::QueryLessEnterScore(WORD wChairID, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
return 0L;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>ʼ
|
|||
|
|
bool CTableFrameSink::OnEventGameStart()
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_cbTurnCardCount=0;
|
|||
|
|
m_wTurnWiner=INVALID_CHAIR;
|
|||
|
|
ZeroMemory(m_cbTurnCardData,sizeof(m_cbTurnCardData));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
m_pITableFrame->SetGameStatus(GAME_SCENE_CALL);
|
|||
|
|
|
|||
|
|
srand(GetTickCount() + m_pITableFrame->GetTableID());
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
BYTE cbRandCard[FULL_COUNT];
|
|||
|
|
m_GameLogic.RandCardList(cbRandCard,CountArray(cbRandCard));
|
|||
|
|
//
|
|||
|
|
#ifdef _DEBUG
|
|||
|
|
|
|||
|
|
//0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D, <20><><EFBFBD><EFBFBD>
|
|||
|
|
//0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, ÷<><C3B7>
|
|||
|
|
//0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D, <20><><EFBFBD><EFBFBD>
|
|||
|
|
//0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D, <20><><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
//BYTE cbTempRandCard[FULL_COUNT]=
|
|||
|
|
//{
|
|||
|
|
// 0x11,0x11,0x1D,0x0C,0x0B,0x0A,0x0A,0x09,0x07,0x07,0x07,0x07,0x06,0x06,0x06,0x05,0x05,
|
|||
|
|
//0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,
|
|||
|
|
//0x29,0x2A,0x2B,0x2C,0x2D,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,
|
|||
|
|
//0x05,0x05,0x04,
|
|||
|
|
//};
|
|||
|
|
|
|||
|
|
//CopyMemory(cbRandCard, cbTempRandCard, sizeof(cbRandCard));
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>
|
|||
|
|
if ((m_pGameServiceOption->wServerType&GAME_GENRE_MATCH)!=0 )
|
|||
|
|
{
|
|||
|
|
m_wFirstUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
|
BYTE cbValidCardData=0;
|
|||
|
|
BYTE cbValidCardIndex=0;
|
|||
|
|
WORD wStartUser=m_wFirstUser;
|
|||
|
|
WORD wCurrentUser=m_wFirstUser;
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
|
if (wStartUser==INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
//<2F><>ȡ<EFBFBD>˿<EFBFBD>
|
|||
|
|
cbValidCardIndex=rand()%DISPATCH_COUNT;
|
|||
|
|
cbValidCardData=cbRandCard[cbValidCardIndex];
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
wStartUser=m_GameLogic.GetCardValue(cbValidCardData)%GAME_PLAYER;
|
|||
|
|
wCurrentUser=(wStartUser+cbValidCardIndex/NORMAL_COUNT)%GAME_PLAYER;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#ifdef DEBUG
|
|||
|
|
//WORD wChairID = INVALID_CHAIR;
|
|||
|
|
|
|||
|
|
////<2F>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
|
//for (BYTE i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
//{
|
|||
|
|
// //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
// IServerUserItem *pServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
// if (pServerUserItem != NULL && pServerUserItem->GetGameID()==100984)
|
|||
|
|
// {
|
|||
|
|
// wChairID = i;
|
|||
|
|
// break;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//if (wChairID != INVALID_CHAIR)
|
|||
|
|
//{
|
|||
|
|
// //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
|
// BYTE cbGoodCard[NORMAL_COUNT] = { 0 };
|
|||
|
|
// m_GameLogic.GetGoodCardData(cbGoodCard);
|
|||
|
|
|
|||
|
|
// //<2F>Ȱ<EFBFBD><C8B0>ƿ<EFBFBD><C6BF>е<EFBFBD><D0B5><EFBFBD>ɾ<EFBFBD><C9BE>
|
|||
|
|
// bool bRemoveSuccess = m_GameLogic.RemoveCardEx(cbGoodCard, NORMAL_COUNT, cbRandCard, CountArray(cbRandCard));
|
|||
|
|
// if (bRemoveSuccess )
|
|||
|
|
// {
|
|||
|
|
// memmove(&cbRandCard[(wChairID + 1)*NORMAL_COUNT], &cbRandCard[wChairID*NORMAL_COUNT], FULL_COUNT - (wChairID + 1)*NORMAL_COUNT);
|
|||
|
|
// CopyMemory(&cbRandCard[wChairID*NORMAL_COUNT], cbGoodCard, NORMAL_COUNT);
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
#endif // DEBUG
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_AndroidCard AndroidCard ;
|
|||
|
|
ZeroMemory(&AndroidCard, sizeof(AndroidCard)) ;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
#ifdef DEBUG
|
|||
|
|
WORD wUserIndex = i;
|
|||
|
|
#else
|
|||
|
|
WORD wUserIndex = (m_wFirstUser+i)%GAME_PLAYER;
|
|||
|
|
#endif
|
|||
|
|
m_cbHandCardCount[wUserIndex]=NORMAL_COUNT;
|
|||
|
|
CopyMemory(&m_cbHandCardData[wUserIndex],&cbRandCard[i*m_cbHandCardCount[wUserIndex]],sizeof(BYTE)*m_cbHandCardCount[wUserIndex]);
|
|||
|
|
CopyMemory(&AndroidCard.cbHandCard[wUserIndex], &cbRandCard[i*m_cbHandCardCount[wUserIndex]], sizeof(BYTE)*m_cbHandCardCount[wUserIndex]) ;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>
|
|||
|
|
CopyMemory(m_cbBankerCard, &cbRandCard[DISPATCH_COUNT], sizeof(m_cbBankerCard));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
m_wFirstUser=wCurrentUser;
|
|||
|
|
m_wCurrentUser=wCurrentUser;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameStart GameStart;
|
|||
|
|
GameStart.wStartUser=wStartUser;
|
|||
|
|
GameStart.wCurrentUser=wCurrentUser;
|
|||
|
|
GameStart.cbValidCardData=cbValidCardData;
|
|||
|
|
GameStart.cbValidCardIndex=cbValidCardIndex;
|
|||
|
|
|
|||
|
|
AndroidCard.wCurrentUser = m_wCurrentUser;
|
|||
|
|
CopyMemory(AndroidCard.cbBankerCard,m_cbBankerCard,3*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
ASSERT(CountArray(GameStart.cbCardData)>=m_cbHandCardCount[i]);
|
|||
|
|
CopyMemory(GameStart.cbCardData,m_cbHandCardData[i],sizeof(BYTE)*m_cbHandCardCount[i]);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
IServerUserItem *pServerUserItem = m_pITableFrame->GetTableUserItem(i) ;
|
|||
|
|
if(!pServerUserItem->IsAndroidUser())
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->SendTableData(i,SUB_S_GAME_START,&GameStart,sizeof(GameStart));
|
|||
|
|
m_pITableFrame->SendLookonData(i,SUB_S_GAME_START,&GameStart,sizeof(GameStart));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->SendTableData(i,SUB_S_GAME_START,&AndroidCard,sizeof(AndroidCard));
|
|||
|
|
m_pITableFrame->SendLookonData(i,SUB_S_GAME_START,&GameStart,sizeof(GameStart));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ¼<><C2BC><EFBFBD><EFBFBD>ʼ;
|
|||
|
|
starGameRecord();
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>ʼ<EFBFBD><CABC>Ϣ;
|
|||
|
|
CMD_Record_GameStart recordStart;
|
|||
|
|
recordStart.wStartUser = wStartUser;
|
|||
|
|
recordStart.wCurrentUser = wCurrentUser;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_START, &recordStart, sizeof(CMD_Record_GameStart));
|
|||
|
|
|
|||
|
|
//WB<57><42>
|
|||
|
|
SendCheatCard();
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
m_GameLogic.SortCardList(m_cbHandCardData[i],m_cbHandCardCount[i],ST_ORDER);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
IsOfflineTrustee();
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnEventGameConclude(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason)
|
|||
|
|
{
|
|||
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1>;
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_USER_OUT_TIME);
|
|||
|
|
|
|||
|
|
switch (cbReason)
|
|||
|
|
{
|
|||
|
|
case GER_NORMAL: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameConclude GameConclude;
|
|||
|
|
ZeroMemory(&GameConclude,sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
GameConclude.cbBankerScore=m_cbBankerScore;
|
|||
|
|
GameConclude.lCellScore=m_pITableFrame->GetCellScore();
|
|||
|
|
|
|||
|
|
//ը<><D5A8><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
GameConclude.cbBombCount=m_cbBombCount;
|
|||
|
|
CopyMemory(GameConclude.cbEachBombCount,m_cbEachBombCount,sizeof(GameConclude.cbEachBombCount));
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
BYTE cbCardIndex=0;
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
GameConclude.cbCardCount[i]=m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(&GameConclude.cbHandCardData[cbCardIndex],m_cbHandCardData[i],m_cbHandCardCount[i]*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
cbCardIndex+=m_cbHandCardCount[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ը<><D5A8>ͳ<EFBFBD><CDB3>
|
|||
|
|
LONG lScoreTimes=1L * m_cbBankerScore;
|
|||
|
|
for (BYTE i=0;i<m_cbBombCount;i++) lScoreTimes*=2L;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
if (wChairID==m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
WORD wUser1=(m_wBankerUser+1)%GAME_PLAYER;
|
|||
|
|
WORD wUser2=(m_wBankerUser+2)%GAME_PLAYER;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>ж<EFBFBD>
|
|||
|
|
if ((m_cbOutCardCount[wUser1]==0)&&(m_cbOutCardCount[wUser2]==0))
|
|||
|
|
{
|
|||
|
|
lScoreTimes*=2L;
|
|||
|
|
GameConclude.bChunTian=TRUE;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
if (wChairID!=m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
if (m_cbOutCardCount[m_wBankerUser]==1)
|
|||
|
|
{
|
|||
|
|
lScoreTimes*=2L;
|
|||
|
|
GameConclude.bFanChunTian=TRUE;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
lScoreTimes=__min(m_pGameCustomRule->wMaxScoreTimes,lScoreTimes);
|
|||
|
|
|
|||
|
|
if (IsHasGameRule(eDDZRuleEnum_LimitMultiple8))
|
|||
|
|
{
|
|||
|
|
lScoreTimes = __min(8, lScoreTimes);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ũ<><C5A9><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
WORD wTrusteeCount=0;
|
|||
|
|
if ((m_pGameServiceOption->wServerType&GAME_GENRE_MATCH)!=0)
|
|||
|
|
{
|
|||
|
|
for(WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (i!=m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
if (m_bUserTrustee[i])
|
|||
|
|
{
|
|||
|
|
wTrusteeCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
|||
|
|
tagScoreInfo ScoreInfoArray[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfoArray,sizeof(ScoreInfoArray));
|
|||
|
|
|
|||
|
|
//ͳ<>ƻ<EFBFBD><C6BB><EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
SCORE lUserScore=0L;
|
|||
|
|
SCORE lCellScore=m_pITableFrame->GetCellScore();
|
|||
|
|
bool bTrusteeUser = m_bUserTrustee[i];
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>
|
|||
|
|
if (i==m_wBankerUser)
|
|||
|
|
{
|
|||
|
|
lUserScore=(m_cbHandCardCount[m_wBankerUser]==0)?2L:-2L;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (m_cbHandCardCount[m_wBankerUser]==0)
|
|||
|
|
{
|
|||
|
|
if (wTrusteeCount>0) lUserScore=(bTrusteeUser==true)?(-2L/wTrusteeCount):0L;
|
|||
|
|
else lUserScore=-1L;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (wTrusteeCount>0) lUserScore=(bTrusteeUser==true)?0L:(2L/wTrusteeCount);
|
|||
|
|
else lUserScore=1L;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ScoreInfoArray[i].lScore=lUserScore*lCellScore*lScoreTimes;
|
|||
|
|
ScoreInfoArray[i].cbType=(ScoreInfoArray[i].lScore>=0L)?SCORE_TYPE_WIN:SCORE_TYPE_LOSE;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>
|
|||
|
|
ScoreInfoArray[i].lRevenue=m_pITableFrame->CalculateRevenue(i,ScoreInfoArray[i].lScore);
|
|||
|
|
if (ScoreInfoArray[i].lRevenue>0L) ScoreInfoArray[i].lScore-=ScoreInfoArray[i].lRevenue;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
|||
|
|
GameConclude.lGameScore[i]=ScoreInfoArray[i].lScore;
|
|||
|
|
|
|||
|
|
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
|
m_HistoryScore.OnEventUserScore(i,GameConclude.lGameScore[i]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
// <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
IServerUserItem* pServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (pServerUserItem)
|
|||
|
|
{
|
|||
|
|
GameConclude.lAllScore[i] = pServerUserItem->GetUserScore() + GameConclude.lGameScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_GAME_CONCLUDE,&GameConclude,sizeof(GameConclude));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_CONCLUDE,&GameConclude,sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_CONCLUDE, &GameConclude, sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
BYTE cbFinishCout = pPrivateRecord->cbFinishCout;
|
|||
|
|
|
|||
|
|
//ͳ<>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ϸ
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (cbFinishCout < 16)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.lDetails[i][cbFinishCout] = GameConclude.lGameScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>
|
|||
|
|
m_PrivateEndInfo.cbFinishCout = cbFinishCout + 1;
|
|||
|
|
|
|||
|
|
m_pITableFrame->addPrivatePlayCout(1);
|
|||
|
|
/********************************˽<>˳<EFBFBD>ͳ<EFBFBD><CDB3>****************************************/
|
|||
|
|
|
|||
|
|
//<2F>ƾֽ<C6BE><D6BD><EFBFBD><EFBFBD><EFBFBD>,ÿ8<C3BF><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>㾭<EFBFBD><E3BEAD>ֵ;
|
|||
|
|
if (IsPrivateEnd())
|
|||
|
|
{
|
|||
|
|
tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
SCORE lGrade = pPrivateFrame->dwPlayCost;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
ScoreInfoArray[i].lGrade = lGrade;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfoArray, CountArray(ScoreInfoArray), kDataStream);
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD><D0BB>û<EFBFBD>
|
|||
|
|
m_wFirstUser=wChairID;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case GER_DISMISS: //<2F><>Ϸ<EFBFBD><CFB7>ɢ
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameConclude GameConclude;
|
|||
|
|
ZeroMemory(&GameConclude,sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
BYTE cbCardIndex=0;
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
GameConclude.cbCardCount[i]=m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(&GameConclude.cbHandCardData[cbCardIndex],m_cbHandCardData[i],m_cbHandCardCount[i]*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
cbCardIndex+=m_cbHandCardCount[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
// <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
IServerUserItem* pServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (pServerUserItem)
|
|||
|
|
{
|
|||
|
|
GameConclude.lAllScore[i] = pServerUserItem->GetUserScore() + GameConclude.lGameScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_GAME_CONCLUDE,&GameConclude,sizeof(GameConclude));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_CONCLUDE,&GameConclude,sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
case GER_USER_LEAVE: //<2F>û<EFBFBD>ǿ<EFBFBD><C7BF>
|
|||
|
|
case GER_NETWORK_ERROR: //<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
{
|
|||
|
|
if ((m_pGameServiceOption->wServerType&GAME_GENRE_MATCH)!=0)
|
|||
|
|
{
|
|||
|
|
if(m_bOffLineTrustee)
|
|||
|
|
{
|
|||
|
|
IsOfflineTrustee();
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_GameConclude GameConclude;
|
|||
|
|
ZeroMemory(&GameConclude,sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
GameConclude.cbBankerScore=m_cbBankerScore;
|
|||
|
|
GameConclude.lCellScore=m_pITableFrame->GetCellScore();
|
|||
|
|
|
|||
|
|
//ը<><D5A8><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
GameConclude.cbBombCount=m_cbBombCount;
|
|||
|
|
CopyMemory(GameConclude.cbEachBombCount,m_cbEachBombCount,sizeof(GameConclude.cbEachBombCount));
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>˿<EFBFBD>
|
|||
|
|
BYTE cbCardIndex=0;
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
GameConclude.cbCardCount[i]=m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(&GameConclude.cbHandCardData[cbCardIndex],m_cbHandCardData[i],m_cbHandCardCount[i]*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
cbCardIndex+=m_cbHandCardCount[i];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
////ը<><D5A8>ͳ<EFBFBD><CDB3>
|
|||
|
|
//WORD lScoreTimes=1;
|
|||
|
|
//for (WORD i=0;i<m_cbBombCount;i++) lScoreTimes*=2L;
|
|||
|
|
|
|||
|
|
////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
//lScoreTimes=__min(m_pGameCustomRule->wMaxScoreTimes,lScoreTimes);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>
|
|||
|
|
tagScoreInfo ScoreInfoArray[GAME_PLAYER];
|
|||
|
|
ZeroMemory(&ScoreInfoArray,sizeof(ScoreInfoArray));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
SCORE lCellScore=m_pITableFrame->GetCellScore();
|
|||
|
|
SCORE lUserScore = lCellScore*m_pGameCustomRule->wFleeScoreTimes;
|
|||
|
|
//SCORE lUserScore=lCellScore*__max(lScoreTimes,m_pGameCustomRule->wFleeScoreTimes);
|
|||
|
|
|
|||
|
|
////<2F><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>
|
|||
|
|
//if ((m_pGameServiceOption->wServerType&SCORE_GENRE_POSITIVE)!=0 || (m_pGameServiceOption->wServerType&(GAME_GENRE_GOLD|GAME_GENRE_EDUCATE))!=0)
|
|||
|
|
//{
|
|||
|
|
// lUserScore=__min(pIServerUserItem->GetUserScore(),lUserScore);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
|
|||
|
|
ScoreInfoArray[wChairID].lScore=-lUserScore;
|
|||
|
|
ScoreInfoArray[wChairID].cbType=SCORE_TYPE_FLEE;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (m_pGameCustomRule->cbFleeScorePatch==TRUE)
|
|||
|
|
{
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
if ( i == wChairID )
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
|||
|
|
ScoreInfoArray[i].lScore=lUserScore/2L;
|
|||
|
|
ScoreInfoArray[i].cbType=SCORE_TYPE_WIN;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>
|
|||
|
|
ScoreInfoArray[i].lRevenue=m_pITableFrame->CalculateRevenue(i,ScoreInfoArray[i].lScore);
|
|||
|
|
if (ScoreInfoArray[i].lRevenue>0L) ScoreInfoArray[i].lScore-=ScoreInfoArray[i].lRevenue;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD>óɼ<C3B3>
|
|||
|
|
GameConclude.lGameScore[i]=ScoreInfoArray[i].lScore;
|
|||
|
|
|
|||
|
|
//<2F><>ʷ<EFBFBD>ɼ<EFBFBD>
|
|||
|
|
m_HistoryScore.OnEventUserScore(i,GameConclude.lGameScore[i]);
|
|||
|
|
|
|||
|
|
// <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
IServerUserItem* pServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (pServerUserItem)
|
|||
|
|
{
|
|||
|
|
GameConclude.lAllScore[i] = pServerUserItem->GetUserScore() + GameConclude.lGameScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_GAME_CONCLUDE,&GameConclude,sizeof(GameConclude));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_CONCLUDE,&GameConclude,sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD><C2BC>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_GAME_CONCLUDE, &GameConclude, sizeof(GameConclude));
|
|||
|
|
|
|||
|
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
DataStream kDataStream;
|
|||
|
|
m_kGameRecord.StreamValue(kDataStream, true);
|
|||
|
|
m_pITableFrame->WriteTableScore(ScoreInfoArray, CountArray(ScoreInfoArray), kDataStream);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
|
|||
|
|
m_pITableFrame->ConcludeGame(GAME_SCENE_FREE);
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnEventSendGameScene(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbGameStatus, bool bSendSecret)
|
|||
|
|
{
|
|||
|
|
switch (cbGameStatus)
|
|||
|
|
{
|
|||
|
|
case GAME_SCENE_FREE: //<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_StatusFree StatusFree;
|
|||
|
|
ZeroMemory(&StatusFree,sizeof(StatusFree));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
StatusFree.lCellScore=m_pITableFrame->GetCellScore();
|
|||
|
|
|
|||
|
|
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
StatusFree.cbTimeOutCard=m_pGameCustomRule->cbTimeOutCard;
|
|||
|
|
StatusFree.cbTimeCallScore=m_pGameCustomRule->cbTimeCallScore;
|
|||
|
|
StatusFree.cbTimeStartGame=m_pGameCustomRule->cbTimeStartGame;
|
|||
|
|
StatusFree.cbTimeHeadOutCard=m_pGameCustomRule->cbTimeHeadOutCard;
|
|||
|
|
|
|||
|
|
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
tagHistoryScore * pHistoryScore=m_HistoryScore.GetHistoryScore(i);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
StatusFree.lTurnScore[i]=pHistoryScore->lTurnScore;
|
|||
|
|
StatusFree.lCollectScore[i]=pHistoryScore->lCollectScore;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
|
return m_pITableFrame->SendGameScene(pIServerUserItem,&StatusFree,sizeof(StatusFree));
|
|||
|
|
}
|
|||
|
|
case GAME_SCENE_CALL: //<2F>з<EFBFBD>״̬
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_StatusCall StatusCall;
|
|||
|
|
ZeroMemory(&StatusCall,sizeof(StatusCall));
|
|||
|
|
|
|||
|
|
//<2F><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>
|
|||
|
|
StatusCall.lCellScore=m_pITableFrame->GetCellScore();
|
|||
|
|
|
|||
|
|
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
StatusCall.cbTimeOutCard=m_pGameCustomRule->cbTimeOutCard;
|
|||
|
|
StatusCall.cbTimeCallScore=m_pGameCustomRule->cbTimeCallScore;
|
|||
|
|
StatusCall.cbTimeStartGame=m_pGameCustomRule->cbTimeStartGame;
|
|||
|
|
StatusCall.cbTimeHeadOutCard=m_pGameCustomRule->cbTimeHeadOutCard;
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>Ϣ
|
|||
|
|
StatusCall.wCurrentUser=m_wCurrentUser;
|
|||
|
|
StatusCall.cbBankerScore=m_cbBankerScore;
|
|||
|
|
CopyMemory(StatusCall.cbScoreInfo,m_cbScoreInfo,sizeof(m_cbScoreInfo));
|
|||
|
|
CopyMemory(StatusCall.cbHandCardData,m_cbHandCardData[wChairID],m_cbHandCardCount[wChairID]*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
StatusCall.bUserTrustee[i] = m_bUserTrustee[i];
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
tagHistoryScore * pHistoryScore=m_HistoryScore.GetHistoryScore(i);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
StatusCall.lTurnScore[i]=pHistoryScore->lTurnScore;
|
|||
|
|
StatusCall.lCollectScore[i]=pHistoryScore->lCollectScore;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
|
bool bSendResult = m_pITableFrame->SendGameScene(pIServerUserItem,&StatusCall,sizeof(StatusCall));
|
|||
|
|
|
|||
|
|
if(pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
if (CUserRight::IsGameCheatUser(pIServerUserItem->GetUserRight()))
|
|||
|
|
{
|
|||
|
|
OnCheatCard(pIServerUserItem);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return bSendResult;
|
|||
|
|
}
|
|||
|
|
case GAME_SCENE_PLAY: //<2F><>Ϸ״̬
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_StatusPlay StatusPlay;
|
|||
|
|
ZeroMemory(&StatusPlay,sizeof(StatusPlay));
|
|||
|
|
|
|||
|
|
//<2F><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>
|
|||
|
|
StatusPlay.lCellScore=m_pITableFrame->GetCellScore();
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
|
|||
|
|
StatusPlay.cbBombCount=m_cbBombCount;
|
|||
|
|
StatusPlay.wBankerUser=m_wBankerUser;
|
|||
|
|
StatusPlay.wCurrentUser=m_wCurrentUser;
|
|||
|
|
StatusPlay.cbBankerScore=m_cbBankerScore;
|
|||
|
|
|
|||
|
|
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
StatusPlay.cbTimeOutCard=m_pGameCustomRule->cbTimeOutCard;
|
|||
|
|
StatusPlay.cbTimeCallScore=m_pGameCustomRule->cbTimeCallScore;
|
|||
|
|
StatusPlay.cbTimeStartGame=m_pGameCustomRule->cbTimeStartGame;
|
|||
|
|
StatusPlay.cbTimeHeadOutCard=m_pGameCustomRule->cbTimeHeadOutCard;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
StatusPlay.wTurnWiner=m_wTurnWiner;
|
|||
|
|
StatusPlay.cbTurnCardCount=m_cbTurnCardCount;
|
|||
|
|
CopyMemory(StatusPlay.cbTurnCardData,m_cbTurnCardData,m_cbTurnCardCount*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|||
|
|
CopyMemory(StatusPlay.cbBankerCard,m_cbBankerCard,sizeof(m_cbBankerCard));
|
|||
|
|
CopyMemory(StatusPlay.cbHandCardCount,m_cbHandCardCount,sizeof(m_cbHandCardCount));
|
|||
|
|
CopyMemory(StatusPlay.cbHandCardData,m_cbHandCardData[wChairID],sizeof(BYTE)*m_cbHandCardCount[wChairID]);
|
|||
|
|
|
|||
|
|
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i=0;i<GAME_PLAYER;i++)
|
|||
|
|
{
|
|||
|
|
StatusPlay.bUserTrustee[i] = m_bUserTrustee[i];
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
tagHistoryScore * pHistoryScore=m_HistoryScore.GetHistoryScore(i);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
StatusPlay.lTurnScore[i]=pHistoryScore->lTurnScore;
|
|||
|
|
StatusPlay.lCollectScore[i]=pHistoryScore->lCollectScore;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
|
bool bSendResult = m_pITableFrame->SendGameScene(pIServerUserItem,&StatusPlay,sizeof(StatusPlay));
|
|||
|
|
|
|||
|
|
if(pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
if(CUserRight::IsGameCheatUser(pIServerUserItem->GetUserRight()))
|
|||
|
|
{
|
|||
|
|
OnCheatCard(pIServerUserItem);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return bSendResult;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ʱ<><CAB1><EFBFBD>¼<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnTimerMessage(DWORD wTimerID, WPARAM wBindParam)
|
|||
|
|
{
|
|||
|
|
if (!m_bOffLineTrustee)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (wTimerID == IDI_USER_OUT_TIME)
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_USER_OUT_TIME);
|
|||
|
|
|
|||
|
|
if (m_wCurrentUser == INVALID_CHAIR) return true;
|
|||
|
|
|
|||
|
|
bool bTrusteeUser = m_bUserTrustee[m_wCurrentUser];
|
|||
|
|
if ((!bTrusteeUser)&&(++m_aryOverTime[m_wCurrentUser] >= m_pGameCustomRule->cbOverTimeTrustee))
|
|||
|
|
{
|
|||
|
|
OnUserTrustee(m_wCurrentUser, true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BYTE cbGameStatus = m_pITableFrame->GetGameStatus();
|
|||
|
|
switch (cbGameStatus)
|
|||
|
|
{
|
|||
|
|
case GAME_SCENE_CALL:
|
|||
|
|
{
|
|||
|
|
if (m_cbBankerScore == 0)
|
|||
|
|
OnUserCallScore(m_wCurrentUser, 0x01);
|
|||
|
|
else
|
|||
|
|
OnUserCallScore(m_wCurrentUser, 0xFF);
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
case GAME_SCENE_PLAY:
|
|||
|
|
{
|
|||
|
|
if (m_cbTurnCardCount == 0)
|
|||
|
|
{
|
|||
|
|
tagSearchCardResult SearchCardResult;
|
|||
|
|
m_GameLogic.SearchOutCard(m_cbHandCardData[m_wCurrentUser], m_cbHandCardCount[m_wCurrentUser], NULL, 0, &SearchCardResult);
|
|||
|
|
if (SearchCardResult.cbCardCount > 0)
|
|||
|
|
{
|
|||
|
|
OnUserOutCard(m_wCurrentUser, SearchCardResult.cbResultCard[0], SearchCardResult.cbCardCount[0]);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
OnUserPassCard(m_wCurrentUser);
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnDataBaseMessage(WORD wRequestID, VOID * pData, WORD wDataSize)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnUserScroeNotify(WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>Ϸ<EFBFBD><CFB7>Ϣ
|
|||
|
|
bool CTableFrameSink::OnGameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
m_cbWaitTime=0;
|
|||
|
|
switch (wSubCmdID)
|
|||
|
|
{
|
|||
|
|
case SUB_C_CALL_SCORE: //<2F>û<EFBFBD><C3BB>з<EFBFBD>
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT(wDataSize==sizeof(CMD_C_CallScore));
|
|||
|
|
if (wDataSize!=sizeof(CMD_C_CallScore)) return false;
|
|||
|
|
|
|||
|
|
//״̬Ч<CCAC><D0A7>
|
|||
|
|
//ASSERT(m_pITableFrame->GetGameStatus()==GAME_SCENE_CALL);
|
|||
|
|
if (m_pITableFrame->GetGameStatus()!=GAME_SCENE_CALL) return true;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
//ASSERT(pIServerUserItem->GetUserStatus()==US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus()!=US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_C_CallScore * pCallScore=(CMD_C_CallScore *)pData;
|
|||
|
|
|
|||
|
|
//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
WORD wChairID=pIServerUserItem->GetChairID();
|
|||
|
|
return OnUserCallScore(wChairID,pCallScore->cbCallScore);
|
|||
|
|
}
|
|||
|
|
case SUB_C_OUT_CARD: //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_C_OutCard * pOutCard=(CMD_C_OutCard *)pData;
|
|||
|
|
WORD wHeadSize=sizeof(CMD_C_OutCard)-sizeof(pOutCard->cbCardData);
|
|||
|
|
|
|||
|
|
//Ч<><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT((wDataSize>=wHeadSize)&&(wDataSize==(wHeadSize+pOutCard->cbCardCount*sizeof(BYTE))));
|
|||
|
|
if ((wDataSize<wHeadSize)||(wDataSize!=(wHeadSize+pOutCard->cbCardCount*sizeof(BYTE)))) return false;
|
|||
|
|
|
|||
|
|
//״̬Ч<CCAC><D0A7>
|
|||
|
|
//ASSERT(m_pITableFrame->GetGameStatus()==GAME_SCENE_PLAY);
|
|||
|
|
if (m_pITableFrame->GetGameStatus()!=GAME_SCENE_PLAY) return true;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
//ASSERT(pIServerUserItem->GetUserStatus()==US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus()!=US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
WORD wChairID=pIServerUserItem->GetChairID();
|
|||
|
|
return OnUserOutCard(wChairID,pOutCard->cbCardData,pOutCard->cbCardCount);
|
|||
|
|
}
|
|||
|
|
case SUB_C_PASS_CARD: //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
{
|
|||
|
|
//״̬Ч<CCAC><D0A7>
|
|||
|
|
//ASSERT(m_pITableFrame->GetGameStatus()==GAME_SCENE_PLAY);
|
|||
|
|
if (m_pITableFrame->GetGameStatus()!=GAME_SCENE_PLAY) return true;
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD>Ч<EFBFBD><D0A7>
|
|||
|
|
//ASSERT(pIServerUserItem->GetUserStatus()==US_PLAYING);
|
|||
|
|
if (pIServerUserItem->GetUserStatus()!=US_PLAYING) return true;
|
|||
|
|
|
|||
|
|
//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
return OnUserPassCard(pIServerUserItem->GetChairID());
|
|||
|
|
}
|
|||
|
|
case SUB_C_TRUSTEE:
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
ASSERT(wDataSize==sizeof(CMD_C_TRUSTEE));
|
|||
|
|
if (wDataSize!=sizeof(CMD_C_TRUSTEE)) return false;
|
|||
|
|
|
|||
|
|
CMD_C_TRUSTEE* pCTrustee = (CMD_C_TRUSTEE*)pData;
|
|||
|
|
|
|||
|
|
WORD wChairID = pIServerUserItem->GetChairID();
|
|||
|
|
if (!pCTrustee->bTrustee)
|
|||
|
|
{
|
|||
|
|
m_aryOverTime[wChairID] = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return OnUserTrustee(wChairID, pCTrustee->bTrustee);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
bool CTableFrameSink::OnFrameMessage(WORD wSubCmdID, VOID * pData, WORD wDataSize, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
void CTableFrameSink::ResetPrivateEndInfo()
|
|||
|
|
{
|
|||
|
|
ZeroMemory(&m_PrivateEndInfo, sizeof(CMD_S_Private_End_Info));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
|||
|
|
void CTableFrameSink::GetPrivateEndInfo(DataStream &kDataStream, bool bSend)
|
|||
|
|
{
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
// <20>ܻ<EFBFBD><DCBB><EFBFBD>
|
|||
|
|
IServerUserItem* pServerUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
if (pServerUserItem)
|
|||
|
|
{
|
|||
|
|
m_PrivateEndInfo.lAllScore[i] = pServerUserItem->GetUserScore();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_PrivateEndInfo.StreamValue(kDataStream, bSend);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ж<EFBFBD>˽<EFBFBD>˳<EFBFBD><CBB3>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::IsPrivateEnd()
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pITableFrame != nullptr);
|
|||
|
|
if (m_pITableFrame == nullptr) return false;
|
|||
|
|
|
|||
|
|
tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
tagPrivateFrameRecordInfo* pPrivateRecord = m_pITableFrame->GetPrivateFrameRecord();
|
|||
|
|
|
|||
|
|
if ((pPrivateFrame == nullptr) || (pPrivateRecord == nullptr)) return false;
|
|||
|
|
|
|||
|
|
if (pPrivateFrame->cbGameCout <= pPrivateRecord->cbFinishCout)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool CTableFrameSink::IsHasGameRule(eDDZRuleEnum eType)
|
|||
|
|
{
|
|||
|
|
ASSERT(m_pITableFrame != nullptr);
|
|||
|
|
if (m_pITableFrame == nullptr) return false;
|
|||
|
|
|
|||
|
|
const tagPrivateFrameParameter* pPrivateFrame = m_pITableFrame->GetPrivateFrameInfo();
|
|||
|
|
if (nullptr == pPrivateFrame) return false;
|
|||
|
|
return (pPrivateFrame->dwGameRule & eType)>0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnActionUserOffLine(WORD wChairID, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
if(m_bOffLineTrustee && wChairID == m_wCurrentUser)
|
|||
|
|
{
|
|||
|
|
IsOfflineTrustee();
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnActionUserConnect(WORD wChairID, IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
if(m_bOffLineTrustee)
|
|||
|
|
{
|
|||
|
|
if (((m_pGameServiceOption->wServerType&GAME_GENRE_MATCH)!=0)&&(pIServerUserItem->GetChairID()==m_wCurrentUser))
|
|||
|
|
{
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_USER_OUT_TIME);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnActionUserSitDown(WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser)
|
|||
|
|
{
|
|||
|
|
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
|
if (bLookonUser==false)
|
|||
|
|
{
|
|||
|
|
ASSERT(wChairID!=INVALID_CHAIR);
|
|||
|
|
m_HistoryScore.OnEventUserEnter(wChairID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnActionUserStandUp(WORD wChairID, IServerUserItem * pIServerUserItem, bool bLookonUser)
|
|||
|
|
{
|
|||
|
|
//<2F><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
|
if (bLookonUser==false)
|
|||
|
|
{
|
|||
|
|
ASSERT(wChairID!=INVALID_CHAIR);
|
|||
|
|
m_HistoryScore.OnEventUserLeave(wChairID);
|
|||
|
|
}
|
|||
|
|
m_bUserTrustee[wChairID] = false;
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>й<EFBFBD>;
|
|||
|
|
bool CTableFrameSink::OnUserTrustee(WORD wChairID, bool bTrustee)
|
|||
|
|
{
|
|||
|
|
CMD_S_TRUSTEE pSTrustee;
|
|||
|
|
pSTrustee.wTrusteeUser = wChairID;
|
|||
|
|
pSTrustee.bTrustee = bTrustee;
|
|||
|
|
|
|||
|
|
m_bUserTrustee[wChairID] = bTrustee;
|
|||
|
|
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_TRUSTEE, &pSTrustee, sizeof(CMD_S_TRUSTEE));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_TRUSTEE, &pSTrustee, sizeof(CMD_S_TRUSTEE));
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnUserPassCard(WORD wChairID)
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7>״̬
|
|||
|
|
ASSERT((wChairID==m_wCurrentUser)&&(m_cbTurnCardCount!=0));
|
|||
|
|
if ((wChairID!=m_wCurrentUser)||(m_cbTurnCardCount==0)) return true;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
m_wCurrentUser=(m_wCurrentUser+1)%GAME_PLAYER;
|
|||
|
|
if (m_wCurrentUser == m_wTurnWiner)
|
|||
|
|
{
|
|||
|
|
m_cbTurnCardCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
CMD_S_PassCard PassCard;
|
|||
|
|
PassCard.wPassCardUser=wChairID;
|
|||
|
|
PassCard.wCurrentUser=m_wCurrentUser;
|
|||
|
|
PassCard.cbTurnOver=(m_cbTurnCardCount==0)?TRUE:FALSE;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_PASS_CARD,&PassCard,sizeof(PassCard));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_PASS_CARD,&PassCard,sizeof(PassCard));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_PASS_CARD, &PassCard, sizeof(PassCard));
|
|||
|
|
|
|||
|
|
IsOfflineTrustee();
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB>з<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnUserCallScore(WORD wChairID, BYTE cbCallScore)
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7>״̬
|
|||
|
|
ASSERT(wChairID==m_wCurrentUser);
|
|||
|
|
if (wChairID!=m_wCurrentUser) return true;
|
|||
|
|
|
|||
|
|
//Ч<><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
//ASSERT(((cbCallScore>=1)&&(cbCallScore<=3)&&(cbCallScore>m_cbBankerScore))||(cbCallScore==255));
|
|||
|
|
if (((cbCallScore<1)||(cbCallScore>3)||(cbCallScore<=m_cbBankerScore))&&(cbCallScore!=255))
|
|||
|
|
cbCallScore = 255;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
if (cbCallScore!=0xFF)
|
|||
|
|
{
|
|||
|
|
m_cbBankerScore=cbCallScore;
|
|||
|
|
m_wBankerUser=m_wCurrentUser;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ýз<C3BD>
|
|||
|
|
m_cbScoreInfo[wChairID]=cbCallScore;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
if ((m_cbBankerScore==3)||(m_wFirstUser==(wChairID+1)%GAME_PLAYER))
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser=INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser=(wChairID+1)%GAME_PLAYER;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_CallScore CallScore;
|
|||
|
|
CallScore.wCallScoreUser=wChairID;
|
|||
|
|
CallScore.wCurrentUser=m_wCurrentUser;
|
|||
|
|
CallScore.cbUserCallScore=cbCallScore;
|
|||
|
|
CallScore.cbCurrentScore=m_cbBankerScore;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_CALL_SCORE,&CallScore,sizeof(CallScore));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_CALL_SCORE,&CallScore,sizeof(CallScore));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD>û<EFBFBD><C3BB>з<EFBFBD><D0B7><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_CALL_SCORE, &CallScore, sizeof(CallScore));
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD>ж<EFBFBD>
|
|||
|
|
if ((m_cbBankerScore==3)||(m_wFirstUser==(wChairID+1)%GAME_PLAYER))
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD>˽з<CBBD>
|
|||
|
|
if ( m_cbBankerScore == 0 )
|
|||
|
|
{
|
|||
|
|
//if ((m_pGameServiceOption->wServerType&GAME_GENRE_MATCH)==0)
|
|||
|
|
//{
|
|||
|
|
// if(m_cbCallScoreCount<2)
|
|||
|
|
// {
|
|||
|
|
// m_cbCallScoreCount++;
|
|||
|
|
// return OnEventGameStart();
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
if (TRUE==m_pGameCustomRule->cbAllNotCallResend)
|
|||
|
|
{
|
|||
|
|
return OnEventGameStart();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_wBankerUser=m_wFirstUser;
|
|||
|
|
m_cbBankerScore=1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
m_pITableFrame->SetGameStatus(GAME_SCENE_PLAY);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
if (m_cbBankerScore==0) m_cbBankerScore=1;
|
|||
|
|
if (m_wBankerUser==INVALID_CHAIR) m_wBankerUser=m_wFirstUser;
|
|||
|
|
m_cbCallScoreCount=0;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD>
|
|||
|
|
m_cbHandCardCount[m_wBankerUser]+=CountArray(m_cbBankerCard);
|
|||
|
|
CopyMemory(&m_cbHandCardData[m_wBankerUser][NORMAL_COUNT],m_cbBankerCard,sizeof(m_cbBankerCard));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
|||
|
|
m_GameLogic.SortCardList(m_cbHandCardData[m_wBankerUser],m_cbHandCardCount[m_wBankerUser],ST_ORDER);
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
m_wTurnWiner=m_wBankerUser;
|
|||
|
|
m_wCurrentUser=m_wBankerUser;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
CMD_S_BankerInfo BankerInfo;
|
|||
|
|
BankerInfo.wBankerUser=m_wBankerUser;
|
|||
|
|
BankerInfo.wCurrentUser=m_wCurrentUser;
|
|||
|
|
BankerInfo.cbBankerScore=m_cbBankerScore;
|
|||
|
|
CopyMemory(BankerInfo.cbBankerCard,m_cbBankerCard,sizeof(m_cbBankerCard));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_BANKER_INFO,&BankerInfo,sizeof(BankerInfo));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_BANKER_INFO,&BankerInfo,sizeof(BankerInfo));
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD>û<EFBFBD><C3BB>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_BANKER_INFO, &BankerInfo, sizeof(BankerInfo));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
IsOfflineTrustee();
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnUserOutCard(WORD wChairID, BYTE cbCardData[], BYTE cbCardCount)
|
|||
|
|
{
|
|||
|
|
//Ч<><D0A7>״̬
|
|||
|
|
ASSERT(wChairID==m_wCurrentUser);
|
|||
|
|
if (wChairID!=m_wCurrentUser) return true;
|
|||
|
|
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
|
BYTE cbCardType=m_GameLogic.GetCardType(cbCardData,cbCardCount);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
if (cbCardType==CT_ERROR)
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
if (m_cbTurnCardCount!=0)
|
|||
|
|
{
|
|||
|
|
//<2F>Ա<EFBFBD><D4B1>˿<EFBFBD>
|
|||
|
|
if (m_GameLogic.CompareCard(m_cbTurnCardData,cbCardData,m_cbTurnCardCount,cbCardCount)==false)
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//ɾ<><C9BE><EFBFBD>˿<EFBFBD>
|
|||
|
|
if (m_GameLogic.RemoveCardList(cbCardData,cbCardCount,m_cbHandCardData[wChairID],m_cbHandCardCount[wChairID])==false)
|
|||
|
|
{
|
|||
|
|
ASSERT(FALSE);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>
|
|||
|
|
m_cbOutCardCount[wChairID]++;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
|||
|
|
m_cbTurnCardCount=cbCardCount;
|
|||
|
|
m_cbHandCardCount[wChairID]-=cbCardCount;
|
|||
|
|
CopyMemory(m_cbTurnCardData,cbCardData,sizeof(BYTE)*cbCardCount);
|
|||
|
|
|
|||
|
|
//ը<><D5A8><EFBFBD>ж<EFBFBD>
|
|||
|
|
if ((cbCardType==CT_BOMB_CARD)||(cbCardType==CT_MISSILE_CARD))
|
|||
|
|
{
|
|||
|
|
m_cbBombCount++;
|
|||
|
|
m_cbEachBombCount[wChairID]++;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>л<EFBFBD><D0BB>û<EFBFBD>
|
|||
|
|
m_wTurnWiner=wChairID;
|
|||
|
|
if (m_cbHandCardCount[wChairID]!=0)
|
|||
|
|
{
|
|||
|
|
if (cbCardType!=CT_MISSILE_CARD)
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser=(m_wCurrentUser+1)%GAME_PLAYER;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
m_wCurrentUser = INVALID_CHAIR;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
CMD_S_OutCard OutCard;
|
|||
|
|
OutCard.wOutCardUser=wChairID;
|
|||
|
|
OutCard.cbCardCount=cbCardCount;
|
|||
|
|
OutCard.wCurrentUser=m_wCurrentUser;
|
|||
|
|
CopyMemory(OutCard.cbCardData,m_cbTurnCardData,m_cbTurnCardCount*sizeof(BYTE));
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
WORD wHeadSize=sizeof(OutCard)-sizeof(OutCard.cbCardData);
|
|||
|
|
WORD wSendSize=wHeadSize+OutCard.cbCardCount*sizeof(BYTE);
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_OUT_CARD,&OutCard,wSendSize);
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_OUT_CARD,&OutCard,wSendSize);
|
|||
|
|
|
|||
|
|
// <20><>¼<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ;
|
|||
|
|
addGameRecordAction(SUB_S_OUT_CARD, &OutCard, wSendSize);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (cbCardType == CT_MISSILE_CARD)
|
|||
|
|
{
|
|||
|
|
m_cbTurnCardCount = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
if (m_wCurrentUser == INVALID_CHAIR)
|
|||
|
|
{
|
|||
|
|
OnEventGameConclude(wChairID, NULL, GER_NORMAL);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
IsOfflineTrustee();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
|
|||
|
|
bool CTableFrameSink::OnCheatCard(IServerUserItem * pIServerUserItem)
|
|||
|
|
{
|
|||
|
|
if(m_pServerControl)
|
|||
|
|
{
|
|||
|
|
CMD_S_CheatCard CheatCard ;
|
|||
|
|
ZeroMemory(&CheatCard, sizeof(CheatCard));
|
|||
|
|
|
|||
|
|
for(WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
CheatCard.wCardUser[CheatCard.cbUserCount] = i;
|
|||
|
|
CheatCard.cbCardCount[CheatCard.cbUserCount] = m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(CheatCard.cbCardData[CheatCard.cbUserCount++],m_cbHandCardData[i],sizeof(BYTE)*m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
//WB<57><42> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BUG
|
|||
|
|
//m_pITableFrame->SendTableData(wChairID,SUB_S_CHEAT_CARD,&CheatCard,sizeof(CheatCard));
|
|||
|
|
//m_pITableFrame->SendLookonData(wChairID,SUB_S_CHEAT_CARD,&CheatCard,sizeof(CheatCard));
|
|||
|
|
m_pServerControl->ServerControl(&CheatCard, m_pITableFrame, pIServerUserItem);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
void CTableFrameSink::SendCheatCard()
|
|||
|
|
{
|
|||
|
|
if(m_pServerControl)
|
|||
|
|
{
|
|||
|
|
CMD_S_CheatCard CheatCard ;
|
|||
|
|
ZeroMemory(&CheatCard, sizeof(CheatCard));
|
|||
|
|
|
|||
|
|
for(WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
CheatCard.wCardUser[CheatCard.cbUserCount] = i;
|
|||
|
|
CheatCard.cbCardCount[CheatCard.cbUserCount] = m_cbHandCardCount[i];
|
|||
|
|
CopyMemory(CheatCard.cbCardData[CheatCard.cbUserCount++],m_cbHandCardData[i],sizeof(BYTE)*m_cbHandCardCount[i]);
|
|||
|
|
}
|
|||
|
|
m_pServerControl->ServerControl(&CheatCard, m_pITableFrame);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
|||
|
|
void CTableFrameSink::SetGameBaseScore(LONG lBaseScore)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_SET_BASESCORE,&lBaseScore,sizeof(lBaseScore));
|
|||
|
|
m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_SET_BASESCORE,&lBaseScore,sizeof(lBaseScore));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>Ƿ<EFBFBD><C7B7>й<EFBFBD>
|
|||
|
|
bool CTableFrameSink::IsOfflineTrustee()
|
|||
|
|
{
|
|||
|
|
////<2F>DZ<EFBFBD><C7B1><EFBFBD>ģʽ
|
|||
|
|
//if((m_pGameServiceOption->wServerType&GAME_GENRE_MATCH)==0) return false;
|
|||
|
|
//<2F>dz<EFBFBD><C7B3><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
|
if(m_wCurrentUser==INVALID_CHAIR) return false;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (m_bOffLineTrustee)
|
|||
|
|
{
|
|||
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʱ<EFBFBD><CAB1>
|
|||
|
|
m_pITableFrame->KillGameTimer(IDI_USER_OUT_TIME);
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
bool bTrusteeUser = m_bUserTrustee[m_wCurrentUser];
|
|||
|
|
DWORD dwTimerTime=3;
|
|||
|
|
|
|||
|
|
if (bTrusteeUser==true)
|
|||
|
|
{
|
|||
|
|
dwTimerTime+=(rand()%3);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
BYTE cbGameStatus=m_pITableFrame->GetGameStatus();
|
|||
|
|
if (cbGameStatus==GAME_SCENE_CALL)
|
|||
|
|
{
|
|||
|
|
dwTimerTime=m_pGameCustomRule->cbTimeCallScore;
|
|||
|
|
}
|
|||
|
|
if (cbGameStatus==GAME_SCENE_PLAY)
|
|||
|
|
{
|
|||
|
|
if (m_cbTurnCardCount==0)
|
|||
|
|
dwTimerTime=m_pGameCustomRule->cbTimeHeadOutCard;
|
|||
|
|
else
|
|||
|
|
dwTimerTime=m_pGameCustomRule->cbTimeOutCard;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
dwTimerTime+=(rand()%3+5);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
m_pITableFrame->SetGameTimer(IDI_USER_OUT_TIME,dwTimerTime*1000,-1,NULL);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/////////////////////////////// <20><>Ϸ¼<CFB7><C2BC> ///////////////////////////////////////////
|
|||
|
|
|
|||
|
|
void CTableFrameSink::addGameRecordAction(WORD wSubCmdID, void* pSubMessage, int nMessageSize)
|
|||
|
|
{
|
|||
|
|
tagGameRecordOperateResult kOperateRecord;
|
|||
|
|
kOperateRecord.wSubCmdID = wSubCmdID;
|
|||
|
|
kOperateRecord.subMessageData.pushValue(pSubMessage, nMessageSize);
|
|||
|
|
m_kGameRecord.actionVec.push_back(kOperateRecord);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void CTableFrameSink::starGameRecord()
|
|||
|
|
{
|
|||
|
|
m_kGameRecord = tagGameRecord();
|
|||
|
|
|
|||
|
|
m_kGameRecord.wBankerUser = m_wBankerUser;
|
|||
|
|
m_kGameRecord.wEastUser = 0;
|
|||
|
|
|
|||
|
|
for (WORD i = 0; i < GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
IServerUserItem* pUserItem = m_pITableFrame->GetTableUserItem(i);
|
|||
|
|
tagUserInfo* pUserInfo = pUserItem->GetUserInfo();
|
|||
|
|
if (pUserItem == NULL || NULL == pUserInfo)
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
tagGameRecordPlayer kReocrdPlayer;
|
|||
|
|
kReocrdPlayer.dwUserID = pUserItem->GetUserID();
|
|||
|
|
kReocrdPlayer.dwGameID = pUserItem->GetGameID();
|
|||
|
|
kReocrdPlayer.wChairID = pUserItem->GetChairID();
|
|||
|
|
kReocrdPlayer.cbSex = pUserItem->GetGender();
|
|||
|
|
kReocrdPlayer.lScore = pUserItem->GetUserScore();
|
|||
|
|
kReocrdPlayer.strHead = pUserInfo->szHeadHttp;
|
|||
|
|
kReocrdPlayer.strNickName = pUserItem->GetNickName();
|
|||
|
|
|
|||
|
|
for (BYTE j = 0; j < NORMAL_COUNT; j++)
|
|||
|
|
{
|
|||
|
|
kReocrdPlayer.cbCardData.push_back(m_cbHandCardData[i][j]);
|
|||
|
|
}
|
|||
|
|
m_kGameRecord.playersVec.push_back(kReocrdPlayer);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|