// ----------------------------------------------------------------------------------------------------------------------- bool CIllusionTemple::NpcTalk(OBJECTSTRUCT* lpNpc, OBJECTSTRUCT* lpObj) { if ( (lpObj->m_IfState.use) > 0 ) { return true; } switch(lpNpc->Class) { case 385: { int templeIndex = this->GetObjTempleIndex(lpObj); if(templeIndex != -1) { if(templeIndex >= 0 && templeIndex < MAX_ILLUSION_TEMPLES) { if(!(this->m_IllusionTemple[templeIndex].m_TempleState == IT_STATE_OPEN)) { char szBuff[100] = {0}; if(this->m_IllusionTemple[templeIndex].m_TempleState == IT_STATE_CLOSED) { sprintf(&szBuff[0], "IT Event will be Opened in %d Minute(s).", (this->m_IllusionTemple[0].m_RemainTime / 60000) - 4); } else { sprintf(&szBuff[0], "IT Event is Running Now, Try again Later!", (this->m_IllusionTemple[0].m_RemainTime / 60000) - 4); } ChatTargetSend(lpNpc, &szBuff[0], lpObj->m_Index); } else { PMSG_ILLUSION_NPC pMsg; pMsg.MemberCount = this->GetUserCount(templeIndex); pMsg.State = 0; gSendProto.DataSend(lpObj->m_Index, (unsigned char*)&pMsg, pMsg.h.size); ChatTargetSend(lpNpc, "Illusion Temple Event Awaits You!", lpObj->m_Index); } } else { ChatTargetSend(lpNpc, "Sorry, You are not allowed to enter the IT Event.", lpObj->m_Index); CLog.LogAddC(2, "[IllusionTemple] Gate Index Error (%d)(%s).", templeIndex, &lpObj->Name[0]); } } else { ChatTargetSend(lpNpc, "You don't have sufficient Level to Enter IT Event.", lpObj->m_Index); } } return TRUE; case 380: { if(IT_FLOOR_RANGE(lpObj->m_IllusionIndex) && IT_MAP_RANGE(lpObj->MapNumber)) { if(this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner == lpNpc->m_Index) { BYTE ItemPosition = gObjInventoryInsertItem(lpObj, 14, 64, 0); if(ItemPosition != -1) { GCInventoryItemOneSend(lpObj->m_Index, ItemPosition); this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner = lpObj->m_Index; } else { GCServerMsgStringSend("You do not have space to capture the artifact!", lpObj->m_Index, 1); } // Need To be Translated By Testers "Você não tem espaço para capturar o artefato!" } else { GCServerMsgStringSend("The artifact is not in the statue!", lpObj->m_Index, 1); } // Need To be Translated By Testers "O artefato não se encontra nesta estátua!" } } return TRUE; case 383: // Blue case 384: { int iTeam = lpNpc->Class == 383 ? IT_TEAM_BLUE : IT_TEAM_RED; if(IT_FLOOR_RANGE(lpObj->m_IllusionIndex) && IT_MAP_RANGE(lpObj->MapNumber)) { bool bFound = false; for(int i = 0; i < INVENTORY_SIZE; i++) { if(lpObj->pInventory[i].IsItem()) { if(lpObj->pInventory[i].m_Type == ITEMGET(14, 64)) { gObjInventoryDeleteItem(lpObj->m_Index, i); GCInventoryItemDeleteSend(lpObj->m_Index, i, 1); bFound = true; } } } if(bFound) { this->m_IllusionTemple[lpObj->m_IllusionIndex].m_BallOwner = this->m_IllusionTemple[lpObj->m_IllusionIndex].m_Statues[rand()%MAX_IT_STATUES]; this->m_IllusionTemple[lpObj->m_IllusionIndex].m_Teams[iTeam].m_Score++; } } } return TRUE; default: return TRUE; } }
//006bc390 //CGUseItemRecv //CGUseItemRecv bool CPeriodItemEx::SetPeriodItemInfo(LPOBJ lpObj,WORD wItemCode,DWORD dwSerial,DWORD dwDuration) //~OK { if( !lpObj ) return false; if( lpObj->Type != OBJ_USER || lpObj->Connected < PLAYER_LOGGED ) return false; int iInventoryPosition = 0; DWORD dwExpireDate = 0; CItem* lpItem = NULL; ITEMDATA ItemData; LPBUFF_EFFECT_DATE lpBuffData = NULL; LPITEMEFFECT lpItemEffect = NULL; if( !dwSerial ) { lpBuffData = g_BuffEffectSlot.GetEffectDataFromItemCode(wItemCode); lpItemEffect = g_ItemAddOption.GetItemEffectData(wItemCode); if( !lpBuffData || !lpItemEffect ) return false; if( gObjAddBuffEffect(lpObj,lpBuffData->btIndex,dwDuration) == TRUE ) { ItemData.Clear(); ItemData.btType = 1; ItemData.wItemCode = wItemCode; ItemData.btTmp = lpBuffData->btViewPortIndex; ItemData.btEffectType1 = lpItemEffect->wEffectType1; ItemData.btEffectType2 = lpItemEffect->wEffectType2; ItemData.iDuration = dwDuration; ItemData.iUnk3 = 0; ItemData.lCurentDate = this->GetCurrentDate(); ItemData.lExpireDate = this->GetExpireDate(dwDuration); } else { return FALSE; } } else { iInventoryPosition = this->GetItemFromInventory(lpObj,wItemCode,dwSerial); if( iInventoryPosition == -1 ) { return false; } lpItem = &lpObj->pInventory[iInventoryPosition]; lpItem->SetPeriodItem(); GCInventoryItemOneSend(lpObj->m_Index, iInventoryPosition); dwExpireDate = this->GetExpireDate(dwDuration); AddPeriodItemData(lpObj,wItemCode,dwSerial,dwDuration,dwExpireDate); ItemData.Clear(); ItemData.wItemCode = wItemCode; ItemData.btType = 2; ItemData.dwSerial = lpItem->GetNumber(); ItemData.iDuration = dwDuration; ItemData.iUnk3 = 0; ItemData.lCurentDate = this->GetCurrentDate(); ItemData.lExpireDate = dwExpireDate; } RequestPeriodItemInsert(lpObj,&ItemData,dwDuration); return true; }
bool CQuest::MonsterItemDrop(LPOBJ lpObj) { int MaxHitUser = gObjMonsterTopHitDamageUser(lpObj); if ( MaxHitUser == -1 ) { return false; } int partycount = gParty.GetPartyCount(gObj[MaxHitUser].PartyNumber); if ( partycount > 0 ) { return false; } int type; int level = 0; int x; int y; float dur = 0; int Option1 = 0; int Option2 = 0; int Option3 = 0; LPOBJ lpTarget = &gObj[MaxHitUser]; int qIndex = lpTarget->q_QuestIndex; if(lpTarget->q_QuestState != QUEST_STATE_ONGOING) { return false; } QuestAtt * lpQuest = &this->quests[qIndex]; if ( lpQuest != NULL ) { for(int i = 0 ; i != lpQuest->QuestsObjectCount; i++) { QuestObjectItem * lpQitem = &lpQuest->ItemsObject[i]; for(int n = 0 ; n != lpQitem->QuestMobCount; n++) { if(lpQuest->QuestKilledCount >= lpQitem->QuestMob[n].count) { dur = 0; x = lpObj->X; y = lpObj->Y; type = ItemGetNumberMake(lpQitem->itemType,lpQitem->itemSubType); CItem uItem; uItem.Convert(type ,0,0,0,0,0,0,CURRENT_DB_VERSION); BYTE uPos = gObjInventoryInsertItem(lpTarget->m_Index,uItem); GCInventoryItemOneSend(lpTarget->m_Index, uPos); LogAddTD("[Quest] Quest Item Insert [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name,lpTarget->AccountID, lpTarget->Name, lpQuest->name, lpQitem->itemType,lpQitem->itemSubType); qMsg->Notice(lpTarget->m_Index, "[Quest] You're item in invnotry!! "); this->SetQuestState(lpTarget , qIndex , QUEST_STATE_FINISH ); lpQuest->QuestKilledCount = 0; } else if(lpObj->Level >= lpQitem->QuestMob[n].minLevel && lpObj->Level <= lpQitem->QuestMob[n].maxLevel) { lpQuest->QuestKilledCount++; qMsg->Msg(lpTarget->m_Index , "[Quest] you need kill more %d monsters",lpQitem->QuestMob[n].count - lpQuest->QuestKilledCount); } } } } return false; }