Пример #1
0
void CMonsterItemMng::gObjGiveItemSearch(int monsterlevel, int maxlevel)
{
	int result;
	int incount = 0;
	int type;
	int index;

	if ( monsterlevel > MAX_LEVEL_MONSTER-1 )
	{
		LogAdd("error-L3 : Monster Level Overflow~ %s %d", __FILE__, __LINE__ );
		return;
	}

	int BallTable[17];

	BallTable[0] = 7;
	BallTable[1] = 8;
	BallTable[2] = 9;
	BallTable[3] = 10;
	BallTable[4] = 11;
	BallTable[5] = 12;
	BallTable[6] = 13;
	BallTable[7] = 14;
	BallTable[8] = 16;
	BallTable[9] = 17;
	BallTable[10] = 18;
	BallTable[11] = 19;
	BallTable[12] = 21;
	BallTable[13] = 22;
	BallTable[14] = 23;
	BallTable[15] = 24;
	BallTable[16] = 35;//#warning ! может 25?!

	while ( true )
	{
		if ( Random(0,19) ==  0 ) 
		{
			if ( Random(0,1) )
			{
				type = MAX_TYPE_ITEMS-1;
				index = Random(0,g_MaxItemIndexOfEachItemType[type]) ;
			}
			else
			{
				type = 12;
				index = BallTable[Random(0,16)];
			}
		}
		else
		{
			type = Random(0,MAX_TYPE_ITEMS-1);
			int iMaxItemIndex = g_MaxItemIndexOfEachItemType[type];
			index = Random(0,iMaxItemIndex-1) ;

			if ( type == 15 || (type == 12 && index != 15 ) )
			{
				continue;
			}
		}

		if ( type == 13 && index == 3 )
		{
			continue;
		}

		if ( (type == 13 && index == 32)
          || (type == 13 && index == 33)
          || (type == 13 && index == 34)
          || (type == 13 && index == 35)
          || (type == 13 && index == 36)
          || (type == 13 && index == 37) )
		{
			continue;
		}

        if ( (type == 14 && index == 35)
          || (type == 14 && index == 36)
          || (type == 14 && index == 37)
          || (type == 14 && index == 38)
          || (type == 14 && index == 39)
          || (type == 14 && index == 40) )
		{
			continue;
		}

        /*if ( IsCashItem(ITEMGET(type, index)) == TRUE )
		{
			continue;
		}*/
        
		if ( (type == 13 && index < 8) || 
			( (type == 14) && (index == 9 || index == 10 ||	index == 13 || index == 14 || index ==16 || index == 17 || index == 18 || index == 22 ) ) ||
			(type == 12 && index == 15) || 
			(type == 13 && index == 14) || 
			(type == 14 && index == 31 ) )
		{
			int perc = Random(0,10);//#error
			BOOL bCheckDevil = FALSE;

			if ( type == 12 && index == 15 )
			{
				if ( monsterlevel >= 13 && monsterlevel <= 66 )
				{
					perc = Random(0,6) ;
					
					if ( perc < 3 )
					{
						perc = 0;
					}
				}
				else
				{
					perc = 1;
				}
			}

			if ( type == 14 && index == 17 )
			{
				if ( gEyesOfDevilSquareDropRate <= 0 )
				{
					gEyesOfDevilSquareDropRate = 1;
				}

				perc = Random(0,gEyesOfDevilSquareDropRate-1);
				bCheckDevil = 1;

				if ( gDevilSquareEvent == 0 )
				{
					perc = 1;
				}
			}

			if ( type == 14 && index == 18 )
			{
				perc = Random(0,gKeyOfDevilSquareDropRate-1);
				bCheckDevil = 1;

				if ( gDevilSquareEvent == 0 )
				{
					perc = 1;
				}

			}

			if ( perc == 0 )
			{
				if ( bCheckDevil == 1 )
				{
					int devilitemlevel = 0;

					if ( Random(0,4) != 0 )
					{
						if ( monsterlevel < 3 )
						{
							devilitemlevel = 0;
						}
						else if ( monsterlevel < 36 ) 
						{
							devilitemlevel = 1;
						}
						else if ( monsterlevel < 47 )
						{
							devilitemlevel = 2;
						}
						else if ( monsterlevel < 60 )
						{
							devilitemlevel = 3;
						}
						else if ( monsterlevel < 70 )
						{
							devilitemlevel = 4;
						}
						else if ( monsterlevel < 80 )
						{
							devilitemlevel = 5;
						}
						else 
						{
							devilitemlevel = 6;
						}

						if ( devilitemlevel != 0 )
						{
							if ( this->InsertItem(monsterlevel, type, index, devilitemlevel, 0, 0, 0) != 0xFF )
							{
								incount++;

								if ( incount > MAX_ITEM_IN_MONSTER -1 )
								{
									return;
								}
							}
						}
					}
				}
				else if ( zzzItemLevel(type, index, monsterlevel ) == TRUE )
				{
					if ( this->InsertItem(monsterlevel, type, index, 0, 0, 0, 0) != (BYTE)-1 )
					{
						incount++;

						if ( incount > MAX_ITEM_IN_MONSTER -1 )
						{
							return;
						}
					}
				}
			}
		}
		else
		{
			result = GetLevelItem(type, index, monsterlevel);

			if ( result >= 0 )
			{
				if ( (type == 13 && index == 10) || (type == 12 && index == 11 ) )
				{
					if ( this->InsertItem(monsterlevel, type, index, result, 0,0,0) != 0xFF )
					{
						incount++;

						if ( incount > MAX_ITEM_IN_MONSTER -1 )
						{
							return;
						}
					}
				}
				else if ( result <= maxlevel )
				{
					if ( type == 12 )
					{
						if ( index != 11 )
						{
							result = 0;
						}
					}

					if ( type == 12 && index == 11 )
					{

					}
					else
					{
						if ( result > maxlevel )
						{
							result = maxlevel;
						}
					}

					if ( (type == 4 && index == 7) || (type == 4 && index == 15) )
					{
						result = 0;
					}
				

					if ( this->InsertItem(monsterlevel, type, index,result, 0,0,0) != (BYTE)-1 )
					{
						incount++;

						if ( incount > MAX_ITEM_IN_MONSTER-1 )
						{
							return;
						}
					}
				}
			}
		}
		
		if ( this->m_iMonsterInvenItemCount[monsterlevel] >= MAX_ITEM_IN_MONSTER )
		{
			return;
		}
		
	}
}
Пример #2
0
//004309b0	-> 100% (Identical)
void CMonsterItemMng::MagicBookGiveItemSearch(int monsterlevel, int maxlevel)
{
	int result	= 0;
	int incount = 0;
	int type, index;
	int BallTable[22];
	// ----
	if( monsterlevel > MAX_MONSTER_LEVEL - 1 )
	{
		LogAdd("error-L3 : Monster Level Overflow~ %s %d", __FILE__, __LINE__);	//Line: 8
		return;
	}
	// ----
	BallTable[0]	= 7;
	BallTable[1]	= 8;
	BallTable[2]	= 9;
	BallTable[3]	= 10;
	BallTable[4]	= 11;
	BallTable[5]	= 12;
	BallTable[6]	= 13;
	BallTable[7]	= 14;
	BallTable[8]	= 16;
	BallTable[9]	= 17;
	BallTable[10]	= 18;
	BallTable[11]	= 19;
	BallTable[12]	= 21;
	BallTable[13]	= 22;
	BallTable[14]	= 23;
	BallTable[15]	= 24;
	BallTable[16]	= 35;
	BallTable[17]	= 44;
	BallTable[18]	= 45;
	BallTable[19]	= 46;
	BallTable[20]	= 47;
	BallTable[21]	= 48;
	// ----
	while(true)
	{
		if( rand() % 2 )
		{
			type	= MAX_TYPE_ITEMS - 1;
			index	= GetLargeRand() % (g_MaxItemIndexOfEachItemType[type] + 1);
		}
		else
		{
			type	= 12;
			index	= BallTable[GetLargeRand() % 22];
		}
		// ----
		if( type == 12 && index == 11 )
		{
			CItem * item		= &this->m_MonsterInvenExItems[monsterlevel][incount];
			result				= GetLevelItem(type, index, monsterlevel);
			// ----
			if( result >= 0 )
			{
				int item_type		= ITEMGET(type, index);
				item->Convert(item_type, 0, 0, 0, 0, 0, 0, 0, -1, 0, 3);
				item->m_Level		= result;
				item->m_Durability	= item->m_BaseDurability;
				// ----
				incount++;
				// ----
				if( incount > MAX_MONSTER_EXITEM - 1 )
				{
					break;
				}
			}
			continue;
		}
		else
		{
			result = GetLevelItem(type, index, monsterlevel);
			// ----
			if( result != 0 )
			{
				continue;
			}
			// ----
			CItem * item	= &this->m_MonsterInvenExItems[monsterlevel][incount];
			int item_type	= ITEMGET(type, index);
			// ----
			item->Convert(item_type, 0, 0, 0, 0, 0, 0, 0, -1, 0, 3);
			item->m_Level		= 0;
			item->m_Durability	= item->m_BaseDurability;
			// ----
			incount++;
			// ----
			if( incount > MAX_MONSTER_EXITEM - 1 )
			{
				break;
			}
		}
	}
	// ----
	this->m_iMonsterInvenExItemCount[monsterlevel] = incount;
}
Пример #3
0
//00430d00	-> 100% (Identical)
void CMonsterItemMng::NormalGiveItemSearch(int monsterlevel, int maxlevel)
{
	int result;
	int incount = 0;
	int type, index;
	// ----
	if( monsterlevel > 
		MAX_MONSTER_LEVEL - 1 )
	{
		LogAdd("error-L3 : Monster Level Overflow~ %s %d", __FILE__, __LINE__);	//Line: 8
		return;
	}
	// ----
	while(true)
	{
		type				= rand() % MAX_TYPE_ITEMS;
		int iMaxItemIndex	= g_MaxItemIndexOfEachItemType[type] + 1;
		index				= rand() % iMaxItemIndex;
		// ----
		if( type == 15 || type == 12 )
		{
			continue;
		}
		// ----
		if( !this->CheckMonsterDropItem(type, index) )
		{
			continue;
		}
		// ----
		if(		(type == 13 && index < 8) 
			||	(type == 14 && (index == 9 || index == 10 || index == 17 || index == 18)) 
			||	(type == 13 && index == 14) 
			||	(type == 14 && index == 31) )
		{
			int perc			= rand() % 8;
			BOOL bCheckDevil	= false;
			// ----
			if( type == 12 && index == 15 )
			{
				if( monsterlevel >= 13 && monsterlevel <= 66 )
				{
					perc = rand() % 7 ;
					// ----
					if( perc < 3 )
					{
						perc = 0;
					}
				}
				else
				{
					perc = 1;
				}
			}
			// ----
			if( type == 14 && index == 17 )
			{
				if( gEyesOfDevilSquareDropRate <= 0 )
				{
					perc		= 1;
					bCheckDevil = false;
				}
				else
				{
					perc		= rand() % gEyesOfDevilSquareDropRate;
					bCheckDevil = true;
				}
				// ----
				if( gDevilSquareEvent == 0 )
				{
					perc = 1;
				}
			}
			// ----
			if( type == 14 && index == 18 )
			{
				if( gKeyOfDevilSquareDropRate <= 0 )
				{
					perc		= 1;
					bCheckDevil = false;
				}
				else
				{
					perc		= rand() % gKeyOfDevilSquareDropRate;
					bCheckDevil = true;
				}
				// ----
				if( gDevilSquareEvent == 0 )
				{
					perc = 1;
				}
			}
			// ----
			if( perc == 0 )
			{
				if( bCheckDevil == true )
				{
					int devilitemlevel = 0;
					// ----
					if( (rand() % 5) != 0 )
					{
						if( monsterlevel < 3 )
						{
							devilitemlevel = 0;
						}
						else if( monsterlevel < 36 ) 
						{
							devilitemlevel = 1;
						}
						else if( monsterlevel < 47 )
						{
							devilitemlevel = 2;
						}
						else if( monsterlevel < 60 )
						{
							devilitemlevel = 3;
						}
						else if( monsterlevel < 70 )
						{
							devilitemlevel = 4;
						}
						else if( monsterlevel < 80 )
						{
							devilitemlevel = 5;
						}
						else 
						{
							devilitemlevel = 6;
						}
						// ----
						if( devilitemlevel != 0 )
						{
							if( this->InsertItem(monsterlevel, type, index, devilitemlevel, 0, 0, 0) != 0xFF )
							{
								incount++;
								// ----
								if( incount > MAX_MONSTER_ITEM - 1 )
								{
									return;
								}
							}
						}
					}
				}
				else if( zzzItemLevel(type, index, monsterlevel) == true )
				{
					if( this->InsertItem(monsterlevel, type, index, 0, 0, 0, 0) != (BYTE)-1 )
					{
						incount++;
						// ----
						if( incount > MAX_MONSTER_ITEM - 1 )
						{
							return;
						}
					}
				}
			}
		}
		else
		{
			result = GetLevelItem(type, index, monsterlevel);
			// ----
			if( result >= 0 )
			{
				if( result <= maxlevel )
				{
					if( type == 12 )
					{
						if( index != 11 )
						{
							result = 0;
						}
					}
					// ----
					if( type == 12 && index == 11 )
					{
						// --
					}
					else
					{
						if( result > maxlevel )
						{
							result = maxlevel;
						}
					}
					// ----
					if( (type == 4 && index == 7) || (type == 4 && index == 15) )
					{
						result = 0;
					}
					// ----
					if( this->InsertItem(monsterlevel, type, index,result, 0, 0, 0) != (BYTE)-1 )
					{
						incount++;
						// ----
						if( incount > MAX_MONSTER_ITEM - 1 )
						{
							return;
						}
					}
				}
			}
		}
		// ----
		if( this->m_iMonsterInvenItemCount[monsterlevel] >= MAX_MONSTER_ITEM )
		{
			break;
		}
	}
}
Пример #4
0
//0042f460	-> 100% (Identical)
void CMonsterItemMng::gObjGiveItemSearch(int monsterlevel, int maxlevel)
{
	int result;
	int incount = 0;
	int type, index;
	int BallTable[22];
	// ----
	if( monsterlevel > MAX_MONSTER_LEVEL-1 )
	{
		LogAdd("error-L3 : Monster Level Overflow~ %s %d", __FILE__, __LINE__ );	//Line: 8
		return;
	}
	// ----
	BallTable[0]	= 7;
	BallTable[1]	= 8;
	BallTable[2]	= 9;
	BallTable[3]	= 10;
	BallTable[4]	= 11;
	BallTable[5]	= 12;
	BallTable[6]	= 13;
	BallTable[7]	= 14;
	BallTable[8]	= 16;
	BallTable[9]	= 17;
	BallTable[10]	= 18;
	BallTable[11]	= 19;
	BallTable[12]	= 21;
	BallTable[13]	= 22;
	BallTable[14]	= 23;
	BallTable[15]	= 24;
	BallTable[16]	= 35;
	BallTable[17]	= 44;
    BallTable[18]	= 45;
    BallTable[19]	= 46;
    BallTable[20]	= 47;
    BallTable[21]	= 48;
	// ----
	while(true)
	{
		if( (rand() % 20) ==  0 )
		{
			if( (rand() % 2) != 0 )
			{
				type	= MAX_TYPE_ITEMS-1;
				index	= rand() % (g_MaxItemIndexOfEachItemType[type] + 1);
			}
			else
			{
				type	= 12;
				index	= BallTable[rand() % 22];
			}
		}
		else
		{
			type				= rand() % MAX_TYPE_ITEMS;
			int iMaxItemIndex	= g_MaxItemIndexOfEachItemType[type]+1;
			index				= rand() % iMaxItemIndex;
			// ----
			if( type == 15 || (type == 12 && index != 15 ) )
			{
				continue;
			}
		}
		// ----
		if( type == 13 && index == 3 )
		{
			continue;
		}
		// ----
		if(		(type == 13 && index == 32)
			||	(type == 13 && index == 33)
			||	(type == 13 && index == 34)
			||	(type == 13 && index == 35)
			||	(type == 13 && index == 36)
			||	(type == 13 && index == 37) )
		{
			continue;
		}
		// ----
		if(		(type == 14 && index == 35)
			||	(type == 14 && index == 36)
			||	(type == 14 && index == 37)
			||	(type == 14 && index == 38)
			||	(type == 14 && index == 39)
			||	(type == 14 && index == 40) )
		{
			continue;
		}
		// ----
        if( IsCashItem(ITEMGET(type, index)) == true )
		{
			continue;
		}
        // ----
		if( IsPremiumItem(ITEMGET(type, index)) == true )
		{
			continue;
		}
		// ----
		if( g_LuckyItemManager.IsLuckyItemTicket(ITEMGET(type, index)) == true )
		{
			continue;
		}
		// ----
		if( g_LuckyItemManager.IsLuckyItemEquipment(ITEMGET(type, index)) == true )
		{
			continue;
		}
		// ----
		if(		(type == 14 && index == 162)
			||	(type == 14 && index == 163)
			||	(type == 14 && index == 164)
			||	(type == 14 && index == 165)
			||	(type == 14 && index == 166) )
		{
			continue;
		}
		// ----
		if(		(type == 14 && index == 45)
			||	(type == 14 && index == 46)
			||	(type == 14 && index == 47)
			||	(type == 14 && index == 48)
			||	(type == 14 && index == 49)
			||	(type == 14 && index == 50) )
		{
			continue;
		}
		// ----
		if( type == 13 && index == 41 )
		{
			continue;
		}
		// ----
		if(		(type == 13 && index < 8) 
			||	(type == 14 && (index == 9 || index == 10 || index == 17 || index == 18)) 
			||	(type == 13 && index == 14) 
			||	(type == 14 && index == 31) )
		{
			int perc			= rand() % 11;
			BOOL bCheckDevil	= false;
			// ----
			if( type == 12 && index == 15 )
			{
				if( monsterlevel >= 13 && monsterlevel <= 66 )
				{
					perc = rand() % 7 ;
					// ----
					if( perc < 3 )
					{
						perc = 0;
					}
				}
				else
				{
					perc = 1;
				}
			}
			// ----
			if( type == 14 && index == 17 )
			{
				if( gEyesOfDevilSquareDropRate <= 0 )
				{
					perc		= 1;
					bCheckDevil = false;
				}
				else
				{
					perc		= rand() % gEyesOfDevilSquareDropRate;
					bCheckDevil = true;
				}
				// ----
				if( gDevilSquareEvent == 0 )
				{
					perc = 1;
				}
			}
			// ----
			if( type == 14 && index == 18 )
			{
				if( gKeyOfDevilSquareDropRate <= 0 )
				{
					perc		= 1;
					bCheckDevil = false;
				}
				else
				{
					perc		= rand() % gKeyOfDevilSquareDropRate;
					bCheckDevil = true;
				}
				// ----
				if( gDevilSquareEvent == 0 )
				{
					perc = 1;
				}
			}
			// ----
			if( perc == 0 )
			{
				if( bCheckDevil == true )
				{
					int devilitemlevel = 0;
					// ----
					if( (rand() % 5) != 0 )
					{
						if( monsterlevel < 3 )
						{
							devilitemlevel = 0;
						}
						else if( monsterlevel < 36 ) 
						{
							devilitemlevel = 1;
						}
						else if( monsterlevel < 47 )
						{
							devilitemlevel = 2;
						}
						else if( monsterlevel < 60 )
						{
							devilitemlevel = 3;
						}
						else if( monsterlevel < 70 )
						{
							devilitemlevel = 4;
						}
						else if( monsterlevel < 80 )
						{
							devilitemlevel = 5;
						}
						else 
						{
							devilitemlevel = 6;
						}
						// ----
						if( devilitemlevel != 0 )
						{
							if( this->InsertItem(monsterlevel, type, index, devilitemlevel, 0, 0, 0) != 0xFF )
							{
								incount++;
								// ----
								if( incount > MAX_MONSTER_ITEM - 1 )
								{
									return;
								}
							}
						}
					}
				}
				else if( zzzItemLevel(type, index, monsterlevel) == true )
				{
					if( this->InsertItem(monsterlevel, type, index, 0, 0, 0, 0) != (BYTE)-1 )
					{
						incount++;
						// ----
						if( incount > MAX_MONSTER_ITEM - 1 )
						{
							return;
						}
					}
				}
			}
		}
		else
		{
			result = GetLevelItem(type, index, monsterlevel);
			// ----
			if( result >= 0 )
			{
				if( (type == 13 && index == 10) || (type == 12 && index == 11 ) )
				{
					if( this->InsertItem(monsterlevel, type, index, result, 0, 0, 0) != 0xFF )
					{
						incount++;
						// ----
						if( incount > MAX_MONSTER_ITEM - 1 )
						{
							return;
						}
					}
				}
				else if( result <= maxlevel )
				{
					if( type == 12 )
					{
						if( index != 11 )
						{
							result = 0;
						}
					}
					// ----
					if( type == 12 && index == 11 )
					{
						// --
					}
					else
					{
						if( result > maxlevel )
						{
							result = maxlevel;
						}
					}
					// ----
					if( (type == 4 && index == 7) || (type == 4 && index == 15) )
					{
						result = 0;
					}
					// ----
					if( this->InsertItem(monsterlevel, type, index,result, 0, 0, 0) != (BYTE)-1 )
					{
						incount++;
						// ----
						if( incount > MAX_MONSTER_ITEM - 1 )
						{
							return;
						}
					}
				}
			}
		}
		// ----
		if( this->m_iMonsterInvenItemCount[monsterlevel] >= MAX_MONSTER_ITEM )
		{
			return;
		}
	}
}