All pastes #916809 Raw Edit

Miscellany

public text v1 · immutable
#916809 ·published 2008-02-24 22:53 UTC
rendered paste body
bool User::GotRobeSetEnchanted()
{
	CItem *pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdGloves);
	if(pItem->GetEnchant() >= 6)
		pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdChest);
		if(pItem->GetEnchant() >= 6)
			pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdLegs);
			if(pItem->GetEnchant() >= 6)
			{
				return true;
			}
	return false;
}

bool User::GotLightSetEnchanted()
{
	CItem *pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdFeet);
	if(pItem->GetEnchant() >= 6)
		pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdChest);
		if(pItem->GetEnchant() >= 6)
			pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdLegs);
			if(pItem->GetEnchant() >= 6)
			{
				return true;
			}
	return false;
}

bool User::GotHeavySetEnchanted()
{
	CItem *pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdHead);
	if(pItem->GetEnchant() >= 6)
	{
		pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdOnePiece);
		if(pItem!=NULL)
		{
			if(pItem->GetEnchant() >= 6)
				return true;
		}else
		{
			pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdChest);
			if(pItem->GetEnchant() >= 6)
			{
				pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdLegs);
				if(pItem->GetEnchant() >= 6)
					return true;
			}
		}
	}
	return false;
}

bool User::GotBASSetEnchanted()
{
	CItem *pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdHead);
	if(pItem->GetEnchant() >= 6)
	{
		pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdFeet);
		if(pItem->GetEnchant() >= 6)
		{
			pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdGloves);
			if(pItem->GetEnchant() >= 6)
			{
				pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdOnePiece);
				if(pItem!=NULL)
				{
					if(pItem->GetEnchant() >= 6)
						return true;
				}else
				{
					pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdChest);
					if(pItem->GetEnchant() >= 6)
					{
						pItem = this->GetInventory()->GetItemByIndex(this->GetSharedData()->nObjIdLegs);
						if(pItem->GetEnchant() >= 6)
							return true;
					}
				}
			}
		}
	}
	return false;
}

