void
NamespaceManagement::SetSEL(uint8_t sel)
{
    LOG_NRM("Setting SEL = 0x%01X", sel);
//    uint8_t val = GetByte(10, 0);
//    SetByte(val | (sel & 0xF), 10, 0); // 1st byte in DW10
    SetNibble(sel, 10, 0);
}
示例#2
0
void cBlockArea::SetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockSkyLight)
{
	SetNibble(a_BlockX, a_BlockY, a_BlockZ, a_BlockSkyLight, m_BlockSkyLight);
}
示例#3
0
void cBlockArea::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta)
{
	SetNibble(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta, m_BlockMetas);
}
示例#4
0
void CItem::InitStats(int iGenLevel)
{
	DWORD statType, statValue, stat2Type, stat2Value;
	int iResult;

	switch(m_sItemEffectType)
	{
	default:
		return;
	case ITEMEFFECTTYPE_ATTACK_MANASAVE:
	case ITEMEFFECTTYPE_ATTACK:
		if(m_sItemEffectType == ITEMEFFECTTYPE_ATTACK_MANASAVE)
		{
			statType = ITEMSTAT_CASTPROB;
			m_cItemColor = 5;
		}else
		{
			iResult = dice(1,10000);
			if ((iResult >= 1) && (iResult <= 299)) {
				statType = ITEMSTAT_LIGHT; 
				m_cItemColor = 2; 
			}
			else if ((iResult >= 300) && (iResult <= 999)) {
				statType = ITEMSTAT_STRONG; 
				m_cItemColor = 3;
			}
			else if ((iResult >= 1000) && (iResult <= 2499)) {
				statType = ITEMSTAT_CRITICAL;
				m_cItemColor = 5;
			}
			else if ((iResult >= 2500) && (iResult <= 4499)) {
				statType = ITEMSTAT_AGILE;
				m_cItemColor = 1;
			}
			else if ((iResult >= 4500) && (iResult <= 6499)) {
				statType = ITEMSTAT_RIGHTEOUS;
				m_cItemColor = 7;
			}
			else if ((iResult >= 6500) && (iResult <= 8099)) {
				statType = ITEMSTAT_POISONING;
				m_cItemColor = 4;
			}
			else if ((iResult >= 8100) && (iResult <= 9699)) {
				statType = ITEMSTAT_SHARP;
				m_cItemColor = 6;
			}
			else if ((iResult >= 9700) && (iResult <= 10000)) {
				statType = ITEMSTAT_ANCIENT;
				m_cItemColor = 8;
			}
		}

		iResult = dice(1, 30000);
		if ((iResult >= 1) && (iResult < 10000))           statValue = 1;  // 10000/29348 = 34%
		else if ((iResult >= 10000) && (iResult < 17400))  statValue = 2;  // 6600/29348 = 22.4%
		else if ((iResult >= 17400) && (iResult < 22400))  statValue = 3;  // 4356/29348 = 14.8%
		else if ((iResult >= 22400) && (iResult < 25400))  statValue = 4;  // 2874/29348 = 9.7%
		else if ((iResult >= 25400) && (iResult < 27400))  statValue = 5;  // 1897/29348 = 6.4%
		else if ((iResult >= 27400) && (iResult < 28400))  statValue = 6;  // 1252/29348 = 4.2%
		else if ((iResult >= 28400) && (iResult < 28900))  statValue = 7;  // 826/29348 = 2.8%
		else if ((iResult >= 28900) && (iResult < 29300))  statValue = 8;  // 545/29348 = 1.85%
		else if ((iResult >= 29300) && (iResult < 29600))  statValue = 9;  // 360/29348 = 1.2%
		else if ((iResult >= 29600) && (iResult < 29800))  statValue = 10; // 237/29348 = 0.8%
		else if ((iResult >= 29800) && (iResult < 29900))  statValue = 11; // 156/29348 = 0.5%
		else if ((iResult >= 29900) && (iResult < 29970))  statValue = 12; // 103/29348 = 0.3%
		else if ((iResult >= 29970) && (iResult <= 30000))  statValue = 13; // 68/29348 = 0.1%
		else statValue = 1; 

		switch (statType) 
		{
		case ITEMSTAT_CRITICAL: 						
			if (statValue <= 5) statValue = 5;
			break; 
		case ITEMSTAT_POISONING: 
			if (statValue <= 4) statValue = 4;
			break; 
		case ITEMSTAT_LIGHT: 
			if (statValue <= 4) statValue = 4;
			break; 
		case ITEMSTAT_STRONG: 						
			if (statValue <= 2) statValue = 2;
			break; 
		}

		if ((iGenLevel <= 2) && (statValue > 7)) statValue = 7;

		SetNibble(m_dwAttribute, 5, statType);
		SetNibble(m_dwAttribute, 4, statValue);


		if (dice(1,10000) >= 6000) {
			iResult = dice(1,10000);
			if ((iResult >= 1) && (iResult <= 4999))          stat2Type = ITEMSTAT2_HITPROB;
			else if ((iResult >= 5000) && (iResult <= 8499))  stat2Type = ITEMSTAT2_CAD;
			else if ((iResult >= 8500) && (iResult <= 9499))  stat2Type = ITEMSTAT2_GOLD;
			else if ((iResult >= 9500) && (iResult <= 10000)) stat2Type = ITEMSTAT2_EXP;

			iResult = dice(1, 30000);
			if ((iResult >= 1) && (iResult < 10000))           stat2Value = 1;  // 33.33%
			else if ((iResult >= 10000) && (iResult < 17400))  stat2Value = 2;  // 24.67%
			else if ((iResult >= 17400) && (iResult < 22400))  stat2Value = 3;  // 16.67%
			else if ((iResult >= 22400) && (iResult < 25400))  stat2Value = 4;  // 10.00%
			else if ((iResult >= 25400) && (iResult < 27100))  stat2Value = 5;  // 5.67%
			else if ((iResult >= 27100) && (iResult < 28200))  stat2Value = 6;  // 3.67%
			else if ((iResult >= 28200) && (iResult < 28900))  stat2Value = 7;  // 2.34%
			else if ((iResult >= 28900) && (iResult < 29400))  stat2Value = 8;  // 1.67%
			else if ((iResult >= 29400) && (iResult < 29720))  stat2Value = 9;  // 1.07%
			else if ((iResult >= 29720) && (iResult < 29900))  stat2Value = 10; // 0.60%
			else if ((iResult >= 29900) && (iResult < 29970))  stat2Value = 11; // 0.24%
			else if ((iResult >= 29970) && (iResult < 29994))  stat2Value = 12; // 0.08%
			else if ((iResult >= 29994) && (iResult <= 30000))  stat2Value = 13; // 0.02%
			else stat2Value = 1; 

			switch (stat2Type) 
			{
			case 2: 
				if (stat2Value <= 3) stat2Value = 3;
				break; 
			case 10: 							
				if (stat2Value > 7) stat2Value = 7; 
				break; 
			case 11: 
				stat2Value = 2;
				break; 
			case 12: 
				stat2Value = 5;
				break; 
			}

			if ((iGenLevel <= 2) && (stat2Value > 7)) stat2Value = 7;

			SetNibble(m_dwAttribute, 3, stat2Type);
			SetNibble(m_dwAttribute, 2, stat2Value);
		}
		break;

	case ITEMEFFECTTYPE_DEFENSE:
		iResult = dice(1,10000);
		if ((iResult >= 1) && (iResult <= 5999))          statType = ITEMSTAT_STRONG;
		else if ((iResult >= 6000) && (iResult <= 8999))  statType = ITEMSTAT_LIGHT;
		else if ((iResult >= 9000) && (iResult <= 9554))  statType = ITEMSTAT_MANACONV;
		else if ((iResult >= 9555) && (iResult <= 10000)) statType = ITEMSTAT_CRITICAL2;


		iResult = dice(1, 30000);
		if ((iResult >= 1) && (iResult < 10000))           statValue = 1;
		else if ((iResult >= 10000) && (iResult < 17400))  statValue = 2; 
		else if ((iResult >= 17400) && (iResult < 22400))  statValue = 3;
		else if ((iResult >= 22400) && (iResult < 25400))  statValue = 4;
		else if ((iResult >= 25400) && (iResult < 27400))  statValue = 5;
		else if ((iResult >= 27400) && (iResult < 28400))  statValue = 6;
		else if ((iResult >= 28400) && (iResult < 28900))  statValue = 7;
		else if ((iResult >= 28900) && (iResult < 29300))  statValue = 8;
		else if ((iResult >= 29300) && (iResult < 29600))  statValue = 9;
		else if ((iResult >= 29600) && (iResult < 29800))  statValue = 10;
		else if ((iResult >= 29800) && (iResult < 29900))  statValue = 11;
		else if ((iResult >= 29900) && (iResult < 29970))  statValue = 12;
		else if ((iResult >= 29970) && (iResult <= 30000))  statValue = 13;
		else statValue = 1; 

		switch (statType) 
		{
		case ITEMSTAT_LIGHT: 
			if (statValue <= 4) statValue = 4;
			break; 
		case ITEMSTAT_STRONG: 						
			if (statValue <= 2) statValue = 2;
			break; 
		case ITEMSTAT_MANACONV:
		case ITEMSTAT_CRITICAL2:
			statValue = (statValue+1) / 2;
			if (statValue < 1) statValue = 1;
			if ((iGenLevel <= 3) && (statValue > 2)) statValue = 2;
			break;
		}

		if ((iGenLevel <= 2) && (statValue > 7)) statValue = 7;

		SetNibble(m_dwAttribute, 5, statType);
		SetNibble(m_dwAttribute, 4, statValue);

		if (dice(1,10000) <= 8500) {
			iResult = dice(1,10000);
			if (iResult <= 1000)       stat2Type = ITEMSTAT2_PSNRES;	// 10
			else if (iResult <= 2200)  stat2Type = ITEMSTAT2_DEF;		// 12
			else if (iResult <= 3800)  stat2Type = ITEMSTAT2_SPREC;	// 16
			else if (iResult <= 6100)  stat2Type = ITEMSTAT2_HPREC;	// 23
			else if (iResult <= 8400)  stat2Type = ITEMSTAT2_MPREC;	// 23
			else if (iResult <= 9600)  stat2Type = ITEMSTAT2_MR;		// 12
			else if (iResult <= 9900)  stat2Type = ITEMSTAT2_PA;		// 3
			else if (iResult <= 10000) stat2Type = ITEMSTAT2_MA;		// 1

			iResult = dice(1, 30017);
			if ((iResult >= 1) && (iResult < 11800))           stat2Value = 1;
			else if ((iResult >= 11800) && (iResult < 19800))  stat2Value = 2;
			else if ((iResult >= 19800) && (iResult < 24300))  stat2Value = 3;
			else if ((iResult >= 24300) && (iResult < 27000))  stat2Value = 4;
			else if ((iResult >= 27000) && (iResult < 28500))  stat2Value = 5;
			else if ((iResult >= 28500) && (iResult < 29250))  stat2Value = 6;
			else if ((iResult >= 29250) && (iResult < 29650))  stat2Value = 7;
			else if ((iResult >= 29650) && (iResult < 29850))  stat2Value = 8;
			else if ((iResult >= 29850) && (iResult < 29950))  stat2Value = 9;
			else if ((iResult >= 29950) && (iResult < 29995))  stat2Value = 10;
			else if ((iResult >= 29995) && (iResult < 30011))  stat2Value = 11;
			else if ((iResult >= 30011) && (iResult < 30016))  stat2Value = 12;
			else if ((iResult >= 30016) && (iResult <= 30017))  stat2Value = 13;
			else stat2Value = 1;

			switch (stat2Type) 
			{
			case ITEMSTAT2_PSNRES:
			case ITEMSTAT2_DEF:
			case ITEMSTAT2_MR:
			case ITEMSTAT2_PA:
			case ITEMSTAT2_MA:
				if (stat2Value <= 3) stat2Value = 3;
				break; 
			}

			if ((iGenLevel <= 2) && (stat2Value > 7)) stat2Value = 7;

			SetNibble(m_dwAttribute, 3, stat2Type);
			SetNibble(m_dwAttribute, 2, stat2Value);
#ifdef LOG_ARMORSTATS
			wsprintf(g_cTxt, "[I] Armor Drop: %s %s+%u (%u)", 
				m_cName, itemStats2[stat2Type].desc, stat2Value * itemStats2[stat2Type].mult, stat2Value);
			PutLogList(g_cTxt);
#endif
		}
		break;

	case ITEMEFFECTTYPE_JEWELRY:
		iResult = dice(1,10000);
		if ((iResult >= 1) && (iResult <= 4999))  statType = ITEMSTAT_LIGHT;
		else if ((iResult >= 5000) && (iResult <= 7999))  statType = ITEMSTAT_MANACONV;
		else if ((iResult >= 8000) && (iResult <= 10000)) statType = ITEMSTAT_CRITICAL2;


		uint32 bonus = m_sItemEffectValue1;

		iResult = dice(1, 30000-bonus) + bonus;
		if ((iResult >= 1) && (iResult < 10000))           statValue = 1;
		else if ((iResult >= 10000) && (iResult < 17400))  statValue = 2; 
		else if ((iResult >= 17400) && (iResult < 22400))  statValue = 3;
		else if ((iResult >= 22400) && (iResult < 25400))  statValue = 4;
		else if ((iResult >= 25400) && (iResult < 27400))  statValue = 5;
		else if ((iResult >= 27400) && (iResult < 28400))  statValue = 6;
		else if ((iResult >= 28400) && (iResult < 28900))  statValue = 7;
		else if ((iResult >= 28900) && (iResult < 29300))  statValue = 8;
		else if ((iResult >= 29300) && (iResult < 29600))  statValue = 9;
		else if ((iResult >= 29600) && (iResult < 29800))  statValue = 10;
		else if ((iResult >= 29800) && (iResult < 29900))  statValue = 11;
		else if ((iResult >= 29900) && (iResult < 29970))  statValue = 12;
		else if ((iResult >= 29970) && (iResult <= 30000))  statValue = 13;
		else statValue = 1; 

		switch (statType) 
		{
		case ITEMSTAT_LIGHT: 
			if (statValue <= 4) statValue = 4;
			break; 
		case ITEMSTAT_STRONG: 						
			if (statValue <= 2) statValue = 2;
			break; 
		case ITEMSTAT_MANACONV:
		case ITEMSTAT_CRITICAL2:
			statValue = (statValue+1) / 2;
			if (statValue < 1) statValue = 1;
			if ((iGenLevel <= 3) && (statValue > 2)) statValue = 2;
			break;
		}

		if ((iGenLevel <= 2) && (statValue > 7)) statValue = 7;

		SetNibble(m_dwAttribute, 5, statType);
		SetNibble(m_dwAttribute, 4, statValue);

		if (dice(1,10000) <= 8000) {
			iResult = dice(1,13000);
			if (iResult <= 1000)       stat2Type = ITEMSTAT2_PSNRES;	// 10
			else if (iResult <= 2000)  stat2Type = ITEMSTAT2_DEF;		// 10
			else if (iResult <= 3000)  stat2Type = ITEMSTAT2_SPREC;	// 16
			else if (iResult <= 5400)  stat2Type = ITEMSTAT2_HPREC;	// 24
			else if (iResult <= 7800)  stat2Type = ITEMSTAT2_MPREC;	// 24
			else if (iResult <= 9000)  stat2Type = ITEMSTAT2_MR;		// 12
			else if (iResult <= 11000)  stat2Type = ITEMSTAT2_EXP;
			else if (iResult <= 13000)  stat2Type = ITEMSTAT2_GOLD;

			iResult = dice(1, 29980 - bonus) + bonus;
			if ((iResult >= 1) && (iResult < 15000))           stat2Value = 1; 
			else if ((iResult >= 15000) && (iResult < 22400))  stat2Value = 2; 
			else if ((iResult >= 23000) && (iResult < 26100))  stat2Value = 3; 
			else if ((iResult >= 26100) && (iResult < 27700))  stat2Value = 4;  
			else if ((iResult >= 27700) && (iResult < 28700))  stat2Value = 5; 
			else if ((iResult >= 28700) && (iResult < 29200))  stat2Value = 6;  
			else if ((iResult >= 29200) && (iResult < 29450))  stat2Value = 7;  
			else if ((iResult >= 29450) && (iResult < 29649))  stat2Value = 8; 
			else if ((iResult >= 29649) && (iResult < 29793))  stat2Value = 9; 
			else if ((iResult >= 29793) && (iResult < 29888))  stat2Value = 10;
			else if ((iResult >= 29888) && (iResult < 29935))  stat2Value = 11; 
			else if ((iResult >= 29935) && (iResult < 29967))  stat2Value = 12;
			else if ((iResult >= 29967) && (iResult <= 29980))  stat2Value = 13;
			else stat2Value = 1;

			switch (stat2Type) 
			{
			case ITEMSTAT2_PSNRES:
			case ITEMSTAT2_DEF:
			case ITEMSTAT2_MR:
				if (stat2Value <= 3) stat2Value = 3;
				break; 
			}

			if (iGenLevel <= 2 && stat2Value > 7) stat2Value = 7;

			SetNibble(m_dwAttribute, 3, stat2Type);
			SetNibble(m_dwAttribute, 2, stat2Value);
		}
		break;
	}

	AdjustByStat();
}
示例#5
0
void Unit::SetSideFlag(Side side)
{
	SetNibble(m_iStatus, 7, side);
}