Пример #1
0
int CCrywolfUtil::CrywolfMVPLevelUp(int iUserIndex, int iAddExp)
{
	if ( !OBJMAX_RANGE(iUserIndex ) )
		return 0;

	int iLEFT_EXP = 0;

	LogAddTD("[ Crywolf ][MVP Exp.] : [%s][%s](%d) %u %d",
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience,
		iAddExp);

	LogAddTD("Experience : Map[%d]-(%d,%d) [%s][%s](%d) %u %d MonsterIndex : %d, EventType : %d",
		gObj[iUserIndex].MapNumber, gObj[iUserIndex].X, gObj[iUserIndex].Y, // #error Deathway - Must be Y
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp, 0, EVENT_TYPE_CRYWOLF);

	gObjSetExpPetItem(iUserIndex, iAddExp);

	if ( gObj[iUserIndex].Level >= MAX_CHAR_LEVEL )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(4, 112)), gObj[iUserIndex].m_Index, 1);
		return 0;
	}

	if ( (gObj[iUserIndex].Experience + iAddExp) < gObj[iUserIndex].NextExp )
	{
		gObj[iUserIndex].Experience += iAddExp;
	}
	else
	{
		iLEFT_EXP = gObj[iUserIndex].Experience + iAddExp - gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Experience = gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Level++;

		if ( gObj[iUserIndex].Class == CLASS_DARKLORD || gObj[iUserIndex].Class == CLASS_MAGUMSA )
		{
			gObj[iUserIndex].LevelUpPoint += gLevelUpPointMGDL;
		}
		else
		{
			gObj[iUserIndex].LevelUpPoint += gLevelUpPointNormal;
		}

		if ( gObj[iUserIndex].PlusStatQuestClear != false )
		{
			gObj[iUserIndex].LevelUpPoint++;

			LogAddTD("[ Crywolf ][MVP Exp.] [%s][%s] LevelUp PlusStatQuest Clear AddStat %d",
				gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
				gObj[iUserIndex].LevelUpPoint);
		}

		gObj[iUserIndex].MaxLife += DCInfo.DefClass[gObj[iUserIndex].Class].LevelLife;
		gObj[iUserIndex].MaxMana += DCInfo.DefClass[gObj[iUserIndex].Class].LevelMana;
		gObj[iUserIndex].Life = gObj[iUserIndex].MaxLife;
		gObj[iUserIndex].Mana = gObj[iUserIndex].MaxMana;
		gObjNextExpCal(&gObj[iUserIndex]);
		gObjSetBP(gObj[iUserIndex].m_Index);
		GCLevelUpMsgSend(gObj[iUserIndex].m_Index, 1);
		gObjCalcMaxLifePower(gObj[iUserIndex].m_Index);

		LogAddTD(lMsg.Get(MSGGET(2, 8)), gObj[iUserIndex].AccountID,
			gObj[iUserIndex].Name, gObj[iUserIndex].Level);
	}

	return iLEFT_EXP;
}
Пример #2
0
bool cChat::AddCommands(LPOBJ gObj, char *Msg, int Type)
{
	int aIndex = User.GetPlayerIndex(gObj->Name);

	switch (Type)
	{
	case 0:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen,
			Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addstr <num>", Msg))
			return true;
		break;
	case 1:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addagi <num>", Msg))
			return true;
		break;
	case 2:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addvit <num>", Msg))
			return true;
		break;
	case 3:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addene <num>", Msg))
			return true;
		break;
	case 4:
		if (CheckCommand(gObj, Configs.Commands.AddPointEnabled, GmSystem.NONE, Configs.Commands.AddPriceZen, Configs.Commands.AddPointLevelReq, 1, 0, "AddStats", "/addcmd <num>", Msg))
			return true;
		if (gObj->Class != 4)
		{
			TNotice.SendNotice(aIndex, 1, "[AddStats] You are not Dark Lord!!!");
			//MessageLog(1, gObj, "[AddStats] You are not Dark Lord!!!");
			return true;
		}
		break;
	}
	DWORD Points;
	sscanf(Msg, "%d", &Points);

	if (Configs.Commands.MaxAddedStats > 0 && Configs.Commands.MaxAddedStats <= Points)
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You can't add more than %d stats!!!", Configs.Commands.MaxAddedStats);
		return true;
	}

	int MaxPoints = 32767;
	//if(Configs.Enable65kStats >= 1)
	//	MaxPoints = -536;	

	int Stats = 0;
	bool bResult = false;
	switch (Type)
	{
	case 0x00:
		Stats = gObj->Strength;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x01:
		Stats = gObj->Dexterity;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x02:
		Stats = gObj->Vitality;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x03:
		Stats = gObj->Energy;
		if (gObj->Class == 0)
			MaxPoints;
		else if (gObj->Class == 1)
			MaxPoints;
		else if (gObj->Class == 2)
			MaxPoints;
		else if (gObj->Class == 3)
			MaxPoints;
		else if (gObj->Class == 4)
			MaxPoints;
		else if (gObj->Class == 5)
			MaxPoints;
		break;
	case 0x04:
		Stats = gObj->Leadership;
		if (gObj->Class == 4)
			MaxPoints;
		break;
	}

	int MaxPointsTemp = MaxPoints;
	if (MaxPoints > 32767)
		MaxPoints = -32768 + (MaxPoints - 32767);

	if (((MaxPoints > 0) && (Stats >= MaxPoints || Stats < 0)) ||
		((MaxPoints < 0) && (Stats < 0) && (Stats >= MaxPoints)))
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You have max points for this type!!!");
		return true;
	}

	int StatsTemp = Stats;
	Stats += Points;
	if (gObj->LevelUpPoint < Points)
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You don't have enough points to add. Need %d more.", Points - gObj->LevelUpPoint);
		return true;
	}

	if (((MaxPoints > 0) && (Stats > MaxPoints || Stats < 0)) ||
		((MaxPoints < 0) && (Stats < 0) && (Stats > MaxPoints)))
	{
		TNotice.SendNotice(aIndex, 1, "[AddStats] You can't add more than %d points for this type!!!", MaxPoints - StatsTemp);
		return true;
	}

	TakeCommand(gObj, Configs.Commands.AddPriceZen, "AddStats");

	switch (Type)
	{
	case 0x00://str
	{
		//PMSG_CHARREGEN pMsg;
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 3;
		pMsg.btStatValue = Points;
		gObj->Strength += Points;
		gObj->LevelUpPoint -= Points;

		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		gObjSetBP(gObj->m_Index);

		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		//Utilits.SendEffect(gObj, 5);
		return true;
	}
	case 0x01://agi
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 2;
		pMsg.btStatValue = Points;
		gObj->Dexterity += Points;
		gObj->LevelUpPoint -= Points;

		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		gObjSetBP(gObj->m_Index);

		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);

		return true;
	}
	case 0x02://vit
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btStatValue = Points;
		pMsg.btFruitType = 1;
		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		gObj->Vitality += Points;
		gObj->MaxLife += gObj->VitalityToLife * Points;

		gObj->LevelUpPoint -= Points;
		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		GCReFillSend(gObj->m_Index, gObj->MaxLife + gObj->AddLife, 0xFE, 0, gObj->iMaxShield + gObj->iAddShield);
		gObjSetBP(gObj->m_Index);
		//Utilits.SendEffect(gObj, 2);
		return true;
	}
	case 0x03://ene
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 0;
		pMsg.btStatValue = Points;
		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		gObj->Energy += Points;
		gObj->MaxMana += gObj->EnergyToMana * Points;

		gObj->LevelUpPoint -= Points;
		GCLevelUpMsgSend(gObj->m_Index, 1);
		gObjCalCharacter(gObj->m_Index);
		GCManaSend(gObj->m_Index, gObj->MaxMana + gObj->AddMana, 0xFE, 0, gObj->MaxBP + gObj->AddBP);
		gObjSetBP(gObj->m_Index);

		//Utilits.SendEffect(gObj, 2);
		return true;
	}
	case 0x04://cmd
	{
		PMSG_STAT_UPDATE pMsg;
		PHeadSetB((LPBYTE)&pMsg, 0x2C, sizeof(PMSG_STAT_UPDATE));
		pMsg.result = 0;
		pMsg.btFruitType = 4;
		pMsg.btStatValue = Points;
		gObj->Leadership += Points;
		gObj->LevelUpPoint -= Points;

		DataSend(gObj->m_Index, (char*)&pMsg, pMsg.h.size);
		gObjCalCharacter(aIndex);
		gObjSetBP(aIndex);
		GCLevelUpMsgSend(gObj->m_Index, 0);
		//Utilits.SendEffect(gObj, 2);
		return true;
	}
	default:
	{
		return true;
	}
	}

	TNotice.SendNotice(aIndex, 1, "[AddStats] Your stats successfully added!");
	TNotice.SendNotice(aIndex, 1, "Please Relog!");
	return true;
}
Пример #3
0
void ImperialFort_StartStage4(void * lpParam)
{
	while(true)
	{	
		BYTE Packet[13] = {0xC1, 0x0D, 0xF7, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
		
		if(ImperialMobCfg.nMonsterOfEvent <= 0)
		{	
			if(Imperial.EventDay != 4)
			{
				//End Event Succes
				ImperialMain.Status = 0;

				PMSG_FORT_EVENT_TIMER pMsg;
				pMsg.h.c = 0xC1;
				pMsg.h.size = 0x0D;
				pMsg.h.headcode = 0xF7;
				pMsg.h.subcode = 0x04;
				pMsg.Status = 0x01;
				pMsg.Unk4 = 0x00;
				pMsg.TimerL = 0;
				pMsg.TimerH = 0;
				pMsg.Unk5 = 0x00;
				pMsg.Mob = 0;
				
				for(int i=MIN_PLAYERID;i<MAX_PLAYERID;i++)
				{	
					GOBJSTRUCT *gObj = (GOBJSTRUCT*)OBJECT_POINTER(i);

					if(gObj->Connected == 3 && gObj->MapNumber == Imperial.EventMap && ImperialMain.UserIsInFort[GET_USER_INDEX(i)] == 1 && ImperialMain.Stage == 4 && (ImperialMain.Status == 3 || ImperialMain.Status == 0))
					{	
						int Experience = 1234567890;
			
						PMSG_FOR_END_MESSAGE pMsg;
						pMsg.h.c = 0xC1;
						pMsg.h.size = 0x0D;
						pMsg.h.headcode = 0xF7;
						pMsg.h.subcode = 0x06;
						pMsg.Type = 0x02;
						pMsg.Experience = Experience;
						DataSend(i, (BYTE*)&pMsg, pMsg.h.size);

						gObj->Experience += Experience;
						GCLevelUpMsgSend(i,0);

						gObjTeleport(i,0,125,124);

						//Clear Event 2
						//Imperial.EventClearIndex(i);

						ImperialMain.UserIsInFort[GET_USER_INDEX(i)] = 0;

						_beginthread( ImperialFort_EndEvent, 0, NULL  );

					}
				}

			}
			else
			{	
				Imperial.CanUseTwisting = 1;
				Imperial.StandByTimer = 144;
				_beginthread( ImperialFort_StandBy3, 0, NULL  );
			}

			_endthread();
		}

		if(Imperial.Stage4Timer <= 0)
		{	
			for(int i=MIN_PLAYERID;i<MAX_PLAYERID;i++)
			{	
				GOBJSTRUCT *gObj = (GOBJSTRUCT*)OBJECT_POINTER(i);

				if(gObj->Connected == 3)
				{	
					if(ImperialMain.UserIsInFort[GET_USER_INDEX(i)] == 1)
					{	
						DataSend(i, &Packet[0], Packet[1]); //Send Fail Message
						gObjTeleport(i,0,125,124);
							
						//Clear Event 2
						Imperial.EventClearIndex(i);
					}
				}
			}
			_endthread();
		}

		Imperial.Stage4Timer -= 4;

		PMSG_FORT_EVENT_TIMER pMsg;
		pMsg.h.c = 0xC1;
		pMsg.h.size = 0x0D;
		pMsg.h.headcode = 0xF7;
		pMsg.h.subcode = 0x04;
		pMsg.Status = 0x02;
		pMsg.Unk4 = 0x00;
		pMsg.TimerL = LOBYTE(Imperial.Stage4Timer);
		pMsg.TimerH = HIBYTE(Imperial.Stage4Timer);
		pMsg.Unk5 = 0x00;
		pMsg.Mob = ImperialMobCfg.nMonsterOfEvent;

		for(int i=MIN_PLAYERID;i<MAX_PLAYERID;i++)
		{	
			GOBJSTRUCT *gObj = (GOBJSTRUCT*)OBJECT_POINTER(i);		
			if(gObj->Connected == 3 && gObj->MapNumber == Imperial.EventMap && ImperialMain.UserIsInFort[GET_USER_INDEX(i)] == 1 && ImperialMain.Stage == 4 && ( ImperialMain.Status == 1 || ImperialMain.Status == 3) )
			{	
				DataSend(i, (BYTE*)&pMsg, pMsg.h.size);
			}
			else if(gObj->Connected == 3 && gObj->MapNumber != Imperial.EventMap && ImperialMain.UserIsInFort[GET_USER_INDEX(i)] == 1 && ImperialMain.Stage == 4 && ( ImperialMain.Status == 1 || ImperialMain.Status == 3))
			{	
				DataSend(i, &Packet[0], Packet[1]);

				Imperial.EventClear();
				_endthread();
			}
			else if(UserCountInMap(Imperial.EventMap) == 0 && ImperialMain.UserIsInFort[GET_USER_INDEX(i)] == 1 && ImperialMain.Stage == 4 && ( ImperialMain.Status == 1 || ImperialMain.Status == 3))
			{	
				DataSend(i, &Packet[0], Packet[1]);

				Imperial.EventClear();
				_endthread();
			}
			else
			{	
				if(gObj->Connected == 3 && gObj->MapNumber == Imperial.EventMap && ImperialMain.UserIsInFort[GET_USER_INDEX(i)] != 1 && ImperialMain.Stage == 4 && ( ImperialMain.Status == 1 || ImperialMain.Status == 3))
				{
				gObjTeleport(i,0,125,125);
				}
			}
		}
		Sleep(1000);
	}
	_endthread();
}
Пример #4
0
int CCrywolfUtil::CrywolfMVPLevelUp(int iUserIndex,int iAddExp)
{
	if ( !OBJMAX_RANGE(iUserIndex ) )
		return 0;

	LogAddTD("[ Crywolf ][MVP Exp.] : [%s][%s](%d) %u %d",
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience,
		iAddExp);

	if( g_MasterExp.LevelUp(&gObj[iUserIndex],iAddExp) )
	{
		return FALSE;
	}

	gObjSetExpPetItem(iUserIndex, iAddExp);
	int iLEFT_EXP = 0;

	LogAddTD("Experience : Map[%d]-(%d,%d) [%s][%s](%d) %u %d MonsterIndex : %d, EventType : %d",
		gObj[iUserIndex].MapNumber, gObj[iUserIndex].X, gObj[iUserIndex].Y,
		gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
		gObj[iUserIndex].Level, gObj[iUserIndex].Experience, iAddExp, 0, EVENT_TYPE_CRYWOLF);

	if ( gObj[iUserIndex].Level >= MAX_CHAR_LEVEL )
	{
		GCServerMsgStringSend(lMsg.Get(MSGGET(4, 112)), gObj[iUserIndex].m_Index, 1);
		return 0;
	}

	if ( (gObj[iUserIndex].Experience + iAddExp) < gObj[iUserIndex].NextExp )
	{
		gObj[iUserIndex].Experience += iAddExp;
	}
	else
	{
		iLEFT_EXP = gObj[iUserIndex].Experience + iAddExp - gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Experience = gObj[iUserIndex].NextExp;
		gObj[iUserIndex].Level++;
#if (ENABLE_CUSTOM_CLASSCALC == 1)
		gObj[iUserIndex].LevelUpPoint += g_ClassCalc.GetLevelPoint(&gObj[iUserIndex], 0, 0);
#else
		if( gObj[iUserIndex].Class == CLASS_DARKLORD )
		{
			gObj[iUserIndex].LevelUpPoint += 7;
		}
		else if( gObj[iUserIndex].Class == CLASS_MAGUMSA )
		{
			gObj[iUserIndex].LevelUpPoint += 7;
		}
		else if( gObj[iUserIndex].Class == CLASS_FIGHTER )
		{
			gObj[iUserIndex].LevelUpPoint += 7;
		}
		else
		{
			gObj[iUserIndex].LevelUpPoint += 5;
		}
#endif

		if( gObj[iUserIndex].PlusStatQuestClear != false )
		{
#if (ENABLE_CUSTOM_CLASSCALC == 1)
			gObj[iUserIndex].LevelUpPoint += g_ClassCalc.GetLevelPoint(&gObj[iUserIndex], 0, 1);
#else
			gObj[iUserIndex].LevelUpPoint += 1;
#endif
			LogAddTD("[ Crywolf ][MVP Exp.] [%s][%s] LevelUp PlusStatQuest Clear AddStat %d",
				gObj[iUserIndex].AccountID, gObj[iUserIndex].Name,
				gObj[iUserIndex].LevelUpPoint);
		}

		gObj[iUserIndex].MaxLife += DCInfo.DefClass[gObj[iUserIndex].Class].LevelLife;
		gObj[iUserIndex].MaxMana += DCInfo.DefClass[gObj[iUserIndex].Class].LevelMana;
		gObj[iUserIndex].Life = gObj[iUserIndex].MaxLife;
		gObj[iUserIndex].Mana = gObj[iUserIndex].MaxMana;
		gObjNextExpCal(&gObj[iUserIndex]);
		gObjSetBP(gObj[iUserIndex].m_Index);
		GCLevelUpMsgSend(gObj[iUserIndex].m_Index, 1);
		LogAddTD(lMsg.Get(MSGGET(2, 8)), gObj[iUserIndex].AccountID,
			gObj[iUserIndex].Name, gObj[iUserIndex].Level);


		if( gObj[iUserIndex].Level == 400 && gObj[iUserIndex].PartyNumber >= 0 )
		{
			int partynumber = gObj[iUserIndex].PartyNumber;
			char szTmp[256];

			sprintf(szTmp,"400 LevelUp (%s)(%s) Party ",gObj[iUserIndex].AccountID,gObj[iUserIndex].Name);

			int tObjNum;

			for(int i = 0; i < 5; i++)
			{
				tObjNum = gParty.m_PartyS[partynumber].Number[i];
				if( tObjNum >= 0 )
				{
					int len = strlen(szTmp);
					sprintf(&szTmp[len],",(%s)(%s) ",gObj[tObjNum].AccountID,gObj[tObjNum].Name);
				}
			}

			LogAddTD(szTmp);
		}
	}

	return iLEFT_EXP;
}
Пример #5
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;
}