Item functors - zeroKilo/GROBackendWV GitHub Wiki
Item functors
The game implements validation of item data as a set of predicates called item functors.
The validation is performed before the items can be displayed e.g. in the store grid UI.
IDs
Item functor objects are stored in StoreModel
. On creation each is assigned a 32-bit functorId
:
- the low-order word (
functorId & 0xFFFF
) is item type (1-13) - the high-order word (
functorId - functorId & 0xFFFF
) is weapon type with additional -1, -2 and compatibility bridge-originating values
The functor IDs are associated with SKU IDs.
List
There are more item functors used by the game, these are only the item type and subtype validators.
XXXX
is the weapon component list key (weapon type) sent in compatibility bridge map. Note that it's a 16-bit value.
ID | Functor name | Item |
---|---|---|
0x00000002 | SingleSubItemTypeEqualFunctor<RDV_st_Weapon> | Weapon (assault rifle) |
0x00010002 | SingleSubItemTypeEqualFunctor<RDV_st_Weapon> | Weapon (sniper rifle) |
0x00020002 | SingleSubItemTypeEqualFunctor<RDV_st_Weapon> | Weapon (shotgun) |
0x00030002 | SingleSubItemTypeEqualFunctor<RDV_st_Weapon> | Weapon (SMG) |
0x00040002 | SingleSubItemTypeEqualFunctor<RDV_st_Weapon> | Weapon (LMG) |
0x00050002 | SingleSubItemTypeEqualFunctor<RDV_st_Weapon> | Weapon (pistol) |
0x00060002 | SingleSubItemTypeEqualFunctor<RDV_st_Weapon> | Weapon (grenade) |
0xXXXX 0004 |
CompatibleComponentTypeEqualFunctor | Component |
0xFFFE0004 | SingleSubItemTypeEqualFunctor<RDV_st_Component> | Component |
0xFFFF0001 | PackageEqualFunctor | SKU bundle |
0xFFFF0002 | SingleItemTypeEqualFunctor | Weapon |
0xFFFF0003 | SingleItemTypeEqualFunctor | Armor insert |
0xFFFF0004 | SingleItemTypeEqualFunctor | Component |
0xFFFF0005 | unused | Avatar |
0xFFFF0006 | SingleItemTypeEqualFunctor | Boost |
0xFFFF0007 | SingleItemTypeEqualFunctor | Consumable |
0xFFFF0008 | SingleItemTypeEqualFunctor | Armor item |
0xFFFF0009 | SingleItemTypeEqualFunctor | Apply item |
0xFFFF000A | SingleItemTypeEqualFunctor | Armor tier |
0xFFFF000B | SingleItemTypeEqualFunctor | Ability |
0xFFFF000C | SingleItemTypeEqualFunctor | Ability upgrade |
0xFFFF000D | SingleItemTypeEqualFunctor | Passive ability |
SingleItemTypeEqualFunctor
Validates basic item data:
- SKU item vector size (always 1)
- template item/SKU item ID association
- template item type with functor's type (controlled by item and weapon types)
bool __thiscall RDV_ft_SingleItemTypeEqualFunctor::Validate(RDV_ft_SingleItemTypeEqualFunctor *this, char skuId)
{
RDV_cl_StoreModelInterface::VMT **storeVmt; // eax
GenericStaticList *skus; // eax
DWORD skuItemId; // ST30_4
RDV_cl_InventoryModel::VMT::Interface **invVmt; // eax
bool result; // al
GR5_TemplateItemAligned *tempItem; // [esp+30h] [ebp-8h]
GR5_SKUAligned *sku; // [esp+34h] [ebp-4h]
storeVmt = (this->pDllClient->pVMT->RDV_cl_DLLClient::GetStoreModelInterface)(this->pDllClient);
skus = ((*storeVmt)->j_RDV_cl_StoreModel::GetSkuList)(storeVmt);
sku = j_GetSkuFromList(skus, &skuId);
result = 0;
if ( sku )
{
if ( sku->skuItemVec.size == 1 )
{
skuItemId = sku->skuItemVec.skuItems->itemID;
invVmt = (this->pDllClient->pVMT->RDV_cl_DLLClient::GetInventoryModelInterface)(this->pDllClient);
tempItem = ((*invVmt)->j_RDV_cl_InventoryModel::GetTemplateItemForSlot)(invVmt, skuItemId);
if ( tempItem )
{
if ( tempItem->itemType == this->itemType )
result = 1;
}
}
}
return result;
}
CompatibleComponentTypeEqualFunctor
Performs initial validation of weapon component data:
- SKU item vector size (always 1)
- template item type (
4
for components) - compatibility bridge entry -
value
should match the component id
bool __thiscall RDV_ft_CompatibleComponentTypeEqualFunctor::Validate(RDV_ft_CompatibleComponentTypeEqualFunctor *this, char a2)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
storeVmt = (this->pDllClient->pVMT->RDV_cl_DLLClient::GetStoreModelInterface)(this->pDllClient);
skus = ((*storeVmt)->j_RDV_cl_StoreModel::GetSkuList)(storeVmt);
sku = j_GetSkuFromList(skus, &a2);
if ( sku
&& sku->skuItemVec.size == 1
&& (skuItemId = sku->skuItemVec.skuItems->itemID,
invVmt = (this->pDllClient->pVMT->RDV_cl_DLLClient::GetInventoryModelInterface)(this->pDllClient),
(tempItem = ((*invVmt)->j_RDV_cl_InventoryModel::GetTemplateItemForSlot)(invVmt, skuItemId)) != 0)
&& tempItem->itemType == 4
&& (weapVmt = (this->pDllClient->pVMT->RDV_cl_DLLClient::GetWeaponsModelInterface)(this->pDllClient),
bridge = ((*weapVmt)->j_RDV_cl_WeaponsModelInterface::GetCompatBridge)(weapVmt),
(mapList = j_RDV_cl_Map::GetListByKey(bridge, &this->compatBridgeId)) != 0) )
{
result = sub_1001194B(mapList, &skuItemId) != mapList;
}
else
{
result = 0;
}
return result;
}