Beispiel #1
0
void CTableFrameSink::CountDownTime( WORD wChairID , bool bKill/*=false*/ )
{
	if(bKill)
	{
		if(wChairID == INVALID_CHAIR)
		{
			for (int i=0; i<GAME_PLAYER ;i++)
			{
				IServerUserItem *pServerUserItem = m_pITableFrame->GetServerUserItem(i);
				if(pServerUserItem == NULL) continue;
				m_pITableFrame->KillGameTimer(IDI_COUNTDOWN+i);
			}
		}
		else
		{
			m_pITableFrame->KillGameTimer(IDI_COUNTDOWN+wChairID);
		}
	}
	else
	{
		BYTE cbLeaveTime = TIME_LESS;
		if(m_pITableFrame->GetGameStatus() == GS_FREE)
		{
			cbLeaveTime = TIME_LESS+10;
		}
		else if(m_pITableFrame->GetGameStatus() == GS_OX_PLAY)
		{
			cbLeaveTime = TIME_LESS*2;
		}

		if(wChairID != INVALID_CHAIR)
		{
			IServerUserItem *pServerUserItem = m_pITableFrame->GetServerUserItem(wChairID);
			ASSERT(pServerUserItem != NULL);
			if(pServerUserItem!=NULL && pServerUserItem->GetUserStatus() == US_OFFLINE)
			{
				cbLeaveTime = TIME_OFFLINE;
			}
			m_pITableFrame->SetGameTimer(IDI_COUNTDOWN+wChairID , cbLeaveTime*1000 , 1 , 0);
		}
		else
		{
			for(int i=0 ; i<GAME_PLAYER; i++)
			{
				IServerUserItem *pServerUserItem = m_pITableFrame->GetServerUserItem(i);
				if(pServerUserItem == NULL) continue;
				if(pServerUserItem->GetUserStatus() == US_OFFLINE)
				{
					cbLeaveTime = TIME_OFFLINE;
				}
				m_pITableFrame->SetGameTimer(IDI_COUNTDOWN+i , cbLeaveTime*1000 , 1 , 0);
			}
		}

	}
	m_pITableFrame->KillGameTimer(IDI_CONCLUDEGAME);
	m_pITableFrame->SetGameTimer(IDI_CONCLUDEGAME,60*1000,1,0);
}
Beispiel #2
0
bool CTableFrameSink::OnHurryCard( WORD wChairID , WORD cbWords )
{
	CMD_S_HurryCard hurryCard;
	ZeroMemory(&hurryCard ,sizeof(hurryCard));
	hurryCard.wCurrentUser = wChairID;
	hurryCard.cbWords = cbWords;
	for (INT i=0 ; i<GAME_PLAYER; i++)
	{
		IServerUserItem *pServerItem = m_pITableFrame->GetServerUserItem(i);
		if(pServerItem == NULL || pServerItem->IsAndroidUser()) continue;
		m_pITableFrame->SendTableData(i , SUB_S_HURRY_CARD , &hurryCard , sizeof(CMD_S_HurryCard));
	}	
	return true;
}
Beispiel #3
0
void CTableFrameSink::CheckXijin()
{
	for (int i=0; i<GAME_PLAYER; i++)
	{
		IServerUserItem * pIServerUserItem = m_pITableFrame->GetServerUserItem(i);
		if (pIServerUserItem == NULL || pIServerUserItem->IsAndroidUser()) continue;
		if(m_GameLogic.GetBestCardType(m_cbHandCardData[i], MAX_COUNT) >= 10)
		{
			m_oLog.Log("玩家[%s]获得喜金座位[%d]身上携带筹码[%d]获得奖励元宝数[%d]",pIServerUserItem->GetAccounts(), pIServerUserItem->GetChairID(), pIServerUserItem->GetUserScore()->lBodyChip, m_lLikeIngot);
			m_pITableFrame->SendTableData(i,SUB_S_XIJIN,NULL,0);
			m_pITableFrame->WriteUserTask(i,1,1,m_lLikeIngot);
		}
	}
}
Beispiel #4
0
bool CTableFrameSink::CheckUserContribution( WORD wChairID , LONGLONG lBuffer )
{
	IServerUserItem *pServerUserItem = m_pITableFrame->GetServerUserItem(wChairID) ;
	if(pServerUserItem == NULL) return false;
	if(pServerUserItem->IsAndroidUser()) return false;
	const tagUserScore *pUserScore = pServerUserItem->GetUserScore();

	if(pUserScore->lInfullContribution/200 < lBuffer || pUserScore->lIngotContribution/200 < lBuffer)
	{
		m_oLog.LogWithoutTimeMark("检查元宝贡献度:%s 充值贡献度%I64d/200 元宝贡献度%I64d/200 元宝累计%I64d 不满足",pServerUserItem->GetNickName(),pUserScore->lInfullContribution ,pUserScore->lIngotContribution, lBuffer);
		return false;
	}
	m_oLog.LogWithoutTimeMark("检查元宝贡献度:%s 充值贡献度%I64d/200 元宝贡献度%I64d/200 元宝累计%I64d 满足",pServerUserItem->GetNickName(),pUserScore->lInfullContribution ,pUserScore->lIngotContribution, lBuffer);
	return true;
}
//每局游戏开始时刻,计算各区域初始可下分值
bool __cdecl CTableFrameSink::CalculateAreaInitLimite()
{
	//初始化变量
	__int64 iBankerScore = 0;
	IServerUserItem * pIBankerServerUserItem = NULL;

	//有人做庄,获得庄家信息
	if( INVALID_CHAIR != m_wCurrentBanker )
	{
		pIBankerServerUserItem = m_pITableFrame->GetServerUserItem(m_wCurrentBanker);
		if( pIBankerServerUserItem == NULL )
			return FALSE;

		//获得庄家当前的积分(金币)
		iBankerScore = pIBankerServerUserItem->GetUserScore()->lScore;

		//根据庄家金币数量,计算各区域的初始化可下分
		for( int i=0; i<JETTON_AREA_COUNT; i++ )
			m_iAreaScoreLimit[i] = __min(iBankerScore/(m_iOddsArray[i]+1), m_iMaxAreaScore);
	}
	else //如果无人做庄
	{
		if( m_bEnableSysBanker ) //如果允许系统做庄
		{
			for( int i=0; i<JETTON_AREA_COUNT; i++ )
			{
				if( i%2 == 0 )
				{
					m_iAreaScoreLimit[i] = __min( m_iSysLimitScore/(m_iOddsArray[i]/m_iOddsArray[i+1]), m_iMaxAreaScore);
				}
				else
				{
					m_iAreaScoreLimit[i] = m_iSysLimitScore;	//如果是低倍率区域,则该区域的限注为配置文件指定的限额
				}
			}
		}
		else
		{
			return FALSE;
		}
	}
	return TRUE;
}
Beispiel #6
0
bool CTableFrameSink::OnExchangeChip( WORD wChairID, LONGLONG lChip )
{
	IServerUserItem *pIServerUserItem = m_pITableFrame->GetServerUserItem(wChairID);
	LONGLONG lScore;

	if (GAME_GENRE_GOLD == m_pGameServiceOption->wServerType)//欢乐豆筹码
	{
		lScore = pIServerUserItem->GetUserScore()->lBodySilverScore - 10000;
	}
	else if (GAME_GENRE_SCORE_CHIP == m_pGameServiceOption->wServerType)//灵珠筹码
	{
		lScore = pIServerUserItem->GetUserScore()->lBodyScore;
	}
	else
	{
		m_pITableFrame->SendGameMessage(pIServerUserItem, "房间类型错误,请联系在线客服解决此问题!", SMT_CLOSE_GAME|SMT_EJECT|SMT_INFO);
		return false;
	}

	for (int i=MAX_CHIP_COUNT-1; i>=0; i--)
	{
		if (lChip >= m_lChipNum[i])
		{
			if (lScore < lChip*m_pGameServiceOption->lCellScore + lChip*m_pGameServiceOption->lCellScore*m_lPercentage[i]/100)
			{
				char szBuf[100];
				sprintf_s(szBuf, 100 , "您所带的游戏币不足以兑换%I64d筹码!", lChip);
				m_pITableFrame->SendGameMessage(pIServerUserItem, szBuf, SMT_CLOSE_GAME|SMT_EJECT|SMT_INFO);
				return false;
			}
			else
			{
				m_pITableFrame->SendExchangeChip(pIServerUserItem, lChip+lChip*m_lPercentage[i]/100);
				m_pITableFrame->WriteUserScore(pIServerUserItem, -(lChip*m_lPercentage[i]/100), 0, enScoreKind_Service);
				m_pITableFrame->SendTableData(wChairID,SUB_S_EX_CHIP);
				return true;
			}
		}
	}
	return true;
}
Beispiel #7
0
//游戏开始
void CTableFrameSink::GameStart()
{
	m_oLog.Log("//////-------游戏开始--------////////");
	for(int i=0; i<GAME_PLAYER; i++)
	{
		IServerUserItem * pIServerUserItem = m_pITableFrame->GetServerUserItem(i);
		if (pIServerUserItem == NULL) continue;
		if (!pIServerUserItem->IsAndroidUser())
		{
			m_oLog.Log("玩家[%s] 带入筹码[%I64d]" , pIServerUserItem->GetAccounts() , pIServerUserItem->GetUserScore()->lBodyChip);
		}
	}
	CountDownTime(INVALID_CHAIR);
 	CMD_S_GameStart GameStart;
	ZeroMemory(&GameStart,sizeof(GameStart));
	//强发聚宝盆
	//m_oLog.Log("强发状态:%s",m_bMeetConditions?"已经进行过强发,还未清除状态不能强发!":"未进行过强发,可以强发!");
	bool bSuccess = false;//= ForceDispathCard();
	//m_oLog.Log("1");
	while (!bSuccess)
	{
		//m_oLog.Log("2");
		bSuccess = DispathCard();
	}
	
	//随机喜金牌
	ZeroMemory(m_cbRewardCardData,sizeof(m_cbRewardCardData));
	for (int i=0; i<GAME_PLAYER; i++)
	{
		if (m_cbPlayStatus[i] == FALSE) continue;
		m_GameLogic.RandCardList(m_cbRewardCardData[i],MAX_COUNT);
	}
	
	//测试配牌
 	if (m_bCheat)
 	{
 		for (int i=0; i<GAME_PLAYER; i++)
 		{
 			if (m_cbCheatCardData[i][0] == 0)continue;
 			CopyMemory(m_cbHandCardData[i], m_cbCheatCardData[i],MAX_COUNT);
 	
 		}
 		for (int i=0; i<GAME_PLAYER; i++)
 		{
 			if (m_cbCheatRewardCard[i][0] ==0)continue;
 			{
 				CopyMemory(m_cbRewardCardData[i], m_cbCheatRewardCard[i], MAX_COUNT);
 			}
 		}
 	}

	m_oLog.Log("原始手牌:");

	for(int i=0; i<GAME_PLAYER; i++)
	{
		//获取用户
		IServerUserItem *pIServerUser=m_pITableFrame->GetServerUserItem(i);
		if(pIServerUser==NULL) continue;
		m_oLog.Log("%s手牌:[%s%s][%s%s][%s%s][%s%s][%s%s]---牌型为[%s]",pIServerUser->GetUserData()->szAccounts,cn(m_cbHandCardData[i][0]),vn(m_cbHandCardData[i][0]),
			cn(m_cbHandCardData[i][1]),vn(m_cbHandCardData[i][1]),cn(m_cbHandCardData[i][2]),vn(m_cbHandCardData[i][2]),cn(m_cbHandCardData[i][3]),vn(m_cbHandCardData[i][3]),
			cn(m_cbHandCardData[i][4]),vn(m_cbHandCardData[i][4]),CardTypeName(m_GameLogic.GetBestCardType(m_cbHandCardData[i],MAX_COUNT)));
	}
	
	m_oContral.ControlDispath(m_cbHandCardData, m_cbPlayStatus);

	m_oLog.Log("控制后手牌:");

	for(int i=0; i<GAME_PLAYER; i++)
	{
		//获取用户
		IServerUserItem *pIServerUser=m_pITableFrame->GetServerUserItem(i);
		if(pIServerUser==NULL) continue;
		m_oLog.Log("%s手牌:[%s%s][%s%s][%s%s][%s%s][%s%s]---牌型为[%s]",pIServerUser->GetUserData()->szAccounts,cn(m_cbHandCardData[i][0]),vn(m_cbHandCardData[i][0]),
			cn(m_cbHandCardData[i][1]),vn(m_cbHandCardData[i][1]),cn(m_cbHandCardData[i][2]),vn(m_cbHandCardData[i][2]),cn(m_cbHandCardData[i][3]),vn(m_cbHandCardData[i][3]),
			cn(m_cbHandCardData[i][4]),vn(m_cbHandCardData[i][4]),CardTypeName(m_GameLogic.GetBestCardType(m_cbHandCardData[i],MAX_COUNT)));
	}
// 	
	//发送扑克
	for (WORD i=0;i<m_wPlayerCount;i++)
	{
		if(m_cbPlayStatus[i]==FALSE)continue;
		
		CopyMemory(GameStart.cbPlayStatus, m_cbPlayStatus,sizeof(m_cbPlayStatus));
		//派发扑克
		CopyMemory(GameStart.cbCardData[i],m_cbHandCardData[i],MAX_COUNT);
		std::random_shuffle(GameStart.cbCardData[i], GameStart.cbCardData[i]+MAX_COUNT);
		//派发喜金扑克
		CopyMemory(GameStart.cbRewardCardData[i], m_cbRewardCardData[i],MAX_COUNT);
		//发送数据
		m_pITableFrame->SendTableData(i,SUB_S_GAME_START,&GameStart,sizeof(GameStart));
		ZeroMemory(GameStart.cbCardData, sizeof(GameStart.cbCardData));
	}


	m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_START,&GameStart,sizeof(GameStart));


}
Beispiel #8
0
void CTableFrameSink::WriteScore()
{
	m_dwOverTime = GetTickCount();
	DWORD temp_dwPlayTime = (m_dwOverTime - m_dwJettonTime)/1000;
	m_pITableFrame->KillGameTimer(IDI_WRITESCORE);
	//SendTaskIngot();

	for (int i=0; i<GAME_PLAYER; i++)
	{
		if(m_cbPlayStatus[i] == FALSE) continue;
		m_lTotalWinScore[i] = m_lUserWinScore[i] - m_lDeskPay;
	}
	
	//聚宝盆
	//SendTaskIngot();
	LONGLONG lTotalRevenue = 0;
	for (WORD i=0;i<GAME_PLAYER;i++)
	{
		if (m_lTotalWinScore[i] != 0)
		{
			enScoreKind nScoreKind = enScoreKind_Draw;
			nScoreKind = (m_lUserWinScore[i] > 0 )?enScoreKind_Win:enScoreKind_Lost;
			IServerUserItem * pIServerUserItem = m_pITableFrame->GetServerUserItem(i);
			if(pIServerUserItem)
			{
				m_oLog.Log("玩家[%s] 写入积分[%I64d]" , pIServerUserItem->GetUserData()->szAccounts , m_lTotalWinScore[i]);
				if(!pIServerUserItem->IsAndroidUser())
				{
					lTotalRevenue += m_lUserRevenue[i];

					LONGLONG temp_SysEat=0;
					temp_SysEat += m_lDeskPay;
					if (m_lUserWinScore[i] < 0)
					{
						temp_SysEat += ((-m_lUserWinScore[i])*m_cbEateRate /100);
					}

					//写入积分
					m_pITableFrame->WriteUserScore(i,m_lTotalWinScore[i],m_lUserRevenue[i],nScoreKind,temp_dwPlayTime,temp_SysEat,m_lMinbet);

				}
				else
				{
					//写入积分
					m_pITableFrame->WriteUserScore(i,m_lTotalWinScore[i],m_lUserRevenue[i],nScoreKind);
				}


			}
		}						 
	}

	for(int i=0; i<GAME_PLAYER; i++)
	{
		IServerUserItem * pIServerUserItem = m_pITableFrame->GetServerUserItem(i);
		if (pIServerUserItem == NULL) continue;
		if (!pIServerUserItem->IsAndroidUser())
		{
			m_oLog.Log("玩家[%s] 身上剩余[%I64d]" , pIServerUserItem->GetAccounts() , pIServerUserItem->GetUserScore()->lBodyChip);
		}
	}
	m_oLog.Log("将要写入放分池的系统输赢分[%I64d]" , m_lSysWinScore);
	//系统输赢放入放分池
	m_oContral.ChangeBuffer(m_lSysWinScore);
	//放入聚宝盆
// 	if (m_lSysWinScore > 0)
// 	{
// 		AddBuffer(0,m_lSysWinScore*m_cbBufferRate/100);
// 	}

	
	if(lTotalRevenue > 0)
	{
		// 		AddBuffer(BIG_BUFFER , lTotalRevenue);
		// 		AddBuffer(SMALL_BUFFER , lTotalRevenue);
	}

	//设置文件名
	TCHAR szPath[MAX_PATH]=TEXT("");
	TCHAR szConfigFileName[MAX_PATH]=TEXT("");
	GetCurrentDirectory(sizeof(szPath),szPath);
	_snprintf_s(szConfigFileName,sizeof(szConfigFileName),TEXT("%s\\%d_RatiOx.ini"),szPath,m_pGameServiceOption->wServerID);
	m_oLog.Log("=============放分池数据[%I64d]写入配置文件[%s]=================" ,m_oContral.GetPoolScore(),szConfigFileName);
	CString strPoolScore;
	strPoolScore.Format("%I64d", m_oContral.GetPoolScore());
	WritePrivateProfileString(TEXT("SCOREPOOL"), TEXT("ScorePool"),strPoolScore,szConfigFileName);
	ConcludeGame();
	m_oLog.Log("////------------游戏结束----------------------////");
	//结束游戏
}
//用户进贡
bool CTableFrameSink::OnPayTribute(const void * pDataBuffer)
{
	//获取数据
	CMD_C_PayTribute *pPayTribute=(CMD_C_PayTribute *)pDataBuffer;
	WORD	wChairID		=	pPayTribute->wUser;
	BYTE    bPayCard		=	pPayTribute->bCard;

	m_bPayNumber++;
	m_bPayCard[wChairID]=bPayCard;
    
	//未全部进贡
	if((m_bPayNumber<=m_wPlayerCount&&m_bGameStatus==SHUANG_XIA)||
		(m_bPayNumber<=2&&m_bGameStatus==DAN_XIA)||(m_bPayNumber<=2&&m_bGameStatus==OTHER))
	{
		//构造数据
		CMD_S_PayTribute PayTribute;
		PayTribute.bPayStatus	=	enNone;
		PayTribute.bCard		=	bPayCard;
		PayTribute.wFromUser	=	wChairID;
		PayTribute.wCurrentUser	=	INVALID_CHAIR;
		PayTribute.wToUser		=	INVALID_CHAIR;
		m_GameLogic.RemoveCard(&bPayCard,1,m_bHandCardData[wChairID],m_bCardCount[wChairID]);
		m_bCardCount[wChairID]--;
		
		CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(m_bPayTribute));
		//发送数据
		m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
		m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
	}
	if(pPayTribute->bPayType==enJin_Gong&&((m_bPayNumber>=2&&m_bGameStatus==SHUANG_XIA)
		||(m_bPayNumber>=1&&m_bGameStatus==DAN_XIA)
		||(m_bPayNumber>=1&&m_bGameStatus==OTHER)))
	{   
		//构造数据
		CMD_S_PayTribute PayTribute;
		PayTribute.bPayStatus	=	enHui_Gong;
		PayTribute.wCurrentUser	=	INVALID_CHAIR;
		CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(m_bPayTribute));
		
		//单下处理
		if(m_bGameStatus==DAN_XIA)
		{ 
			//当前用户
			m_wCurrentUser			=   (m_bRanKing[1]+2)%m_wPlayerCount;
	
			//进贡扑克
			PayTribute.bCard		=	m_bPayCard[(m_bRanKing[1]+2)%m_wPlayerCount];
			PayTribute.wFromUser	=	(m_bRanKing[1]+2)%m_wPlayerCount;
			PayTribute.wToUser		=   m_bRanKing[0];
			m_pITableFrame->SendTableData(PayTribute.wToUser,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
			m_GameLogic.Add(PayTribute.bCard, m_bHandCardData[PayTribute.wToUser],m_bCardCount[PayTribute.wToUser]);
			m_bCardCount[PayTribute.wToUser]++;
		}
		//平扣处理
		else if(m_bGameStatus==OTHER)
		{
			//当前用户
			m_wCurrentUser			=   (m_bRanKing[0]+2)%m_wPlayerCount;
	
			//进贡扑克
			PayTribute.bCard		=	m_bPayCard[(m_bRanKing[0]+2)%m_wPlayerCount];
			PayTribute.wFromUser	=	(m_bRanKing[0]+2)%m_wPlayerCount;
			PayTribute.wToUser		=   m_bRanKing[0];
			m_pITableFrame->SendTableData(PayTribute.wToUser,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
			m_GameLogic.Add(PayTribute.bCard, m_bHandCardData[PayTribute.wToUser],m_bCardCount[PayTribute.wToUser]);
			m_bCardCount[PayTribute.wToUser]++;
		}
		//双下处理
		else if(m_bGameStatus==SHUANG_XIA)
		{   
			BYTE bFirst=m_bRanKing[0],bSecond=m_bRanKing[1];
			BYTE bThird=(bFirst+1)%m_wPlayerCount,bFouth=(bSecond+1)%m_wPlayerCount;

			if(m_GameLogic.GetCardLogicValue(m_bPayCard[bThird])>m_GameLogic.GetCardLogicValue(m_bPayCard[bFouth]))
			{
				//当前用户
				m_wCurrentUser			=   bThird;

				PayTribute.bCard		=	m_bPayCard[bThird];
				PayTribute.wFromUser	=	bThird;
				PayTribute.wToUser		=	bFirst;
				m_pITableFrame->SendTableData(PayTribute.wToUser,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
				m_GameLogic.Add(PayTribute.bCard, m_bHandCardData[PayTribute.wToUser], m_bCardCount[PayTribute.wToUser]);
			    m_bCardCount[PayTribute.wToUser]++;
				
				
				PayTribute.bCard		=	m_bPayCard[bFouth];
				PayTribute.wFromUser	=	bFouth;
				PayTribute.wToUser		=	bSecond;
				m_pITableFrame->SendTableData(PayTribute.wToUser,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
				m_GameLogic.Add(PayTribute.bCard, m_bHandCardData[PayTribute.wToUser], m_bCardCount[PayTribute.wToUser]);
			    m_bCardCount[PayTribute.wToUser]++;
				
			}else
			{
				
				//当前用户
				m_wCurrentUser			=   bFouth;

				PayTribute.bCard		=	m_bPayCard[bFouth];
				PayTribute.wFromUser	=	bFouth;
				PayTribute.wToUser		=	bFirst;
				m_pITableFrame->SendTableData(PayTribute.wToUser,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
				m_GameLogic.Add(PayTribute.bCard, m_bHandCardData[PayTribute.wToUser], m_bCardCount[PayTribute.wToUser]);
			    m_bCardCount[PayTribute.wToUser]++;
				
				
				PayTribute.bCard		=	m_bPayCard[bThird];
				PayTribute.wFromUser	=	bThird;
				PayTribute.wToUser		=	bSecond;
				m_pITableFrame->SendTableData(PayTribute.wToUser,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
				m_GameLogic.Add(PayTribute.bCard, m_bHandCardData[PayTribute.wToUser], m_bCardCount[PayTribute.wToUser]);
			    m_bCardCount[PayTribute.wToUser]++;

			}
		}
	}
	if(pPayTribute->bPayType==enHui_Gong)
	{
		//构造数据
		CMD_S_PayTribute PayTribute;
		PayTribute.bPayStatus	=	enGet_Hui_Gong;
		PayTribute.wCurrentUser	=	INVALID_CHAIR;
		CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(m_bPayTribute));

		PayTribute.bCard		=	pPayTribute->bCard;
		PayTribute.wFromUser	=	pPayTribute->wUser;
		PayTribute.wToUser		=	pPayTribute->wToUser;
		m_pITableFrame->SendTableData(PayTribute.wToUser,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
		m_GameLogic.Add(PayTribute.bCard, m_bHandCardData[PayTribute.wToUser], m_bCardCount[PayTribute.wToUser]);
		m_bCardCount[PayTribute.wToUser]++;

		//发送系统消息
		CMD_S_MESSAGE message;
		IServerUserItem *pFrom	=	m_pITableFrame->GetServerUserItem(PayTribute.wFromUser);
		IServerUserItem *pTo	=	m_pITableFrame->GetServerUserItem(PayTribute.wToUser);
		_sntprintf(message.szBuffer,sizeof(message.szBuffer),"用户 %-s 进贡给 %-s",
			pTo->GetAccounts(),pFrom->GetAccounts());
		m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_SYSTEM_MESSAGE,&message,sizeof(message));
		m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_SYSTEM_MESSAGE,&message,sizeof(message));

	}
	if((m_bPayNumber==4&&m_bGameStatus==SHUANG_XIA)||
		(m_bPayNumber==2&&m_bGameStatus==DAN_XIA)||m_bPayNumber==2&&m_bGameStatus==OTHER)
	{	
		//构造数据
		CMD_S_PayTribute PayTribute;
		PayTribute.bPayStatus	=	enNone;
		PayTribute.wCurrentUser	=	m_wCurrentUser;
		CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(m_bPayTribute));

		//发送数据
		m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
		m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
	}

  return true;
}
Beispiel #10
0
//定时器事件
bool __cdecl CTableFrameSink::OnTimerMessage(WORD wTimerID, WPARAM wBindParam)
{
	switch (wTimerID)
	{
	case IDI_FREE:		//空闲时间结束
		{
			//开始游戏
			m_pITableFrameControl->StartGame();

			//启动下注计时器
			m_pITableFrame->SetGameTimer(IDI_PLACE_JETTON,TIME_PLACE_JETTON*1000,1,0L);

			//设置游状态为下注阶段
			m_pITableFrame->SetGameStatus(GS_PLACE_JETTON);

			return true;
		}
	case IDI_PLACE_JETTON:		//下注时间结束
		{
			//状态判断(防止强退重复设置)
			if (m_pITableFrame->GetGameStatus()!=GS_GAME_END)
			{
				//设置状态
				m_pITableFrame->SetGameStatus(GS_GAME_END);			

				//结束游戏
				OnEventGameEnd(INVALID_CHAIR,NULL,GER_NORMAL);

				//设置时间
				m_pITableFrame->SetGameTimer(IDI_GAME_END,TIME_GAME_END*1000,1,0L);			
			}

			return true;
		}
	case IDI_GAME_END:			//结束游戏
		{
			//写入积分
			for ( WORD wUserChairID = 0; wUserChairID < GAME_PLAYER; ++wUserChairID )
			{
				IServerUserItem *pIServerUserItem = m_pITableFrame->GetServerUserItem(wUserChairID);
				if ( pIServerUserItem == NULL ) 
					continue;

				//胜利类型
				enScoreKind ScoreKind=(m_iUserWinScore[wUserChairID]>0L)?enScoreKind_Win:enScoreKind_Lost;

				//写入积分
				if (m_iUserWinScore[wUserChairID]!=0L) 
					m_pITableFrame->WriteUserScore(wUserChairID,m_iUserWinScore[wUserChairID], m_iUserRevenue[wUserChairID], ScoreKind);

				//坐庄条件判断。一轮游戏结束,玩家有输有赢。所以需要在申请上庄队列里把输了钱不在满足做庄的玩家清除掉
				__int64 iUserScore=pIServerUserItem->GetUserScore()->lScore;
				if (wUserChairID!=m_wCurrentBanker && iUserScore<m_iApplyBankerCondition)
				{
					for (WORD i=0; i<m_ApplyUserArray.GetCount(); ++i)
					{
						if (wUserChairID!=m_ApplyUserArray[i]) continue;

						//从庄家队列删除不符合上庄的玩家
						m_ApplyUserArray.RemoveAt(i);

						//发送消息
						CMD_S_CancelBanker CancelBanker;
						ZeroMemory(&CancelBanker,sizeof(CancelBanker));

						//设置变量
						lstrcpyn(CancelBanker.szCancelUser,pIServerUserItem->GetAccounts(),CountArray(CancelBanker.szCancelUser));

						//发送消息
						m_pITableFrame->SendTableData(INVALID_CHAIR, SUB_S_CANCEL_BANKER, &CancelBanker, sizeof(CancelBanker));
						m_pITableFrame->SendLookonData(INVALID_CHAIR, SUB_S_CANCEL_BANKER, &CancelBanker, sizeof(CancelBanker));

						//提示消息
						TCHAR szTipMsg[128];
						_sntprintf(szTipMsg,CountArray(szTipMsg),TEXT("由于你的金币数少于坐庄必须金币数(%I64d),你自动下庄!"),m_iApplyBankerCondition);
						SendGameMessage(wUserChairID,szTipMsg);

						break;
					}
				}
			}

			//结束游戏
			m_pITableFrame->ConcludeGame();

			//切换庄家
			ChangeBanker(false);

			//设置时间
			m_dwJettonTime=(DWORD)time(NULL);
			m_pITableFrame->SetGameTimer(IDI_FREE,TIME_FREE*1000,1,0L);

			//发送消息
			CMD_S_GameFree GameFree;
			ZeroMemory(&GameFree,sizeof(GameFree));
			GameFree.cbTimeLeave=TIME_FREE;
			GameFree.cbGameRecord = m_iGoalAnimal;
			GameFree.iGameTimes = m_iGameTimes;
			m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_GAME_FREE,&GameFree,sizeof(GameFree));
			m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_FREE,&GameFree,sizeof(GameFree));

			return true;
		}
	}

	return false;
}
Beispiel #11
0
//人工智能游戏动作
bool __cdecl CTableFrameSink::OnPerformAIGameAction()
{
	//机器人判断
	IServerUserItem * pIServerUserItem = m_pITableFrame->GetServerUserItem(m_wCurrentUser);
	if(pIServerUserItem == NULL || 
		pIServerUserItem->IsAIUser() == false || 
		pIServerUserItem->GetUserStatus() != US_PLAY)
		return false;
	WORD wChairID = pIServerUserItem->GetChairID();
	if(wChairID == INVALID_CHAIR)
		return false;

	WORD wCurrentWiner=DeduceWiner(0,4);
	//判断当前赢家
	if(wCurrentWiner == wChairID)
	{
	}
	else
	{
		DWORD wGameUser = m_pITableFrame->GetAIKillGameUserChairID();
		//机器人智商-相当几率放弃
		if(wGameUser == wCurrentWiner && CAIUtil::DetectionProbability(m_pGameServiceOption->cbAILevel))
		{
			//发送消息
			OnGameMessage(SUB_C_GIVE_UP, NULL, 0, pIServerUserItem);

			return true;
		}
		else
		{

		}
	}
	//获取金币	
	LONG lTurnMaxGold = 1;
	if (m_bSendCardCount<=2)
	{
		lTurnMaxGold=m_fMaxGold/4L;
		if(lTurnMaxGold <= m_pGameServiceOption->dwCellScore)
		{
			lTurnMaxGold = m_pGameServiceOption->dwCellScore;
		}
	}
	else if (m_bSendCardCount==3) lTurnMaxGold=m_fMaxGold/2L;
	else lTurnMaxGold=m_fMaxGold;

	lTurnMaxGold=lTurnMaxGold-m_fTableGold[wChairID*2+1];
	lTurnMaxGold = __max(lTurnMaxGold,m_fTurnBasicGold);

	lTurnMaxGold = lTurnMaxGold - m_fTurnBasicGold;
	lTurnMaxGold += 1;
	LONG lGold=0;
	if(lTurnMaxGold!=0)
	{
		lGold= (wCurrentWiner == wChairID) ? (((rand() % (LONG)lTurnMaxGold)/2)  + lTurnMaxGold/2): (rand() % ((LONG)lTurnMaxGold)/4);
	}
	else
	{
		//lGold = 1;
	}
	lGold=lGold + m_fTurnBasicGold;
	lGold=__max(lGold,m_fTurnBasicGold);


	//发送数据
	CMD_C_AddGold AddPoint;
	AddPoint.fGold=lGold;
	OnGameMessage(SUB_C_ADD_GOLD,&AddPoint,sizeof(AddPoint), pIServerUserItem);

	return true;
}
Beispiel #12
0
//时间消息
bool __cdecl CAndroidUserItemSink::OnEventTimer(UINT nTimerID)
{
	switch (nTimerID)
	{
	case IDI_CHECK_BANKER:		//检查上庄
		{
			m_pIAndroidUserItem->KillGameTimer(nTimerID);

			if (m_wCurrentBanker == m_pIAndroidUserItem->GetChairID())
				return false;

			if (m_wCurrentBanker == INVALID_CHAIR)
			{
				//空庄
				m_nWaitBanker++;

				//MyDebug(_T("机器人上庄(End) %d [%d %d] [%d %d]"), m_pIAndroidUserItem->GetChairID(), m_nWaitBanker, 
				//	m_nRobotWaitBanker, m_stlApplyBanker, m_nRobotApplyBanker);

				//机器人上庄
				if ( m_bRobotBanker && m_nWaitBanker > m_nRobotWaitBanker && m_stlApplyBanker < m_nRobotApplyBanker)
				{
					//合法判断
					IServerUserItem *pIUserItemBanker = m_pIAndroidUserItem->GetMeUserItem();
					if (pIUserItemBanker->GetUserScore()->lScore > m_lBankerCondition) 
					{
						//机器人上庄
						m_nBankerCount = 0;
						m_stlApplyBanker++;
						m_pIAndroidUserItem->SetGameTimer(IDI_REQUEST_BANKER, (rand() % m_cbTimeLeave) + 1);
					}
				}
			}
			else if ( m_wCurrentBanker != INVALID_CHAIR )
			{
				//其他人坐庄
				m_nWaitBanker = 0;
			}

			return false;
		}
	case IDI_REQUEST_BANKER:	//申请上庄
		{
			m_pIAndroidUserItem->KillGameTimer(nTimerID);

			m_pIAndroidUserItem->SendSocketData(SUB_C_APPLY_BANKER);

			return false;
		}
	case IDI_GIVEUP_BANKER:		//申请下庄
		{
			m_pIAndroidUserItem->KillGameTimer(nTimerID);

			m_pIAndroidUserItem->SendSocketData(SUB_C_CANCEL_BANKER);

			return false;
		}
	default:
		{
			if (nTimerID >= IDI_PLACE_JETTON && nTimerID <= IDI_PLACE_JETTON+MAX_CHIP_TIME)
			{
				srand(GetTickCount());

				//变量定义
				int nRandNum = 0, nChipArea = 0, nCurChip = 0, nACTotal = 0, nCurJetLmt[2] = {};
				LONGLONG lMaxChipLmt = __min(m_lMaxChipBanker, m_lMaxChipUser);			//最大可下注值
				WORD wMyID = m_pIAndroidUserItem->GetChairID();
				for (int i = 0; i < AREA_COUNT; i++)
					nACTotal += m_RobotInfo.nAreaChance[i];

				//统计次数
				m_nChipTimeCount++;

				//检测退出
				if (lMaxChipLmt < m_RobotInfo.nChip[m_nChipLimit[0]])	return false;
				for (int i = 0; i < AREA_COUNT; i++)
				{
					if (m_lAreaChip[i] >= m_RobotInfo.nChip[m_nChipLimit[0]])	break;
					if (i == AREA_COUNT-1)	return false;
				}

				//下注区域
				ASSERT(nACTotal>0);
				static int nStFluc = 1;				//随机辅助
				if (nACTotal <= 0)	return false;
				do {
					nRandNum = (rand()+wMyID+nStFluc*3) % nACTotal;
					for (int i = 0; i < AREA_COUNT; i++)
					{
						nRandNum -= m_RobotInfo.nAreaChance[i];
						if (nRandNum < 0)
						{
							nChipArea = i;
							break;
						}
					}
				}
				while (m_lAreaChip[nChipArea] < m_RobotInfo.nChip[m_nChipLimit[0]]);
				nStFluc = nStFluc%3 + 1;

				//下注大小
				if (m_nChipLimit[0] == m_nChipLimit[1])
					nCurChip = m_nChipLimit[0];
				else
				{
					//设置变量
					lMaxChipLmt = __min(lMaxChipLmt, m_lAreaChip[nChipArea]);
					nCurJetLmt[0] = m_nChipLimit[0];
					nCurJetLmt[1] = m_nChipLimit[0];

					//计算当前最大筹码
					for (int i = m_nChipLimit[1]; i > m_nChipLimit[0]; i--)
					{
						if (lMaxChipLmt > m_RobotInfo.nChip[i]) 
						{
							nCurJetLmt[1] = i;
							break;
						}
					}

					//随机下注
					nRandNum = (rand()+wMyID) % (nCurJetLmt[1]-nCurJetLmt[0]+1);
					nCurChip = nCurJetLmt[0] + nRandNum;

					//多下控制 (当庄家金币较少时会尽量保证下足次数)
					if (m_nChipTimeCount < m_nChipTime)
					{
						LONGLONG lLeftJetton = LONGLONG( (lMaxChipLmt-m_RobotInfo.nChip[nCurChip])/(m_nChipTime-m_nChipTimeCount) );

						//不够次数 (即全用最小限制筹码下注也少了)
						if (lLeftJetton < m_RobotInfo.nChip[m_nChipLimit[0]] && nCurChip > m_nChipLimit[0])
							nCurChip--;
					}
				}

				/*ASSERT( MyDebug(_T("机器人下注 %d 下注次数 [%d/%d] 下注 [%d %d] 范围 [%d %d] 限制 [%I64d %I64d %I64d]"), wMyID, nTimerID-IDI_PLACE_JETTON, m_nChipTime, 
					nChipArea, m_RobotInfo.nChip[nCurChip], m_nChipLimit[0], m_nChipLimit[1], m_lMaxChipBanker, m_lMaxChipUser, lMaxChipLmt) );*/

				//变量定义
				CMD_C_PlaceJetton PlaceJetton = {};

				//构造变量
				PlaceJetton.cbJettonArea = nChipArea+1;		//区域宏从1开始
				PlaceJetton.lJettonScore = m_RobotInfo.nChip[nCurChip];

				//发送消息
				m_pIAndroidUserItem->SendSocketData(SUB_C_PLACE_JETTON, &PlaceJetton, sizeof(PlaceJetton));
			}

			m_pIAndroidUserItem->KillGameTimer(nTimerID);
			return false;
		}
	}
	return false;
}
Beispiel #13
0
//场景消息
bool __cdecl CAndroidUserItemSink::OnEventGameScene(BYTE cbGameStatus, bool bLookonOther, void * pData, WORD wDataSize)
{
	switch (cbGameStatus)
	{
	case GS_FREE:			//空闲状态
		{
			//效验数据
			ASSERT(wDataSize==sizeof(CMD_S_StatusFree));
			if (wDataSize!=sizeof(CMD_S_StatusFree)) return false;

			//消息处理
			CMD_S_StatusFree * pStatusFree=(CMD_S_StatusFree *)pData;

			m_lUserLimitScore = pStatusFree->lUserMaxScore;
			m_lAreaLimitScore = pStatusFree->lAreaLimitScore;
			m_lBankerCondition = pStatusFree->lApplyBankerCondition;

			memcpy(m_szRoomName, pStatusFree->szGameRoomName, sizeof(m_szRoomName));

			ReadConfigInformation(m_RobotInfo.szCfgFileName, m_szRoomName, true);

			//MyDebug(_T("机器人上庄(Free) %d [%d %d] [%d %d]"), m_pIAndroidUserItem->GetChairID(), m_nWaitBanker, 
			//	m_nRobotWaitBanker, m_stlApplyBanker, m_nRobotApplyBanker);

			//上庄处理
			if (pStatusFree->wBankerUser == INVALID_CHAIR)
			{
				if (m_bRobotBanker && m_nRobotWaitBanker == 0  && m_stlApplyBanker < m_nRobotApplyBanker)
				{
					//合法判断
					IServerUserItem *pIUserItemBanker = m_pIAndroidUserItem->GetMeUserItem();
					if (pIUserItemBanker->GetUserScore()->lScore > m_lBankerCondition) 
					{
						//机器人上庄
						m_nBankerCount = 0;
						m_stlApplyBanker++;
						
						BYTE cbTime = (pStatusFree->cbTimeLeave>0?(rand()%pStatusFree->cbTimeLeave+1):2);
						if (cbTime == 0) cbTime = 2;

						m_pIAndroidUserItem->SetGameTimer(IDI_REQUEST_BANKER, cbTime);
					}
				}
			}

			return true;
		}
	case GS_PLAYING:		//游戏状态
	case GS_GAME_END:		//结束状态
		{
			//效验数据
			ASSERT(wDataSize==sizeof(CMD_S_StatusPlay));
			if (wDataSize!=sizeof(CMD_S_StatusPlay)) return false;

			//消息处理
			CMD_S_StatusPlay * pStatusPlay=(CMD_S_StatusPlay *)pData;

			//庄家信息
			m_wCurrentBanker = pStatusPlay->wBankerUser;

			m_lUserLimitScore = pStatusPlay->lUserMaxScore;
			m_lAreaLimitScore = pStatusPlay->lAreaLimitScore;
			m_lBankerCondition = pStatusPlay->lApplyBankerCondition;

			memcpy(m_szRoomName, pStatusPlay->szGameRoomName, sizeof(m_szRoomName));

			ReadConfigInformation(m_RobotInfo.szCfgFileName, m_szRoomName, true);

			return true;
		}
	}

	return true;
}
Beispiel #14
0
//游戏结束
bool __cdecl CTableFrameSink::OnEventGameEnd( WORD wChairID, IServerUserItem * pIServerUserItem, BYTE cbReason )
{
	switch ( cbReason )
	{
	case GER_DISMISS:		//游戏解散
		{
			//效验参数
			//ASSERT( pIServerUserItem != NULL );
			//ASSERT( wChairID < m_wPlayerCount );

			//构造数据
			CMD_S_GameEnd GameEnd;
			memset( &GameEnd, 0, sizeof( GameEnd ) );
			CopyMemory(GameEnd.bBackCard,m_bBackCard,sizeof(m_bBackCard));

			//剩余扑克
			BYTE bCardPos = 0;
			for ( WORD i = 0; i < m_wPlayerCount; i++ )
			{
				GameEnd.bCardCount[ i ] = m_bCardCount[ i ];
				CopyMemory( &GameEnd.bCardData[ bCardPos ], m_bHandCardData[ i ], m_bCardCount[ i ] * sizeof( BYTE ) );
				bCardPos += m_bCardCount[ i ];
			}

			//发送信息
			m_pITableFrame->SendTableData( INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof( GameEnd ) );
			m_pITableFrame->SendLookonData( INVALID_CHAIR, SUB_S_GAME_END, &GameEnd, sizeof( GameEnd ) );

			//结束游戏
			m_pITableFrame->ConcludeGame();

			return true;
		}
	case GER_NORMAL:		//常规结束
		{
			//定义变量
			CMD_S_GameEnd GameEnd;
			ZeroMemory( &GameEnd, sizeof( GameEnd ) );
			CopyMemory(GameEnd.bBackCard,m_bBackCard,sizeof(m_bBackCard));

			//剩余扑克
			BYTE bCardPos = 0;
			for (WORD i=0;i<m_wPlayerCount;i++)
			{
				GameEnd.bCardCount[i]=m_bCardCount[i];
				CopyMemory(&GameEnd.bCardData[bCardPos],m_bHandCardData[i],m_bCardCount[i]*sizeof(BYTE));
				bCardPos+=m_bCardCount[i];
			}

			//变量定义
			LONG lCellScore=m_pGameServiceOption->lCellScore;
			bool bLandWin =(m_bCardCount[m_wBankerUser]==0)?true:false;

			//春天判断
			WORD wBombTime=1;
			if(wChairID==m_wBankerUser)
			{
				WORD wUser1=(m_wBankerUser+1)%GAME_PLAYER;
				WORD wUser2=(m_wBankerUser+2)%GAME_PLAYER;
				if((m_bOutCardCount[wUser1]==0)&&(m_bOutCardCount[wUser2]==0))wBombTime*=2;
			}
			else
			{
				if(m_bOutCardCount[m_wBankerUser]==1)wBombTime*=2;
			}

			//炸弹限制
			//wBombTime= __min( wBombTime, 16 );

			//游戏积分
			LONG lScore=0;
			LONG lRevenue=0;
			enScoreKind ScoreKind;
 
			//统计积分
			for ( WORD i = 0; i < m_wPlayerCount; i++ )
			{
				lScore=0;
				lRevenue=0;
 				//统计积分
				if ( i == m_wBankerUser )
				{
					WORD wUser1=(m_wBankerUser+1)%m_wPlayerCount,wUser2=(m_wBankerUser+2)%m_wPlayerCount;
					//lScore=(m_bScoreTimes[wUser1]+m_bScoreTimes[wUser2])*wBombTime*lCellScore*((bLandWin==true)?1:-1);

					// 3番满
 					lScore=(m_bScoreTimes[wUser1]+m_bScoreTimes[wUser2])*wBombTime*lCellScore;
					int fullscore = (int)pow(2.0,MAX_SCORE)*lCellScore*2;
					lScore = lScore>fullscore?fullscore:lScore;
 					lScore*=((bLandWin==true)?1:-1);
 
 					GameEnd.lGameScore[i]=lScore;
				}
				else 
				{
					//lScore = m_bScoreTimes[i] * wBombTime * lCellScore * ( ( bLandWin == true ) ? -1 : 1 );
					lScore = m_bScoreTimes[i] * wBombTime * lCellScore;
					int fullscore = (int)pow(2.0,MAX_SCORE)*lCellScore;
					lScore = lScore>fullscore?fullscore:lScore;
					lScore*=((bLandWin==true)?-1:1);

					GameEnd.lGameScore[i] = lScore;
				}


				//防止负分
				IServerUserItem *pUserItem = m_pITableFrame->GetServerUserItem(i);

				if( GAME_GENRE_SCORE==m_pGameServiceOption->wServerType 
  					&&GameEnd.lGameScore[i] < 0L && 
					-GameEnd.lGameScore[i] > pUserItem->GetUserScore()->lScore )
				{
					// 负分情况
					GameEnd.lGameScore[i] = -pUserItem->GetUserScore()->lScore;
				}

				if( GAME_GENRE_GOLD==m_pGameServiceOption->wServerType 
					&&GameEnd.lGameScore[i] < 0L && 
					-GameEnd.lGameScore[i] > pUserItem->GetUserScore()->lGameGold ) // 
				{
					// 负分情况,不应该允许这种情况发生
					GameEnd.lGameScore[i] = -pUserItem->GetUserScore()->lGameGold;
				}



				//胜利类型
				ScoreKind=(GameEnd.lGameScore[i]>0L)?enScoreKind_Win:enScoreKind_Lost;

				//计算税收
				//if (m_pGameServiceOption->wServerType==GAME_GENRE_GOLD)GAME_GENRE_SCORE
				if (m_pGameServiceOption->wServerType==GAME_GENRE_SCORE ||
					m_pGameServiceOption->wServerType==GAME_GENRE_GOLD)
				{
					//if (GameEnd.lGameScore[i]>=100L)
					if (GameEnd.lGameScore[i]>0L)
 					{
						//计算税收
						GameEnd.lGameTax+= (GameEnd.lGameScore[i]*m_pGameServiceOption->wRevenue/100L);
						lRevenue = (GameEnd.lGameScore[i]*m_pGameServiceOption->wRevenue/100L);

						//积分调整
						lScore=lScore-lRevenue;
						GameEnd.lGameScore[i]=GameEnd.lGameScore[i]-lRevenue;
					}
				} 
 


 				//修改分数
				m_pITableFrame->WriteUserScore(i,GameEnd.lGameScore[i],lRevenue,ScoreKind);
			}


			// oma add 
			for (int k = 0;k<GAME_PLAYER;k++)
			{
				IServerUserItem *pUserItem = m_pITableFrame->GetServerUserItem(k);
				// 计算当局结束后分数
				LONG totalScore  =  pUserItem->GetUserScore()->lScore;

				TCHAR printmsg[512] = TEXT("");
				_snprintf(printmsg,sizeof(printmsg),TEXT("当局游戏结束后用户分数:%ld ,当前送分次:%d 游戏类型:%d "),
					totalScore,pUserItem->GetUserScore()->lGrantCount,m_pGameServiceOption->wServerType);
				CTraceService::TraceString(printmsg,TraceLevel_Debug);


				// 非金币类型送分
				//if( GAME_GENRE_SCORE == m_pGameServiceOption->wServerType
				//	&& totalScore < START_GRANT_SCORE_BASE 
				//	&& pUserItem->GetUserScore()->lGrantCount > 0 )
				if( GAME_GENRE_SCORE == m_pGameServiceOption->wServerType
					&& totalScore < m_pGameServiceOption->lLessScore
					&& pUserItem->GetUserScore()->lGrantCount > 0 )
				{
					int leftcount = --pUserItem->GetUserData()->UserScoreInfo.lGrantCount;
					// 送分,每次送 GRANT_SCORE_VALUE 分
 					 int grantscore = GRANT_SCORE_VALUE;//m_pGameServiceOption->lCellScore*pow(2.0,4);
					CMD_S_Message msg;
 					_snprintf(msg.message,sizeof(msg.message),TEXT("你当前的积分是%d 不足 %d, 这是第 %ld 次送 %ld 分 (每天 %ld 次)"),
						totalScore,m_pGameServiceOption->lLessScore,GRANT_SCORE_COUNT-leftcount,grantscore,GRANT_SCORE_COUNT);
					CTraceService::TraceString(msg.message,TraceLevel_Debug);

					//totalScore+= GRANT_SCORE_VALUE;
					// 通知客户端用户
  					m_pITableFrame->SendTableData(k,SUB_S_GRANT_SCORE,&msg,sizeof(CMD_S_Message));
					//写入积分
					m_pITableFrame->WriteUserScore(k,GRANT_SCORE_VALUE,0,enScoreKind_Present);// 扣税0
				}
				else
				{
					CTraceService::TraceString(TEXT("没有送分啊"),TraceLevel_Debug);

				}
 			}
			// oma add end 


			//发送信息
			m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_GAME_END,&GameEnd,sizeof(GameEnd));
			m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_END,&GameEnd,sizeof(GameEnd));

			//切换用户
			m_wFirstUser=wChairID;

			//结束游戏
			m_pITableFrame->ConcludeGame();

			return true;
		}
	case GER_USER_LEFT:		//用户强退
		{
			//效验参数
			ASSERT(pIServerUserItem!=NULL);
			ASSERT(wChairID<m_wPlayerCount);

			//构造数据
			CMD_S_GameEnd GameEnd;
			ZeroMemory(&GameEnd,sizeof(GameEnd));
			CopyMemory(GameEnd.bBackCard,m_bBackCard,sizeof(m_bBackCard));

			//剩余扑克
			BYTE bCardPos=0;
			for (WORD i=0;i<m_wPlayerCount;i++)
			{
				GameEnd.bCardCount[i]=m_bCardCount[i];
				CopyMemory(&GameEnd.bCardData[bCardPos],m_bHandCardData[i],m_bCardCount[i]*sizeof(BYTE));
				bCardPos+=m_bCardCount[i];
			}

			//炸弹限制
			//WORD wBombTime = 1;
			//wBombTime=__min(wBombTime,16);

			//最少赔率
			for (WORD i=0;i<m_wPlayerCount;i++)
			{
				m_bScoreTimes[i] = __max(m_bScoreTimes[i],1);
			}

			//修改积分
			for (WORD i=0;i<m_wPlayerCount;i++)
			{
				//游戏积分
				LONG lScore=0;
				LONG lRevenue=0;
				enScoreKind ScoreKind=enScoreKind_Draw;

				//构造变量
				if (i==wChairID)
				{
					ScoreKind=enScoreKind_Flee;
					WORD wUser1=(i+1)%m_wPlayerCount;
					WORD wUser2=(i+2)%m_wPlayerCount;
					lScore=(m_bScoreTimes[wUser1]+m_bScoreTimes[wUser2])*m_pGameServiceOption->lCellScore*(-2);
					GameEnd.lGameScore[i]=lScore;
				}
				else if (m_pGameServiceOption->wServerType==GAME_GENRE_GOLD)
				{
					//统计积分
					ScoreKind=enScoreKind_Win;
					lScore=m_bScoreTimes[i]*m_pGameServiceOption->lCellScore*2;
					GameEnd.lGameScore[i]=lScore;

					//计算税收
					//if (lScore>=100L)
					if (lScore>0)
 					{
						//计算税收
						GameEnd.lGameTax+=GameEnd.lGameScore[i]*m_pGameServiceOption->wRevenue/100L;
						lRevenue = GameEnd.lGameScore[i]*m_pGameServiceOption->wRevenue/100L;

						//积分调整
						lScore=lScore-lRevenue ;
						GameEnd.lGameScore[i]=GameEnd.lGameScore[i]-lRevenue ;
					}
				}

				//写入积分
				m_pITableFrame->WriteUserScore(i,lScore,lRevenue,ScoreKind);
			}

			//发送信息
			m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_GAME_END,&GameEnd,sizeof(GameEnd));
			m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_END,&GameEnd,sizeof(GameEnd));

			//结束游戏
			m_pITableFrame->ConcludeGame();

			return true;
		}
	}

	ASSERT(FALSE);

	return false;
}
//时间消息
bool __cdecl CAndroidUserItemSink::OnEventTimer(UINT nTimerID)
{
	switch (nTimerID)
	{
	case IDI_USER_JETTON:	// 机器人下注
		{
			return OnPlaceJetton();
		}
	case IDI_PLACE_JETTON:	// 总的下注时间到了
		{
			if (NULL != m_pIAndroidUserItem)
			{
				m_pIAndroidUserItem->KillGameTimer(IDI_USER_JETTON);
			}
			m_bEnableNote = false;
			return true;
		}
	case IDI_APPLY_BANKER:
		{
			if (m_arApplyBanker.GetCount() >= m_iMaxAndroidBanker)
			{
				return true;
			}
			//合法判断
			IServerUserItem *pMeUserItem = m_pIAndroidUserItem->GetMeUserItem();
			if (m_wCurrentBanker == m_pIAndroidUserItem->GetChairID())
			{
				return true;
			}

			// 申请上庄
			if (pMeUserItem->GetUserScore()->lScore < m_lApplyBankerCondition)
			{
				return true;
			}

			// 自己要不再队列中
			for (int i=0; i<m_arApplyBanker.GetCount(); ++i)
			{
				if (m_arApplyBanker[i] == m_pIAndroidUserItem->GetUserID())
				{
					return true;
				}
			}

			//发送消息
			WORD wChairID = INVALID_CHAIR;
			m_pIAndroidUserItem->SendSocketData(SUB_C_APPLY_BANKER, (void *)&wChairID, sizeof(wChairID));
			return true;
		}
	case IDI_CANCEL_BANKER:
		{
			if (m_arApplyBanker.GetCount() < m_iMaxAndroidBanker)
			{
				return true;
			}

			//合法判断
			IServerUserItem *pMeUserItem = m_pIAndroidUserItem->GetMeUserItem();
			if (m_wCurrentBanker == m_pIAndroidUserItem->GetChairID())
			{
				return true;
			}

			// 自己在申请的庄家队列中
			for (int i=0; i<m_arApplyBanker.GetCount(); ++i)
			{
				if (m_arApplyBanker[i] == m_pIAndroidUserItem->GetUserID())
				{
					//发送消息
					WORD wChairID = INVALID_CHAIR;
					m_pIAndroidUserItem->SendSocketData(SUB_C_CANCEL_BANKER, (void *)&wChairID, sizeof(wChairID));
					return true;
				}
			}
			return true;
		}
	case IDI_SELECT_SICBOTYPE:
		{
			m_pIAndroidUserItem->KillGameTimer(IDI_SELECT_SICBOTYPE);
			if (m_wCurrentBanker != m_pIAndroidUserItem->GetChairID())
			{
				return true;
			}
			// 发送摇骰子方式
			CMD_C_ChangeSicboType cmdChangeSicboType;
			ZeroMemory(&cmdChangeSicboType, sizeof(cmdChangeSicboType));
			cmdChangeSicboType.enSicboType = (E_SICBO_TYPE)(rand()%enSicboType_InTheAir);
			m_pIAndroidUserItem->SendSocketData(SUB_C_CHANGE_SICBO_TYPE, &cmdChangeSicboType, sizeof(cmdChangeSicboType));
			return true;
		}
	default: break;
	}
	return false;
}
Beispiel #16
0
//游戏开始
bool __cdecl CTableFrameSink::OnEventGameStart()
{
	//设置状态
	m_pITableFrame->SetGameStatus(GS_WK_SCORE);

	BYTE cbSendGoodCard = rand () % GOOD_CARD_PERCENT ;
	BYTE cbAndroidUserCount = 0 ;
	WORD wAndroidUser[ GAME_PLAYER ] = {0};

	//机器人个数
	for ( WORD wChairID = 0; wChairID < GAME_PLAYER; ++wChairID )
	{
		IServerUserItem *pServerUserItem = m_pITableFrame->GetServerUserItem( wChairID ) ;
		if ( pServerUserItem->IsAndroidUser() )
		{
			wAndroidUser[ cbAndroidUserCount ] = ( wChairID ) ;
			++cbAndroidUserCount ;
		}
	}

	WORD wHaveGoodCardAndroidUser = INVALID_CHAIR ;
	if ( 0 < cbAndroidUserCount ) wHaveGoodCardAndroidUser = wAndroidUser[ rand() % cbAndroidUserCount ] ;

	//发送好牌
	if ( 1 == cbSendGoodCard && wHaveGoodCardAndroidUser != INVALID_CHAIR )
	{
		//混乱扑克
		BYTE bRandCard[54];
		m_GameLogic.RandCardList( bRandCard, sizeof( bRandCard ) / sizeof( bRandCard[ 0 ] ) );

		BYTE cbGoodCard[ NORMAL_COUNT ] ;
		m_GameLogic.GetGoodCardData( cbGoodCard ) ;

		//抽取好牌
		m_GameLogic.RemoveGoodCardData( cbGoodCard, NORMAL_COUNT, bRandCard, FULL_COUNT ) ;

		//分发扑克
		CopyMemory( m_bHandCardData[ wHaveGoodCardAndroidUser ], cbGoodCard, NORMAL_COUNT ) ;
		m_bCardCount[ wHaveGoodCardAndroidUser ] = 17;
		for ( WORD i = 0, j = 0; i < m_wPlayerCount; i++ )
		{
			if ( i != wHaveGoodCardAndroidUser )
			{
				m_bCardCount[ i ] = 17;
				CopyMemory( &m_bHandCardData[ i ], &bRandCard[ j * 17 ], sizeof( BYTE ) * 17 );
				++j ;
			}
		}
		CopyMemory( m_bBackCard, &bRandCard[ 34 ], sizeof( m_bBackCard ) );
		m_GameLogic.SortCardList( m_bBackCard, 3, ST_ORDER );
	}
	else
	{
		//混乱扑克
		BYTE bRandCard[ 54 ];
		m_GameLogic.RandCardList( bRandCard, sizeof( bRandCard ) / sizeof( bRandCard[ 0 ] ) );

		//分发扑克
		for ( WORD i = 0; i < m_wPlayerCount; i++ )
		{
			m_bCardCount[ i ] = 17;
			CopyMemory( &m_bHandCardData[ i ], &bRandCard[ i * m_bCardCount[ i ] ], sizeof( BYTE ) * m_bCardCount[ i ] );
		}
		CopyMemory( m_bBackCard, &bRandCard[ 51 ], sizeof( m_bBackCard ) );
		m_GameLogic.SortCardList( m_bBackCard, 3, ST_ORDER );
	}

	//设置用户
	m_wCurrentUser = rand() % GAME_PLAYER;
	m_wFirstUser=m_wCurrentUser;

	//发送扑克
	CMD_S_SendAllCard SendAllCard ;
	SendAllCard.wCurrentUser = m_wCurrentUser ;

	//手上扑克
	CopyMemory( SendAllCard.bCardData, m_bHandCardData, sizeof( m_bHandCardData ) ) ;
	//底牌扑克
	CopyMemory( SendAllCard.bBackCardData, m_bBackCard, 3 ) ;
	for ( WORD i = 0; i < m_wPlayerCount; i++ )
	{
		m_pITableFrame->SendTableData( i, SUB_S_SEND_CARD, &SendAllCard, sizeof( SendAllCard ) );
		m_pITableFrame->SendLookonData( i, SUB_S_SEND_CARD, &SendAllCard, sizeof( SendAllCard ) );
	}

	//排列扑克
	for ( WORD i = 0; i < m_wPlayerCount; i++ )
	{
		m_GameLogic.SortCardList( m_bHandCardData[ i ], m_bCardCount[ i ], ST_ORDER );
	}

	return true;
}
Beispiel #17
0
//叫分事件
bool CTableFrameSink::OnUserLandScore(WORD wChairID, BYTE bLandScore)
{
	//效验状态
	if (m_pITableFrame->GetGameStatus()!=GS_WK_SCORE) return true;
	if (wChairID!=m_wCurrentUser) return false;

	//效验参数
	if (((bLandScore>3)&&(bLandScore!=255))||(bLandScore<=m_bLandScore)) return false;

	//设置变量
	if (bLandScore!=255)
	{
		m_bLandScore=bLandScore;
		m_wBankerUser=m_wCurrentUser;
	}
	m_bScoreInfo[wChairID]=bLandScore;

	//开始判断
	if ((m_bLandScore==3)||(m_wFirstUser==(wChairID+1)%m_wPlayerCount))
	{
		//重新发牌
		if (m_bLandScore==0) 
		{
			BYTE cbSendGoodCard = rand() % GOOD_CARD_PERCENT ;
			BYTE cbAndroidUserCount=0 ;
			WORD wAndroidUser[GAME_PLAYER]={0};

			//重置变量
			ZeroMemory(m_bScoreInfo, sizeof(m_bScoreInfo)) ;

			//机器人个数
			for(WORD wChairID=0; wChairID<GAME_PLAYER; ++wChairID)
			{
				IServerUserItem *pServerUserItem = m_pITableFrame->GetServerUserItem(wChairID) ;
				if(pServerUserItem->IsAndroidUser())
				{
					wAndroidUser[cbAndroidUserCount] = (wChairID) ;
					++cbAndroidUserCount ;

				}
			}

			WORD wHaveGoodCardAndroidUser = INVALID_CHAIR ;
			if(cbAndroidUserCount>0) wHaveGoodCardAndroidUser = wAndroidUser[rand()%cbAndroidUserCount] ;

			//发送好牌
			if( 0 == cbSendGoodCard && wHaveGoodCardAndroidUser!=INVALID_CHAIR)
			{
				//混乱扑克
				BYTE bRandCard[54];
				m_GameLogic.RandCardList(bRandCard,sizeof(bRandCard)/sizeof(bRandCard[0]));

				BYTE cbGoodCard[NORMAL_COUNT] ;
				m_GameLogic.GetGoodCardData(cbGoodCard) ;

				//抽取好牌
				m_GameLogic.RemoveGoodCardData(cbGoodCard, NORMAL_COUNT, bRandCard, FULL_COUNT ) ;

				//分发扑克
				CopyMemory(m_bHandCardData[wHaveGoodCardAndroidUser], cbGoodCard, NORMAL_COUNT) ;
				m_bCardCount[wHaveGoodCardAndroidUser]=17;
				for (WORD i=0, j=0;i<m_wPlayerCount;i++)
				{
					if(i!=wHaveGoodCardAndroidUser)
					{
						m_bCardCount[i]=17;
						CopyMemory(&m_bHandCardData[i],&bRandCard[j*17],sizeof(BYTE)*17);
						++j ;
					}
				}
				CopyMemory(m_bBackCard,&bRandCard[34],sizeof(m_bBackCard));
				m_GameLogic.SortCardList(m_bBackCard,3,ST_ORDER);
			}
			else
			{
				//混乱扑克
				BYTE bRandCard[54];
				m_GameLogic.RandCardList(bRandCard,sizeof(bRandCard)/sizeof(bRandCard[0]));

				//分发扑克
				for (WORD i=0;i<m_wPlayerCount;i++)
				{
					m_bCardCount[i]=17;
					CopyMemory(&m_bHandCardData[i],&bRandCard[i*m_bCardCount[i]],sizeof(BYTE)*m_bCardCount[i]);
				}
				CopyMemory(m_bBackCard,&bRandCard[51],sizeof(m_bBackCard));
				m_GameLogic.SortCardList(m_bBackCard,3,ST_ORDER);
			}

			//设置用户
			m_wCurrentUser = rand() % GAME_PLAYER;
			m_wFirstUser=m_wCurrentUser;

			//发送扑克
			CMD_S_SendAllCard SendAllCard ;
			SendAllCard.wCurrentUser = m_wCurrentUser ;

			//手上扑克
			CopyMemory(SendAllCard.bCardData, m_bHandCardData, sizeof(m_bHandCardData)) ;
			//底牌扑克
			CopyMemory(SendAllCard.bBackCardData, m_bBackCard, 3) ;
			for (WORD i=0;i<m_wPlayerCount;i++)
			{
				m_pITableFrame->SendTableData(i,SUB_S_SEND_CARD,&SendAllCard,sizeof(SendAllCard));
				m_pITableFrame->SendLookonData(i,SUB_S_SEND_CARD,&SendAllCard,sizeof(SendAllCard));
			}

			//排列扑克
			for (WORD i=0;i<m_wPlayerCount;i++)
			{
				m_GameLogic.SortCardList(m_bHandCardData[i],m_bCardCount[i],ST_ORDER);
			}

			return true;
		}

		//设置变量
		if (m_wBankerUser==INVALID_CHAIR) m_wBankerUser=m_wFirstUser;

		//设置状态
		m_pITableFrame->SetGameStatus(GS_WK_PLAYING);

		//发送底牌
		m_bCardCount[m_wBankerUser]=20;
		CopyMemory(&m_bHandCardData[m_wBankerUser][17],m_bBackCard,sizeof(m_bBackCard));
		m_GameLogic.SortCardList(m_bHandCardData[m_wBankerUser],m_bCardCount[m_wBankerUser],ST_ORDER);

		//出牌信息
		m_bTurnCardCount=0;
		m_wTurnWiner=m_wBankerUser;
		m_wCurrentUser=m_wBankerUser;

		//发送消息
		CMD_S_GameStart GameStart;
		GameStart.wLandUser=m_wBankerUser;
		GameStart.bLandScore=m_bLandScore;
		GameStart.wCurrentUser=m_wCurrentUser;
		CopyMemory(GameStart.bBackCard,m_bBackCard,sizeof(m_bBackCard));
		m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_GAME_START,&GameStart,sizeof(GameStart));
		m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_GAME_START,&GameStart,sizeof(GameStart));

		return true;
	}

	//设置用户
	m_wCurrentUser=(wChairID+1)%m_wPlayerCount;

	//发送消息
	CMD_S_LandScore LandScore;
	LandScore.bLandUser=wChairID;
	LandScore.bLandScore=bLandScore;
	LandScore.wCurrentUser=m_wCurrentUser;
	LandScore.bCurrentScore=m_bLandScore;
	m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_LAND_SCORE,&LandScore,sizeof(LandScore));
	m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_LAND_SCORE,&LandScore,sizeof(LandScore));

	return true;
}
Beispiel #18
0
//游戏开始
bool __cdecl CTableFrameSink::OnEventGameStart()
{
	//设置状态
	m_pITableFrame->SetGameStatus(GS_PLAYING);

	CMD_S_GameStart GameStart;
	ZeroMemory(&GameStart,sizeof(GameStart));
	m_GameLogic.m_bSeries	=   m_bSeries.bCurrentSeries|0x20;
	m_bEnd					=	false;
	
	//混论扑克
	BYTE bRandCard[108];
	m_GameLogic.RandCardList(bRandCard,CountArray(bRandCard));

	//分发扑克
	for(WORD i=0;i<m_wPlayerCount;i++)
	{
		m_bCardCount[i]=27;
		CopyMemory(&m_bHandCardData[i],&bRandCard[i*m_bCardCount[i]],sizeof(BYTE)*m_bCardCount[i]);
		m_GameLogic.SortCardList(m_bHandCardData[i] ,m_bCardCount[i]);
	}

	//设置用户
	if(m_wBankerUser==INVALID_CHAIR)
	{
		GameStart.bLiangPai					=	true;
		m_wCurrentUser						=   rand() % m_wPlayerCount;
		BYTE    bIndex						=   rand() % 27;
		GameStart.bLiangCard				=	m_bHandCardData[m_wCurrentUser][bIndex];
		m_wBankerUser						=   m_wCurrentUser;
	}
	else
		m_wCurrentUser						=	m_wBankerUser;

    CMD_S_PayTribute   PayTribute;
	//判断进贡
	if(m_bGameStatus	==	SHUANG_XIA)
	{
		m_wCurrentUser		=	INVALID_CHAIR;
		BYTE  bFirst		=	m_bRanKing[0];
		BYTE  bSecond		=   (bFirst+1)%m_wPlayerCount;
		BYTE  bThree		=	(bSecond+2)%m_wPlayerCount;

		//拥有双大王,抗贡
		if(m_bHandCardData[bFirst][0]!=0x42&&m_bHandCardData[(bFirst+2)%m_wPlayerCount][0]!=0x42)
		{
			CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(BYTE)*4);
			if(m_bHandCardData[bSecond][0]!=0x42)
				PayTribute.bPayType[bSecond]=0;
			if(m_bHandCardData[bThree][0]!=0x42)
				PayTribute.bPayType[bThree]=0;

			ZeroMemory(m_bPayTribute,sizeof(m_bPayTribute));
			m_wCurrentUser			  =		bFirst;

		}
	}else if(m_bGameStatus == DAN_XIA)
	{
		m_wCurrentUser		=	INVALID_CHAIR;
		BYTE bSecond		=	(m_bRanKing[1]+2)%m_wPlayerCount;

		//拥有双大王,抗贡
		if(m_bHandCardData[bSecond][0]==0x42&&m_bHandCardData[bSecond][1]==0x42)
		{
			CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(BYTE)*4);
			ZeroMemory(m_bPayTribute,sizeof(m_bPayTribute));
			m_wCurrentUser			=      m_bRanKing[0];
		}
	}else if(m_bGameStatus == OTHER)
	{	
		m_wCurrentUser		=	INVALID_CHAIR;
		BYTE bSecond		=	(m_bRanKing[0]+2)%m_wPlayerCount;

		//拥有双大王,抗贡
		if(m_bHandCardData[bSecond][0]==0x42&&m_bHandCardData[bSecond][1]==0x42)
		{
			CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(BYTE)*4);
			ZeroMemory(m_bPayTribute,sizeof(m_bPayTribute));
			m_wCurrentUser			=      m_bRanKing[0];
		}
	}
	
	//发送扑克
	//消息创建
	GameStart.wBankerUser				=	m_wBankerUser;
	GameStart.wCurrentUser				=	m_wCurrentUser;
	GameStart.series					=	m_bSeries;
	CopyMemory(GameStart.m_iGameResult,m_iGameResult,sizeof(m_iGameResult));
	GameStart.RoomType=enRoomType_Normal;
	
	GameStart.wServerType	= m_pGameServiceOption->wServerType;

	for (WORD i=0;i<m_wPlayerCount;i++)
	{  
		CopyMemory(GameStart.cbCardData,m_bHandCardData[i],sizeof(GameStart.cbCardData));
		m_pITableFrame->SendTableData(i,SUB_S_GAME_START,&GameStart,sizeof(GameStart));
		m_pITableFrame->SendLookonData(i,SUB_S_GAME_START,&GameStart,sizeof(GameStart));
	}
	//处理进贡
    if(m_wCurrentUser==INVALID_CHAIR)
	{
		CopyMemory(PayTribute.bPayType,m_bPayTribute,sizeof(BYTE)*4);
		PayTribute.wCurrentUser	=	INVALID_CHAIR;
		PayTribute.bPayStatus	=	enJin_Gong;
		PayTribute.wCurrentUser	=	INVALID_CHAIR;
		m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
		CMD_S_MESSAGE message;
		IServerUserItem * pIServerUserItem;
		for(WORD i=0;i<m_wPlayerCount;i++)
		{
			if(PayTribute.bPayType[i]==2)
			{
				pIServerUserItem=m_pITableFrame->GetServerUserItem(i);
				_sntprintf(message.szBuffer,sizeof(message.szBuffer),"等待用户 %-s 进贡",
					pIServerUserItem->GetAccounts());
				m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_SYSTEM_MESSAGE,&message,sizeof(message));
				m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_SYSTEM_MESSAGE,&message,sizeof(message));
			}	
		}
	}
	//处理抗贡
	else if(m_bGameStatus!=0)
	{
			PayTribute.bPayStatus=enKang_Gong;
			m_pITableFrame->SendTableData(INVALID_CHAIR,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
			m_pITableFrame->SendLookonData(INVALID_CHAIR,SUB_S_PAY_TRIBUTE,&PayTribute,sizeof(PayTribute));
	}
			
	
	return true;
}