Beispiel #1
0
bool Game_Actor::IsSkillUsable(int skill_id) const {
	const RPG::Skill* skill = ReaderUtil::GetElement(Data::skills, skill_id);
	if (!skill) {
		Output::Warning("IsSkillUsable: Invalid skill ID %d", skill_id);
		return false;
	}

	// Actor must have all attributes of the skill equipped as weapons
	const RPG::Item* item = GetEquipment(RPG::Item::Type_weapon);
	const RPG::Item* item2 = HasTwoWeapons() ? GetEquipment(RPG::Item::Type_weapon + 1) : nullptr;

	for (size_t i = 0; i < skill->attribute_effects.size(); ++i) {
		bool required = skill->attribute_effects[i] && Data::attributes[i].type == RPG::Attribute::Type_physical;
		if (required) {
			if (item && i < item->attribute_set.size() && item->attribute_set[i]) {
				continue;
			}
			if (item2 && i < item2->attribute_set.size() && item2->attribute_set[i]) {
				continue;
			}
			return false;
		}
	}

	return Game_Battler::IsSkillUsable(skill_id);
}
Beispiel #2
0
const RPG::Item* Game_Actor::GetAccessory() const {
	auto* accessory = GetEquipment(RPG::Item::Type_accessory);
	if (accessory && accessory->type == RPG::Item::Type_accessory) {
		return accessory;
	}
	return nullptr;
}
Beispiel #3
0
const RPG::Item* Game_Actor::GetHelmet() const {
	auto* helmet = GetEquipment(RPG::Item::Type_helmet);
	if (helmet && helmet->type == RPG::Item::Type_helmet) {
		return helmet;
	}
	return nullptr;
}
Beispiel #4
0
const RPG::Item* Game_Actor::GetArmor() const {
	auto* armor = GetEquipment(RPG::Item::Type_armor);
	if (armor && armor->type == RPG::Item::Type_armor) {
		return armor;
	}
	return nullptr;
}
Beispiel #5
0
const RPG::Item* Game_Actor::GetShield() const {
	auto* shield = GetEquipment(RPG::Item::Type_shield);
	if (shield && shield->type == RPG::Item::Type_shield) {
		return shield;
	}
	return nullptr;
}
Beispiel #6
0
const RPG::Item* Game_Actor::GetWeapon() const {
	auto* weapon = GetEquipment(RPG::Item::Type_weapon);
	if (weapon && weapon->type == RPG::Item::Type_weapon) {
		return weapon;
	}
	return nullptr;
}
Beispiel #7
0
const RPG::Item* Game_Actor::Get2ndWeapon() const {
	// Checking of HasTwoWeapons() not neccessary. If true, the
	// item equipped in this slot will never be a weapon from
	// legitimate means.
	auto* weapon = GetEquipment(RPG::Item::Type_shield);
	if (weapon && weapon->type == RPG::Item::Type_weapon) {
		return weapon;
	}
	return nullptr;
}
Beispiel #8
0
uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
	const EQEmu::ItemData *item;

	if (material_slot > EQEmu::textures::LastTexture) {
		return 0;
	}

	item = database.GetItem(GetEquipment(material_slot));
	if(item != 0) {
		return (item_tint.Slot[material_slot].UseTint ? item_tint.Slot[material_slot].Color : item->Color);
	}

	return 0;
}
Beispiel #9
0
uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
	const Item_Struct *item;

	if(material_slot > EmuConstants::MATERIAL_END) {
		return 0;
	}

	item = database.GetItem(GetEquipment(material_slot));
	if(item != NO_ITEM) {
		return item_tint[material_slot].RGB.UseTint ?
			item_tint[material_slot].Color :
			item->Color;
	}

	return 0;
}
Beispiel #10
0
Item* ItemFactory::GetRandomEquipment(Equipment::EquipmentPosition pos, ItemRarity rarity)
{
    int random = rand() % m_equipmentIds[pos][rarity].size();
    int itemId = m_equipmentIds[pos][rarity][random];
    return GetEquipment(pos, itemId);
}