// ----------------------------------------------------------------------------------------
void CDoubleGoer::CheckCanEnter(int aIndex)
{
	LPOBJ lpObj = &gObj[aIndex];
	// ----
	if ( lpObj->Type != OBJ_USER )
	{
		return;
	}
	if ( gDoubleGoer.Enabled == 0 )
	{
		SendMsg.MessageOut(aIndex, 0x01, "[DoubleGoer]: Event is disabled");
		return;
	}
	if ( gDoubleGoer.Running == 1 )
	{
		SendMsg.MessageOut(aIndex, 0x01, "[DoubleGoer]: Event is running, please try later");
		return;
	}
	if ( gObjGetItemCountInIventory(aIndex,14,111,0) < 1 )
	{
		SendMsg.MessageOut(aIndex, 0x01, "[DoubleGoer]: Need Mirror of Dimensions to enter");
		return;
	}
	gObjDelteItemCountInInventory(aIndex,14,111,1);
	
	gDoubleGoer.Teleport(aIndex);
}
Exemplo n.º 2
0
BOOL CQuestInfo::QuestClear(LPOBJ lpObj, int QuestIndex)
{
	LPQUEST_INFO lpQuestInfo = this->GetQuestInfo(QuestIndex);

#if (FOREIGN_GAMESERVER==1)
	if ( szAuthKey[18] != AUTHKEY18 )
	{
		DestroyGIocp();
	}
#endif

	if ( lpQuestInfo == NULL )
	{
		return 0xFF;
	}

	int subquestcount = lpQuestInfo->QuestSubInfoCount;
	int concount = lpQuestInfo->QuestConditionCount;
	LPQUEST_SUB_INFO lpSubInfo;

	for ( int subquest=0;subquest<subquestcount;subquest++)
	{
		lpSubInfo = this->GetSubquestInfo(lpObj, lpQuestInfo, subquest);

		if ( lpSubInfo != NULL )
		{
			if ( lpSubInfo->RewardType == QUEST_COMPENSATION_CHANGEUP )
			{
				lpObj->LevelUpPoint += lpSubInfo->RewardCount;
				GCSendQuestPrize(lpObj->m_Index, QUEST_COMPENSATION_STATUP, lpSubInfo->RewardCount );
				lpObj->ChangeUP = true;
				lpObj->DbClass |= 1;
				gObjMakePreviewCharSet(lpObj->m_Index);
				BYTE btClass = (lpObj->Class * 32) & 224 ;
				btClass |= (lpObj->ChangeUP * 16) & 16;
				GCSendQuestPrize(lpObj->m_Index, QUEST_COMPENSATION_CHANGEUP, btClass);
				LogAddTD("[Quest] Quest Clear (%s) : [%s][%s] Stat(%d,%d), ChangeUp",
					lpQuestInfo->Name, lpObj->AccountID, lpObj->Name, lpObj->LevelUpPoint,
					lpSubInfo->RewardCount );
			}
			else if ( lpSubInfo->RewardType == QUEST_COMPENSATION_STATUP )
			{
				lpObj->LevelUpPoint += lpSubInfo->RewardCount;
				GCSendQuestPrize(lpObj->m_Index, QUEST_COMPENSATION_STATUP, lpSubInfo->RewardCount );
				LogAddTD("[Quest] Quest Clear (%s) : [%s][%s] Stat(%d,%d)",
					lpQuestInfo->Name, lpObj->AccountID, lpObj->Name, lpObj->LevelUpPoint,
					lpSubInfo->RewardCount );
			}
			else if ( lpSubInfo->RewardType == QUEST_COMPENSATION_PLUSSSTAT )
			{
				int level = lpObj->Level - QUEST_MINLEVEL_PLUSSTAT;

				if ( level <= 0 )
				{
					level = 0;
				}

				lpObj->LevelUpPoint += level;
				lpObj->PlusStatQuestClear = true;
				GCSendQuestPrize(lpObj->m_Index, QUEST_COMPENSATION_PLUSSSTAT, level );
				LogAddTD("[Quest] Quest Clear (%s) : [%s][%s] Stat(%d,%d), PlusStat",
					lpQuestInfo->Name, lpObj->AccountID, lpObj->Name, lpObj->LevelUpPoint,
					level );
			}
			else if ( lpSubInfo->RewardType == QUEST_COMPENSATION_COMBOSKILL )
			{
				GCSendQuestPrize(lpObj->m_Index, QUEST_COMPENSATION_COMBOSKILL, 0 );
				lpObj->ComboSkillquestClear = true;
				LogAddTD("[Quest] Quest Clear (%s) : [%s][%s] ComboSkill",
					lpQuestInfo->Name, lpObj->AccountID, lpObj->Name);
			}
			else if ( lpSubInfo->RewardType == QUEST_COMPENSATION_CHANGEUP2 )
			{
				lpObj->LevelUpPoint += lpSubInfo->RewardCount;
				GCSendQuestPrize(lpObj->m_Index, QUEST_COMPENSATION_STATUP, lpSubInfo->RewardCount);
				lpObj->ChangeUP = 2;
				BYTE btClass;
				btClass = (lpObj->Class * 32) + 24;

				if (lpObj->DbClass != 2 || lpObj->DbClass != 18 || lpObj->DbClass != 34 || lpObj->DbClass != 50 || lpObj->DbClass != 66 ) //HermeX Great Anti-Hack :P
				{
					if (lpObj->DbClass == 48 || lpObj->DbClass == 64)
					{
						lpObj->DbClass += 2;
					}
					else
					{
						lpObj->DbClass += 1;
					}
				}
				gObjMakePreviewCharSet(lpObj->m_Index);
				GCSendQuestPrize(lpObj->m_Index, QUEST_COMPENSATION_CHANGEUP2, btClass);
				LogAddTD("[Quest] Quest Clear (%s) : [%s][%s] Stat(%d,%d), ChangeUp2",
					lpQuestInfo->Name, lpObj->AccountID, lpObj->Name, lpObj->LevelUpPoint,
					lpSubInfo->RewardCount );
			}

			if ( lpSubInfo->QuestType == 1 )
			{
				gObjDelteItemCountInInventory(lpObj->m_Index, lpSubInfo->NeedType, lpSubInfo->NeedSubType,
					lpSubInfo->NeedNumber);
			}
		}
	}
	return true;
}
Exemplo n.º 3
0
bool CQuest::NpcTalk(LPOBJ lpNpc, LPOBJ lpObj)
{
	int iIndex = lpObj->m_Index;
	if( lpObj->q_QuestIndex == 0xFF)
	{
		this->SetQuestState(lpObj, 0 , QUEST_STATE_START);
	}
	int i = lpObj->q_QuestIndex;

	if(this->quests[i].npcID == lpNpc->Class)
	{

		if(lpObj->Level < this->quests[i].level)
		{
			wsprintf(szQuestTemp, " You're need be level %d for quest!",this->quests[i].level);
			ChatTargetSend(lpNpc,szQuestTemp, iIndex);
			return true;
		}
		if(lpObj->Money < this->quests[i].zen)
		{
			wsprintf(szQuestTemp, " you need zen %d for quest!",this->quests[i].zen);
			ChatTargetSend(lpNpc,szQuestTemp, iIndex);
			return true;
		}
		if(this->IsClass(i, lpObj->DbClass ))
		{
			for(int x = 0 ; x != this->quests->QuestsObjectCount ; x++)
			{
				switch(this->GetQuestType(i,x))
				{
					case QUEST_OBJECT_TYPE_ITEM:
					{
						switch(lpObj->q_QuestState)
						{
							case QUEST_STATE_START:
							{
								int ItemType = this->quests[i].ItemsObject[x].itemType;
								int ItemSubType = this->quests[i].ItemsObject[x].itemSubType;
								LPITEM_ATTRIBUTE Item = &ItemAttribute[ITEMGET(ItemType, ItemSubType) ];
								qMsg->Notice(iIndex , "[Quest] Quest Start. " );
								qMsg->Notice(iIndex , "[Quest] %s go find %s !!!",this->quests[i].name,Item->Name);
								this->SetQuestState(lpObj, i , QUEST_STATE_ONGOING );
								if(this->quests[i].zen > 0)
								{
									lpObj->Money -= this->quests[i].zen;
									GCMoneySend( iIndex , lpObj->Money );
								}
								qMsg->PM( iIndex , "[Quest] Remmber you can do quest only without party");
								qMsg->PM( iIndex , "[Quest] you need free slot in your invenotry for quest item");
								return true;
							}
							case QUEST_STATE_ONGOING:
							{
								int ItemType = this->quests[i].ItemsObject[x].itemType;
								int ItemSubType = this->quests[i].ItemsObject[x].itemSubType;
								int GetCount = this->quests[i].ItemsObject[x].itemCount;

								LPITEM_ATTRIBUTE Item = &ItemAttribute[ITEMGET(ItemType, ItemSubType) ];
								qMsg->PM(iIndex , "[Quest] You do not have enough required items");
								qMsg->PM(iIndex , "[Quest] Search %d %s",GetCount,Item->Name);
								wsprintf(szQuestTemp, "Search %d %s",GetCount,Item->Name);
								ChatTargetSend(lpNpc , szQuestTemp , iIndex );
								return true;

							}
							case QUEST_STATE_FINISH:
							{

								int ItemType = this->quests[i].ItemsObject[x].itemType;

								int ItemSubType = this->quests[i].ItemsObject[x].itemSubType;

								int Count = gObjGetItemCountInIventory(iIndex, ITEMGET(ItemType,ItemSubType));

								int GetCount = this->quests[i].ItemsObject[x].itemCount;

								if(Count >= GetCount)
								{
									LPITEM_ATTRIBUTE Item = &ItemAttribute[ITEMGET(ItemType, ItemSubType) ];
									qMsg->Notice(iIndex, "[Quest] You have been finished %s ",this->quests[i].name);
									gObjDelteItemCountInInventory(iIndex ,ItemType , ItemSubType , Count );
									int PrizeCount = this->quests[i].ItemsObject[x].QuestPrizeCount;
									int uPoint = 0;
									int uClassUp = 0;
									for(int p = 0 ; p != PrizeCount ; p++)
									{
										int Points = this->quests[i].ItemsObject[x].QuestPrize[p].points;
										int ClassUp = this->quests[i].ItemsObject[x].QuestPrize[p].ClassUp;
										if(Points > 0)
											uPoint += Points;
										if(ClassUp > 0 )
											uClassUp += ClassUp;
													
									}
									if(uPoint > 0)
									{
										qMsg->Msg(iIndex , "[Quest] you have received %d points",uPoint);
										lpObj->LevelUpPoint += uPoint;
										GCLevelUpMsgSend(iIndex, 201);
										this->SetQuestState(lpObj, lpObj->q_QuestIndex+1 , QUEST_STATE_START);
									}
									if(uClassUp > 0)
									{
										qMsg->PM(iIndex , "[Quest] congratulation you win Class up :)");
										lpObj->ChangeUP += 1;
										lpObj->DbClass |= 1;
										gObjMakePreviewCharSet(lpObj->m_Index);
										BYTE btClass = (lpObj->Class * 32) & 224 ;
										btClass |= (lpObj->ChangeUP * 16) & 16;
										if(lpObj->ChangeUP == 1)
											GCSendQuestPrize(lpObj->m_Index, 201 , btClass);
										if(lpObj->ChangeUP == 2)
											GCSendQuestPrize(lpObj->m_Index, 204 , btClass);
										GCMagicAttackNumberSend(lpObj, 76 , lpObj->m_Index , 0 );
									}
									
								}
							}
						}
						break;
					}
				}
			}	
		}
	}
	
			

	return false;
}