PC Stable Documentation
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Loading...
Searching...
No Matches
PluginRecipesManagerBase Class Reference

Private Member Functions

void PluginRecipesManager ()
 
void ~PluginRecipesManager ()
 
bool IsEnableDebugCrafting ()
 
void SetEnableDebugCrafting (bool enable)
 
string GetRecipeName (int recipe_id)
 
int GetValidRecipes (ItemBase item1, ItemBase item2, array< int > ids, PlayerBase player)
 
int GetValidRecipesProper (int num_of_items, ItemBase items[], array< int > ids, PlayerBase player)
 
float GetRecipeLengthInSecs (int recipe_id)
 
float GetRecipeSpecialty (int recipe_id)
 
bool GetIsInstaRecipe (int recipe_id)
 
bool GetIsRepeatable (int recipe_id)
 
override void OnInit ()
 
void CallbackGenerateCache ()
 
protected void GenerateRecipeCache ()
 
void WalkRecipes ()
 
protected void MatchItems (TStringArray full_path)
 
bool IsRecipePossibleToPerform (int id, ItemBase itemA, ItemBase itemB, PlayerBase player)
 
void PerformRecipeServer (int id, ItemBase item_a, ItemBase item_b, PlayerBase player)
 
void GenerateHumanReadableRecipeList ()
 
array< RecipeBaseGetRecipesForItem (string itemName)
 
protected bool RecipeSanityCheck (int num_of_ingredients, InventoryItemBase items[], PlayerBase player)
 
override protected void RegisterRecipe (RecipeBase recipe)
 
override protected void UnregisterRecipe (string clasname)
 
protected bool CheckRecipe (int id, ItemBase item1, ItemBase item2, PlayerBase player)
 
protected void PrintCache ()
 
protected bool SortIngredientsInRecipe (int id, int num_of_ingredients, ItemBase ingredients_unsorted[], ItemBase ingredients_sorted[])
 sorts ingredients correctly as either first or second ingredient based on their masks
 
protected void ClearResults ()
 
protected bool ResolveIngredients (int num_of_ingredients, int passes=0)
 
protected void PrintResultMasks (int num)
 
protected int GetRecipeIntersection (int num_of_ingredients, ItemBase items[])
 fills an array with recipe IDs which 'item_a' and 'item_b' share
 
protected int SortIngredients (int num_of_ingredients, ItemBase items_unsorted[], int resolved_recipes[])
 
protected void CreateAllRecipes ()
 
string GetSoundCategory (int recipeID, ItemBase item1, ItemBase item2)
 
int GetAnimationCommandUID (int recipeID)
 

Static Private Member Functions

static int GetMaxNumberOfRecipes ()
 
static int RecipeIDFromClassname (string classname)
 

Private Attributes

ref Timer m_TestTimer
 
const int MAX_NUMBER_OF_RECIPES = GetMaxNumberOfRecipes()
 
const int MAX_CONCURENT_RECIPES = 128
 
const int MAX_INGREDIENTS = 5
 
int m_RegRecipeIndex
 
int m_ResolvedRecipes [MAX_CONCURENT_RECIPES]
 
bool m_EnableDebugCrafting = false
 
ItemBase m_Ingredients [MAX_INGREDIENTS]
 
int m_IngredientBitMask [MAX_INGREDIENTS]
 
int m_IngredientBitMaskSize [MAX_INGREDIENTS]
 
int m_BitsResults [MAX_INGREDIENTS]
 
ItemBase m_ingredient1 [MAX_CONCURENT_RECIPES]
 
ItemBase m_ingredient2 [MAX_CONCURENT_RECIPES]
 
ItemBase m_ingredient3 [MAX_CONCURENT_RECIPES]
 
ItemBase m_sortedIngredients [MAX_NUMBER_OF_INGREDIENTS]
 
ref array< intm_RecipesMatched = new array<int>
 
ref array< stringm_CachedItems = new array<string>
 
ref array< ref RecipeBasem_RecipeList = new array<ref RecipeBase>
 
ref Timer myTimer1
 
ref array< intm_RcpsArray
 
string m_BaseName
 
int m_RecipeID
 
int item_mask
 
int m_BaseMask
 
string m_ItemName
 
ref CacheObject m_CoItem
 
ref CacheObject m_CoBase
 

Static Private Attributes

