Example #1
0
bool Mob::CanUseAlternateAdvancementRank(AA::Rank *rank) {
	AA::Ability *ability = rank->base_ability;

	if(!ability)
		return false;

	if(!(ability->classes & (1 << GetClass()))) {
		return false;
	}

	// Passive and Active Shroud AAs
	// For now we skip them
	if(ability->category == 3 || ability->category == 4) {
		return false;
	}

	//the one titanium hack i will allow
	//just to make sure we dont crash the client with newer aas
	//we'll exclude any expendable ones
	if(IsClient() && CastToClient()->GetClientVersionBit() & BIT_TitaniumAndEarlier) {
		if(ability->charges > 0) {
			return false;
		}
	}

	if(IsClient()) {
		if(!(CastToClient()->GetPP().expansions & (1 << (rank->expansion - 1)))) {
			return false;
		}
	} else {
		if(!(RuleI(World, ExpansionSettings) & (1 << (rank->expansion - 1)))) {
			return false;
		}
	}

	auto race = GetArrayRace(GetBaseRace());
	race = race > 16 ? 1 : race;
	if(!(ability->races & (1 << (race - 1)))) {
		return false;
	}

	auto deity = ConvertDeityToBitDeity((DeityTypes)GetDeity());
	if(!(ability->deities & deity)) {
		return false;
	}

	if(IsClient() && CastToClient()->Admin() < ability->status) {
		return false;
	}

	if(GetBaseRace() == 522) {
		//drakkin_heritage
		if(!(ability->drakkin_heritage & (1 << GetDrakkinHeritage()))) {
			return false;
		}
	}

	return true;
}
Example #2
0
bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const
{
	bool IsRace = false;
	bool IsClass = false;

	uint32 Classes_ = Classes;

	uint32 Races_ = Races;

	uint32 Race_ = GetArrayRace(Race);

	for (int CurrentClass = 1; CurrentClass <= PLAYER_CLASS_COUNT; ++CurrentClass)
	{
		if (Classes_ % 2 == 1)
		{
			if (CurrentClass == Class_)
			{
					IsClass = true;
				break;
			}
		}
		Classes_ >>= 1;
	}

	Race_ = (Race_ == 18 ? 16 : Race_);

	for (unsigned int CurrentRace = 1; CurrentRace <= PLAYER_RACE_COUNT; ++CurrentRace)
	{
		if (Races_ % 2 == 1)
		{
				if (CurrentRace == Race_)
			{
					IsRace = true;
				break;
			}
		}
		Races_ >>= 1;
	}
	return (IsRace && IsClass);
}