BOOL ItemBoxManager::RemoveAllItemBox() { INT iCount = m_Count; for(int i = 0;i<iCount;i++) { Obj_ItemBox* pItemBox = GetItemBox(m_pItemBoxObjID[0]); if(pItemBox) { pItemBox->Recycle(); } } return TRUE; }
ORESULT AbilityGather::OnProcSuccess(Obj_Human* pHuman) { __ENTER_FUNCTION Assert(pHuman); AbilityOpera* pOpera = pHuman->GetAbilityOpera(); Assert(pOpera); ObjID_t TargetID = pOpera->m_Obj; AbilityID_t AbilityID = pOpera->m_AbilityID; Assert(TargetID!=INVALID_ID); Obj* pObj = pHuman->getScene()->GetObjManager()->GetObj(TargetID); if(pObj->GetObjType()==Obj::OBJ_TYPE_ITEM_BOX) { Obj_ItemBox* pItemBox = static_cast<Obj_ItemBox*>(pObj); Assert(pItemBox); if(pItemBox->GetItemCount()>0) { if(pItemBox->GetOpenFlag()!=TRUE) { pItemBox->SetOpenFlag(TRUE); } GCBoxItemList Msg; int j = 0; for(int i =0;i<MAX_BOXITEM_NUMBER;i++) { _ITEM* pItem = pItemBox->GetItem(i); Assert(pItem); if(pItem->IsNullType()) continue; Msg.setItemData(pItem,j); j++; } Msg.setItemNum(pItemBox->GetItemCount()); Msg.setItemBoxId(pItemBox->GetID()); Msg.setItemBoxType(pItemBox->GetType()); pHuman->GetPlayer()->SendPacket(&Msg); } else { Scene* pScene = pHuman->getScene(); Assert(pScene); INT ItemBoxType = pItemBox->GetType(); _GROW_POINT_INFO* pGET = g_GrowPointInfoTbl.Get(ItemBoxType); Assert(pGET); if(pGET->m_ScriptID>0) { if(pScene->GetGrowPointManager()->CallScriptRecycleFunc(pGET->m_ScriptID,pHuman->GetID(),TargetID,pScene->SceneID())) { pItemBox->Recycle(); } } } GCAbilitySucc SuccMsg; SuccMsg.SetAbilityID( AbilityID ); SuccMsg.SetPrescriptionID( INVALID_ID ); pHuman->GetPlayer()->SendPacket( &SuccMsg ); } else { return OR_INVALID_TARGET; } return OR_OK; __LEAVE_FUNCTION return OR_ERROR; }