Add CanTakeItem and FindMineTool method

This commit is contained in:
HungDK
2025-12-22 17:49:59 +07:00
parent 49f0ab3da6
commit fb6f3b3c13
+62
View File
@@ -5295,5 +5295,67 @@ namespace BrewMonster
CANDO_REBUILDPET = 19,
CANDO_SWITCH_PARALLEL_WORLD = 20;
}
public bool CanTakeItem(int idItem, int iAmount)
{
bool bCanPick = false;
if (GPDataTypeHelper.ISMONEYTID(idItem))
{
if (GetMoneyAmount() < GetMaxMoneyAmount())
bCanPick = true;
}
else
{
if (PackInventory.CanAddItem(idItem, iAmount, false) >= 0)
bCanPick = true;
}
return bCanPick;
}
public bool FindMineTool(int tidMine, ref int piPack, ref int piIndex, ref int pidTool)
{
if (tidMine == 0)
return false;
DATA_TYPE DataType = DATA_TYPE.DT_INVALID;
object pDataPtr = ElementDataManProvider.GetElementDataMan().get_data_ptr((uint)tidMine, ID_SPACE.ID_SPACE_ESSENCE, ref DataType);
if (DataType != DATA_TYPE.DT_MINE_ESSENCE)
{
//ASSERT(DataType != DATA_TYPE.DT_MINE_ESSENCE);
return false;
}
MINE_ESSENCE pData = (MINE_ESSENCE)pDataPtr;
int idTool = (int)pData.id_equipment_required;
bool bRet = true;
if (idTool != 0)
{
int iIndex = PackInventory.FindItem(idTool);
if (iIndex >= 0)
{
piPack = EC_Inventory.Inventory_type.IVTRTYPE_PACK;
piIndex = iIndex;
pidTool = idTool;
}
else if ((iIndex = TaskInventory.FindItem(idTool)) >= 0)
{
piPack = EC_Inventory.Inventory_type.IVTRTYPE_TASKPACK;
piIndex = iIndex;
pidTool = idTool;
}
else
bRet = false;
}
else
{
piPack = 0;
piIndex = 0;
pidTool = 0;
}
return bRet;
}
}
}