BOOL CRingMonsterHerd::MonsterHerdItemDrop(LPOBJ lpObj)
{
	switch(lpObj->Class)
	{
		case 135:
			{
				int iIndex = gObjMonsterTopHitDamageUser(lpObj);
				int itemnumber = ItemGetNumberMake(Configs.WW_Group, Configs.WW_ID);

				ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y, itemnumber, 
					Configs.WW_Level, Configs.WW_Dur, Configs.WW_Luck, Configs.WW_Skill, Configs.WW_Opt, iIndex, Configs.WW_Exc, Configs.WW_Anc);

				char szTemp[256];
				wsprintf(szTemp, lMsg.Get(MSGGET(4, 181)), gObj[iIndex].Name, Configs.MapName[lpObj->MapNumber]);

				AllSendServerMsg( szTemp );

				LogAddTD("[Ring Event] White Wizard Killed by [%s][%s], MapNumber:%d", gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber);
				return TRUE;
			}
			break;
		case 136:
		case 137:
			{
				if ( (rand()%100) < 30 )
				{
					int iIndex = gObjMonsterTopHitDamageUser(lpObj);
					int itemnumber = ItemGetNumberMake(13, 20);
					ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y, itemnumber, 0, 30, 0, 0, 0, iIndex, 0, 0);
					return TRUE;
				}

				if ( (rand() % Configs.RingOrcKillGiftRate) == 0 )
				{
					int iIndex = gObjMonsterTopHitDamageUser(lpObj);
					this->SendEventGiftWinner(iIndex, 1);
					return TRUE;
				}

				MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y);
				return TRUE;
			}
			break;
		default:
			return FALSE;
			break;
	}



}
Example #2
0
int MygEventMonsterItemDrop (BYTE * b_MonsterDataAddr,BYTE * a_gObjAddr)
{
WORD wMonsterLv =0;
WORD wMonsterId =0;
WORD Player;
BYTE cMapID, cX, cY;
PBYTE bDataAddr =0;
bDataAddr = (PBYTE)b_MonsterDataAddr;


memcpy(&Player,bDataAddr+0x73,sizeof(WORD));
memcpy(&wMonsterLv, bDataAddr+0xA0, sizeof(WORD));
memcpy(&wMonsterId, bDataAddr+0x9C, sizeof(WORD));
memcpy(&cMapID, bDataAddr+0x10D, sizeof(BYTE));
memcpy(&cX, bDataAddr+0x108, sizeof(BYTE));
memcpy(&cY, bDataAddr+0x10A, sizeof(BYTE));


DWORD dwPena = ItemGetNumberMake(13,14); //pluma
//(13,14) = pluma xD
DWORD dwPena2 = ItemGetNumberMake(12,31); //jewels soul
DWORD dwTopHitUser = gObjMonsterTopHitDamageUser( b_MonsterDataAddr );

DWORD dwRand = rand();


WORD gMonsterID = 0x4D ; //monster Lvl 77 Metal Balrog 
if (wMonsterId<=gMonsterID)
{
if ( dwRand % 10000 >= (10000 - 60)) //60% es para probar
{
ItemSerialCreateSend(b_MonsterDataAddr[0], cMapID,cX,cY,dwPena ,0,255,0,0,0 ,dwTopHitUser,0,0);
return 1;
}
}
//WORD 
	gMonsterID = 0x34 ; //monster level 52  Ice Queen
if (wMonsterId>=gMonsterID) //Mayor a monsters lvl 72 dropearan soul
{
if ( dwRand % 10000 >= (10000 - 90)) //90% es para probar
{
ItemSerialCreateSend(b_MonsterDataAddr[0], cMapID,cX,cY,dwPena2 ,0,255,0,0,0 ,dwTopHitUser,0,0);
return 1;
}
}
int rValue = gEventMonsterItemDrop(b_MonsterDataAddr, a_gObjAddr);
return rValue;
}
BOOL CRingMonsterHerd::MonsterHerdItemDrop(LPOBJ lpObj)
{

    if ( lpObj->Class == 135 )
    {
        int iIndex = gObjMonsterTopHitDamageUser(lpObj);
        int itemnumber = ItemGetNumberMake(14, 13);
        ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y,
                             itemnumber, 0, 0, 0, 0, 0, iIndex, 0, 0);
        char szTemp[256];
        wsprintf(szTemp, lMsg.Get(MSGGET(4, 181)), gObj[iIndex].Name, gMapName[lpObj->MapNumber]);	// #error Apply Deathway fix here
        AllSendServerMsg( szTemp );
        LogAddTD("[Ring Event] White Wizard Killed by [%s][%s], MapNumber:%d",
                 gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber);

        return TRUE;

    }

    if ( lpObj->Class == 136 || lpObj->Class == 137)
    {
        if ( (rand()%100) < 30 )
        {
            int iIndex = gObjMonsterTopHitDamageUser(lpObj);
            int itemnumber = ItemGetNumberMake(13, 20);	// Wizards Ring
            ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, lpObj->X, lpObj->Y,
                                 itemnumber, 0, 30, 0, 0, 0, iIndex, 0, 0);
            return TRUE;
        }

        if ( (rand() % g_iRingOrcKillGiftRate) == 0 )
        {
            int iIndex = gObjMonsterTopHitDamageUser(lpObj);
            this->SendEventGiftWinner(iIndex, 1);
            return TRUE;
        }

        MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y);
        return TRUE;
    }

    return FALSE;

}
Example #4
0
BOOL CRingMonsterHerd::MonsterHerdItemDrop(LPOBJ lpObj)
{
	
	if ( lpObj->Class == 135 )
	{
		int iIndex = gObjMonsterTopHitDamageUser(lpObj);
		int itemnumber = ItemGetNumberMake(14, 13);
		ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y,
			itemnumber, 0, 0, 0, 0, 0, iIndex, 0, 0);
		char szTemp[128];
		wsprintf(szTemp, "%s has defeated the White Wizard Corps", gObj[iIndex].Name);	
		AllSendServerMsg( szTemp ); 
		LogAdd("[Ring Event] White Wizard Killed by [%s][%s], MapNumber:%d",
			gObj[iIndex].AccountID, gObj[iIndex].Name, gObj[iIndex].MapNumber);

		return TRUE;

	}
	
	if ( lpObj->Class == 136 || lpObj->Class == 137)
	{
		if ( Random(0,99) < 30 )
		{
			int iIndex = gObjMonsterTopHitDamageUser(lpObj);
			int itemnumber = ItemGetNumberMake(13, 20);	// Wizards Ring
			ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y,
				itemnumber, 0, 30, 0, 0, 0, iIndex, 0, 0);
			return TRUE;
		}
		
		if ( !Random(0,g_iRingOrcKillGiftRate-1)  )
		{
			int iIndex = gObjMonsterTopHitDamageUser(lpObj);
			this->SendEventGiftWinner(iIndex, 1);
			return TRUE;
		}

		MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y);
		return TRUE;
	}

	return FALSE;

}
Example #5
0
bool CSantaEvent::DropManager(LPOBJ lpObj)
{
	bool bResult = false;
	int MaxHitUser;
	int ItemNumber;
	BYTE Socket[5];
	Socket[0] = 0xFF;
	Socket[1] = 0xFF;
	Socket[2] = 0xFF;
	Socket[3] = 0xFF;
	Socket[4] = 0xFF;
	// ----
	switch ( lpObj->Class )
	{
	case 476:
		MaxHitUser = gObjMonsterTopHitDamageUser(lpObj);
		ItemNumber = ItemGetNumberMake(14, 13);
		ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y, ItemNumber, 0, 0, 0, 0, 0, MaxHitUser, 0,0, Socket);
		bResult = true;
		break;
	case 466:
		if ( (rand()%100) < 30 )
		{
			MaxHitUser = gObjMonsterTopHitDamageUser(lpObj);
			ItemNumber = ItemGetNumberMake(13, 66);
			ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, (BYTE)lpObj->X, (BYTE)lpObj->Y, ItemNumber, 0, 0, 0, 0, 0, MaxHitUser, 0, 0, Socket);
		}
		else
		{
			MapC[lpObj->MapNumber].MoneyItemDrop(10000, (BYTE)lpObj->X, (BYTE)lpObj->Y);
		}
		bResult = true;
		break;
	}
	return bResult;
}
Example #6
0
BYTE CGambleSystem::TryGamble(int aIndex, BYTE MapNumber, int cX, int cY, BYTE btRareItemNum) //0049C6D0 (Identical)
{
	if (this->bLoad == FALSE)
	{
		return 0;
	}

	float Dur = 0;
	int ItemType = 0;
	int Level = 0;
	int MapPosX = 0;
	int MapPosY = 0;
	int Op1 = 0;
	int Op2 = 0;
	int Op3 = 0;
	DWORD n = 0; //loc10
	int loc_11 = 0;
	int NewOp = 0;

	LPOBJ lpObj = &gObj[aIndex]; //loc_13
	 
	if(this->GetBagItemCount() > 0)
	{
		if (this->m_dwSpecialItemRate[btRareItemNum] >= GetLargeRand() % 1000000)
		{
			Level = 0;
			Dur = 0;
			Op1 = 1;
			Op2 = 0;

			DWORD dwOptionRate = GetLargeRand() % 1000000;

			if ( dwOptionRate <= this->m_iBagItemOptionRate[0])
			{
				Op3 = 1;
			}
			else if ( dwOptionRate <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1])
			{
				Op3 = 2;
			}
			else if ( dwOptionRate <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2])
			{
				Op3 = 3;
			}
			else if ( dwOptionRate <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2] + this->m_iBagItemOptionRate[3])
			{
				Op3 = 4;
			}

			DWORD dwNewOptionRate = GetLargeRand() % 1000000;

			if ( dwNewOptionRate <= this->m_iBagItemExcRate[0])
			{
				NewOp = this->SortExcNumberPerKind(1);
			}
			else if ( dwNewOptionRate <= this->m_iBagItemExcRate[0] + this->m_iBagItemExcRate[1])
			{
				NewOp = this->SortExcNumberPerKind(2);
			}
			else if ( dwNewOptionRate <= this->m_iBagItemExcRate[0] + this->m_iBagItemExcRate[1] + this->m_iBagItemExcRate[2])
			{
				NewOp = this->SortExcNumberPerKind(3);
			}
			else if ( dwNewOptionRate <= this->m_iBagItemExcRate[0] + this->m_iBagItemExcRate[1] + this->m_iBagItemExcRate[2] + this->m_iBagItemExcRate[3])
			{
				NewOp = this->SortExcNumberPerKind(4);
			}

			switch ( btRareItemNum ) //5 Types of Special Item
			{
				case 0:
					ItemType = ItemGetNumberMake(3, 11);
				break;
				case 1:
					ItemType = ItemGetNumberMake(5, 33);
				break;
				case 2:
					ItemType = ItemGetNumberMake(4, 24);
				break;
				case 3:
					ItemType = ItemGetNumberMake(2, 18);
				break;
				case 4:
					ItemType = ItemGetNumberMake(5, 34);
				break;
			}
		}
		else //else for common items like a bag
		{
			int iBagNumberCount = 0;
			int iRandA = 0;
			int iRandB = 0;
			int iBagNumber = 0;

			switch( btRareItemNum )
			{
				case 0:
					iBagNumber = 0;
					break;
				case 1:
					iBagNumber = 5;
					break;
				case 2:
					iBagNumber = 10;
					break;
				case 3:
					iBagNumber = 15;
					break;
				case 4:
					iBagNumber = 20;
					break;
			}

			DWORD dwSortItemRand = GetLargeRand() % 1000000;
			
			int iSortItemRate = 0;

			for ( int i = iBagNumber; i < iBagNumber + GAMBLE_MAX_NORMAL_ITEM; i++)
			{
				iSortItemRate += this->m_GamblingInfo[i].m_iSortItemRate;

				if(dwSortItemRand <= iSortItemRate)
				{
					iBagNumber = i;
					break;
				}
			}
			
			while(true) //Max 25
			{
				iRandB += this->m_iDropRatePerItemCount[iBagNumberCount];
	
				if (iBagNumber <= iBagNumberCount)
				{
					break;
				}

				iRandA += this->m_iDropRatePerItemCount[iBagNumberCount];
				iBagNumberCount++;
			}

			while(true)	//temp fix
			{
				if( iRandB > iRandA )
				{
					break;
				}
				// ---
				iRandB++;
			}

			n = (GetLargeRand() % (iRandB - iRandA)) + iRandA;
		
			Dur = 0;
			MapPosX = 0;
			MapPosY = 0;

			Level = this->GetLevel(n);

			ItemType = ItemGetNumberMake(this->BagObject[n].m_type,this->BagObject[n].m_index);

			if (ItemType == -1)
			{
				return 0;
			}

			if( this->BagObject[n].m_isskill != 0)
			{
				if (this->m_GamblingInfo[iBagNumber].m_iSkillRate >= GetLargeRand()%1000000)
				{
					Op1 = 1;
				}
			}

			if(this->BagObject[n].m_isluck != 0)
			{
				if (this->m_GamblingInfo[iBagNumber].m_iLuckRate >= GetLargeRand()%1000000)
				{
					Op2 = 1;
				}
			}

			if(this->BagObject[n].m_isoption != 0)
			{
				if (this->m_GamblingInfo[iBagNumber].m_iOptionRate >= GetLargeRand()%1000000)
				{
					int iOpt3Rand = GetLargeRand() % 1000000;

					if ( iOpt3Rand <= this->m_iBagItemOptionRate[0])
					{
						Op3 = 1;
					}
					else if ( iOpt3Rand <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1])
					{
						Op3 = 2;
					}
					else if ( iOpt3Rand <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2])
					{
						Op3 = 3;
					}
					else if ( iOpt3Rand <= this->m_iBagItemOptionRate[0] + this->m_iBagItemOptionRate[1] + this->m_iBagItemOptionRate[2] + this->m_iBagItemOptionRate[3])
					{
						Op3 = 4;
					}
				}
			}
			
			if(this->BagObject[n].m_isexitem != 0)
			{
				if (this->m_GamblingInfo[iBagNumber].m_iExcRate >= GetLargeRand()%1000000)
				{
					NewOp = this->SortExcOption();
					
					Op2 = 0;
					Op1 = 1;
					Level = 0;	
				}
			}
		}

		ItemSerialCreateSend(lpObj->m_Index,MapNumber,MapPosX,MapPosY,ItemType,Level,Dur,Op1,Op2,Op3,lpObj->m_Index,NewOp,0);
		LogAddTD("[ GAMBLING ][ TryGambling ] %s(%s) Try Item : [%s]%d Level:%d op1:%d op2:%d op3:%d ExOp:%d",lpObj->AccountID,lpObj->Name,ItemAttribute[ItemType].Name,ItemType,Level,Op1,Op2, Op3,NewOp);
	}
	return 1;
}
Example #7
0
int CCashLotterySystem::GetItem(CItem *lpItem)
{
	int iItemCategory = 0;
	int iMaxItemCountInCategory = 0;
	int iItemSelectNumber = 0;
	CItem ReturnItem;
	int iItemNumber = 0;
	int iItemType = 0;
	int iItemIndex = 0;
	int iItemLevel = 0;
	int iItemLevelMin = 0;
	int iItemLevelMax = 0;
	int iSkillOption = 0;
	int iLuckOption = 0;
	int iAddOption = 0;
	int iExOption = 0;
	int iSkillOptionRate = 0;
	int iLuckOptionRate = 0;
	int iAddOptionRate = 0;
	int iExOptionRate = 0;
	BYTE btSkillOption = 0;
	BYTE btLuckOption = 0;
	BYTE btAddOption = 0;
	BYTE btExOption = 0;
	BYTE btExOptionKey = 0;
	BYTE btExOptionValue1 = 0;
	BYTE btExOptionValue2 = 0;
	int iTemp = 0;
	int iRandomKey = 0;
	BYTE ExOption[MAX_EXOPTION_SIZE];

	if ( lpItem == NULL )
		return -1;

	iItemCategory = this->CategoryRandomPool.GetRandomValue(eRANDOMPOOL_BY_WEIGHT);

	if ( iItemCategory < 0 || iItemCategory > MAX_LOTTERY_ITEM_CATEGORY )
		return -1;

	iMaxItemCountInCategory = this->LotteryItemListCount[iItemCategory];

	if ( iMaxItemCountInCategory <= 0 ||  iMaxItemCountInCategory > MAX_LOTTERY_ITEM_COUNT )
		return -1;

	iItemSelectNumber = rand() % iMaxItemCountInCategory;

	if ( iItemSelectNumber < 0 ||  iItemSelectNumber > MAX_LOTTERY_ITEM_COUNT )
		return -1;

	iItemType = this->LotteryItemList[iItemCategory][iItemSelectNumber].btItemType;
	iItemIndex = this->LotteryItemList[iItemCategory][iItemSelectNumber].wItemIndex;
	iItemLevelMin = this->LotteryItemList[iItemCategory][iItemSelectNumber].btItemLevelMin;
	iItemLevelMax = this->LotteryItemList[iItemCategory][iItemSelectNumber].btItemLevelMax;
	iSkillOption = this->LotteryItemList[iItemCategory][iItemSelectNumber].btSkillOption;
	iLuckOption = this->LotteryItemList[iItemCategory][iItemSelectNumber].btLuckOption;
	iAddOption = this->LotteryItemList[iItemCategory][iItemSelectNumber].btAddOption;
	iExOption = this->LotteryItemList[iItemCategory][iItemSelectNumber].btExOption;

	if ( iItemType == -1 || iItemIndex == -1 || iItemLevelMin == -1 || iItemLevelMax == -1 || iItemLevelMin == -1 || iItemLevelMax == -1 || iSkillOption == -1 || iLuckOption == -1 || iAddOption == -1 || iExOption == -1 )
		return -1;

	iSkillOptionRate = this->LotteryItemOptionRate[iItemCategory].iSkillOptionRate;
	iLuckOptionRate = this->LotteryItemOptionRate[iItemCategory].iLuckOptionRate;
	iAddOptionRate = this->LotteryItemOptionRate[iItemCategory].iAddOptionRate;
	iExOptionRate = this->LotteryItemOptionRate[iItemCategory].iExOptionRate;

	iRandomKey = rand() % (iItemLevelMax - iItemLevelMin + 1);
	iItemLevel = iItemLevelMin + iRandomKey;

	if ( iItemLevel > iItemLevelMax || iItemLevel < iItemLevelMin )
		iItemLevel = iItemLevelMin;

	if ( iSkillOption == 1 )
	{
		iRandomKey = GetLargeRand() % 1000000;

		if ( iRandomKey < iSkillOptionRate )
			btSkillOption = 1;
	}

	if ( iLuckOption == 1 )
	{
		iRandomKey = GetLargeRand() % 1000000;

		if ( iRandomKey < iLuckOptionRate )
			btLuckOption = 1;
	}

	if ( iAddOption == 1 )
	{
		iRandomKey = GetLargeRand() % 1000000;

		if ( iRandomKey < iAddOptionRate )
		{
			btAddOption = this->AddOptionRandomPool.GetRandomValue(eRANDOMPOOL_BY_WEIGHT);
			iTemp = btAddOption;
		}
	}

	if ( iExOption == 1 )
	{
		iRandomKey = GetLargeRand() % 1000000;

		if ( iRandomKey < iExOptionRate )
		{
			btExOptionValue1 = this->ExOptionRandomPool.GetRandomValue(eRANDOMPOOL_BY_WEIGHT);
			btExOptionKey =  1 << (int)(btExOptionValue1);
			btExOption |= btExOptionKey;

			iItemLevel = 0;

			if ( (rand() % 4) == 0 )
			{
				btExOptionValue2 = this->ExOptionRandomPool.GetRandomValue(eRANDOMPOOL_BY_WEIGHT);

				if ( btExOptionValue1 != btExOptionValue2 )
				{
					btExOptionKey =  1 << (int)(btExOptionValue2);
					btExOption |= btExOptionKey;
				}
			}
		}
	}
	else if ( iExOption == 2 )
	{
		btExOptionValue1 = this->ExOptionRandomPool.GetRandomValue(eRANDOMPOOL_BY_WEIGHT);
		btExOptionKey =  1 << (int)(btExOptionValue1);
		btExOption |= btExOptionKey;
		iItemLevel = 0;

		if ( (rand() % 4) == 0 )
		{
			btExOptionValue2 = this->ExOptionRandomPool.GetRandomValue(eRANDOMPOOL_BY_WEIGHT);

			if ( btExOptionValue1 != btExOptionValue2 )
			{
				btExOptionKey =  1 << (int)(btExOptionValue2);
				btExOption |= btExOptionKey;
			}
		}
	}

	if ( btAddOption != iTemp )
		btAddOption = 0;

	iItemNumber = ItemGetNumberMake(iItemType, iItemIndex);
	lpItem->Convert(iItemNumber, btSkillOption, btLuckOption, btAddOption, btExOption, 0, 0, 0, -1, CURRENT_DB_VERSION);
	lpItem->m_Level = iItemLevel;

	if ( !lpItem->IsItem() )
		return -1;

	ItemIsBufExOption(ExOption, lpItem);

	LogAddTD("[CashItem][LotteryItem] Get Item Category:%d,Index:%d (Name:%s,Type:%d,Index:%d,Level:%d) Skill:%d,Luck:%d,AddOption:%d,ExOption(%d,%d,%d,%d,%d,%d)",
		iItemCategory, iItemSelectNumber, ItemAttribute[iItemNumber].Name, iItemType,
		iItemIndex, iItemLevel, btSkillOption, btLuckOption, btAddOption, 
		ExOption[0], ExOption[1], ExOption[2], ExOption[3], ExOption[4], ExOption[5]);

	return iItemCategory;
}
Example #8
0
void classdef::SetEquipment(int Class)
{
	int def_type=0;
	int right_type=0;
	int n;

	for (n=0;n<MAX_PLAYER_EQUIPMENT+1;n++)
	{
		this->DefClass[Class].Equipment[n].Clear();
	}

	switch (Class)
	{
		case CLASS_KNIGHT:
			def_type = ItemGetNumberMake(1, 0);
			break;

		case CLASS_ELF:
			def_type = ItemGetNumberMake(4, 0);
			right_type = ItemGetNumberMake(4, 15);
			break;

		case CLASS_DARKLORD:
			def_type = ItemGetNumberMake(6, 0);
			right_type = ItemGetNumberMake(0, 1);
			break;

		case CLASS_MAGUMSA:
			def_type = ItemGetNumberMake(6, 0);
			right_type = ItemGetNumberMake(0, 1);
			break;

		case CLASS_SUMMONER:
			def_type = ItemGetNumberMake(6, 0);
			right_type = ItemGetNumberMake(0, 1);
			break;
	}

	if ( Class != 0 )
	{
		if ( Class == CLASS_DARKLORD )
		{
			this->DefClass[Class].Equipment[0].m_Level = 0;
			this->DefClass[Class].Equipment[1].m_Level = 0;
			this->DefClass[Class].Equipment[0].Convert(right_type, 0,0,0,0,0,0,CURRENT_DB_VERSION);
			this->DefClass[Class].Equipment[1].Convert(def_type, 0,0,0,0,0,0,CURRENT_DB_VERSION);
		}
		else if ( Class == CLASS_ELF || Class == CLASS_MAGUMSA )
		{
			this->DefClass[Class].Equipment[0].m_Level = 0;
			this->DefClass[Class].Equipment[1].m_Level = 0;
			this->DefClass[Class].Equipment[0].Convert(right_type, 0,0,0,0,0,0,CURRENT_DB_VERSION);
			this->DefClass[Class].Equipment[1].Convert(def_type, 0,0,0,0,0,0,CURRENT_DB_VERSION);
		}
		else
		{
			this->DefClass[Class].Equipment[0].m_Level = 0;
			this->DefClass[Class].Equipment[0].Convert(def_type, 0,0,0,0,0,0,CURRENT_DB_VERSION);
		}
	}

	if ( this->m_BabubBanJiCreate == true )
	{
		def_type = ItemGetNumberMake(13, 20);
		this->DefClass[Class].Equipment[12].m_Level = 1;
		this->DefClass[Class].Equipment[12].Convert(def_type, 0,0,0,0,0,0,CURRENT_DB_VERSION);
		
		def_type = ItemGetNumberMake(13, 20);
		this->DefClass[Class].Equipment[13].m_Level = 2;
		this->DefClass[Class].Equipment[13].Convert(def_type, 0,0,0,0,0,0,CURRENT_DB_VERSION);
	}

}
Example #9
0
BOOL CQuestInfo::MonsterItemDrop(LPOBJ lpObj)
{
	int MaxHitUser = gObjMonsterTopHitDamageUser(lpObj);

	if ( MaxHitUser == -1 )
	{
		return false;
	}

	int partycount = gParty.GetPartyCount(gObj[MaxHitUser].PartyNumber);

	if ( partycount > 0 )
	{
		return false;
	}

	LPOBJ lpTarget = &gObj[MaxHitUser];
	int questcount = this->GetQeustCount();
	int foundquest = 0;
	LPQUEST_INFO lpQuestInfo;
	LPQUEST_SUB_INFO lpSubInfo;
	int type;
	int level;
	int x;
	int y;
	float dur = 0;
	int Option1 = 0;
	int Option2 = 0;
	int Option3 = 0;

	

	for ( int i=0;i<MAX_QUEST_INFO;i++)
	{
		lpQuestInfo = this->GetQuestInfo(i);

		if ( lpQuestInfo == NULL )
		{
			continue;
		}

		for ( int n =0;n<lpQuestInfo->QuestSubInfoCount;n++)
		{
			lpSubInfo = this->GetSubquestInfo(lpTarget, lpQuestInfo, n);
			
			if ( lpSubInfo != NULL )
			{
				if ( lpSubInfo->QuestType == 1 && lpSubInfo->NeedTargetMinLevel != -1 ) //Third Quest Fix, only READS Monster Level Min and Max if Level Min is != 1
				{
					if ( lpObj->Level >= lpSubInfo->NeedTargetMinLevel)
					{
						if ( lpObj->Level <= lpSubInfo->NeedTargetMaxLevel )
						{
							if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE )
							{
								if ( (rand() % ITEM_QUEST_DROP_PROBABILITY) < lpSubInfo->NeedDropRate)
								{
									int itemcount = gObjGetItemCountInIventory(MaxHitUser, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType, lpSubInfo->ItemLevel);

									if ( itemcount >= lpSubInfo->NeedNumber)
									{
										continue;
									}

									dur = 0;
									x = lpObj->X;
									y = lpObj->Y;
									level = lpSubInfo->ItemLevel;
									type = ItemGetNumberMake(lpSubInfo->NeedType, lpSubInfo->NeedSubType);
									ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, x, y, type, level, dur, Option1,
										Option2, Option3, MaxHitUser, 0, 0);
									LogAddTD("[Quest] Quest Item Drop [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name,
										lpTarget->AccountID, lpTarget->Name, lpQuestInfo->Name, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType);
									qMsg->Msg(lpObj->m_Index, "@[Quest] Your item droped.");
									return true;
								}
							}
						}
					}
				}
				//Start of S3 Quest
				if ( lpSubInfo->QuestType == 1 && lpSubInfo->NeedTargetMinLevel == -1 ) //Third Quest
				{
					if ( lpObj->Class == lpSubInfo->NeedTargetMaxLevel) //READS Monster Class on TargetMax Level Category (for Original Quest.txt)
					{
						if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE )
							{
								if ( (rand() % ITEM_QUEST_DROP_PROBABILITY) < lpSubInfo->NeedDropRate)
								{
									int itemcount = gObjGetItemCountInIventory(MaxHitUser, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType, lpSubInfo->ItemLevel);

									if ( itemcount >= lpSubInfo->NeedNumber)
									{
										continue;
									}

									dur = 0;
									x = lpObj->X;
									y = lpObj->Y;
									level = lpSubInfo->ItemLevel;
									type = ItemGetNumberMake(lpSubInfo->NeedType, lpSubInfo->NeedSubType);
									ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, x, y, type, level, dur, Option1,
										Option2, Option3, MaxHitUser, 0, 0);
									LogAddTD("[Season3 Quest] Quest Item Drop [%s]: [%s][%s] (%s) (%d,%d)", lpObj->Name,
										lpTarget->AccountID, lpTarget->Name, lpQuestInfo->Name, lpSubInfo->NeedType,
										lpSubInfo->NeedSubType);
									return true;
								}
							}
					}
				}
				if ( lpSubInfo->QuestType == 2 && lpSubInfo->NeedTargetMinLevel == -1 ) //Third Quest for Kill Count
				{
					if ( lpObj->Class == lpSubInfo->NeedTargetMaxLevel) //READS Monster Class on TargetMax Level Category (for Original Quest.txt)
					{
						if ( this->GetQuestState(lpTarget, lpQuestInfo->QuestIndex) == TRUE )
						{
							if( lpTarget->m_Quest[1] == 0xF6 && lpTarget->MapNumber == 41 )
							{
								if( lpTarget->m_Quest[30] > 10)
								{
									lpTarget->m_Quest[30] = 0;
								}
								if( lpTarget->m_Quest[31] > 10 )
								{
									lpTarget->m_Quest[31] = 0;
								}
								if( lpTarget->m_Quest[32] > 10 )
								{
									lpTarget->m_Quest[32] = 0;
								}

								if(lpObj->Class == 409 && lpTarget->m_Quest[30] < 10)
								{
									lpTarget->m_Quest[30] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Balram(Hero)", lpTarget->m_Quest[30]);
								}

								if(lpObj->Class == 410 && lpTarget->m_Quest[31] < 10)
								{
									lpTarget->m_Quest[31] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Death Spirit(Hero)", lpTarget->m_Quest[31]);
								}

								if(lpObj->Class == 411 && lpTarget->m_Quest[32] < 10)
								{
									lpTarget->m_Quest[32] += 1;
									lpTarget->m_Quest[34] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/10) Soram(Hero).", lpTarget->m_Quest[32]);
								}
							}
							if( lpTarget->m_Quest[1] == 0xDA && lpTarget->MapNumber == 42 )
							{
								if( lpTarget->m_Quest[34] > 1 )
								{
									lpTarget->m_Quest[34] = 0;
								}
									
								if(lpObj->Class == 412 && lpTarget->m_Quest[34] < 1)
								{
									lpTarget->m_Quest[34] += 1;
									MsgOutput(lpTarget->m_Index, "[Quest] (%d/1) Dark Elf(Hero)", lpTarget->m_Quest[34]);
								}
							}
						//End of S3 Quest
						}
					}
				}
			//
			}
		}

		foundquest++;

		if ( foundquest == questcount )
		{
			break;
		}
	}

	return false;
}
bool CItemDropManager::ProccessItemDrop(LPOBJ lpMobObj)
{
	unsigned char Map = lpMobObj->MapNumber;
	unsigned char X = lpMobObj->X;
	unsigned char Y = lpMobObj->Y;
	int Type = 0;
	char Level = 0;
	unsigned char Dur = 0;
	char Luck = 0;
	char Skill = 0;
	char Opt = 0;
	char Exe = 0;
	char Anc = 0;
	unsigned char Socket[5];
	Socket[0] = 0xFF;
	Socket[1] = 0xFF;
	Socket[2] = 0xFF;
	Socket[3] = 0xFF;
	Socket[4] = 0xFF;

	if ( gItemDropManager.ItemsCount > 0 )
	{
		int iTopHitUser = gObjMonsterTopHitDamageUser(lpMobObj);

		for (int i=0;i<gItemDropManager.ItemsCount;++i)
		{
			if ( lpMobObj->MapNumber == gItemDropManager.DropMap[i] || gItemDropManager.DropMap[i] == -1 )
			{
				if ( lpMobObj->Level >= gItemDropManager.MobMinLvl[i] && lpMobObj->Level <= gItemDropManager.MobMaxLvl[i] )
				{
					if ( (rand()%10000) < gItemDropManager.DropRate[i] )
					{
						Type = ItemGetNumberMake(gItemDropManager.ItemType[i],gItemDropManager.ItemIndex[i]);

						Level = gItemDropManager.ItemLevel[i];
						Dur = gItemDropManager.ItemDur[i];
						Luck = gItemDropManager.ItemLuck[i];
						Skill = gItemDropManager.ItemSkill[i];
						Opt = gItemDropManager.ItemOption[i];
						if ( gItemDropManager.ItemExe[i] > 0 )
						{
							Exe = GetRandomExeOption(gItemDropManager.ItemExe[i]+1);
						}
						if ( gItemDropManager.ItemAncient[i] == 5 || gItemDropManager.ItemAncient[i] == 10 )
						{
							Anc = gItemDropManager.ItemAncient[i];
						}
						if ( gItemDropManager.Socket[0][i] != 255 )
						{
							Socket[0] = gItemDropManager.Socket[0][i];

							if ( gItemDropManager.Socket[1][i] != 255 )
							{
								Socket[1] = gItemDropManager.Socket[1][i];

								if ( gItemDropManager.Socket[2][i] != 255 )
								{
									Socket[2] = gItemDropManager.Socket[2][i];

									if ( gItemDropManager.Socket[3][i] != 255 )
									{
										Socket[3] = gItemDropManager.Socket[3][i];

										if ( gItemDropManager.Socket[4][i] != 255 )
										{
											Socket[4] = gItemDropManager.Socket[4][i];
										}
									}
								}
							}
						}

						ItemSerialCreateSend(lpMobObj->m_Index,Map,X,Y,Type,Level,Dur,Skill,Luck,Opt,iTopHitUser,Exe,Anc,Socket);
						return true;
					}
				}
			}
		}
	}
	return false;
}
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;
}
int CItemBagEx::DropCastleHuntZoneBossReward(int aIndex,BYTE btMapNumber, BYTE cX, BYTE cY)
{
	if ( this->m_IBLoad == FALSE )
	{
		return FALSE;
	}

	float dur;
	int type;
	int level;
	int x;
	int y;
	int Option1 = 0;
	int Option2 = 0;
	int Option3 = 0;
	int DropItemNum;
	int ExOption = 0;
	LPOBJ lpObj = &gObj[aIndex];
	
	if(this->GetBagCount() > 0 )
	{
		if(GS_CASTLE)
		{

			DropItemNum = rand() % this->GetBagCount();
			dur = 0;
			
			if(!cX && !cY )
			{
				 x = lpObj->X;
				 y = lpObj->Y;
			}
			else
			{
				x = cX;
				y = cY;
			}

			level = this->GetLevel(DropItemNum);

			type = ItemGetNumberMake(this->EventBagObject[DropItemNum].m_Type,this->EventBagObject[DropItemNum].m_Index);

			if(type == -1)
				return FALSE;

			if(this->EventBagObject[DropItemNum].m_IsSkill != FALSE)
			{
				Option1 = this->EventBagObject[DropItemNum].m_IsSkill;
			}

			if(this->EventBagObject[DropItemNum].m_IsLuck != FALSE)
			{
				Option2 = 0;

				if ( (rand()%2) == 0 )
				{
					Option2 = 1;
				}
			}

			if ( this->EventBagObject[DropItemNum].m_IsOption != 0 )
			{
				if ( rand()%5 < 1 )
				{
					Option3 = 3;
				}
				else
				{
					Option3 = rand()%3;
				}
			}

			if ( this->EventBagObject[DropItemNum].m_IsExcItem != 0 )
			{
				ExOption = NewOptionRand(0);
				Option2 = 0;
				Option1 = 1;
			}

			if ( type == ITEMGET(12,15) ||
				type == ITEMGET(14,13) || 
				type == ITEMGET(14,14))	// Chaos, Bless, Soul
			{
				Option1 = 0;
				Option2 = 0;
				Option3 = 0;
				level = 0;
			}

			if ( type == ITEMGET(13,0) ||
				 type == ITEMGET(13,1) ||
				 type == ITEMGET(13,2) ||
				 type == ITEMGET(13,8) ||
				 type == ITEMGET(13,9) ||
				 type == ITEMGET(13,12) ||
				 type ==ITEMGET(13,13) )	// Angel, imp, unirioa, dino, r and pendant of ice, poisonm
			{
				level = 0;
			}

			BYTE Socket[5];
			Socket[0] = 0xFF;
			Socket[1] = 0xFF;
			Socket[2] = 0xFF;
			Socket[3] = 0xFF;
			Socket[4] = 0xFF;

			ItemSerialCreateSend(lpObj->m_Index, btMapNumber, x, y, type, level, dur, Option1, Option2, Option3, lpObj->m_Index, ExOption, 0, Socket);

			CLog.LogAdd("[Castle HuntZone] Castle HuntZone Boss ItemDrop [%s][%s] [%s] : (%d)(%d/%d) Item:(%s)%d Level:%d op1:%d op2:%d op3:%d",
				lpObj->AccountID, lpObj->Name, this->m_IBEventName, btMapNumber, x, y, ItemAttribute[type].Name, type, level, Option1, Option2, Option3);
			return TRUE;
		}
	}
	
	return TRUE;
}
// -----------------------------------------------------------------------------------------------------------------------------------------
BOOL CItemBagEx::PickItem(CItem & ObjItem, int & nItemIndex)
{
	if ( this->m_IBLoad == FALSE )
		return FALSE;

	int DropItemNum;

	if ( this->GetBagCount() > 0 )
	{
		DropItemNum = rand() % this->GetBagCount();
		nItemIndex = DropItemNum;
		ObjItem.m_Type = ItemGetNumberMake(this->EventBagObject[DropItemNum].m_Type, this->EventBagObject[DropItemNum].m_Index);
		ObjItem.m_Level = this->GetLevel(DropItemNum);

		if ( ObjItem.m_Type == -1 )
			return FALSE;

		if ( this->EventBagObject[DropItemNum].m_IsSkill != 0 )
			ObjItem.m_Option1 = 1;

		if ( this->EventBagObject[DropItemNum].m_IsLuck != 0 )
			ObjItem.m_Option2 = 1;

		if ( this->EventBagObject[DropItemNum].m_IsOption != 0 )
			ObjItem.m_Option3 = 1;

		if ( this->EventBagObject[DropItemNum].m_IsExcItem != 0 )
		{
			ObjItem.m_NewOption = 1;
			ObjItem.m_Option1 = 0;
			ObjItem.m_Option2 = 0;
		}

		if ( ObjItem.m_Type == ITEMGET(12,15) ||
			 ObjItem.m_Type == ITEMGET(14,13) ||
			 ObjItem.m_Type == ITEMGET(14,14) )
		{
			ObjItem.m_Option1 = 0;
			ObjItem.m_Option2 = 0;
			ObjItem.m_Option3 = 0;
			ObjItem.m_Level = 0;
		}

		if ( ObjItem.m_Type == ITEMGET(13,0) ||
			 ObjItem.m_Type == ITEMGET(13,1) ||
			 ObjItem.m_Type == ITEMGET(13,2) ||
			 ObjItem.m_Type == ITEMGET(13,8) ||
			 ObjItem.m_Type == ITEMGET(13,9) ||
			 ObjItem.m_Type == ITEMGET(13,12) ||
			 ObjItem.m_Type == ITEMGET(13,13) )
		{
			ObjItem.m_Level = 0;
		}

		ObjItem.m_Durability = 0;

		return TRUE;
	}

	return FALSE;
}
// -----------------------------------------------------------------------------------------------------------------------------------------
BOOL CItemBagEx::DropItem(int aIndex)
{
	LPOBJ lpObj = &gObj[aIndex];

	int Type;
	int Level;
	int CordX;
	int CordY;
	int szSkill		= 0;
	int szLuck		= 0;
	int szAddOpt	= 0;
	int ExOption	= 0;
	int RandomExe	= 0;
	int IsExeOption[6] = {0,0,0,0,0,0};
	int DropItemNum;
	float Durability;
	BYTE Socket[5];
	Socket[0] = 0xFF;
	Socket[1] = 0xFF;
	Socket[2] = 0xFF;
	Socket[3] = 0xFF;
	Socket[4] = 0xFF;
	//----------
	if(this->m_IBLoad == FALSE) return FALSE;
	//----------
	if ( this->GetBagCount() > 0 )
	{
		if ( (rand()%100) < this->m_IBItemDropRate )
		{
			if ( (rand() % 100 ) < this->m_IBExcItemDropRate )
			{
				DropItemNum =  rand()%this->GetBagCount();
				Durability = 0;
				CordX = lpObj->X;
				CordY = lpObj->Y;
				Level = this->GetLevel(DropItemNum);
				Type = ItemGetNumberMake(this->EventBagObject[DropItemNum].m_Type, this->EventBagObject[DropItemNum].m_Index);
				// -----
				if ( Type == -1 ) return FALSE;
				// -----
				if ( this->EventBagObject[DropItemNum].m_IsSkill != 0 )
				{
					szSkill = rand()%2;
				}
				// -----
				if ( this->EventBagObject[DropItemNum].m_IsLuck != 0 )
				{
					szLuck = rand()%2;
				}
				// -----
				if ( this->EventBagObject[DropItemNum].m_IsOption != 0 )
				{
					if ( rand()%5 < 1 )
					{
						szAddOpt = 3;
					}
					else
					{
						szAddOpt = rand()%3;
					}
				}
				// -----
				if ( this->EventBagObject[DropItemNum].m_IsExcItem != 0 )
				{
					ExOption = NewOptionRand(0);
					szSkill = 1;
				}
				// --- Chaos, Bless, Soul, Life, Creation, Harmony & Loch Feather
				if ( Type == ITEMGET(12,15) || 
					 Type == ITEMGET(14,13) || 
					 Type == ITEMGET(14,14) || 
					 Type == ITEMGET(14,16) ||
					 Type == ITEMGET(14,31) ||
					 Type == ITEMGET(14,42) ||
					 Type == ITEMGET(13,14) )
				{
					szSkill		= 0;
					szLuck		= 0;
					szAddOpt	= 0;
					Level		= 0;
					ExOption	= 0;
				}
				// -----
				if ( Type >= ITEMGET(13,0)   && Type <= ITEMGET(13,5)	||
					 Type >= ITEMGET(13,8)   && Type <= ITEMGET(13,13)	||
					 Type >= ITEMGET(13,20)  && Type <= ITEMGET(13,28)	||
					 Type == ITEMGET(13,64)  || Type == ITEMGET(13,65)	||
					 Type == ITEMGET(13,67)  || Type == ITEMGET(13,68)	||
					 Type == ITEMGET(13,76)  || Type == ITEMGET(13,80)	||
					 Type == ITEMGET(14,85)	 || Type == ITEMGET(14,86)	||
					 Type == ITEMGET(14,87)	 || Type == ITEMGET(14,88)	||
					 Type == ITEMGET(14,89)	 || Type == ITEMGET(14,90)	||
					 Type == ITEMGET(13,122) || Type == ITEMGET(13,123)	)
				{
					Level = 0;
				}
			}
			else
			{
				DropItemNum =  rand()%this->GetBagCount();
				Durability = 0;
				CordX = lpObj->X;
				CordY = lpObj->Y;
				Level = this->GetLevel(DropItemNum);
				Type = ItemGetNumberMake(this->EventBagObject[DropItemNum].m_Type, this->EventBagObject[DropItemNum].m_Index);
				// -----
				if ( Type == -1 ) return FALSE;
				// -----
				if ( this->EventBagObject[DropItemNum].m_IsSkill != 0 )
				{
				szSkill = rand()%2;
				}
				// -----
				if ( this->EventBagObject[DropItemNum].m_IsLuck != 0 )
				{
					szLuck = rand()%2;
				}
				// -----
				if ( this->EventBagObject[DropItemNum].m_IsOption != 0 )
				{
					if ( rand()%5 < 1 )
					{
						szAddOpt = 3;
					}
					else
					{
						szAddOpt = rand()%3;
					}
				}
				// -----
				ExOption = 0;
				// --- Chaos, Bless, Soul, Life, Creation, Harmony & Loch Feather
				if ( Type == ITEMGET(12,15) || 
					 Type == ITEMGET(14,13) || 
					 Type == ITEMGET(14,14) || 
					 Type == ITEMGET(14,16) ||
					 Type == ITEMGET(14,31) ||
					 Type == ITEMGET(14,42) ||
					 Type == ITEMGET(13,14) )
				{
					szSkill		= 0;
					szLuck		= 0;
					szAddOpt	= 0;
					Level		= 0;
					ExOption	= 0;
				}
				// -----
				if ( Type >= ITEMGET(13,0)   && Type <= ITEMGET(13,5)	||
					 Type >= ITEMGET(13,8)   && Type <= ITEMGET(13,13)	||
					 Type >= ITEMGET(13,20)  && Type <= ITEMGET(13,28)	||
					 Type == ITEMGET(13,64)  || Type == ITEMGET(13,65)	||
					 Type == ITEMGET(13,67)  || Type == ITEMGET(13,68)	||
					 Type == ITEMGET(13,76)  || Type == ITEMGET(13,80)	||
					 Type == ITEMGET(14,85)	 || Type == ITEMGET(14,86)	||
					 Type == ITEMGET(14,87)	 || Type == ITEMGET(14,88)	||
					 Type == ITEMGET(14,89)	 || Type == ITEMGET(14,90)	||
					 Type == ITEMGET(13,122) || Type == ITEMGET(13,123)	)
				{
					Level = 0;
				}
			}
			BYTE Socket[5];
	Socket[0] = 0xFF;
	Socket[1] = 0xFF;
	Socket[2] = 0xFF;
	Socket[3] = 0xFF;
	Socket[4] = 0xFF;
			// -----
			ItemSerialCreateSend(lpObj->m_Index, lpObj->MapNumber, CordX, CordY, Type, Level, Durability, szSkill, szLuck, szAddOpt, lpObj->m_Index, ExOption, 0, Socket);
			// -----
			CLog.LogAddC(TColor.Aqua(), "[%s][%s][%s Event Item Drop]: (%d)(X:%d/Y:%d) Item:%d(%s) Level:%d Skill:%d Luck:%d AddOpt:%d Exc:%d",
				lpObj->AccountID, lpObj->Name, this->m_IBEventName, lpObj->MapNumber, CordX, CordY, Type, ItemAttribute[Type].Name, Level, szSkill, szLuck, szAddOpt, ExOption, Socket);
			return TRUE;
		}
	}
	else
	{
		CordX = lpObj->X;
		CordY = lpObj->Y;
		MapC[lpObj->MapNumber].MoneyItemDrop(this->m_IBDropZen, CordX, CordY);
	}
	// -----
	return TRUE;
}
Example #15
0
int CGMMng::ManagementProc(LPOBJ lpObj, char* szCmd, int aIndex)
{
	char * szCmdToken;
	char string[256]={0};
	char szId[20]={0};
	char * pId = szId;
	int len = strlen(szCmd);
	int command_number;

	if ( len < 1 || len > 250 )
	{
		return 0;
	}

	strcpy_s(string, sizeof(string), szCmd);
	szCmdToken = InitTokenString(string);
	command_number = this->GetCmd(szCmdToken);

	switch ( command_number )
	{

        case 331:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 0, pId);
        }
        break;
        case 332:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 1, pId);
        }
        break;
        case 333:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 2, pId);
        }
        break;
        case 334:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 3, pId);
        }
        break;
        case 335:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 4, pId);
        }
        break;
        case 336:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 5, pId);
        }
        break;
        case 337:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 6, pId);
        }
        break;
        case 338:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 7, pId);
        }
        break;
        case 340:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 8, pId);
        }
        break;

		case 217:	//116:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, "FIRECRACK.");
				int x = lpObj->X;
				int y = lpObj->Y;
				PMSG_SERVERCMD pMsg;

				PHeadSubSetB((LPBYTE)&pMsg,0xF3,0x40, sizeof(pMsg));
				pMsg.CmdType = 0;

				for ( int i=0;i<15;i++)
				{
					pMsg.X = x+Random(0,4)*2 - 4;
					pMsg.Y = y+Random(0,4)*2 - 4;
					MsgSendV2(lpObj,(UCHAR*)&pMsg, sizeof(pMsg));
					::DataSend(lpObj->m_Index ,(UCHAR*)&pMsg, sizeof(pMsg));
				}
			}
			break;

		case 216:	//115:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				LPOBJ lpTargetObj = gObjFind(pId);

				if ( lpTargetObj == NULL )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]	[ %s ]	[ %s ] / Target : [%s][%s] : %s ",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
					lpTargetObj->Name, "User Watching");

				char szTemp[256];

				if ( this->WatchTargetIndex == lpTargetObj->m_Index )
				{
					this->WatchTargetIndex = -1;
					
					wsprintf(szTemp, "%s : Off guard", lpTargetObj->Name);	
					GCServerMsgStringSend(szTemp, lpObj->m_Index, 1);
				}
				else
				{
					wsprintf(szTemp, "%s : Start monitoring", lpTargetObj->Name);	
					GCServerMsgStringSend(szTemp, lpObj->m_Index, 1);
					this->WatchTargetIndex = lpTargetObj->m_Index;
				}
			}
			break;

		case 215:	//114:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int map;
				int iX;
				int iY;
				LPOBJ lpTargetObj = gObjFind(pId);
				int iIndex;

				if ( lpTargetObj == NULL )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
					lpTargetObj->Name, "User Tracking");
				map = lpTargetObj->MapNumber;
				iX = lpTargetObj->X;
				iY = lpTargetObj->Y;
				iIndex = lpObj->m_Index;

				if ( iIndex >= 0 )
				{
					gObjTeleport(iIndex, map, iX, iY);
				}
			}
			break;

		case 214:	//113:
			{
				if ( (lpObj->Authority & 2) != 2 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, 
					"User Stat (connection)");

				int lc151 = 0;
				int lc152 = 400;
				int iTokenNumber = this->GetTokenNumber();

				if ( iTokenNumber > 0 )
				{
					lc151 = iTokenNumber;
				}

				int iTokenNumber2 = this->GetTokenNumber();

				if ( iTokenNumber2 > 0 )
				{
					lc152 = iTokenNumber2;
				}

				gObjSendUserStatistic(lpObj->m_Index, lc151, lc152);
			}
			break;

		case 100:	//100:
			{
				if ( (lpObj->AuthorityCode &4) != 4 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int iTargetIndex = gObjGetIndex(pId);
				
				if ( iTargetIndex == -1)
					iTargetIndex=0;

				if ( iTargetIndex >= 0 )
				{
					LPOBJ lpTargetObj = gObjFind(pId);

					if ( lpTargetObj == NULL )
					{
						return 0;
					}

					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
						lpTargetObj->Name, "User Disconnect");
					LogAdd("%s is forced to disconnect.", pId);
					CloseClient(iTargetIndex);
				}
			}
			break;

		case 112:	//108:
			{
				if ( (lpObj->AuthorityCode &4) != 4 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
					"Guild Disconnect");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				_GUILD_INFO_STRUCT * lpGuild = Guild.SearchGuild(pId);
				int iIndex;

				if ( lpGuild != NULL )
				{
					for ( int i=0;i<MAX_USER_GUILD ; i++ )
					{
						if ( lpGuild->Index[i] >= 0 )
						{
							iIndex = lpGuild->Index[i];

							if ( iIndex >= 0 )
							{
								LogAdd("%s is forced to disconnect.", pId);
								CloseClient(iIndex);
							}
						}
					}
				}
			}
			break;

		case 101:	//101: /move
			{
				char* map_name=this->GetTokenString();

				if (map_name == NULL)
					return 0;

				int iTokenNumber1 = this->GetTokenNumber();

				if ( (lpObj->AuthorityCode &8) == 8 && iTokenNumber1 != -1)
				{

					int iTokenNumber2 = this->GetTokenNumber();
					int iTokenNumber3 = this->GetTokenNumber();

					if (iTokenNumber2 == -1)
						iTokenNumber2 = 0;

					if (iTokenNumber3 == -1)
						iTokenNumber3 = 0;

					int iIndex = gObjGetIndex(map_name);

					if ( iIndex >= 0 )
					{
						LPOBJ lpTargetObj = gObjFind(map_name);

						if ( lpTargetObj == NULL )
						{
							return 0;
						}

						LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
							lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
							lpTargetObj->Name, "User SetPosition");

						gObjTeleport(iIndex, iTokenNumber1, iTokenNumber2, iTokenNumber3);
					}
				}
				else
				{

					int lc165 = -1;
					int lc166 = 0;
					int lc167 = 0;

					if ( lpObj->Teleport != 0 )
					{
						GCServerMsgStringSend("You are currently not able to warp.", lpObj->m_Index, 1);
						return 0;
					}

					if ( (lpObj->m_IfState.use) != 0 )
					{
						if ( lpObj->m_IfState.type  == 3 )
						{
							lpObj->TargetShopNumber = -1;
							lpObj->m_IfState.type = 0;
							lpObj->m_IfState.use = 0;
						}
					}

					if ( lpObj->m_IfState.use > 0 )
					{
						GCServerMsgStringSend("You are currently not able to warp.", lpObj->m_Index, 1);
						return 0;
					}

					if ( gObj[aIndex].IsInBattleGround != false )
					{
						GCServerMsgStringSend("You are currently not able to warp.", lpObj->m_Index, 1);
						return 0;
					}

					if ( lpObj->m_PK_Level >= gPKLvlToCantWarp )
					{
						GCServerMsgStringSend("An outlaw cannot use the /warp command. ", lpObj->m_Index, 1);
						return 0;
					}

					gMoveCommand.Move(lpObj, map_name);
				}
			}
			break;

		case 108:	//104:
			{
				if ( (lpObj->AuthorityCode &8)!= 8 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, 
					"Guild SetPosition");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int iTokenNumber1 = this->GetTokenNumber();
				int iTokenNumber2 = this->GetTokenNumber();
				int iTokenNumber3 = this->GetTokenNumber();

				if (iTokenNumber1 == -1)
					iTokenNumber1 = 0;

				if (iTokenNumber2 == -1)
					iTokenNumber2 = 0;

				if (iTokenNumber3 == -1)
					iTokenNumber3 = 0;

				_GUILD_INFO_STRUCT* lpGuild = Guild.SearchGuild(pId);
				int iIndex;

				if ( lpGuild != NULL )
				{
					for ( int i=0;i<MAX_USER_GUILD;i++)
					{
						if (lpGuild->Index[i] >= 0 )
						{
							iIndex = lpGuild->Index[i];
							gObjTeleport(iIndex, iTokenNumber1, iTokenNumber2++, iTokenNumber3);
						}
					}
				}
			}
			break;

		case 109:	//105:
			{
				if ( (lpObj->Authority &2)== 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
						"Start BattleSoccer");

					BattleSoccerGoalStart(0);
				}
			}
			break;

		case 110:	//106:
			{
				if ( (lpObj->Authority &2) == 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
						"Stop BattleSoccer");

					BattleSoccerGoalEnd(0);
				}
				else
				{
					if ( gObj[aIndex].lpGuild != NULL )
					{
						if (gObj[aIndex].lpGuild->WarType == 1 )
						{
							strcmp(gObj[aIndex].Name, gObj[aIndex].lpGuild->Names[0] );
						}
					}
				}
			}

			break;

		case 111:	//107:
			{
				if ( (lpObj->Authority & 2) == 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, "End GuildWar");

					char * szGuild = this->GetTokenString();

					if ( szGuild != NULL )
					{
						GCManagerGuildWarEnd(szGuild);
					}
				}
				else
				{
					if ( gObj[aIndex].lpGuild != NULL && gObj[aIndex].lpGuild->lpTargetGuildNode != NULL)
					{
						if ( strcmp( gObj[aIndex].Name, gObj[aIndex].lpGuild->Names[0] ) ==  0)
						{
							if ( gObj[aIndex].lpGuild->BattleGroundIndex >= 0 && gObj[aIndex].lpGuild->WarType == 1 )
							{
								::gObjAddMsgSendDelay(&gObj[aIndex], 7, aIndex, 10000, 0);

								char szTemp[100];

								wsprintf(szTemp, "Because of %s's request, the match will end automatically in 10 seconds", gObj[aIndex].lpGuild->Names[0] );
								::GCServerMsgStringSendGuild(gObj[aIndex].lpGuild, szTemp, 1);
								::GCServerMsgStringSendGuild(gObj[aIndex].lpGuild->lpTargetGuildNode, szTemp, 1);
							}
						}
					}
				}
			}
			break;

		case 104:	//102:
			{
				if ( (lpObj->AuthorityCode&0x20 ) != 0x20 )
				{
					return FALSE;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "Ban Chatting");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return FALSE;
				}

				int Index = ::gObjGetIndex(pId);

				if ( Index >= 0 )
				{
					gObj[Index].Penalty |= 2;
				}

			}
			break;

		case 106:	//103:
			{
				if ( (lpObj->AuthorityCode & 32 ) != 32 )
				{
					return FALSE;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "Free Ban-Chatting");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return FALSE;
				}

				int Index = ::gObjGetIndex(pId);

				if ( Index >= 0 )
				{
					gObj[Index].Penalty &= ~2;
				}
			}
			break;

		case 200:	//109:
			{
				pId = this->GetTokenString();

				if ( pId != NULL )
				{
					if ( strlen(pId) >= 1 )
					{
						::GCGuildWarRequestResult(pId, aIndex, 0);
					}
				}
			}

			break;

		case 202:	//111:
			{
				if ( (lpObj->Authority & 2 ) == 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
						lpObj->Name, "Set GuildWar");
		
					pId = this->GetTokenString();

					if ( pId != NULL )
					{
						char * Rival = this->GetTokenString();

						if ( Rival != NULL )
						{
							if ( strlen(pId) >= 1 )
							{
								if ( strlen(Rival) >= 1 )
								{
									::GCManagerGuildWarSet(pId, Rival, 1);
								}
							}
						}
					}
				}
				else
				{
					if ( gEnableBattleSoccer != FALSE )
					{
						pId = this->GetTokenString();

						if ( pId != NULL )
						{
							if ( strlen(pId) >= 1 )
							{
								::GCGuildWarRequestResult(pId, aIndex, 1);
							}
						}
					}
				}
			}

			break;

		case 201:	//110:
			{
				gObjBillRequest(&gObj[aIndex]);
			}
			break;

		case 203:	//112:
			{
				pId = this->GetTokenString();

				if ( pId != NULL )
				{
					BOOL bState;

					if ( strcmp(pId, "on" ) == 0 )
					{
						bState = TRUE;
					}
					else if ( strcmp(pId, "off") == 0 )
					{
						bState = FALSE;
					}

					if ( bState >= FALSE && bState <= TRUE )
					{
						::gObjSetTradeOption(aIndex, bState);
						::gObjSetDuelOption(aIndex, bState);
					}
				}
			}
			break;

		case 320:	//117:
			{
				if ( (lpObj->Authority &2) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "View the status of kundun");	
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "View the status of kundun");	

				for ( int n=0;n<MAX_VIEWPORT;n++)
				{
					if ( lpObj->VpPlayer[n].state != 0 )
					{
						if ( lpObj->VpPlayer[n].type == OBJ_MONSTER )
						{
							if ( lpObj->VpPlayer[n].number >= 0 )
							{
								LPOBJ lpTarget = &gObj[lpObj->VpPlayer[n].number];

								if ( lpTarget->Class == 275 )
								{
									TNotice pNotice(1);

									pNotice.SendToUser(lpObj->m_Index, "Kundun HP = %7.0f / %7.0f", lpTarget->Life, lpTarget->MaxLife); 
									pNotice.SendToUser(lpObj->m_Index, "Kundun RefillHP/Sec = %d RefillHP = %d RefillHPTime = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation
								}
							}
						}
					}
				}

			}
			break;

		case 321:	//118:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP설정");	// Require Translation

				int iLife = this->GetTokenNumber();

				if (iLife == -1)
					iLife = 0;

				for ( int n=0;n<MAX_VIEWPORT;n++)
				{
					if ( lpObj->VpPlayer[n].state != FALSE )
					{
						if ( lpObj->VpPlayer[n].type == OBJ_MONSTER )
						{
							if ( lpObj->VpPlayer[n].number >= 0 )
							{
								LPOBJ lpTarget = &gObj[lpObj->VpPlayer[n].number];

								if ( lpTarget->Class == 275 )
								{
									if  ( iLife <= 5000 )
									{
										iLife = 5000 ;
									}

									if ( iLife > lpTarget->MaxLife )
									{
										iLife = (int)lpTarget->MaxLife;
									}

									lpTarget->Life = iLife;
								
									TNotice pNotice(1);

									pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP = %7.0f / %7.0f", lpTarget->Life, lpTarget->MaxLife); //Require Translation
								}
							}
						}
					}
				}
			}
			break;

		case 322:	//119:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복량설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복량설정");	// Require Translation

				int RefillHP = this->GetTokenNumber();

				if ( RefillHP <= 0 || RefillHP > 5000000 )
				{
					return 0;
				}

				giKundunRefillHP = RefillHP;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP 초당회복량 = %d 회복량 = %d 회복시간 = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}

			break;

		case 323:	//120:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP초당회복량설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP초당회복량설정");	// Require Translation

				int RefillHPSec = this->GetTokenNumber();

				if ( RefillHPSec <= 0 || RefillHPSec > 10000 )
				{
					return 0;
				}

				giKundunRefillHPSec = RefillHPSec;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP 초당회복량 = %d 회복량 = %d 회복시간 = %d",
					giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}

			break;

		case 324:	//121:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복시간설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복시간설정");	// Require Translation

				int RefillHPTime = this->GetTokenNumber();

				if ( RefillHPTime < 0 || RefillHPTime > 60000 )
				{
					return 0;
				}

				giKundunRefillHPTime = RefillHPTime;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP 초당회복량 = %d 회복량 = %d 회복시간 = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}
			break;
 
		case 345:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 1);
			break;
		case 346:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 2);
			break;
		case 347:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 3);
			break;
		case 348:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 0);
			break;

		case 369:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 0);
			break;
		case 370:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 1);
			break;
		case 371:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 2);
			break;
		case 372:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 3);
			break;
		case 373:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 4);
			break;
		case 374:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 5);
			break;
		case 375:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 6);
			break;
		case 376:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 7);
			break;
		case 377:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 8);
			break;
		case 378:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 9);
			break;
		case 379:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 10);
			break;
		case 380:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 11);
			break;
		case 381:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 12);
			break;
		case 382:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 13);
			break;
		case 383:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 14);
			break;
		case 384:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 15);
			break;
		case 385:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 16);
			break;
		case 386:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 17);
			break;
		case 387:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 18);
			break;
		case 388:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 19);
			break;
		case 389:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 20);
			break;
	    case 390:
        {
                if ( (lpObj->Authority &2 ) != 2 )
                {
                        return FALSE;
                }

                int type, index,ItemLevel,ItemSkill,ItemLuck,ItemOpt,ItemExc,ItemAncient;
                type = GetTokenNumber();
                index = GetTokenNumber();
                ItemLevel = GetTokenNumber();
                ItemSkill = GetTokenNumber();
                ItemLuck = GetTokenNumber();
                ItemOpt = GetTokenNumber();
                ItemExc = GetTokenNumber();
                ItemAncient = GetTokenNumber();

				if (type == -1)
					type = 0;
                
				if (index == -1)
					index = 0;

				if (ItemLevel == -1)
					ItemLevel = 0;

				if (ItemSkill == -1)
					ItemSkill = 0;

				if (ItemLuck == -1)
					ItemLuck = 0;

				if (ItemOpt == -1)
					ItemOpt = 0;

				if (ItemExc == -1)
					ItemExc = 0;

				if (ItemAncient == -1)
					ItemAncient = 0;

                if( (type >= 0 && type <= 15) )
                {
					int Item = ItemGetNumberMake( type, index);
					ItemSerialCreateSend(aIndex, gObj[aIndex].MapNumber, (BYTE)gObj[aIndex].X, (BYTE)gObj[aIndex].Y, Item,ItemLevel,0,ItemSkill,ItemLuck,ItemOpt,-1,ItemExc,ItemAncient);
                }
                break;
        }
        case 391:
        {
                int value = GetTokenNumber();

				if (value == -1)
					value = 0;

                g_Crywolf.OperateGmCommand(lpObj->m_Index,value);
        }
        break;

	}
	return 0;
}