Beispiel #1
0
//-----------------------------------------------
// isUserColorSupported :
// Test whether user color is supported for this equipment
//-----------------------------------------------
bool isUserColorSupported(const CPlayerSheet::CEquipment &equip)
{
	NLMISC::CSheetId si;
	if(!si.buildSheetId(equip.Item))
		return false;

	CItemSheet *is = dynamic_cast<CItemSheet *>(SheetMngr.get(si));
	if(!is)
		return false;

	return is->Color == -1; // user color supported by the item
}// isUserColorSupported //
Beispiel #2
0
//-----------------------------------------------
// getColor :
//-----------------------------------------------
sint8 getColor(const CPlayerSheet::CEquipment &equip)
{
	NLMISC::CSheetId si;
	if(!si.buildSheetId(equip.Item))
		return -2;

	CItemSheet *is = dynamic_cast<CItemSheet *>(SheetMngr.get(si));
	if(!is)
		return -2;

	if(is->Color == -1) // user color supported by the item
	{
		return equip.Color;
	}
	else
	{
		return is->Color;
	}
}// getColor //
Beispiel #3
0
//=======================================================================
sint CSheetManager::getVSIndex(const std::string &itemName, SLOTTYPE::EVisualSlot slot)
{
	NLMISC::CSheetId si;
	if (!si.buildSheetId(itemName))
	{
		nlwarning("<CSheetManager::getVSIndex> : cannot build id from item %s for the slot %d.", itemName.c_str(), slot);
		return -1;
	}

	TEntitySheetMap::iterator it =  _EntitySheetContainer.find(si);;
	if (it == _EntitySheetContainer.end())
	{
		nlwarning("<CSheetManager::getVSIndex> : cannot find %s for the slot %d.", itemName.c_str(), slot);
		return -1;
	}
	if (it->second.EntitySheet == 0 || it->second.EntitySheet->type() != CEntitySheet::ITEM)
	{
		nlwarning("<CSheetManager::getVSIndex> : %s is not an item for the slot %d.", itemName.c_str(), slot);
		return -1;
	}

	CItemSheet *is = static_cast<CItemSheet *>(it->second.EntitySheet);

	const TVisualSlotItemArray *ia = getVSItems(is);
	if (ia == NULL)
	{
		nlwarning("<CSheetManager::getVSIndex> : no items for the slot %d. while looking for %s", slot, itemName.c_str());
		return -1;
	}

	TVisualSlotItemArray::const_iterator first(ia->begin()), last(ia->end());
	for(; first != last; ++first)
	{
		if (first->first == slot)
		{
			return first->second;
		}
	}

	nlwarning("<CSheetManager::getVSIndex> : cannot find %s for the slot %d.", itemName.c_str(), slot);
	return -1;
}