int CItemUseProc::UseProc(const item_t *_item,const int _Pos) { int itemTableIdx=-1; itemTableIdx = _item->itemTableIdx; if(itemTableIdx <0 || itemTableIdx >= MAX_NUMBER_OF_ITEM_TABLE) return( IF_CTL_NONE ); int UseItemType = gItemTableData.GetUseItemType(&g_itemTable[itemTableIdx]); switch(UseItemType) { case CItemTableData::ItemTable_FluxDataType::USE_ITEM_FOR_REPAIR : return RepairItem(_item,_Pos); case CItemTableData::ItemTable_FluxDataType::USE_ITEM_FOR_EPK_CHARGE : return EpkItem(_item,_Pos); case CItemTableData::ItemTable_FluxDataType::USE_ITEM_FOR_EPK_MUCH_CHARGE : return EpkMuchItem(_item,_Pos); case CItemTableData::ItemTable_FluxDataType::USE_ITEM_FOR_WEATHER_SNOW : return WeatherSnowItem(_item,_Pos); case CItemTableData::ItemTable_FluxDataType::USE_ITEM_FOR_WEATHER_RAIN : return WeatherRainItem(_item,_Pos); case CItemTableData::ItemTable_FluxDataType::USE_ITEM_FOR_OPTION_MANAGE: { int OptionType = gItemTableData.GetData(_item->itemTableIdx, CItemTableData::ItemTable_FluxDataValue::OPTION_MANAGE_TYPE); switch ( OptionType) { case 0: GTH_SendMessageRequest_StoneOfSage(_Pos); break; case 1: GTH_SendMessageRequest_StoneOfLucky(_Pos); break; case 2: GTH_SendMessageRequest_StoneOfEachName(_Pos); break; } }break; case CItemTableData::ItemTable_FluxDataType::USE_ITEM_FOR_AWAKEN: { g_cgv.myCharacterInfo->m_CashMall_OptionStone.m_iUsingItemInvenIdx = _Pos; g_ifMng->SetMessage( g_LPACK.GetMassage(0,322), "정말 각성을 초기화 하시겠습니까?", MSG_BUTTONTYPE_OKCANCEL, IF_MESSAGE_INIT_AWEAKEN ); } break; } return( IF_CTL_NONE ); }
void RandomFailure::EvalCtrlActions(eScdCtrlTasks Tasks) { RevalidateDataFields(); dCurrentTime += getDeltaTime(); for (int i = 0; i < tasks.size(); i++) { if (!bOn) { tasks.at(i)->bRunning = true; } else try { while (true) { if (tasks.at(i)->dRepairsDone < 0) //Item is running { if (tasks.at(i)->dNextFailure < 0) //Item has not been initialized RepairItem(*tasks.at(i)); if (tasks.at(i)->dNextFailure < dCurrentTime) //Item will go down in this iteration FailItem(*tasks.at(i)); else break; } else //Item is being repaired { if (tasks.at(i)->dRepairsDone < dCurrentTime) //Item will be repaired in this iteration RepairItem(*tasks.at(i)); else break; } } bool bNowRunning = tasks.at(i)->dBackedUpDowntime < getDeltaTime(); if (tasks.at(i)->TagSubs.IsActive) { if (bNowRunning &! tasks.at(i)->bRunning) //Task is starting up again, set tag to OnValue tasks.at(i)->TagSubs.DoubleSI = tasks.at(i)->dOnValue; if (!bNowRunning && tasks.at(i)->bRunning) //Task is shutting down, set tag to 0 tasks.at(i)->TagSubs.DoubleSI = tasks.at(i)->dOffValue; } tasks.at(i)->bRunning = bNowRunning; if (!tasks.at(i)->bRunning) { tasks.at(i)->dTotalDowntime += getDeltaTime(); tasks.at(i)->dBackedUpDowntime -= getDeltaTime(); } } catch (MMdlException &ex) { Log.Message(MMsg_Error, ex.Description); } catch (MFPPException &e) { e.ClearFPP(); Log.Message(MMsg_Error, e.Description); } catch (MSysException &e) { Log.Message(MMsg_Error, e.Description); } catch (...) { Log.Message(MMsg_Error, "Some Unknown Exception occured"); } } }