static ref map< string, ref CacheObjectm_RecipeCache = new map<string,ref CacheObject >
 
static ref map< typename, boolm_RecipesInitializedItem = new map<typename, bool>
 
static ref map< string, intm_RecipeNamesList = new map<string, int>
 

Constructor & Destructor Documentation

◆ ~PluginRecipesManager()

void ~PluginRecipesManager ( )
inlineprivate

Member Function Documentation

◆ CallbackGenerateCache()

void CallbackGenerateCache ( )
inlineprivate

◆ CheckRecipe()

protected bool CheckRecipe ( int  id,
ItemBase  item1,
ItemBase  item2,
PlayerBase  player 
)
inlineprivate

◆ ClearResults()

protected void ClearResults ( )
inlineprivate

References MAX_INGREDIENTS.

Referenced by SortIngredientsInRecipe().

◆ CreateAllRecipes()

protected void CreateAllRecipes ( )
inlineprivate

References RegisterRecipies().

Referenced by PluginRecipesManager().

◆ GenerateHumanReadableRecipeList()

void GenerateHumanReadableRecipeList ( )
inlineprivate

◆ GenerateRecipeCache()

◆ GetAnimationCommandUID()

int GetAnimationCommandUID ( int  recipeID)
inlineprivate

◆ GetIsInstaRecipe()

bool GetIsInstaRecipe ( int  recipe_id)
inlineprivate

◆ GetIsRepeatable()

bool GetIsRepeatable ( int  recipe_id)
inlineprivate

◆ GetMaxNumberOfRecipes()

static int GetMaxNumberOfRecipes ( )
inlinestaticprivate

◆ GetRecipeIntersection()

protected int GetRecipeIntersection ( int  num_of_ingredients,
ItemBase  items[] 
)
inlineprivate

fills an array with recipe IDs which 'item_a' and 'item_b' share

References CacheObject(), GetType(), and x.

Referenced by GetValidRecipesProper().

◆ GetRecipeLengthInSecs()

float GetRecipeLengthInSecs ( int  recipe_id)
inlineprivate

◆ GetRecipeName()

string GetRecipeName ( int  recipe_id)
inlineprivate

◆ GetRecipesForItem()

array< RecipeBase > GetRecipesForItem ( string  itemName)
inlineprivate

References CacheObject().

◆ GetRecipeSpecialty()

float GetRecipeSpecialty ( int  recipe_id)
inlineprivate

◆ GetSoundCategory()

string GetSoundCategory ( int  recipeID,
ItemBase  item1,
ItemBase  item2 
)
inlineprivate

◆ GetValidRecipes()

int GetValidRecipes ( ItemBase  item1,
ItemBase  item2,
array< int ids,
PlayerBase  player 
)
inlineprivate

◆ GetValidRecipesProper()

int GetValidRecipesProper ( int  num_of_items,
ItemBase  items[],
array< int ids,
PlayerBase  player 
)
inlineprivate

◆ IsEnableDebugCrafting()

bool IsEnableDebugCrafting ( )
inlineprivate

References m_EnableDebugCrafting.

◆ IsRecipePossibleToPerform()

bool IsRecipePossibleToPerform ( int  id,
ItemBase  itemA,
ItemBase  itemB,
PlayerBase  player 
)
inlineprivate

◆ MatchItems()

protected void MatchItems ( TStringArray  full_path)
inlineprivate

◆ OnInit()

override void OnInit ( )
inlineprivate

◆ PerformRecipeServer()

void PerformRecipeServer ( int  id,
ItemBase  item_a,
ItemBase  item_b,
PlayerBase  player 
)
inlineprivate

◆ PluginRecipesManager()

void PluginRecipesManager ( )
inlineprivate

◆ PrintCache()

protected void PrintCache ( )
inlineprivate

References CacheObject(), and PrintString().

◆ PrintResultMasks()

protected void PrintResultMasks ( int  num)
inlineprivate

References Debug::Log().

◆ RecipeIDFromClassname()

static int RecipeIDFromClassname ( string  classname)
inlinestaticprivate

Referenced by UnregisterRecipe().

◆ RecipeSanityCheck()

protected bool RecipeSanityCheck ( int  num_of_ingredients,
InventoryItemBase  items[],
PlayerBase  player 
)
inlineprivate

◆ RegisterRecipe()

override protected void RegisterRecipe ( RecipeBase  recipe)
inlineprivate

References Error(), and RecipeBase::SetID().

Referenced by RegisterRecipies().

◆ ResolveIngredients()

protected bool ResolveIngredients ( int  num_of_ingredients,
int  passes = 0 
)
inlineprivate

◆ SetEnableDebugCrafting()

void SetEnableDebugCrafting ( bool  enable)
inlineprivate

◆ SortIngredients()

protected int SortIngredients ( int  num_of_ingredients,
ItemBase  items_unsorted[],
int  resolved_recipes[] 
)
inlineprivate

◆ SortIngredientsInRecipe()

protected bool SortIngredientsInRecipe ( int  id,
int  num_of_ingredients,
ItemBase  ingredients_unsorted[],
ItemBase  ingredients_sorted[] 
)
inlineprivate

sorts ingredients correctly as either first or second ingredient based on their masks

References CacheObject(), ClearResults(), GetType(), Math::Log2(), and ResolveIngredients().

Referenced by GetSoundCategory(), IsRecipePossibleToPerform(), PerformRecipeServer(), and SortIngredients().

◆ UnregisterRecipe()

override protected void UnregisterRecipe ( string  clasname)
inlineprivate

◆ WalkRecipes()

void WalkRecipes ( )
inlineprivate

Field Documentation

◆ item_mask

int item_mask
private

◆ m_BaseMask

int m_BaseMask
private

◆ m_BaseName

string m_BaseName
private

◆ m_BitsResults

int m_BitsResults[MAX_INGREDIENTS]
private

◆ m_CachedItems

ref array<string> m_CachedItems = new array<string>
private

◆ m_CoBase

ref CacheObject m_CoBase
private

◆ m_CoItem

ref CacheObject m_CoItem
private

◆ m_EnableDebugCrafting

bool m_EnableDebugCrafting = false
private

Referenced by IsEnableDebugCrafting().

◆ m_ingredient1

ItemBase m_ingredient1[MAX_CONCURENT_RECIPES]
private

◆ m_ingredient2

ItemBase m_ingredient2[MAX_CONCURENT_RECIPES]
private

◆ m_ingredient3

ItemBase m_ingredient3[MAX_CONCURENT_RECIPES]
private

◆ m_IngredientBitMask

int m_IngredientBitMask[MAX_INGREDIENTS]
private

◆ m_IngredientBitMaskSize

int m_IngredientBitMaskSize[MAX_INGREDIENTS]
private

◆ m_Ingredients

ItemBase m_Ingredients[MAX_INGREDIENTS]
private

◆ m_ItemName

string m_ItemName
private

◆ m_RcpsArray

ref array<int> m_RcpsArray
private

◆ m_RecipeCache

ref map<string,ref CacheObject > m_RecipeCache = new map<string,ref CacheObject >
staticprivate

◆ m_RecipeID

int m_RecipeID
private

◆ m_RecipeList

ref array<ref RecipeBase> m_RecipeList = new array<ref RecipeBase>
private

◆ m_RecipeNamesList

ref map<string, int> m_RecipeNamesList = new map<string, int>
staticprivate

◆ m_RecipesInitializedItem

ref map<typename, bool> m_RecipesInitializedItem = new map<typename, bool>
staticprivate

◆ m_RecipesMatched

ref array<int> m_RecipesMatched = new array<int>
private

◆ m_RegRecipeIndex

int m_RegRecipeIndex
private

◆ m_ResolvedRecipes

int m_ResolvedRecipes[MAX_CONCURENT_RECIPES]
private

◆ m_sortedIngredients

ItemBase m_sortedIngredients[MAX_NUMBER_OF_INGREDIENTS]
private

◆ m_TestTimer

ref Timer m_TestTimer
private

◆ MAX_CONCURENT_RECIPES

const int MAX_CONCURENT_RECIPES = 128
private

◆ MAX_INGREDIENTS

const int MAX_INGREDIENTS = 5
private

Referenced by ClearResults(), and RecipeSanityCheck().

◆ MAX_NUMBER_OF_RECIPES

const int MAX_NUMBER_OF_RECIPES = GetMaxNumberOfRecipes()
private

◆ myTimer1

ref Timer myTimer1
private

The documentation for this class was generated from the following file: