Exemplo n.º 1
0
int PartyMatchInfo(LPMSG_PARTYMATCHING_INFO_REQ lpMsg,PARTYMATCH_INFO* pBodyMsg,int& count,int& pages)
{
	char szQuery[256];
	long dwLen = 0;
	int TotalPages = 0;

#ifdef ZTEAMDB
	sprintf(szQuery,"EXEC PartyMatching_GetList ?,%d,%d,'%s',%d,%d,%d",
		lpMsg->RequestPage,lpMsg->ReqType,lpMsg->szSearch,
		lpMsg->Level,lpMsg->Class,lpMsg->Gens);
#else
	sprintf(szQuery,"EXEC WZ_PM_Listinfo ?,%d,%d,'%s',%d,%d,%d",
		lpMsg->RequestPage,lpMsg->ReqType,lpMsg->szSearch,
		lpMsg->Level,lpMsg->Class,lpMsg->Gens);
#endif

	g_PartyMatchDB.BindParameterIntOutput(1,&TotalPages,&dwLen);

	if( !g_PartyMatchDB.Exec(szQuery) )
	{
		g_PartyMatchDB.Clear();
		return -1;
	}

	count = 0;
	int fResult;

	while( (fResult = g_PartyMatchDB.Fetch()) != SQL_NO_DATA && fResult != SQL_ERROR )
	{
		pBodyMsg[count].btPartyCount = g_PartyMatchDB.GetInt("PartyCount");
		pBodyMsg[count].LeaderLevel = g_PartyMatchDB.GetInt("LeaderLevel");
		pBodyMsg[count].LeaderClass = g_PartyMatchDB.GetInt("LeaderClass");
		pBodyMsg[count].LeaderChannel = g_PartyMatchDB.GetInt("LeaderChannel");
		pBodyMsg[count].btClass = g_PartyMatchDB.GetInt("Class");
		pBodyMsg[count].MinLevel = g_PartyMatchDB.GetInt("MinLevel");
		pBodyMsg[count].MaxLevel = g_PartyMatchDB.GetInt("MaxLevel");
		pBodyMsg[count].MoveReqId = g_PartyMatchDB.GetInt("MoveReqId");
		pBodyMsg[count].Gens = g_PartyMatchDB.GetInt("Gens");

		char szTmpPassword[8] = {0};
		g_PartyMatchDB.GetStr("Password",szTmpPassword);
		pBodyMsg[count].btIsPassword = (strlen(szTmpPassword) > 1) ? TRUE : FALSE;

		g_PartyMatchDB.GetStr("PartyLeader",pBodyMsg[count].szLeader);
		g_PartyMatchDB.GetStr("Description",pBodyMsg[count].szDescription);
		count++;
	}

	while( g_PartyMatchDB.MoreResults() != SQL_NO_DATA )
	{

	}

	pages = TotalPages;
	g_PartyMatchDB.Clear();
	return 0;
}
Exemplo n.º 2
0
void DGPartyMatchReqList(PARTYMATCH_GDREQ_REQUESTLIST* lpData, int aIndex)
{
	const int MaxSize = sizeof(PARTYMATCH_DGANS_REQUESTLIST_COUNT) + sizeof(PARTYMATCH_DGANS_REQUESTLIST_INFO) * 80;
	BYTE Buffer[MaxSize + 1] = { 0 };
	int Offset = sizeof(PARTYMATCH_DGANS_REQUESTLIST_COUNT);
	// ----
	PARTYMATCH_DGANS_REQUESTLIST_COUNT* lpAnswerCount = (PARTYMATCH_DGANS_REQUESTLIST_COUNT*)Buffer;
	PARTYMATCH_DGANS_REQUESTLIST_INFO* lpAnswerInfo = (PARTYMATCH_DGANS_REQUESTLIST_INFO*)&Buffer[Offset];
	// ----
	lpAnswerCount->h.c = PMHC_WORD;
	lpAnswerCount->h.headcode = 0xEF;
	lpAnswerCount->h.subcode = 0x04;
	lpAnswerCount->h.sizeH = SET_NUMBERH(Offset);
	lpAnswerCount->h.sizeL = SET_NUMBERL(Offset);
	lpAnswerCount->UserIndex = lpData->UserIndex;
	// ----
	char Query[256];
	long Len = 0;
	// ----
	sprintf(Query, "EXEC PartyMatching_GetRequestList '%s'", lpData->PartyLeader);
	// ----
	if( !g_PartyMatchDB.Exec(Query) )
	{
		g_PartyMatchDB.Clear();
		DataSend(aIndex, (LPBYTE)lpAnswerCount, Offset);
		return;
	}
	// ----
	int Result, Count = 0;
	// ----
	while( (Result = g_PartyMatchDB.Fetch()) != SQL_NO_DATA && Result != SQL_ERROR )
	{
		g_PartyMatchDB.GetStr("Name", lpAnswerInfo[Count].Character);
		lpAnswerInfo[Count].Class = g_PartyMatchDB.GetInt("SenderClass");
		lpAnswerInfo[Count].Level = g_PartyMatchDB.GetInt("SenderLevel");
		Offset += sizeof(PARTYMATCH_DGANS_REQUESTLIST_INFO);
		Count++;
	}
	// ----
	while( g_PartyMatchDB.MoreResults() != SQL_NO_DATA )
	{
		
	}
	// ----
	g_PartyMatchDB.Clear();
	// ----
	lpAnswerCount->h.sizeH = SET_NUMBERH(Offset);
	lpAnswerCount->h.sizeL = SET_NUMBERL(Offset);
	lpAnswerCount->Count = Count;
	// ----
	DataSend(aIndex, (LPBYTE)Buffer, Offset);
}
Exemplo n.º 3
0
void CHousingDBCtrl::LoadHousingInfo( DWORD dwPlayerId, DPID dpId )
{
    CHousing* pHousing = CHousingMng::GetInstance()->GetHousing( dwPlayerId );
    if( !pHousing )
    {
        pHousing = CHousingMng::GetInstance()->CreateHousing( dwPlayerId );
        if( !pHousing )	// 생성 실패시 그냥 리턴..
            return;

        // DB 로딩...
        CQuery* pQuery = GetQueryObject();
        if( pQuery->Execute( "usp_Housing_Load '%02d', '%07d'", g_appInfo.dwSys, dwPlayerId ) )
        {
            while( pQuery->Fetch() )
            {
                HOUSINGINFO housingInfo;
                housingInfo.dwItemId = static_cast<DWORD>( pQuery->GetInt( "ItemIndex" ) );
                housingInfo.tKeepTime = static_cast<time_t>( pQuery->GetInt64( "tKeepTime" ) );
                housingInfo.bSetup = static_cast<BOOL>( pQuery->GetInt( "bSetup" ) );
                housingInfo.vPos.x = pQuery->GetFloat( "x_Pos" );
                housingInfo.vPos.y = pQuery->GetFloat( "y_Pos" );
                housingInfo.vPos.z = pQuery->GetFloat( "z_Pos" );
                housingInfo.fAngle = pQuery->GetFloat( "fAngle" );

                ItemProp* pItemProp = prj.GetItemProp( housingInfo.dwItemId );
                if( pItemProp && pItemProp->dwItemKind1 == IK1_HOUSING )
                    pHousing->SetFurnitureList( housingInfo, TRUE );
            }

            if( pQuery->MoreResults() )
            {
                while( pQuery->Fetch() )
                    pHousing->SetVisitAllow( pQuery->GetInt( "f_idPlayer" ), TRUE );
            }
        }
    }

    // 하우징 정보를 월드서버에 전달...
    CDPTrans::GetInstance()->SendHousingLoadInfo( dwPlayerId, pHousing, dpId );
}