ORESULT AbilityInlay::OnProcSuccess(Obj_Human* pHuman) { __ENTER_FUNCTION Assert( pHuman ); AbilityOpera* pAbilityOpera; pAbilityOpera = pHuman->GetAbilityOpera(); Assert( pAbilityOpera ); LuaInterface* pLuaInterface; pLuaInterface = pHuman->getScene()->GetLuaInterface(); GamePlayer* pGamePlayer; pGamePlayer = (GamePlayer*)pHuman->GetPlayer(); Assert( pGamePlayer != NULL ); // 发送成功消息以及物品和状态变化 Item* pItem = HumanItemLogic::GetBagItem(pHuman, pAbilityOpera->m_BagPos[1]); Assert( pItem ); GCAbilitySucc SuccMsg; SuccMsg.SetAbilityID( pAbilityOpera->m_AbilityID ); SuccMsg.SetPrescriptionID( INVALID_ID ); SuccMsg.SetItemSerial( pItem->GetItemTableIndex() ); //SuccMsg.SetSuccFlag( TRUE ); pGamePlayer->SendPacket( &SuccMsg ); return OR_OK; __LEAVE_FUNCTION return OR_ERROR; }
ORESULT AbilityMachining::OnProcSuccess(Obj_Human* pHuman) { __ENTER_FUNCTION Assert( pHuman ); AbilityOpera* pAbilityOpera; pAbilityOpera = pHuman->GetAbilityOpera(); Assert( pAbilityOpera ); LuaInterface* pLuaInterface; pLuaInterface = pHuman->getScene()->GetLuaInterface(); GamePlayer* pGamePlayer; pGamePlayer = (GamePlayer*)pHuman->GetPlayer(); Assert( pGamePlayer != NULL ); switch( pAbilityOpera->m_SubType ) { case NORMAL_TYPE: break; case GEM_COMPOUND: { _ITEM_TYPE GemType; UINT bi; ITEM_LOG_PARAM ItemLogParam; ItemLogParam.OpType = ITEM_CREATE_ABILITY_COMPOUD; ItemLogParam.CharGUID = pHuman->GetGUID(); ItemLogParam.SceneID = pHuman->getScene()->SceneID(); ItemLogParam.XPos = pHuman->getWorldPos()->m_fX; ItemLogParam.ZPos = pHuman->getWorldPos()->m_fZ; GemType = ConvertSerial2ItemType( pAbilityOpera->m_uItemIndex ); //GemType.m_Quality++; HumanItemLogic::CreateItemToBag(&ItemLogParam,pHuman,GemType.ToSerial(),bi); if(bi==INVALID_INDEX) //创建失败 { return OR_ERROR; } SaveItemLog(&ItemLogParam); GCNotifyEquip Msg; Msg.SetBagIndex( bi ); Item* pItem = HumanItemLogic::GetBagItem(pHuman,bi); Assert(pItem); pItem->SaveValueTo(Msg.GetItem()); pGamePlayer->SendPacket(&Msg); // 发送成功消息以及物品和状态变化 GCAbilitySucc SuccMsg; SuccMsg.SetAbilityID( EAN_GEM_COMPOUNDED ); SuccMsg.SetPrescriptionID( INVALID_ID ); SuccMsg.SetItemSerial( GemType.ToSerial() ); //SuccMsg.SetSuccFlag( TRUE ); pGamePlayer->SendPacket( &SuccMsg ); } break; case GEM_EMBED: // 不需要额外的处理了 { // 发送成功消息以及物品和状态变化 Item* pItem = HumanItemLogic::GetBagItem(pHuman, pAbilityOpera->m_BagPos[1]); Assert( pItem ); GCAbilitySucc SuccMsg; SuccMsg.SetAbilityID( EAN_GEM_EMBEDDED ); SuccMsg.SetPrescriptionID( INVALID_ID ); SuccMsg.SetItemSerial( pItem->GetItemTableIndex() ); //SuccMsg.SetSuccFlag( TRUE ); pGamePlayer->SendPacket( &SuccMsg ); } break; default: Assert(FALSE); return OR_ERROR; } // 判断一下熟练度是否足够升级了 pLuaInterface->ExeScript_DDD( ABILITY_LOGIC_SCRIPT, "CheckAbilityLevel", (INT)pHuman->getScene()->SceneID(), (INT)pHuman->GetID(), (INT)pAbilityOpera->m_AbilityID ) ; return OR_OK; __LEAVE_FUNCTION return OR_ERROR; }
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; }