void User::CheckEnchantedSetBonus()
{
	int nSetSkill[49];
	nSetSkill[0] = 3507;
	nSetSkill[1] = 3504;
	nSetSkill[2] = 3505;
	nSetSkill[3] = 3503;
	nSetSkill[4] = 3506;
	nSetSkill[5] = 3502;	//End of d grade
	nSetSkill[6] = 3517;
	nSetSkill[7] = 3510;
	nSetSkill[8] = 3513;
	nSetSkill[9] = 3515;
	nSetSkill[10] = 3514;
	nSetSkill[11] = 3511;
	nSetSkill[12] = 3508;
	nSetSkill[13] = 3516;
	nSetSkill[14] = 3512;
	nSetSkill[15] = 3509;	//end of C grades 
	nSetSkill[16] = 3518;	//heavy
	nSetSkill[17] = 3519;	//heavy
	nSetSkill[18] = 3520;	//light
	nSetSkill[19] = 3521;	//light
	nSetSkill[20] = 3522; 	//robe
	nSetSkill[21] = 3523;	//robe	//avadon & zubei
	nSetSkill[22] = 3524;	//heavy
	nSetSkill[23] = 3525;	//heavy
	nSetSkill[24] = 3526;	//light
	nSetSkill[25] = 3527;	//light
	nSetSkill[26] = 3528;	//robe
	nSetSkill[27] = 3529;	//robe	//blue wolf & doom  - end of B grades
	nSetSkill[28] = 3530;	//heavy
	nSetSkill[29] = 3531;	//heavy
	nSetSkill[30] = 3532;	//light
	nSetSkill[31] = 3533;	//light
	nSetSkill[32] = 3534;	//robe
	nSetSkill[33] = 3535;	//robe	//tallum & dark crystal
	nSetSkill[34] = 3536;	//heavy
	nSetSkill[35] = 3537;	//heavy
	nSetSkill[36] = 3538;	//light
	nSetSkill[37] = 3539;	//light
	nSetSkill[38] = 3540;	//robe
	nSetSkill[39] = 3541;	//robe	// NM & majestic - end of A grades
	nSetSkill[40] = 3553;	//heavy
	nSetSkill[41] = 3555;	//light
	nSetSkill[42] = 3556;	//robe // end of S grades
	nSetSkill[43] = 3608;	//heavy
	nSetSkill[44] = 3609;	//light
	nSetSkill[45] = 3610;	//robe	//End of apella Heavy Light Robe
	nSetSkill[46] = 3605;	//heavy
	nSetSkill[47] = 3606;	//light
	nSetSkill[48] = 3607;	//robe	//End of Oath Heavy Light Robe

	int nSetSkillID[15];
	nSetSkillID[0]=3611;
	nSetSkillID[1]=3612;
	nSetSkillID[2]=3613;	//d grade end
	nSetSkillID[3]=3614;
	nSetSkillID[4]=3615;
	nSetSkillID[5]=3616;	//c grade end
	nSetSkillID[6]=3617;
	nSetSkillID[7]=3618;
	nSetSkillID[8]=3619;	//b grade end
	nSetSkillID[9]=3620;
	nSetSkillID[10]=3621;
	nSetSkillID[11]=3622;	//a grade end
	nSetSkillID[12]=3623;
	nSetSkillID[13]=3624;
	nSetSkillID[14]=3625;	//s grade end

	int nPlace = 0;
	bool hasSet = false;
	bool Enchanted = false;

	for(unsigned int i=0;i<49;i++)
	{
		if(this->haveSkill(nSetSkill[i], 1))
		{
			nPlace = i;
			hasSet= true;
		}
	}
	if(!hasSet)
		for(unsigned int i=0;i<15;i++)
		{
			if(this->haveSkill(nSetSkillID[i], 1))
				this->DeleteSkill(nSetSkillID[i]);
		}

	if(hasSet)
	{
		if(((nPlace>3)&&(nPlace<6))||((nPlace>12) && (nPlace<16))) //heavy d/c grade
		{
			Enchanted = this->GotHeavySetEnchanted();
		}else
		if(((nPlace>1)&&(nPlace<4))||((nPlace>8) && (nPlace<13))) //light d/c grade
		{
			Enchanted = this->GotLightSetEnchanted();
		}else
		if(((nPlace>=0)&&(nPlace<2))||((nPlace>5) && (nPlace<9))) //robe d/c grade
		{
			Enchanted = this->GotRobeSetEnchanted();
		}else
		if((nPlace>15)&&(nPlace<43)) // BAS grades
		{
			Enchanted = this->GotBASSetEnchanted();
		}
	}

	if(Enchanted)
	{
		CLog::Log()->AddAnsi(CLog::SystemConsoleBlue, "[EnchantedSet]Player[%ls] got +6 set, adding bonus skill.", this->GetSharedData()->wszName);
		if((nPlace>3)&&(nPlace<6)) //heavy d grade
		{
			this->AcquireSkill(nSetSkillID[0], 1);
		}else
		if((nPlace>1)&&(nPlace<4)) //light d grade
		{
			this->AcquireSkill(nSetSkillID[1], 1);
		}else
		if((nPlace>=0)&&(nPlace<2)) //robe d grade
		{
			this->AcquireSkill(nSetSkillID[2], 1);
		}else
		if((nPlace>12)&&(nPlace<16)) //heavy c grade
		{
			this->AcquireSkill(nSetSkillID[3], 1);
		}else
		if((nPlace>8)&&(nPlace<13)) //light c grade
		{
			this->AcquireSkill(nSetSkillID[4], 1);
		}else
		if((nPlace>5)&&(nPlace<9)) //robe c grade
		{
			this->AcquireSkill(nSetSkillID[5], 1);
		}else
		if(((nPlace>15)&&(nPlace<18))||((nPlace>21) && (nPlace<24))) //heavy b grade
		{
			this->AcquireSkill(nSetSkillID[6], 1);
		}else
		if(((nPlace>17)&&(nPlace<20))||((nPlace>23) && (nPlace<26))) //light b grade
		{
			this->AcquireSkill(nSetSkillID[7], 1);
		}else
		if(((nPlace>19)&&(nPlace<22))||((nPlace>25) && (nPlace<28))) //robe b grade
		{
			this->AcquireSkill(nSetSkillID[8], 1);
		}else
		if(((nPlace>27)&&(nPlace<30))||((nPlace>33) && (nPlace<36))) //heavy a grade
		{
			this->AcquireSkill(nSetSkillID[9], 1);
		}else
		if(((nPlace>29)&&(nPlace<32))||((nPlace>35) && (nPlace<38))) //light a grade
		{
			this->AcquireSkill(nSetSkillID[10], 1);
		}else
		if(((nPlace>31)&&(nPlace<34))||((nPlace>37) && (nPlace<40))) //robe a grade
		{
			this->AcquireSkill(nSetSkillID[11], 1);
		}else
		if(nPlace==40) this->AcquireSkill(nSetSkillID[12], 1);
		else
		if(nPlace==41) this->AcquireSkill(nSetSkillID[13], 1);
		else
		if(nPlace==42) this->AcquireSkill(nSetSkillID[14], 1);
	}
	this->ValidateParameters();
	this->ValidateSkillList();

}