📄 auction.cpp
字号:
void CAuction::RecvCMD_MERCHANT_SELL_ITEM_REGISTER(const int iCn, t_packet &p)//魄概 酒捞袍阑 殿废
{//努扼捞攫飘俊霸父 罐嚼聪促.//叼厚肺 傈价 钦聪促.
const int cn = p.u.SellerItemRegister.iCn;
CHARLIST * ch = CheckServerId(cn);
if(!ch){return;}
//捞抚 八荤棺 酒捞袍 乐绰瘤 眉农殿殿..
if(strcmp(p.u.SellerItemRegister.szName, ch->Name)){return;}//捞抚捞 撇妨
ITEMATTR* pItem = ::GetItemByPOS(ch,p.u.SellerItemRegister.pos);//酒捞袍 罐绰促
if(!pItem){return;}//酒捞袍 绝匙
if(memcmp(pItem,&p.u.SellerItemRegister.SellItem,sizeof(ITEMATTR))){return;}//酒捞袍捞 撇府匙
if(ch->GetBankMoney() < AUCTION_CANCEL_MONEY)//AUCTION_CANCEL_MONEY 焊促 篮青捣捞 累促搁 角菩促
{
::OutMessage(ch,2,12);//捣捞 葛磊而聪促.
return;
}
//惑牢牢啊 眉农甫 馆靛矫 秦 杭巴
//酒捞袍狼 努贰胶,饭绢,饭骇,琶平,涝篮辆幅
CItem *t = ::ItemUnit(*pItem);
if(!t){return;}//厘抄摹唱.. 捞蝶困 酒捞袍阑!
DWORD dwATTR3 = pItem->attr[IATTR_RARE_MAIN];
ITEMRAREMAIN *pRare = (LPRareMain)&dwATTR3;
int iRareType = NORMAL_ITEM;
if(dwATTR3)//饭绢八荤
{// pRare
switch(pRare->iHighLevel)
{
case H_LV_HIGH_ITEM:
{
iRareType = HIGH_ITEM;
}break;
case H_LV_NO_HIGH_ITEM:
{
iRareType = RARE_ITEM;
if(pRare->IsDynamicRare)
{
iRareType = DYNAMIC_RARE_ITEM;
}
}break;
case H_LV_LEGEND_ITEM:
{
iRareType = SET_ITEM;
}break;
}
}
else
{
iRareType = NORMAL_ITEM;
}
p.u.SellerItemRegister.iFKRareType = iRareType;
p.u.SellerItemRegister.iFKLevel = (t->GetNeed3Lv()/10);
p.u.SellerItemRegister.iFKWearType = t->GetWearAble();
p.u.SellerItemRegister.iFKTacticType= t->GetSkill_Ability();
//啊拜 八荤
const int iSellValue = (int)p.u.SellerItemRegister.dwSellValue;
if(iSellValue >= 0 && iSellValue < INT_MAX)//0焊促 农绊 INT_MAX焊促 累酒具 茄促.. 弊贰具 剧荐促
{ //八荤 场
p.h.header.type = CMD_MERCHANT_SELL_ITEM_REGISTER_COMFORM;//叼厚俊霸 肮荐 眉农 罐栏矾 啊磊
::QueuePacket(connections,DB_DEMON,&p,1);
}
return;//int 逞绰 捣篮 绝绢
}
void CAuction::RecvCMD_MERCHANT_SELL_ITEM_REGISTER_COMFORM_RESULT(const int iCn, t_packet &p)
{
const int iUserCn = p.u.SellerItemRegister.iCn;
CHARLIST *ch = CheckServerId(iUserCn);
if(!ch){return;}//货尝 弊荤捞俊 唱艾匙..
if(strcmp(ch->Name ,p.u.SellerItemRegister.szName)){return;}//倔饭 促弗仇捞匙.
//荐荐丰 眉农
if(ch->GetBankMoney() < AUCTION_CANCEL_MONEY)//AUCTION_CANCEL_MONEY 焊促 篮青捣捞 累促搁 角菩促
{//捞繁 惑炔捞 积扁唱? 酒鳖 哪汽罐扁 傈俊 篮青捣 眉农 沁绰单..
::OutMessage(ch,2,12);//捣捞 葛磊而聪促.
return;
}
if (ch->DecBankMoney(AUCTION_CANCEL_MONEY, BMCT_AUCTION_ITEM_REGISTER))
{ //< CSD-030723 : 秒家 荐荐丰 罐扁捞 乐备唱 付捞呈胶 救登霸阐 贸府
if (1 == p.u.SellerItemRegister.iKey)
{ //酒捞袍阑 哗狙绊 叼厚俊霸 酒捞袍阑 殿废 矫诺聪促.
POS pos = p.u.SellerItemRegister.pos;
ITEMATTR* pItem = ::GetItemByPOS(ch,pos);//酒捞袍 罐绰促
if(!pItem){return;}//酒捞袍 绝匙
if(memcmp(pItem,&p.u.SellerItemRegister.SellItem,sizeof(ITEMATTR))){return;}//酒捞袍捞 撇府匙
//捞贰历贰 嘎栏聪鳖
::SendItemEventLog( pItem, ch->GetServerID(), 0, SILT_REGISTER_AUCTION_ITEM, 1 );//021209 lsw
::DeleteItem(pItem);//酒捞袍 化疽促
::SendServerEachItem( &pos, pItem, iUserCn);//焊郴扁//瘤况柳吧 焊辰促
::QueuePacket(connections,DB_DEMON,&p,1);//叼厚俊 殿废 秦崔扼绊 茄促
}
else
{ //具.. 够 弊犯霸 腹捞 迫妨备 弊矾衬.. 弊父 迫绢(肮荐力茄 吧覆)
::QueuePacket(connections,iUserCn,&p,1);
}
} //> CSD-030723
}
void CAuction::RecvCMD_MERCHANT_SELL_ITEM_REGISTER_RESULT(t_packet &p)//魄概 酒捞袍阑 殿废
{//叼厚俊霸 罐酒辑 努扼捞攫飘肺 傈价 钦聪促.
const int iUserCn = p.u.SellerItemRegister.iCn;
CHARLIST* ch = CheckServerId(iUserCn);
if(!ch){return;}
if(strcmp(ch->Name ,p.u.SellerItemRegister.szName)){return;}//倔饭 促弗仇捞匙.
const int iKey = p.u.SellerItemRegister.iKey;
if(!iKey)
{//殿废 角菩牢单? ぱぱ;.. 酒捞袍 瘤奎栏聪鳖 汗备 秦 拎具 窍匙..
int a=0,b=0,c=0;
POS pos;
ITEMATTR *pNoRegItem = &p.u.SellerItemRegister.SellItem;
if(!::SearchInv(ch->inv,a,b,c))
{//固模仇 弊荤捞俊 救亥配府甫 盲奎绢??
AddItemList( pNoRegItem->item_no,pNoRegItem->attr,0,
ch->X+rand()%40, ch->Y+rand()%60, 0, 0, 0,0,0,0);//官蹿俊 冻绢 脸绢
}
else
{//瘤鞭
SetItemPos(INV,a,b,c,&pos);//pos 盲快绊
ITEMATTR *pItem = ::GetItemByPOS(ch,pos);//酒捞袍 林家 罐绊
(*pItem) = (*pNoRegItem);//酒捞袍 促矫 瘤鞭
::SendServerEachItem( &pos, pItem, iUserCn);//焊郴扁//瘤况柳吧 焊辰促
}
}
//<! BBD 040226 殿废矫 苛记肺弊
else // 殿废 己傍捞聪 肺弊甫 巢扁磊
{
t_SellerItemDelete item;
memset(&item, 0L, sizeof(item));
item.dwSellValue = p.u.SellerItemRegister.dwSellValue;
item.iCn = p.u.SellerItemRegister.iCn;
item.iIndex = 0; // 殿废矫绰 牢郸胶啊 臼甸绢柯促.
item.iKey = 0; // 殿废 肋夌栏聪 IsEnd绰 0捞摆瘤
item.SellItem = p.u.SellerItemRegister.SellItem;
strcpy(item.szSellerName, p.u.SellerItemRegister.szName);
g_pLogManager->SaveAutionLog(ACLT_SELLER_REGIST, &(item));
}
//> BBD 040226 殿废矫 苛记肺弊
::QueuePacket(connections,iUserCn,&p,1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 殿废 窍扁 场
////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 芭贰 搬苞 府胶飘 罐扁 矫累
////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CAuction::RecvCMD_MERCHANT_RESULT_LIST_REQUEST(const int cn,t_packet &p)
{
if(cn != p.u.SellerItemRequest.iCn){return;}
CHARLIST * ch = CheckServerId(cn);
if(!ch){return;}
if(!strcmp(ch->Name,p.u.SellerItemRequest.szName))//捞抚 八祸饶 努扼捞攫飘肺 胶困莫
::QueuePacket(connections,DB_DEMON,&p,1);
}
void CAuction::RecvCMD_MERCHANT_RESULT_LIST_REQUEST_RESULT(t_packet &p)
{
const int cn = p.u.SearchResultList.iCn;
CHARLIST * ch = CheckServerId(cn);
if(!ch){return;}
if(!strcmp(ch->Name,p.u.SearchResultList.szName))//捞抚 八祸饶 努扼捞攫飘肺 胶困莫
{
::QueuePacket(connections,cn,&p,1);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 芭贰 搬苞 府胶飘 罐扁 场
////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//芭贰 搬苞拱 啊廉啊扁 矫累
////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CAuction::RecvCMD_MERCHANT_RESULT_TAKE(const int cn,t_packet &p)
{
CHARLIST *ch = CheckServerId(cn);
if(!ch){return;}
if(strcmp(p.u.MerchantResultTake.szMyName, ch->Name)){return;}//捞抚捞 撇妨
if(!strcmp(p.u.MerchantResultTake.szMyName,p.u.MerchantResultTake.szSellerName))//魄概磊 捞搁
{//捣 罐阑 荐 乐绰瘤 眉农
const int dwSellValue = p.u.MerchantResultTake.dwSellValue;
const int iNeedCount = ConvBondMoneyCount(dwSellValue);
const int iHaveCount = SearchInvEmptyCount(ch->inv);
if(iNeedCount > iHaveCount)//捣罐阑 沫捞 葛磊鄂单
{
::OutMessage(ch,2,13);//烙矫,,牢亥配府 傍埃捞 面盒摹 臼嚼聪促.
return;
}
else
{
p.u.MerchantResultTake.iKey = 1;//魄概磊肺 汲沥
p.h.header.type = CMD_MERCHANT_RESULT_TAKE_COMFORM;//鸥涝 傈券
::QueuePacket(connections,DB_DEMON,&p,1);//叼厚俊霸 焊忱聪促.
}
}
else//备概磊 捞搁
{
int a=0,b=0,c=0;
if(::SearchInv(ch->inv,a,b,c))//后傍埃捞 乐绰啊
{
p.u.MerchantResultTake.iKey = 0;//备概磊肺 汲沥
p.h.header.type = CMD_MERCHANT_RESULT_TAKE_COMFORM;//鸥涝 傈券
::QueuePacket(connections,DB_DEMON,&p,1);//叼厚俊霸 焊忱聪促.
}
else
{
::OutMessage(ch,2,13);//烙矫,,牢亥配府 傍埃捞 面盒摹 臼嚼聪促.
}
}
}
void CAuction::RecvCMD_MERCHANT_RESULT_TAKE_COMFORM_RESULT(const int cn,t_packet &p)
{//抛捞农 惑怕肺 倒涝 沁促
MERCHANTRESULTTAKE *pMRT = &p.u.MerchantResultTake;
const int iUserCn = pMRT->iCn;
CHARLIST *ch = CheckServerId(iUserCn);
if(!ch){return;}
if(strcmp(pMRT->szMyName, ch->Name)){return;}//捞抚捞 撇妨
if(-1 == pMRT->iKey)//魄概磊 荤捞靛
{ //呈 瘤鞭罐绰单 巩力啊 乐绢
return;
}
if(1 == pMRT->iKey)
{//魄概磊具 捣父 冈绢扼
const DWORD dwSellValue = p.u.MerchantResultTake.dwSellValue;
if(::GiveMoney(ch,dwSellValue))
{//瘤鞭己傍
pMRT->iKey += 100;
}
else
{
pMRT->iKey += 10;
}
}
else
{
int a=0,b=0,c=0;
if(::SearchInv(ch->inv,a,b,c))//傍埃捞 乐备唱
{
POS pos;
SetItemPos(INV,a,b,c,&pos);//pos悸泼
ITEMATTR *pItem = ::GetItemByPOS(ch,pos);//酒捞袍 林家 罐绊
(*pItem) = pMRT->SellItem;
::SendServerEachItem( &pos, pItem,iUserCn);//焊郴扁
::SendItemEventLog( pItem, ch->GetServerID(), 0, SILT_TAKE_AUCTION_RESULT_ITEM, 1 );//021209 lsw
pMRT->iKey += 100;
}
else//捞繁 惑炔捞 积扁唱? 酒鳖 哪汽罐扁 傈俊 牢亥配府 眉农 沁绰单..
{
::OutMessage(ch,2,13);//烙矫,,牢亥配府 傍埃捞 面盒摹 臼嚼聪促.
pMRT->iKey += 10;
}
}
p.h.header.type = CMD_MERCHANT_RESULT_TAKE_COMFORM_RESULT;//鸥涝 傈券
::QueuePacket(connections,DB_DEMON,&p,1);//叼厚俊霸 焊忱聪促.
}
void CAuction::RecvCMD_MERCHANT_RESULT_TAKE_RESULT(t_packet &p)
{
const int cn = p.u.MerchantResultTake.iCn;
CHARLIST * ch = CheckServerId(cn);
if(!ch){return;}
if(!strcmp(ch->Name,p.u.MerchantResultTake.szMyName))//捞抚 八祸饶 努扼捞攫飘肺 胶困莫
{
::QueuePacket(connections,cn,&p,1);
}
//<! BBD 040226 魄概磊捞带 备概磊捞带 芭贰 搬苞拱阑 葛滴 肋 罐疽促. DBDemon俊霸 饭内靛甫 昏力窍扼绊 舅赴促.
if(p.u.MerchantResultTake.iKey == 101 || p.u.MerchantResultTake.iKey == 100)
{
p.h.header.type = CMD_MERCHANT_RECORD_DEL_COMPLETE;//鸥涝 傈券
::QueuePacket(connections,DB_DEMON,&p,1);//叼厚俊霸 焊忱聪促.
}
//> BBD 040226 魄概磊捞带 备概磊捞带 芭贰 搬苞拱阑 葛滴 肋 罐疽促. DBDemon俊霸 饭内靛甫 昏力窍扼绊 舅赴促.
//<! BBD 040226 绢露芭唱 瘤鞭登菌栏聪 肺弊甫 巢败具瘤
t_SellerItemDelete item;
memset(&item, 0L, sizeof(item));
item.iCn = p.u.MerchantResultTake.iCn;
item.iIndex = p.u.MerchantResultTake.iIndex;
strcpy(item.szSellerName, p.u.MerchantResultTake.szSellerName);
strcpy(item.szName, p.u.MerchantResultTake.szBuyerName);
item.iKey = p.u.MerchantResultTake.iKey;
item.dwSellValue = p.u.MerchantResultTake.dwSellValue;
item.SellItem = p.u.MerchantResultTake.SellItem;
if(p.u.MerchantResultTake.iKey == 101) // 魄概磊 捣 瘤鞭 己傍
{
g_pLogManager->SaveAutionLog(ACLT_SELLER_TAKE, &(item));
}
else if(p.u.MerchantResultTake.iKey == 100) // 备概磊 酒捞袍 瘤鞭 己傍
{
g_pLogManager->SaveAutionLog(ACLT_BUYER_TAKE, &(item));
}
//> BBD 040226 绢露芭唱 瘤鞭登菌栏聪 肺弊甫 巢败具瘤
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 芭贰 搬苞拱 啊廉啊扁 场
////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//俺牢利 芭贰 府胶飘 矫累
////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CAuction::RecvCMD_MERCHANT_DIRECT_EXCHANGE_LIST_REQUSET(const int cn,t_packet &p)
{
const int iTargetCn =ExistHe(p.u.MerchantExchangeRequest.szSellerName);
const CHARLIST *pTargetCh = CheckServerId(iTargetCn);
if(!pTargetCh){return;}
p.u.MerchantExchangeRequest.iCn = cn;
::QueuePacket(connections,DB_DEMON,&p,1);//叼厚俊霸 焊忱聪促.
}
void CAuction::RecvCMD_MERCHANT_DIRECT_EXCHANGE_LIST_REQUSET_RESULT(t_packet &p)
{
const int cn = p.u.SearchResultList.iCn;
CHARLIST * ch = CheckServerId(cn);
if(!ch){return;}
if(!strcmp(ch->Name,p.u.SearchResultList.szName))//捞抚 八祸饶 努扼捞攫飘肺 胶困莫
{
::QueuePacket(connections,cn,&p,1);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//俺牢利 芭贰 府胶飘 场
////////////////////////////////////////////////////////////////////////////////////////////////////////////
int SearchInvEmptyCount( ItemAttr inv[3][3][8])
{
int iCount = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -