//----------------------------------------------------------- // 从货架上头购买一个物品 VOID CGameInterface::Booth_BuyItem( tObject_Item* pItem ) { CGShopBuy msg; // 先判断是否够钱买 msg.SetUniqueID(CDataPool::GetMe()->Booth_GetShopUniqueId()); msg.SetIndex(pItem->GetPosIndex()); CNetManager::GetMe()->SendPacket( &msg ); }
INT NpcShop::NpcShopBuy(LuaPlus::LuaState* state) { LuaStack args(state); if (!(args[2].IsInteger())) { KLThrow("LUA:NpcShopBuy Param 1 Wrong"); } INT nIndex = args[2].GetInteger(); if (!(args[3].IsInteger())) { KLThrow("LUA:NpcShopBuy Param 2 Wrong"); } INT nNumber = args[3].GetInteger(); //tObject_Item* pItem = CDataPool::GetMe()->CDataPool::GetMe()->Booth_GetSoldItem(i);(nIndex); //tActionItem* pItem = CActionSystem::GetMe()->EnumAction( nIndex, "boothitem" ); // 20100406 modifyCodeBegin // tObject_Item* pItem = CDataPool::GetMe()->Booth_GetItem(nIndex); // if( !pItem ) return 0; tObject_Item* pItem; if ( nIndex < 200 ) { pItem = CDataPool::GetMe()->Booth_GetItem(nIndex); if( !pItem ) return 0; } else if ( nIndex >= 200 ) { pItem = CDataPool::GetMe()->Booth_GetSoldItem( nIndex - 200 ); if( !pItem ) return 0; } else return 0; // 20100406 modifyCodeEnd if(CActionSystem::GetMe()->GetDefaultAction() == CActionItem_MouseCmd_Repair::GetMe()) { //取消修理 CGameProcedure::s_pGameInterface->Skill_CancelAction(); } if(CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_Money() >= pItem->GetItemPrice() ) { CGShopBuy msg; msg.SetIndex(nIndex); msg.SetCount(nNumber); msg.SetUniqueID(CUIDataPool::GetMe()->GetCurShopNpcId()); CNetManager::GetMe()->SendPacket( &msg ); } else { CEventSystem::GetMe()->PushEvent(GE_NEW_DEBUGMESSAGE,"金钱不够"); } return 0; }