本文整理汇总了C++中Item::GetItemIdent方法的典型用法代码示例。如果您正苦于以下问题:C++ Item::GetItemIdent方法的具体用法?C++ Item::GetItemIdent怎么用?C++ Item::GetItemIdent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::GetItemIdent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
UINT CGUseEquipHandler::Execute(CGUseEquip* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
Assert( pGamePlayer ) ;
Obj_Human* pHuman = pGamePlayer->GetHuman() ;
Assert( pHuman ) ;
Scene* pScene = pHuman->getScene() ;
if( pScene==NULL )
{
Assert(FALSE) ;
return PACKET_EXE_ERROR ;
}
//检查线程执行资源是否正确
Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
//切场景时丢弃换装消息
if(pGamePlayer->GetPlayerStatus()!=PS_SERVER_NORMAL ||
!pHuman->IsActiveObj() )
{
g_pLog->FastSaveLog( LOG_FILE_1, "CGUseEquipmentHandler: change scene") ;
return PACKET_EXE_CONTINUE;
}
BYTE BagIndex = pPacket->getBagIndex();
if( BagIndex == INVALID_BAG_INDEX )
{
Assert(FALSE) ; //包发错了
return PACKET_EXE_CONTINUE ;
}
Item* pUseItem = HumanItemLogic::GetItem(pHuman,BagIndex);
GCUseEquipResult Msg;
//////////////////////////////////////////////////////////////////////////
//装配条件判断
UCHAR itemClass = pUseItem->GetItemClass();
if(itemClass == ICLASS_EQUIP)
{
//需求等级判断
if(pUseItem->GetRequireLevel()>pHuman->GetLevel())
{
Msg.setResult(USEEQUIP_IDENT_FAIL);
pGamePlayer->SendPacket( &Msg ) ;
}
//鉴定判断
else if(pUseItem->GetItemQual() == EQUALITY_BLUE && pUseItem->GetItemIdent() == FALSE)
{
Msg.setResult(USEEQUIP_LEVEL_FAIL);
pGamePlayer->SendPacket( &Msg ) ;
}
else
{
HUMAN_EQUIP Equip_Point =(HUMAN_EQUIP)pUseItem->GetEquipPoint();
//const _ITEM* pEquip = pHuman->GetEquip(Equip_Point);
ItemContainer* pEquipContainer = pHuman->GetEquipContain();
if(!pEquipContainer)
{
Assert(pEquipContainer);
return PACKET_EXE_CONTINUE;
}
Item* pEquipItem = pEquipContainer->GetItem((UINT)Equip_Point);
if(!pEquipItem)
{
Assert(pEquipItem);
return PACKET_EXE_CONTINUE;
}
BOOL bEquipStatus = (!pEquipItem->IsEmpty());
ItemContainer* pBagContainer =
HumanItemLogic::GetContainer(pHuman,BagIndex);
if(bEquipStatus)
{
//装备上物品,替换下来装备点数据
g_ItemOperator.ExchangeItem(pBagContainer,
pBagContainer->BagIndex2ConIndex(BagIndex),
pEquipContainer,
(UINT)Equip_Point);
}
else
{
//pHuman->GetDB()->OverWriteBag2Equip(BagIndex,Equip_Point);
g_ItemOperator.MoveItem(pBagContainer,
//.........这里部分代码省略.........
示例2: Execute
//.........这里部分代码省略.........
break;
case SHOP_MATERIAL: //材料
{
if( ICLASS_MATERIAL != pCurrentItem->GetItemClass())
{
bCanBuy = FALSE;
}
}
break;
case SHOP_COMITEM: //药品
{
if( ICLASS_COMITEM != pCurrentItem->GetItemClass())
{
bCanBuy = FALSE;
}
}
break;
default:
{
bCanBuy = FALSE;
break;
}
}
}
//是否返回失败消息???
if(bCanBuy == FALSE)
{
return PACKET_EXE_CONTINUE;
}
INT iPrice = ShopMgr::ConvertItemType2Money(ConvertSerial2ItemType(pCurrentItem->GetItemTableIndex()));
iPrice *= pCurrentItem->GetLayedNum();
//2006-4-21
//玩家向商店出售已经鉴定过的物品或者无需鉴定的物品按照基础价格*系数A(=1/3) 计算;
//若出售未鉴定物品,价格应该更低,设此价格系数为B(=1/10),这个有待于调整,请在config中开放调整A,B的接口。
//耐久衰减系数D=当前耐久/最大耐久
//修理失败衰减次数F=1/(修理失败次数+1)
//因此最终的出售价格为V=基础价格B*A*D*F
//再乘以商店得价格比例
FLOAT fCur = 1;
FLOAT fMax = 1;
INT iFailTimes = 0;
if(pCurrentItem->GetItemClass() == ICLASS_EQUIP)
{
fCur = (FLOAT)pCurrentItem->GetDurPoints();
fMax = (FLOAT)pCurrentItem->GetMaxDurPoint();
iFailTimes = pCurrentItem->GetFailTimes();
}
if(pCurrentItem->GetItemIdent())
{
iPrice = (INT)( ((FLOAT)iPrice/(FLOAT)3.0) * (fCur/fMax) * ((FLOAT)1/(FLOAT)(iFailTimes+1)) * (pShop->m_scale) );
}
else
{
iPrice = (INT)( ((FLOAT)iPrice/(FLOAT)10.0) * (fCur/fMax) * ((FLOAT)1/(FLOAT)(iFailTimes+1)) * (pShop->m_scale) );
}
//备份一下,一会儿放到购回列表里
_ITEM tempitem;
pCurrentItem->SaveValueTo(&tempitem);
//备份到回购列表中
pHuman->AddToSoldList(m_nBagIndex, iPrice);
//给钱
pHuman->SetMoney( pHuman->GetMoney() + iPrice);
MONEY_LOG_PARAM MoneyLogParam;
MoneyLogParam.CharGUID = pHuman->GetGUID();
MoneyLogParam.OPType = MONEY_SHOP_SELL;
MoneyLogParam.Count = iPrice;
MoneyLogParam.SceneID = pHuman->getScene()->SceneID();
MoneyLogParam.XPos = pHuman->getWorldPos()->m_fX;
MoneyLogParam.ZPos = pHuman->getWorldPos()->m_fZ;
SaveMoneyLog(&MoneyLogParam);
//把这个回购商品显示到界面
GCShopSoldList::_MERCHANDISE_ITEM SoldItem;
SoldItem.item_data = tempitem;
GCShopSoldList MsgSold;
MsgSold.SetMerchadiseNum(1);
MsgSold.SetMerchadiseList(&SoldItem);
pHuman->GetPlayer()->SendPacket( &MsgSold );
GCShopSell MsgSell;
pHuman->GetPlayer()->SendPacket( &MsgSell );
g_pLog->FastSaveLog( LOG_FILE_1, "CGShopSellHandler m_nBagIndex=%d ",
m_nBagIndex ) ;
return PACKET_EXE_CONTINUE;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}