📄 auction.cpp
字号:
// Auction.cpp: implementation of the CAuction class.
//
//////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "packed.h"
#include "servertable.h"
#include "MAIN.H"
#include "Scrp_exe.H"
#include "ID.h"
#include "SealStone.h"
#include "Debug.h"
#include "mainheader.h"
#include "monitor.h"
#include "Citem.h"
#include "Pay.h"
#include "ChrLog.h"
#include "dragonloginserver2.h" // 010406 YGI
#include "hong_sub.h"
#include "Auction.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern HDBC hDBC_ChrLogDB;
extern HDBC hDBC_TotalDB;
extern HENV hEnv ;
extern HDBC hDBC ;
extern int g_wday;
CAuction Auction;
CAuction::CAuction()
{
Clear();
}
CAuction::~CAuction()
{
Clear();
}
void CAuction::Clear()
{
}
//soto-030514
int CAuction::SearchAuctionItem(SEARCHRESULTLIST *List, const char* szQuery)
{
HSTMT hStmt = NULL;
RETCODE retCode;
SDWORD cbValue;
::SQLAllocStmt(hDBC, &hStmt);
retCode = SQLExecDirect(hStmt, (UCHAR *)szQuery, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
int i = 0;
retCode = SQLFetch(hStmt);
while( retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
if(i > MAX_SEARCH_RESULT_LIST)
{
goto __FAIL;
}
int column = 0;
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].iIndex , 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_CHAR, List->ResultList[i].szSellerName, 20, &cbValue);
::EatRearWhiteChar(List->ResultList[i].szSellerName);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_CHAR, List->ResultList[i].szBuyerName, 20, &cbValue);
::EatRearWhiteChar(List->ResultList[i].szBuyerName);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].iIsEnd, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].iSellerTake, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].iBuyerTake, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].iSellValue, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].m_ResultItem.item_no, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].m_ResultItem.attr[0], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].m_ResultItem.attr[1], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].m_ResultItem.attr[2], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].m_ResultItem.attr[3], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].m_ResultItem.attr[4], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &List->ResultList[i].m_ResultItem.attr[5], 0, &cbValue);
i++;
retCode = SQLFetch(hStmt);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO){}
else if( retCode == SQL_NO_DATA )
{
break;
}
else
{
goto __FAIL;
}
}
goto __SUCCESS;
}
goto __FAIL;
__FAIL:
{
::SQLFreeStmt(hStmt, SQL_DROP);
return false;
}
__SUCCESS:
{
::SQLFreeStmt(hStmt, SQL_DROP); // 0308 YGI
return true;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 府胶飘 八祸 窍扁 矫累 (备概磊
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//soto-030514
int CAuction::RecvCMD_MERCHANT_BUY_LIST_REQUEST(const int iCn, t_packet &p)//府胶飘 夸没(备概磊啊 焊绰巴//八祸扁啊 龋免
{
SEARCHRESULTLIST FindResult;
memset(&FindResult ,0, sizeof(SEARCHRESULTLIST));
FindResult.iCn = p.u.SearchPacketServer.iCn;
FindResult.iKey = p.u.SearchPacketServer.ClientMsg.iKey;//021113 lsw
int iIndex = p.u.SearchPacketServer.ClientMsg.iIndex;
memcpy(FindResult.szName,p.u.SearchPacketServer.szName,20);
char szQuery[1000] ={0,};
char szKeyWord[21] = {NULL,};
char szMerchant[21] = {NULL,};
int nDay = 0;
switch(p.u.SearchPacketServer.ClientMsg.nPeriod)
{
case 0:
nDay = 2;//1老.
break;
case 1:
nDay = 4;//3老
break;
case 2:
nDay = 8;//1林老
break;
}
memcpy(szKeyWord,p.u.SearchPacketServer.ClientMsg.szKeyWord,20);szKeyWord[20] = 0;
memcpy(szMerchant,p.u.SearchPacketServer.ClientMsg.szMerchant,20);szMerchant[20] = 0;
if(FindResult.iKey)
{
if(strlen(szKeyWord))//虐况靛啊 乐栏搁.
{
if(strlen(szMerchant))//惑牢 捞抚捞 乐栏搁.
{
//咯扁绰 虐况靛客 惑牢 捞抚苞 扁埃捞 炼扒捞促.
sprintf(szQuery,"EXEC MerchantItemSearch_Key_Merchant_Day '%s', '%s', %d, %d, %d, %d, %d",
szKeyWord,szMerchant,nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
else
{
//咯扁绰 虐况靛客 扁埃 父捞 炼扒捞促.
sprintf(szQuery,"EXEC MerchantItemSearch_Key_Day '%s', %d, %d, %d, %d, %d",
szKeyWord,nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
}
else//虐况靛啊 绝栏搁.
{
if(strlen(szMerchant))//惑牢 捞抚捞 乐栏搁.
{
//咯扁绰 惑牢捞抚苞 扁埃捞 炼扒捞促.
sprintf(szQuery,"EXEC MerchantItemSearch_Merchant_Day '%s',%d, %d, %d, %d, %d",
szMerchant,nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
else//咯扁绰 窜鉴洒 扁埃父捞 炼扒捞促.
{
sprintf(szQuery,"EXEC MerchantItemSearch_Day %d, %d, %d, %d, %d",
nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
}
}
else
{
if(strlen(szKeyWord))//虐况靛啊 乐栏搁.
{
if(strlen(szMerchant))//惑牢 捞抚捞 乐栏搁.
{
//咯扁绰 虐况靛客 惑牢 捞抚苞 扁埃捞 炼扒捞促.
sprintf(szQuery,"EXEC MerchantItemSearch_Key_Merchant_Day_Inverse '%s', '%s', %d, %d, %d, %d, %d",
szKeyWord,szMerchant,nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
else
{
//咯扁绰 虐况靛客 扁埃 父捞 炼扒捞促.
sprintf(szQuery,"EXEC MerchantItemSearch_Key_Day_Inverse '%s', %d, %d, %d, %d, %d",
szKeyWord,nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
}
else//虐况靛啊 绝栏搁.
{
if(strlen(szMerchant))//惑牢 捞抚捞 乐栏搁.
{
//咯扁绰 惑牢捞抚苞 扁埃捞 炼扒捞促.
sprintf(szQuery,"EXEC MerchantItemSearch_Merchant_Day_Inverse '%s',%d, %d, %d, %d, %d",
szMerchant,nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
else//咯扁绰 窜鉴洒 扁埃父捞 炼扒捞促.
{
sprintf(szQuery,"EXEC MerchantItemSearch_Day_Inverse %d, %d, %d, %d, %d",
nDay,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
}
}
/*
if(iKey)
{
sprintf(szQuery,"EXEC MerchantItemSearchBuyerSide %d, %d, %d, %d, %d, %d, %d, %d",
iRareType, iItemLevel, iTacticType, iWearType,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
else
{
sprintf(szQuery,"EXEC MerchantItemSearchBuyerSideInverse %d, %d, %d, %d, %d, %d, %d, %d",
iRareType, iItemLevel, iTacticType, iWearType,
IS_END_ALL_RIGHT, 0, 0,iIndex);
}
*/
if(SearchAuctionItem(&FindResult,szQuery))
{
t_packet rp;
rp.h.header.type = CMD_MERCHANT_BUY_ITEM_SEARCH_RESULT;
rp.h.header.size = sizeof(SEARCHRESULTLIST);
rp.u.SearchResultList= FindResult;
::QueuePacket(connections,iCn,&rp,1);
}
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 府胶飘 八祸 窍扁 场 (备概磊
////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 备概 窍扁 矫累(备概磊)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CAuction::RecvCMD_MERCHANT_ITEM_BUY_COMFORM(const int iCn,t_packet &p)
{
/*
CREATE PROC MerchantItemBuyComform
(
@No int,
@SellerName char(20),
@BuyerName char(20),
@SetIsEnd int,
@BeforeIsEnd int,
@ItemNo int,
@ItemAttr1 int,
@ItemAttr2 int,
@ItemAttr3 int,
@ItemAttr4 int,
@ItemAttr5 int,
@ItemAttr6 int
)
as
UPDATE MerchantSeller SET [IsEnd] = @SetIsEnd, [BuyerName] = @BuyerName WHERE ([SellerName] =@SellerName) AND ([No] = @No)AND ([IsEnd] = @BeforeIsEnd)
SELECT count(*)FROM MerchantSeller WHERE
([No] = @No)AND
([SellerName] =@SellerName) AND
([IsEnd ]=@SetIsEnd ) AND
([SellItemNo ]=@ItemNo) AND
([SellItemAttr1]= @ItemAttr1) AND
([SellItemAttr2 ]=@ItemAttr2) AND
([SellItemAttr3 ]=@ItemAttr3) AND
([SellItemAttr4 ]=@ItemAttr4) AND
([SellItemAttr5 ]=@ItemAttr5) AND
([SellItemAttr6 ]=@ItemAttr6)
MerchantItemBuyComform 1,'拳尔惑快', 3,1
*/
//isend 甫 芭贰吝栏肺 秦霖促
//备概 啊瓷 茄啊? //牢郸胶,颇绰仇,酒捞袍,isEnd == 0(备概啊瓷) 栏肺 八祸茄促
//墨款飘甫 罐酒辑 八荤 窍磊 0 捞搁 救魄促绊 1 捞搁 魄促 摆瘤.
HSTMT hStmt = NULL;
RETCODE retCode;
SDWORD cbValue;
::SQLAllocStmt(hDBC, &hStmt);
char szQuery[255] ={0,};
MERCHANT_ITEM_BUY *pMIB = &p.u.MerchantItemBuy;
MERCHANT_ITEM_BUY QueryResult = *pMIB;//罐篮吧肺 檬扁拳甫 矫挪促
sprintf(szQuery,"EXEC MerchantItemBuyComform %d, '%s' , '%s', "//牢郸胶,捞抚,官曹蔼,捞傈蔼
" %d, %d, "
"%d, %d, %d, %d, %d, %d, %d",
pMIB->iIndex,
pMIB->szSellerName,
pMIB->szBuyerName,
IS_END_BUYING,//备概吝 惑怕肺 父电促
IS_END_ALL_RIGHT,
pMIB->SellItem.item_no,
pMIB->SellItem.attr[0],
pMIB->SellItem.attr[1],
pMIB->SellItem.attr[2],
pMIB->SellItem.attr[3],
pMIB->SellItem.attr[4],
pMIB->SellItem.attr[5]);
//IS_END_ALL_RIGHT 惑怕俊辑父 瘤匡 荐 乐促 咯矾锅 瘤快绰扒 阂啊瓷 窍促
retCode = SQLExecDirect(hStmt, (UCHAR *)szQuery, SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
retCode = SQLFetch(hStmt);
if( retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
int column = 0;
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.iIndex, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_CHAR, QueryResult.szSellerName, 20, &cbValue);
::EatRearWhiteChar(QueryResult.szSellerName);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.iKey, 0, &cbValue);//IsEnd蔼捞 甸绢柯促
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.dwSellValue, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.SellItem.item_no, 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.SellItem.attr[0], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.SellItem.attr[1], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.SellItem.attr[2], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.SellItem.attr[3], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.SellItem.attr[4], 0, &cbValue);
retCode = ::SQLGetData(hStmt, ++column, SQL_C_LONG, &QueryResult.SellItem.attr[5], 0, &cbValue);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{ //咯扁 吭澜篮 单捞鸥啊 钢履窍促绰 刘芭.(诀单捞飘俊 己傍 沁促.
if(QueryResult.dwSellValue != pMIB->dwSellValue)
{
MyLog(0,"Auction Critical Warning!! Type => CMD_MERCHANT_ITEM_BUY_COMFORM SellValue NotMatch = DB %d, Client %d",QueryResult.dwSellValue, pMIB->dwSellValue);
pMIB->dwSellValue = QueryResult.dwSellValue;
MyLog(0,"Auction Critical Warning!! Type => CMD_MERCHANT_ITEM_BUY_COMFORM Force Change Value = %d ",QueryResult.dwSellValue);
}
goto __SUCCESS;
}
else //葛电 抗寇 惑炔篮 绝促.
{ //捞繁 富档 救登绰 惑炔
goto __FAIL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -