Added: Inventory filter for animals

--HG--
branch : develop
This commit is contained in:
Inky 2019-01-08 02:33:18 +01:00
parent ed31302163
commit bc35724622
2 changed files with 26 additions and 4 deletions

View file

@ -2003,6 +2003,9 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */)
prop = xmlGetProp (cur, (xmlChar*)"filter_tool"); prop = xmlGetProp (cur, (xmlChar*)"filter_tool");
if (prop) DbFilterTool = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); if (prop) DbFilterTool = NLGUI::CDBManager::getInstance()->getDbProp(prop.str());
prop = xmlGetProp (cur, (xmlChar*)"filter_pet");
if (prop) DbFilterPet = NLGUI::CDBManager::getInstance()->getDbProp(prop.str());
prop = xmlGetProp (cur, (xmlChar*)"filter_mp"); prop = xmlGetProp (cur, (xmlChar*)"filter_mp");
if (prop) DbFilterMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); if (prop) DbFilterMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str());
@ -2079,6 +2082,13 @@ bool SBagOptions::isSomethingChanged()
LastDbFilterTool = (DbFilterTool->getValue8() != 0); LastDbFilterTool = (DbFilterTool->getValue8() != 0);
} }
if (DbFilterPet != NULL)
if ((DbFilterPet->getValue8() != 0) != LastDbFilterPet)
{
bRet = true;
LastDbFilterPet = (DbFilterPet->getValue8() != 0);
}
if (DbFilterMP != NULL) if (DbFilterMP != NULL)
if ((DbFilterMP->getValue8() != 0) != LastDbFilterMP) if ((DbFilterMP->getValue8() != 0) != LastDbFilterMP)
{ {
@ -2117,6 +2127,7 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const
bool bFilterArmor = getFilterArmor(); bool bFilterArmor = getFilterArmor();
bool bFilterWeapon = getFilterWeapon(); bool bFilterWeapon = getFilterWeapon();
bool bFilterTool = getFilterTool(); bool bFilterTool = getFilterTool();
bool bFilterPet = getFilterPet();
bool bFilterMP = getFilterMP(); bool bFilterMP = getFilterMP();
bool bFilterMissMP = getFilterMissMP(); bool bFilterMissMP = getFilterMissMP();
bool bFilterTP = getFilterTP(); bool bFilterTP = getFilterTP();
@ -2168,10 +2179,13 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const
(pIS->Family == ITEMFAMILY::HARVEST_TOOL) || (pIS->Family == ITEMFAMILY::HARVEST_TOOL) ||
(pIS->Family == ITEMFAMILY::TAMING_TOOL) || (pIS->Family == ITEMFAMILY::TAMING_TOOL) ||
(pIS->Family == ITEMFAMILY::TRAINING_TOOL) || (pIS->Family == ITEMFAMILY::TRAINING_TOOL) ||
(pIS->Family == ITEMFAMILY::BAG) || (pIS->Family == ITEMFAMILY::BAG))
(pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET) )
if (!bFilterTool) bDisplay = false; if (!bFilterTool) bDisplay = false;
// Pet
if (pIS->Family == ITEMFAMILY::PET_ANIMAL_TICKET)
if (!bFilterPet) bDisplay = false;
// MP // MP
if ((pIS->Family == ITEMFAMILY::RAW_MATERIAL) && pIS->canBuildSomeItemPart()) if ((pIS->Family == ITEMFAMILY::RAW_MATERIAL) && pIS->canBuildSomeItemPart())
if (!bFilterMP) bDisplay = false; if (!bFilterMP) bDisplay = false;

View file

@ -509,6 +509,7 @@ struct SBagOptions
NLMISC::CCDBNodeLeaf *DbFilterArmor; NLMISC::CCDBNodeLeaf *DbFilterArmor;
NLMISC::CCDBNodeLeaf *DbFilterWeapon; NLMISC::CCDBNodeLeaf *DbFilterWeapon;
NLMISC::CCDBNodeLeaf *DbFilterTool; NLMISC::CCDBNodeLeaf *DbFilterTool;
NLMISC::CCDBNodeLeaf *DbFilterPet;
NLMISC::CCDBNodeLeaf *DbFilterMP; NLMISC::CCDBNodeLeaf *DbFilterMP;
NLMISC::CCDBNodeLeaf *DbFilterMissMP; NLMISC::CCDBNodeLeaf *DbFilterMissMP;
NLMISC::CCDBNodeLeaf *DbFilterTP; NLMISC::CCDBNodeLeaf *DbFilterTP;
@ -516,6 +517,7 @@ struct SBagOptions
bool LastDbFilterArmor; bool LastDbFilterArmor;
bool LastDbFilterWeapon; bool LastDbFilterWeapon;
bool LastDbFilterTool; bool LastDbFilterTool;
bool LastDbFilterPet;
bool LastDbFilterMP; bool LastDbFilterMP;
bool LastDbFilterMissMP; bool LastDbFilterMissMP;
bool LastDbFilterTP; bool LastDbFilterTP;
@ -529,8 +531,8 @@ struct SBagOptions
SBagOptions() SBagOptions()
{ {
InvType = CInventoryManager::InvUnknown; InvType = CInventoryManager::InvUnknown;
DbFilterArmor = DbFilterWeapon = DbFilterTool = DbFilterMP = DbFilterMissMP = DbFilterTP = NULL; DbFilterArmor = DbFilterWeapon = DbFilterTool = DbFilterPet = DbFilterMP = DbFilterMissMP = DbFilterTP = NULL;
LastDbFilterArmor = LastDbFilterWeapon = LastDbFilterTool = LastDbFilterMP = LastDbFilterMissMP = LastDbFilterTP = false; LastDbFilterArmor = LastDbFilterWeapon = LastDbFilterTool = LastDbFilterPet = LastDbFilterMP = LastDbFilterMissMP = LastDbFilterTP = false;
SearchFilterChanged = false; SearchFilterChanged = false;
SearchQualityMin = 0; SearchQualityMin = 0;
SearchQualityMax = 999; SearchQualityMax = 999;
@ -561,6 +563,12 @@ struct SBagOptions
return (DbFilterTool->getValue8()!=0); return (DbFilterTool->getValue8()!=0);
} }
bool getFilterPet() const
{
if (DbFilterPet == NULL) return true;
return (DbFilterPet->getValue8()!=0);
}
bool getFilterMP() const bool getFilterMP() const
{ {
if (DbFilterMP == NULL) return true; if (DbFilterMP == NULL) return true;