Elin Decompiled Documentation EA 23.324 Nightly
Loading...
Searching...
No Matches
Recipe Class Reference
Inheritance diagram for Recipe:
EClass RecipeBridgePillar RecipeCard RecipeCustom

Classes

class  Ingredient
 

Public Types

enum  State { Valid , Invalid }
 
enum  IngType { Default , CreativeFood }
 

Public Member Functions

bool IsStaticLV ()
 
int GetQualityBonus ()
 
virtual int GetRefVal ()
 
virtual string GetIdThing ()
 
virtual bool ShouldShowHighlight (HitResult r)
 
BaseTileSelector.BoxType GetBoxType ()
 
int GetDefaultColor ()
 
virtual SourceMaterial.Row GetMainMaterial ()
 
virtual SourceMaterial.Row GetColorMaterial ()
 
virtual void BuildIngredientList ()
 
void BuildIngredientList (Thing t)
 
virtual void OnChangeIngredient ()
 
virtual Thing Craft (BlessedState blessed, bool sound=false, List< Thing > ings=null, TraitCrafter crafter=null, bool model=false)
 
bool HasSameTile (Point point, int dir, int altitude, int bridgeHeight)
 
virtual void Build (TaskBuild task)
 
virtual void Build (Chara chara, Card t, Point pos, int mat, int dir, int altitude, int bridgeHeight)
 
virtual void OnRenderMarker (Point point, bool active, HitResult result, bool main, int dir, int bridgeHeight)
 
string GetName ()
 
virtual string GetDetail ()
 
virtual void WriteNote (UINote n)
 
void WriteReqFactory (UINote n, bool hasFactory=true)
 
void WriteReqSkill (UINote n)
 
virtual IRenderer GetRenderer ()
 
virtual void OnSelected ()
 
virtual void OnChangeAltitude (int a)
 
virtual void Rotate ()
 
virtual void SetDir (int d)
 
virtual Recipe Duplicate ()
 
virtual void SetImage (Image icon)
 
bool IsCraftable ()
 
int GetMaxCount ()
 
void SetTextDifficulty (UIText text)
 
int GetSortVal ()
 
bool HasFirstTimeBonus ()
 
void TryGetFirstTimeBonus ()
 
void SaveLastIngredients ()
 
QuestTrackCraft GetQuestTrack ()
 
void ToggleTrack (QuestTrackCraft quest)
 

Static Public Member Functions

static Recipe GetOrCreate (string id)
 
static Recipe Create (RecipeSource _source, int idMat=-1, Thing ing=null)
 
static Recipe Create (Thing t)
 
static void DropIngredients (string id, string idMatMain, int num=1)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

string id
 
List< Ingredientingredients = new List<Ingredient>()
 
bool UseStock
 
bool IngAsProduct
 
bool VirtualBlock
 
int _dir
 
int sync
 
int idMat = -1
 
int idSkin
 
State state
 
RecipeSource _source
 

Static Public Attributes

static Dictionary< string, ReciperecipeCache = new Dictionary<string, Recipe>()
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

RecipeSource source [get]
 
SourceMaterial.Row DefaultMaterial [get]
 
virtual TileRow tileRow [get]
 
virtual RenderRow renderRow [get]
 
string Name [get]
 
virtual TileType tileType [get]
 
virtual bool IsFloorOrBridge [get]
 
int MaxAltitude [get]
 
int RecipeLv [get]
 
bool IsFloor [get]
 
bool IsObj [get]
 
virtual bool IsBlock [get]
 
bool IsWallOrFence [get]
 
bool IsBridge [get]
 
virtual bool IsThing [get]
 
virtual Card Mold [get]
 
virtual int W [get]
 
virtual int H [get]
 
virtual bool RequireIngredients [get]
 
bool MultiSize [get]
 
BaseTileSelector tileSelector [get]
 
virtual int CostMoney [get]
 
virtual bool CanRotate [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 6 of file Recipe.cs.

Member Enumeration Documentation

◆ IngType

Enumerator
Default 
CreativeFood 

Definition at line 14 of file Recipe.cs.

◆ State

Enumerator
Valid 
Invalid 

Definition at line 8 of file Recipe.cs.

9 {
10 Valid,
12 }

Member Function Documentation

◆ Build() [1/2]

virtual void Recipe.Build ( Chara  chara,
Card  t,
Point  pos,
int  mat,
int  dir,
int  altitude,
int  bridgeHeight 
)
inlinevirtual

Reimplemented in RecipeBridgePillar, and RecipeCard.

Definition at line 645 of file Recipe.cs.

646 {
647 if (mat == -1)
648 {
649 mat = 2;
650 }
651 SourceMaterial.Row row = EClass.sources.materials.map.TryGetValue(mat) ?? EClass.sources.materials.map[2];
653 pos.cell.isModified = true;
654 switch (source.type)
655 {
656 case "Block":
657 {
658 int ramp = tileRow.id;
659 if (ramp == 3)
660 {
661 ramp = row.ramp;
662 }
664 {
665 EClass._map.SetRoofBlock(pos.x, pos.z, mat, ramp, dir, altitude);
666 break;
667 }
668 if (pos.HasObj && !pos.sourceObj.tileType.CanBuiltOnBlock)
669 {
671 EClass._map.SetObj(pos.x, pos.z);
672 }
673 EClass._map.SetBlock(pos.x, pos.z, mat, ramp, dir);
674 if (tileType.IsBlockPass && pos.HasChara)
675 {
676 foreach (Chara item in pos.ListCharas().Copy())
677 {
678 chara.Kick(item, ignoreSelf: false, karmaLoss: false);
679 }
680 }
682 {
683 pos.cell.objDir = dir;
684 }
685 {
686 foreach (Card item2 in pos.ListCards())
687 {
688 if (item2.isThing && item2.placeState == PlaceState.roaming)
689 {
690 item2._Move(item2.pos.GetNearestPoint());
691 }
692 }
693 break;
694 }
695 }
696 case "Floor":
697 if (pos.HasObj && pos.sourceObj.tileType.RemoveOnFloorChange && (!BuildMenu.Instance || !EClass.debug.ignoreBuildRule))
698 {
699 EClass._map.SetObj(pos.x, pos.z);
700 }
701 EClass._map.SetFloor(pos.x, pos.z, mat, tileRow.id, dir);
702 break;
703 case "Deco":
704 EClass._map.SetDeco(pos.x, pos.z, mat, (pos.cell._deco == 0) ? tileRow.id : 0);
705 break;
706 case "Bridge":
707 {
708 if (pos.sourceObj.tileType.RemoveOnFloorChange)
709 {
710 EClass._map.SetObj(pos.x, pos.z);
711 }
712 byte idPillar = (byte)((tileRow.id == 130) ? 255u : 0u);
713 EClass._map.SetBridge(pos.x, pos.z, Mathf.Clamp(bridgeHeight + altitude, 0, 255), mat, tileRow.id, dir, idPillar);
714 break;
715 }
716 case "Obj":
717 EClass._map.SetObj(pos.x, pos.z, mat, tileRow.id, 1, dir, ignoreRandomMat: true);
719 {
720 EClass._map.SetBlockDir(pos.x, pos.z, dir);
721 }
722 if (pos.growth != null)
723 {
725 }
726 break;
727 }
728 }
PlaceState
Definition: PlaceState.cs:2
virtual bool IsRoofEditMode(Card c=null)
Definition: ActionMode.cs:311
static BuildMenu Instance
Definition: BuildMenu.cs:77
Definition: Card.cs:11
virtual MoveResult _Move(Point p, MoveType type=MoveType.Walk)
Definition: Card.cs:6118
virtual bool isThing
Definition: Card.cs:2133
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6594
void Kick(Point p, bool ignoreSelf=false, bool checkWall=true)
Definition: Card.cs:6268
PlaceState placeState
Definition: Card.cs:86
Point pos
Definition: Card.cs:60
byte _deco
Definition: Cell.cs:58
Definition: Chara.cs:10
bool ignoreBuildRule
Definition: CoreDebug.cs:200
Definition: EClass.cs:6
static Scene scene
Definition: EClass.cs:31
static Map _map
Definition: EClass.cs:19
static SourceManager sources
Definition: EClass.cs:43
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
void SetDefaultStage()
Definition: GrowSystem.cs:278
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0, byte idPillar=0)
Definition: Map.cs:993
void SetBlockDir(int x, int z, int dir)
Definition: Map.cs:1186
void SetDeco(int x, int z, int idMat, int idDeco)
Definition: Map.cs:985
void MineObjSound(Point point)
Definition: Map.cs:1982
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:970
void SetBlock(int x, int z, int idMat=0, int idBlock=0)
Definition: Map.cs:1017
void SetRoofBlock(int x, int z, int idMat, int idBlock, int dir, int height)
Definition: Map.cs:1008
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1580
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1057
int x
Definition: Point.cs:36
Point GetNearestPoint(bool allowBlock=false, bool allowChara=true, bool allowInstalled=true, bool ignoreCenter=false, int minRadius=0)
Definition: Point.cs:624
int z
Definition: Point.cs:39
SourceObj.Row sourceObj
Definition: Point.cs:69
List< Chara > ListCharas()
Definition: Point.cs:1177
bool HasObj
Definition: Point.cs:137
Cell cell
Definition: Point.cs:51
GrowSystem growth
Definition: Point.cs:77
bool HasChara
Definition: Point.cs:238
string type
Definition: RecipeSource.cs:7
virtual TileRow tileRow
Definition: Recipe.cs:208
virtual TileType tileType
Definition: Recipe.cs:215
RecipeSource source
Definition: Recipe.cs:204
ActionMode actionMode
Definition: Scene.cs:79
SourceMaterial materials
string GetSoundImpact(RenderRow c=null)
int id
Definition: TileRow.cs:8
virtual bool AltitudeAsDir
Definition: TileType.cs:225
virtual bool ChangeBlockDir
Definition: TileType.cs:133
virtual bool IsBlockPass
Definition: TileType.cs:159

References Cell._deco, EClass._map, Card._Move(), Scene.actionMode, TileType.AltitudeAsDir, Point.cell, TileType.ChangeBlockDir, EClass.debug, Point.GetNearestPoint(), SourceMaterial.Row.GetSoundImpact(), Point.growth, Point.HasChara, Point.HasObj, TileRow.id, CoreDebug.ignoreBuildRule, BuildMenu.Instance, TileType.IsBlockPass, ActionMode.IsRoofEditMode(), Card.isThing, item, Card.Kick(), Point.ListCards(), Point.ListCharas(), SourceManager.materials, Map.MineObjSound(), EClass.pc, Card.placeState, Card.PlaySound(), Card.pos, SourceMaterial.Row.ramp, EClass.scene, Map.SetBlock(), Map.SetBlockDir(), Map.SetBridge(), Map.SetDeco(), GrowSystem.SetDefaultStage(), Map.SetFloor(), Map.SetObj(), Map.SetRoofBlock(), source, Point.sourceObj, EClass.sources, tileRow, tileType, RecipeSource.type, Point.x, and Point.z.

◆ Build() [2/2]

virtual void Recipe.Build ( TaskBuild  task)
inlinevirtual

Reimplemented in RecipeCard, and RecipeCustom.

Definition at line 640 of file Recipe.cs.

641 {
642 Build(task.owner, null, task.pos, (ingredients.Count > 0) ? ingredients[0].mat : task.recipe.idMat, task.dir, task.altitude, task.bridgeHeight);
643 }
new Chara owner
Definition: AIAct.cs:14
int idMat
Definition: Recipe.cs:196
List< Ingredient > ingredients
Definition: Recipe.cs:181
int altitude
Definition: TaskBuild.cs:17
Recipe recipe
Definition: TaskBuild.cs:8
int bridgeHeight
Definition: TaskBuild.cs:14
int dir
Definition: TaskBuild.cs:11
Point pos
Definition: TaskPoint.cs:11

References TaskBuild.altitude, TaskBuild.bridgeHeight, Build, TaskBuild.dir, idMat, ingredients, AIAct.owner, TaskPoint.pos, and TaskBuild.recipe.

◆ BuildIngredientList() [1/2]

virtual void Recipe.BuildIngredientList ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 539 of file Recipe.cs.

540 {
542 {
544 }
545 }
List< Recipe.Ingredient > GetIngredients()
virtual bool RequireIngredients
Definition: Recipe.cs:280
bool UseStock
Definition: Recipe.cs:184

References RecipeSource.GetIngredients(), ingredients, RequireIngredients, source, and UseStock.

Referenced by Create(), RecipeManager.Create(), DropIngredients(), BuildMenu.RefreshCategory(), and LayerCraft.RefreshCategory().

◆ BuildIngredientList() [2/2]

void Recipe.BuildIngredientList ( Thing  t)
inline

Definition at line 547 of file Recipe.cs.

548 {
549 UseStock = true;
550 Ingredient item = new Ingredient
551 {
552 id = t.id,
553 tag = null,
554 req = 1,
555 uid = t.uid,
556 thing = t,
557 mat = t.material.id
558 };
559 ingredients.Add(item);
560 }
string id
Definition: Card.cs:36
int uid
Definition: Card.cs:125

References Card.id, ingredients, item, Card.uid, and UseStock.

◆ Craft()

virtual Thing Recipe.Craft ( BlessedState  blessed,
bool  sound = false,
List< Thing ings = null,
TraitCrafter  crafter = null,
bool  model = false 
)
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 566 of file Recipe.cs.

567 {
568 Thing thing = null;
569 thing = source.type switch
570 {
571 "Block" => ThingGen.CreateBlock(tileRow.id, GetMainMaterial().id),
573 "Deco" => ThingGen.CreateDeco(tileRow.id, GetMainMaterial().id),
575 };
576 if (thing == null)
577 {
578 return null;
579 }
580 thing.trait.OnCrafted(this, ings);
581 thing.SetBlessedState(blessed);
582 if (model)
583 {
584 return thing;
585 }
586 Msg.Say("crafted", thing);
587 thing = EClass.pc.AddCard(thing) as Thing;
588 if (thing.GetRootCard() == EClass.pc)
589 {
590 EClass.pc.HoldCard(thing);
591 }
592 return thing;
593 }
Card AddCard(Card c)
Definition: Card.cs:3259
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:4069
Trait trait
Definition: Card.cs:54
Card GetRootCard()
Definition: Card.cs:3600
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4706
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
virtual SourceMaterial.Row GetMainMaterial()
Definition: Recipe.cs:492
static Thing CreateBlock(int id, int idMat)
Definition: ThingGen.cs:101
static Thing CreateObj(int id, int idMat)
Definition: ThingGen.cs:124
static Thing CreateDeco(int id, int idMat)
Definition: ThingGen.cs:116
static Thing CreateFloor(int id, int idMat, bool platform=false)
Definition: ThingGen.cs:108
Definition: Thing.cs:8
virtual void OnCrafted(Recipe recipe, List< Thing > ings)
Definition: Trait.cs:696

References Card.AddCard(), ThingGen.CreateBlock(), ThingGen.CreateDeco(), ThingGen.CreateFloor(), ThingGen.CreateObj(), GetMainMaterial(), Card.GetRootCard(), Chara.HoldCard(), TileRow.id, RecipeSource.isBridge, Trait.OnCrafted(), EClass.pc, Msg.Say(), Card.SetBlessedState(), source, tileRow, and Card.trait.

Referenced by TaskCraft.OnProgressComplete(), LayerCraft.RefreshProduct(), and AI_UseCrafter.Run().

◆ Create() [1/2]

static Recipe Recipe.Create ( RecipeSource  _source,
int  idMat = -1,
Thing  ing = null 
)
inlinestatic

Definition at line 325 of file Recipe.cs.

326 {
327 string type = _source.type;
328 Recipe recipe = (_source.isBridgePillar ? new RecipeBridgePillar() : (type.IsEmpty() ? new RecipeCard() : ((type == "Custom") ? new RecipeCustom() : new Recipe())));
329 recipe.id = _source.id;
330 recipe._source = _source;
331 recipe.idMat = idMat;
332 if (ing != null)
333 {
334 recipe.BuildIngredientList(ing);
335 if (ing.trait is TraitTile)
336 {
337 recipe.VirtualBlock = true;
338 }
339 }
340 return recipe;
341 }
Definition: Recipe.cs:7
RecipeSource _source
Definition: Recipe.cs:202
virtual void BuildIngredientList()
Definition: Recipe.cs:539

References _source, BuildIngredientList(), RecipeSource.id, idMat, and RecipeSource.type.

Referenced by BuildMenu._Search(), RecipeManager.Create(), Trait.GetBuildModeRecipe(), TraitTile.GetBuildModeRecipe(), GetOrCreate(), Trait.GetRecipe(), TraitTile.GetRecipe(), BuildMenu.RefreshCategory(), LayerCraft.RefreshCategory(), LayerCraftFloat.RefreshDisassemble(), and WidgetCodex.Search().

◆ Create() [2/2]

static Recipe Recipe.Create ( Thing  t)
inlinestatic

Definition at line 343 of file Recipe.cs.

344 {
345 RecipeSource recipeSource = RecipeManager.dict.TryGetValue(t.id);
346 if (recipeSource == null)
347 {
348 return null;
349 }
350 RecipeCard recipeCard = new RecipeCard
351 {
352 id = recipeSource.id,
353 _source = recipeSource,
354 IngAsProduct = true,
355 idSkin = t.idSkin
356 };
357 recipeCard.BuildIngredientList(t);
358 if (t.uid == 0 || recipeCard.ingredients[0].uid == 0 || recipeCard.ingredients[0].thing == null)
359 {
360 Debug.LogError("exception: invalid ingredient " + t);
361 }
362 return recipeCard;
363 }
override void BuildIngredientList()
Definition: RecipeCard.cs:65
static Dictionary< string, RecipeSource > dict
int idSkin
Definition: Recipe.cs:198
bool IngAsProduct
Definition: Recipe.cs:187

References _source, RecipeCard.BuildIngredientList(), Debug, RecipeManager.dict, Card.id, RecipeSource.id, idSkin, IngAsProduct, ingredients, and Card.uid.

◆ DropIngredients()

static void Recipe.DropIngredients ( string  id,
string  idMatMain,
int  num = 1 
)
inlinestatic

Definition at line 365 of file Recipe.cs.

366 {
368 Recipe orCreate = GetOrCreate(EClass.sources.cards.map[id].RecipeID);
369 orCreate.BuildIngredientList();
370 Msg.Say("dropReward");
371 foreach (Ingredient ingredient in orCreate.ingredients)
372 {
373 Thing thing = ThingGen.Create(ingredient.id).SetNum(ingredient.req);
374 if (ingredient == orCreate.ingredients[0])
375 {
376 thing.ChangeMaterial(idMatMain);
377 thing.SetNum(num);
378 }
379 EClass.player.DropReward(thing, silent: true);
380 }
381 }
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3210
Thing SetNum(int a)
Definition: Card.cs:3669
static Player player
Definition: EClass.cs:13
Thing DropReward(Thing t, bool silent=false)
Definition: Player.cs:2642
static void BuildList()
static Recipe GetOrCreate(string id)
Definition: Recipe.cs:310
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceCard cards
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53

References BuildIngredientList(), RecipeManager.BuildList(), SourceManager.cards, Card.ChangeMaterial(), ThingGen.Create(), Player.DropReward(), GetOrCreate(), Recipe.Ingredient.id, SourceCard.map, EClass.player, Recipe.Ingredient.req, Msg.Say(), Card.SetNum(), and EClass.sources.

Referenced by DramaOutcome.QuestShippingChest_Drop1().

◆ Duplicate()

virtual Recipe Recipe.Duplicate ( )
inlinevirtual

Reimplemented in RecipeBridgePillar, and RecipeCard.

Definition at line 919 of file Recipe.cs.

920 {
921 return IO.DeepCopy(this);
922 }
Definition: IO.cs:10

◆ GetBoxType()

BaseTileSelector.BoxType Recipe.GetBoxType ( )
inline

Definition at line 473 of file Recipe.cs.

474 {
476 {
477 return BaseTileSelector.BoxType.Box;
478 }
479 return BaseTileSelector.BoxType.Fence;
480 }
virtual BaseTileSelector.BoxType BoxType
Definition: TileType.cs:281

References TileType.BoxType, and tileType.

◆ GetColorMaterial()

virtual SourceMaterial.Row Recipe.GetColorMaterial ( )
inlinevirtual

Definition at line 506 of file Recipe.cs.

507 {
508 if (idMat != -1)
509 {
510 return EClass.sources.materials.map.TryGetValue(idMat) ?? EClass.sources.materials.map[3];
511 }
512 if (UseStock)
513 {
514 ingredients[0].RefreshThing();
515 Thing thing = ingredients[0].thing;
516 if (thing != null)
517 {
518 if (!thing.isDyed)
519 {
520 return thing.material;
521 }
522 return thing.DyeMat;
523 }
524 return EClass.sources.materials.map[3];
525 }
526 int num = 3;
527 if (ingredients.Count > 0)
528 {
529 Ingredient ingredient = ingredients[source.colorIng];
530 num = ((ingredient.thing != null && ingredient.thing.isDyed) ? ingredient.thing.DyeMat.id : ingredient.mat);
531 }
532 if (num == -1)
533 {
534 num = 3;
535 }
536 return EClass.sources.materials.map.TryGetValue(num) ?? EClass.sources.materials.map[3];
537 }
SourceMaterial.Row DyeMat
Definition: Card.cs:1992
SourceMaterial.Row material
Definition: Card.cs:2103
bool isDyed
Definition: Card.cs:461

References RecipeSource.colorIng, Card.DyeMat, idMat, ingredients, Card.isDyed, Recipe.Ingredient.mat, Card.material, SourceManager.materials, source, EClass.sources, Recipe.Ingredient.thing, and UseStock.

Referenced by RecipeCard.Build(), RecipeCard.Craft(), HasSameTile(), DropdownGrid.OnChangeIngredient(), RecipeCard.OnChangeIngredient(), TaskCraft.OnProgressComplete(), UIRecipeInfo.RefreshImages(), AI_UseCrafter.Run(), ButtonGrid.SetRecipeVariation(), and UICardInfo.UpdateRecipe().

◆ GetDefaultColor()

int Recipe.GetDefaultColor ( )
inline

Definition at line 482 of file Recipe.cs.

483 {
484 if (UseStock)
485 {
486 Thing thing = ingredients[0].thing;
487 return renderRow.GetColorInt(thing.isDyed ? thing.DyeMat : thing.material);
488 }
490 }
SourceMaterial.Row DefaultMaterial
Definition: Recipe.cs:206
virtual RenderRow renderRow
Definition: Recipe.cs:210
int GetColorInt(SourceMaterial.Row mat)
Definition: RenderRow.cs:437

References DefaultMaterial, Card.DyeMat, RenderRow.GetColorInt(), ingredients, Card.isDyed, Card.material, renderRow, and UseStock.

Referenced by GridItemRecipe.SetButton(), and ButtonGrid.SetRecipe().

◆ GetDetail()

virtual string Recipe.GetDetail ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 824 of file Recipe.cs.

825 {
826 return renderRow.GetText("detail").IsEmpty(source.GetDetail());
827 }
string GetDetail()
string GetText(string id="name", bool returnNull=false)
Definition: SourceData.cs:688

References RecipeSource.GetDetail(), SourceData< T, T2 >.BaseRow.GetText(), renderRow, and source.

Referenced by UIRecipeInfo.Refresh(), GridItemRecipe.SetButton(), and ButtonGrid.SetCraftRecipe().

◆ GetIdThing()

virtual string Recipe.GetIdThing ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 443 of file Recipe.cs.

444 {
445 if (source.row is SourceBlock.Row)
446 {
447 return (source.row as SourceBlock.Row).idThing;
448 }
449 if (source.row is SourceFloor.Row)
450 {
451 if (!IsBridge)
452 {
453 return "floor";
454 }
455 return "platform";
456 }
457 if (source.row is SourceDeco.Row)
458 {
459 return "deco";
460 }
461 if (source.row is SourceObj.Row)
462 {
463 return "obj";
464 }
465 return null;
466 }
RenderRow row
Definition: RecipeSource.cs:5
bool IsBridge
Definition: Recipe.cs:250

References IsBridge, RecipeSource.row, and source.

Referenced by HitSummary.Execute(), and UIRecipeInfo.Refresh().

◆ GetMainMaterial()

virtual SourceMaterial.Row Recipe.GetMainMaterial ( )
inlinevirtual

Definition at line 492 of file Recipe.cs.

493 {
494 int num = -1;
495 if (ingredients.Count > 0)
496 {
497 num = ((ingredients[0].thing == null) ? ingredients[0].mat : ingredients[0].thing.material.id);
498 }
499 if (num == -1)
500 {
501 num = 3;
502 }
503 return EClass.sources.materials.map.TryGetValue(num) ?? EClass.sources.materials.map[3];
504 }

References ingredients, SourceManager.materials, and EClass.sources.

Referenced by RecipeCard.Build(), Craft(), RecipeCard.Craft(), RecipeCard.OnChangeIngredient(), and TaskCraft.OnProgress().

◆ GetMaxCount()

int Recipe.GetMaxCount ( )
inline

Definition at line 955 of file Recipe.cs.

956 {
957 int num = 999;
958 for (int i = 0; i < ingredients.Count; i++)
959 {
960 Ingredient ingredient = ingredients[i];
961 Thing thing = ingredient.thing;
962 int num2 = 0;
963 if (!ingredient.optional || thing != null)
964 {
965 if (thing != null && !thing.isDestroyed)
966 {
967 num2 = thing.Num / ingredient.req;
968 }
969 if (num2 < num)
970 {
971 num = num2;
972 }
973 }
974 }
975 return num;
976 }
bool isDestroyed
Definition: Card.cs:78

References ingredients, Card.isDestroyed, Recipe.Ingredient.optional, Recipe.Ingredient.req, and Recipe.Ingredient.thing.

Referenced by LayerCraft.RefreshInputNum().

◆ GetName()

string Recipe.GetName ( )
inline

Definition at line 802 of file Recipe.cs.

803 {
804 if (UseStock && ingredients[0].thing == null)
805 {
806 return "";
807 }
808 string text = (UseStock ? ingredients[0].thing.Name : source.Name);
809 if (text == "")
810 {
811 text = ("card_" + source.id).lang();
812 }
813 if (text == "*r")
814 {
815 text = source.row.GetText("aka");
816 }
817 if (text == "*r")
818 {
819 text = "(" + source.row.GetField<string>("id") + ")";
820 }
821 return text.ToTitleCase();
822 }

References SourceData< T, T2 >.BaseRow.GetText(), RecipeSource.id, ingredients, RecipeSource.Name, RecipeSource.row, source, and UseStock.

Referenced by UIRecipeInfo.Refresh(), and ButtonGrid.SetCraftRecipe().

◆ GetOrCreate()

static Recipe Recipe.GetOrCreate ( string  id)
inlinestatic

Definition at line 310 of file Recipe.cs.

311 {
312 Recipe recipe = recipeCache.TryGetValue(id);
313 if (recipe == null)
314 {
315 RecipeSource recipeSource = RecipeManager.dict.TryGetValue(id);
316 if (recipeSource != null)
317 {
318 recipe = Create(recipeSource);
319 recipeCache.Add(id, recipe);
320 }
321 }
322 return recipe;
323 }
static Dictionary< string, Recipe > recipeCache
Definition: Recipe.cs:175
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
Definition: Recipe.cs:325

References Create(), RecipeManager.dict, and recipeCache.

Referenced by PartialMap.Apply(), and DropIngredients().

◆ GetQualityBonus()

int Recipe.GetQualityBonus ( )
inline

Definition at line 397 of file Recipe.cs.

398 {
399 if (IsStaticLV())
400 {
401 return 0;
402 }
403 Element reqSkill = source.GetReqSkill();
404 int num = reqSkill.Value - EClass.pc.Evalue(reqSkill.id);
405 int num2 = 0;
406 if (num > 0)
407 {
408 if (num < 5)
409 {
410 return 0;
411 }
412 return -(num - 4) * 10;
413 }
414 num2 += EClass.curve(-num, 10, 20, 80) / 10 * 10 + 10;
415 if (RecipeLv > 0)
416 {
417 num2 += (int)Mathf.Sqrt(RecipeLv - 1) * 10;
418 }
419 return num2;
420 }
int Evalue(int ele)
Definition: Card.cs:2704
static int curve(long _a, int start, int step, int rate=75)
Definition: EClass.cs:69
int id
Definition: ELEMENT.cs:257
Element GetReqSkill()
int RecipeLv
Definition: Recipe.cs:240
bool IsStaticLV()
Definition: Recipe.cs:383

References EClass.curve(), Card.Evalue(), RecipeSource.GetReqSkill(), Element.id, IsStaticLV(), EClass.pc, RecipeLv, and source.

Referenced by RecipeCard.Craft(), RecipeCard.MakeDish(), and RecipeCard.MixIngredients().

◆ GetQuestTrack()

QuestTrackCraft Recipe.GetQuestTrack ( )
inline

Definition at line 1028 of file Recipe.cs.

1029 {
1030 QuestTrackCraft result = null;
1031 foreach (Quest item in EClass.game.quests.list)
1032 {
1033 if (item is QuestTrackCraft)
1034 {
1035 result = item as QuestTrackCraft;
1036 break;
1037 }
1038 }
1039 return result;
1040 }
static Game game
Definition: EClass.cs:9
QuestManager quests
Definition: Game.cs:183
List< Quest > list
Definition: QuestManager.cs:11
Definition: Quest.cs:7

References EClass.game, item, QuestManager.list, and Game.quests.

Referenced by WidgetCodex.RefreshList(), and LayerCraft.RefreshTrackButton().

◆ GetRefVal()

virtual int Recipe.GetRefVal ( )
inlinevirtual

Definition at line 422 of file Recipe.cs.

423 {
424 if (source.row is SourceBlock.Row)
425 {
426 return (source.row as SourceBlock.Row).id;
427 }
428 if (source.row is SourceFloor.Row)
429 {
430 return (source.row as SourceFloor.Row).id;
431 }
432 if (source.row is SourceDeco.Row)
433 {
434 return (source.row as SourceDeco.Row).id;
435 }
436 if (source.row is SourceObj.Row)
437 {
438 return (source.row as SourceObj.Row).id;
439 }
440 return -1;
441 }

References RecipeSource.row, and source.

Referenced by UIRecipeInfo.Refresh().

◆ GetRenderer()

virtual IRenderer Recipe.GetRenderer ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 854 of file Recipe.cs.

855 {
856 return tileRow.renderData;
857 }
RenderData renderData
Definition: RenderRow.cs:71

References RenderRow.renderData, and tileRow.

Referenced by UICardInfo.UpdateRecipe().

◆ GetSortVal()

int Recipe.GetSortVal ( )
inline

Definition at line 986 of file Recipe.cs.

987 {
988 Element reqSkill = source.GetReqSkill();
989 return reqSkill.source.id * 10000 - reqSkill.Value;
990 }
int Value
Definition: ELEMENT.cs:299

References RecipeSource.GetReqSkill(), source, and Element.Value.

Referenced by LayerCraft.RefreshCategory().

◆ HasFirstTimeBonus()

bool Recipe.HasFirstTimeBonus ( )
inline

Definition at line 992 of file Recipe.cs.

993 {
994 if (IsStaticLV())
995 {
996 return false;
997 }
998 if (EClass.player.recipes.craftedRecipes.Contains(id))
999 {
1000 return false;
1001 }
1002 return true;
1003 }
RecipeManager recipes
Definition: Player.cs:1164
HashSet< string > craftedRecipes

References RecipeManager.craftedRecipes, IsStaticLV(), EClass.player, and Player.recipes.

Referenced by LayerCraft.RefreshCategory(), and TryGetFirstTimeBonus().

◆ HasSameTile()

bool Recipe.HasSameTile ( Point  point,
int  dir,
int  altitude,
int  bridgeHeight 
)
inline

Definition at line 595 of file Recipe.cs.

596 {
597 if (IsObj)
598 {
599 if (point.growth != null && point.sourceObj == tileRow && point.cell.matObj == GetColorMaterial())
600 {
601 return true;
602 }
603 if (dir == point.cell.objDir && point.cell.matObj == GetColorMaterial() && point.sourceObj == tileRow)
604 {
605 return true;
606 }
607 }
608 else if (IsBridge)
609 {
610 if (dir == point.cell.floorDir && point.matBridge == GetColorMaterial() && point.sourceBridge == tileRow && Mathf.Clamp(bridgeHeight + altitude, 0, 255) == point.cell.bridgeHeight)
611 {
612 return true;
613 }
614 }
615 else if (IsFloorOrBridge)
616 {
617 if (dir == point.cell.floorDir && point.matFloor == GetColorMaterial() && point.sourceFloor == tileRow)
618 {
619 return true;
620 }
621 }
622 else if (IsWallOrFence)
623 {
624 if (point.matBlock == GetColorMaterial() && point.sourceBlock == tileRow && dir == point.cell.blockDir)
625 {
626 return true;
627 }
628 }
629 else if (IsBlock && point.matBlock == GetColorMaterial() && (point.sourceBlock == tileRow || (tileRow != null && tileRow.tileType == point.sourceBlock.tileType && tileRow.tileType == TileType.Slope)))
630 {
631 if (point.sourceBlock.tileType.AltitudeAsDir && dir != point.cell.objDir)
632 {
633 return false;
634 }
635 return true;
636 }
637 return false;
638 }
SourceMaterial.Row matObj
Definition: Cell.cs:1046
int floorDir
Definition: Cell.cs:930
int objDir
Definition: Cell.cs:918
byte bridgeHeight
Definition: Cell.cs:82
int blockDir
Definition: Cell.cs:906
SourceMaterial.Row matBlock
Definition: Point.cs:55
SourceMaterial.Row matFloor
Definition: Point.cs:57
SourceBlock.Row sourceBlock
Definition: Point.cs:63
SourceMaterial.Row matBridge
Definition: Point.cs:59
SourceFloor.Row sourceFloor
Definition: Point.cs:65
SourceFloor.Row sourceBridge
Definition: Point.cs:67
bool IsObj
Definition: Recipe.cs:244
virtual bool IsFloorOrBridge
Definition: Recipe.cs:226
virtual bool IsBlock
Definition: Recipe.cs:246
bool IsWallOrFence
Definition: Recipe.cs:248
virtual SourceMaterial.Row GetColorMaterial()
Definition: Recipe.cs:506
TileType tileType
Definition: RenderRow.cs:77
static TileTypeSlope Slope
Definition: TileType.cs:25

References Cell.blockDir, Cell.bridgeHeight, Point.cell, Cell.floorDir, GetColorMaterial(), Point.growth, IsBlock, IsBridge, IsFloorOrBridge, IsObj, IsWallOrFence, Point.matBlock, Point.matBridge, Point.matFloor, Cell.matObj, Cell.objDir, TileType.Slope, Point.sourceBlock, Point.sourceBridge, Point.sourceFloor, Point.sourceObj, tileRow, and RenderRow.tileType.

Referenced by TaskBuild.GetHitResult().

◆ IsCraftable()

bool Recipe.IsCraftable ( )
inline

Definition at line 929 of file Recipe.cs.

930 {
931 foreach (Ingredient ingredient in ingredients)
932 {
933 if (ingredient.optional)
934 {
935 continue;
936 }
937 ThingStack thingStack = EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.AroundPC);
938 bool flag = false;
939 foreach (Thing item in thingStack.list)
940 {
941 if (item.Num >= ingredient.req)
942 {
943 flag = true;
944 break;
945 }
946 }
947 if (!flag)
948 {
949 return false;
950 }
951 }
952 return true;
953 }
StockSearchMode
PropsStocked Stocked
Definition: Map.cs:121
ThingStack ListThingStack(Recipe.Ingredient ing, StockSearchMode searchMode)
Definition: Props.cs:204
List< Thing > list
Definition: ThingStack.cs:5

References EClass._map, ingredients, item, Props.ListThingStack(), Recipe.Ingredient.optional, Recipe.Ingredient.req, and Map.Stocked.

◆ IsStaticLV()

bool Recipe.IsStaticLV ( )
inline

Definition at line 383 of file Recipe.cs.

384 {
385 switch (source.idFactory)
386 {
387 case "factory_floor":
388 case "factory_block":
389 case "factory_wall":
390 case "factory_platform":
391 return true;
392 default:
393 return renderRow.Category.IsChildOf("block");
394 }
395 }
string idFactory
Definition: RecipeSource.cs:87
SourceCategory.Row Category
Definition: RenderRow.cs:119

References RenderRow.Category, RecipeSource.idFactory, renderRow, and source.

Referenced by GetQualityBonus(), HasFirstTimeBonus(), and TryGetFirstTimeBonus().

◆ OnChangeAltitude()

virtual void Recipe.OnChangeAltitude ( int  a)
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 863 of file Recipe.cs.

864 {
865 }

Referenced by AM_Build.SetAltitude().

◆ OnChangeIngredient()

virtual void Recipe.OnChangeIngredient ( )
inlinevirtual

◆ OnRenderMarker()

virtual void Recipe.OnRenderMarker ( Point  point,
bool  active,
HitResult  result,
bool  main,
int  dir,
int  bridgeHeight 
)
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 730 of file Recipe.cs.

731 {
732 if (dir != -1)
733 {
734 _dir = dir;
735 }
736 RenderParam renderParam = tileRow.GetRenderParam(DefaultMaterial, _dir, point, bridgeHeight);
737 renderParam.matColor = (active ? EClass.Colors.blockColors.Active : EClass.Colors.blockColors.Inactive);
738 point.ApplyAnime(renderParam);
739 if (tileType.IsWater)
740 {
742 {
743 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
744 }
745 return;
746 }
748 {
749 Vector3 v = point.Position();
751 {
753 }
754 }
756 {
757 if (bridgeHeight > 0 && !point.cell.skipRender && EClass.screen.guide.isActive)
758 {
759 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
760 }
761 if (!tileType.IsWallOrFence && (point.HasChara || (point.HasObj && point.cell.blocked)))
762 {
763 Vector3 v2 = point.Position();
765 {
767 }
768 return;
769 }
771 {
772 EClass.screen.tileMap.SetRoofHeight(renderParam, point.cell, point.x, point.z, 0, bridgeHeight, tileType.IsWallOrFence ? _dir : (-1), ignoreAltitudeY: true);
773 }
774 renderParam.y = renderParam.y - EClass.screen.tileMap.rendererBlockMarker.offset.y + renderRow.renderData.offset.y;
775 renderParam.z += EClass.setting.render.tileMarkerZ;
776 int num = ((tileType.blockRenderMode != BlockRenderMode.Pillar) ? 1 : (_dir + 1 + ((_dir >= 7) ? _dir : 0)));
777 if (num == 1)
778 {
780 }
781 else
782 {
784 }
785 }
787 {
788 if (point.HasObj)
789 {
790 _ = ref point.Position();
791 }
792 renderParam.z += ((point.cell.liquidLv > 0) ? (-0.01f) : EClass.setting.render.tileMarkerZFloor);
794 }
795 else
796 {
797 renderParam.z += EClass.setting.render.tileMarkerZ;
798 renderRow.renderData.Draw(renderParam);
799 }
800 }
BlockRenderMode
ScreenGuide guide
BaseTileMap tileMap
MeshPass passFloor
Definition: BaseTileMap.cs:145
MeshPass passFloorEx
Definition: BaseTileMap.cs:163
MeshPass passFloorWater
Definition: BaseTileMap.cs:165
RenderData rendererFloorMarker
Definition: BaseTileMap.cs:201
RenderData rendererBlockMarker
Definition: BaseTileMap.cs:199
MeshPass passLiquid
Definition: BaseTileMap.cs:135
void SetRoofHeight(MeshPassParam _param, Cell _cell, int _cx, int _cz, int h=0, int altitude=0, int dirWall=-1, bool ignoreAltitudeY=false)
MeshPass passBlockEx
Definition: BaseTileMap.cs:161
MeshPass passBlock
Definition: BaseTileMap.cs:147
bool skipRender
Definition: Cell.cs:278
BlockColors blockColors
static ColorProfile Colors
Definition: EClass.cs:39
static BaseGameScreen screen
Definition: EClass.cs:33
static GameSetting setting
Definition: EClass.cs:35
RenderSetting render
Definition: GameSetting.cs:303
void Add(Point point, float tile=0f, float color=0f)
Definition: MeshPass.cs:122
ref Vector3 Position(int height)
Definition: Point.cs:553
RenderParam ApplyAnime(RenderParam p)
Definition: Point.cs:1331
bool HasNonWallBlock
Definition: Point.cs:194
int _dir
Definition: Recipe.cs:192
void Draw(RenderParam p, int tile)
Definition: RenderData.cs:129
void DrawRepeat(RenderParam p, int count, float size, bool skipFirst=false)
Definition: RenderData.cs:215
Vector3 offset
Definition: RenderData.cs:19
MeshPass pass
Definition: RenderData.cs:17
virtual RenderParam GetRenderParam(SourceMaterial.Row mat, int dir, Point point=null, int bridgeHeight=-1)
Definition: RenderRow.cs:401
bool isActive
Definition: ScreenGuide.cs:15
MeshPass passGuideBlock
Definition: ScreenGuide.cs:5
MeshPass passGuideFloor
Definition: ScreenGuide.cs:7
virtual float RepeatSize
Definition: TileType.cs:247
virtual bool IsWallOrFence
Definition: TileType.cs:149
virtual bool IsWater
Definition: TileType.cs:169

References _dir, Scene.actionMode, MeshPass.Add(), Point.ApplyAnime(), ColorProfile.blockColors, Algorithms.WeightCell.blocked, Point.cell, EClass.Colors, DefaultMaterial, RenderData.Draw(), RenderData.DrawRepeat(), RenderRow.GetRenderParam(), BaseGameScreen.guide, Point.HasChara, Point.HasNonWallBlock, Point.HasObj, ColorProfile.BlockColors.Inactive, ScreenGuide.isActive, ActionMode.IsRoofEditMode(), TileType.IsWallOrFence, TileType.IsWater, RenderData.offset, RenderData.pass, BaseTileMap.passBlock, BaseTileMap.passBlockEx, BaseTileMap.passFloor, BaseTileMap.passFloorEx, BaseTileMap.passFloorWater, ScreenGuide.passGuideBlock, ScreenGuide.passGuideFloor, BaseTileMap.passLiquid, Point.Position(), GameSetting.render, RenderRow.renderData, BaseTileMap.rendererBlockMarker, BaseTileMap.rendererFloorMarker, renderRow, TileType.RepeatSize, EClass.scene, EClass.screen, BaseTileMap.SetRoofHeight(), EClass.setting, Cell.skipRender, BaseGameScreen.tileMap, GameSetting.RenderSetting.tileMarkerZ, GameSetting.RenderSetting.tileMarkerZFloor, tileRow, tileType, Point.x, and Point.z.

Referenced by PartialMap.Apply(), TaskBuild.DrawMarker(), and AM_Build.OnRenderTile().

◆ OnSelected()

virtual void Recipe.OnSelected ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 859 of file Recipe.cs.

860 {
861 }

Referenced by UIRecipeInfo.Refresh().

◆ Rotate()

virtual void Recipe.Rotate ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 867 of file Recipe.cs.

868 {
869 if (EInput.isShiftDown || Input.GetMouseButton(1))
870 {
871 _dir--;
872 }
873 else
874 {
875 _dir++;
876 }
878 {
880 {
881 _dir = 0;
882 }
883 if (_dir < 0)
884 {
885 _dir = tileType.MaxAltitude - 1;
886 }
887 }
888 else
889 {
890 int num = tileRow._tiles.Length;
892 {
893 num = 2;
894 }
895 if (_dir < 0)
896 {
897 _dir = num - 1;
898 }
899 if (_dir >= num)
900 {
901 _dir = 0;
902 }
903 }
904 if ((bool)BuildMenu.Instance)
905 {
907 }
908 }
UIRecipeInfo info1
Definition: BuildMenu.cs:27
Definition: EInput.cs:8
static bool isShiftDown
Definition: EInput.cs:272
int[] _tiles
Definition: RenderRow.cs:12
virtual int MaxAltitude
Definition: TileType.cs:214
static TileTypeDoor Door
Definition: TileType.cs:101
void OnRotate()

References _dir, RenderRow._tiles, TileType.AltitudeAsDir, TileType.Door, BuildMenu.info1, BuildMenu.Instance, EInput.isShiftDown, TileType.MaxAltitude, UIRecipeInfo.OnRotate(), tileRow, tileType, and RenderRow.tileType.

Referenced by AM_Adv._OnUpdateInput(), and AM_Build.RotateUnderMouse().

◆ SaveLastIngredients()

void Recipe.SaveLastIngredients ( )
inline

Definition at line 1017 of file Recipe.cs.

1018 {
1019 List<int> list = new List<int>();
1020 foreach (Ingredient ingredient in ingredients)
1021 {
1022 int item = ((ingredient.thing != null) ? ingredient.thing.uid : 0);
1023 list.Add(item);
1024 }
1026 }
Dictionary< string, List< int > > lastIngredients
string id
Definition: Recipe.cs:178

References id, ingredients, item, RecipeManager.lastIngredients, EClass.player, Player.recipes, Recipe.Ingredient.thing, and Card.uid.

Referenced by DropdownGrid.Activate(), LayerCraft.OnClickCraft(), LayerCraft.RefreshCategory(), and ButtonGrid.SetIngredient().

◆ SetDir()

virtual void Recipe.SetDir ( int  d)
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 910 of file Recipe.cs.

911 {
912 _dir = d;
913 if ((bool)BuildMenu.Instance)
914 {
916 }
917 }

References _dir, BuildMenu.info1, BuildMenu.Instance, and UIRecipeInfo.OnRotate().

Referenced by TaskBuild.GetHitResult(), and UIRecipeInfo.Refresh().

◆ SetImage()

virtual void Recipe.SetImage ( Image  icon)
inlinevirtual

Definition at line 924 of file Recipe.cs.

925 {
926 renderRow.SetImage(icon, null, renderRow.GetColorInt((ingredients != null && ingredients.Count > 0 && ingredients[0].thing != null) ? ingredients[0].thing.material : DefaultMaterial), setNativeSize: true, 0, idSkin);
927 }
void SetImage(Image image, Sprite sprite=null, int matCol=0, bool setNativeSize=true, int dir=0, int idSkin=0, Card card=null)
Definition: RenderRow.cs:359

References DefaultMaterial, RenderRow.GetColorInt(), idSkin, ingredients, renderRow, and RenderRow.SetImage().

Referenced by ButtonGrid.SetCraftRecipe().

◆ SetTextDifficulty()

void Recipe.SetTextDifficulty ( UIText  text)
inline

Definition at line 978 of file Recipe.cs.

979 {
980 Element reqSkill = source.GetReqSkill();
982 string text2 = reqSkill.Name + " " + reqSkill.Value;
983 text.SetText(text2);
984 }
ElementContainerCard elements
Definition: Card.cs:42
Element GetOrCreateElement(Element ele)
void SetText(string s)
Definition: UIText.cs:163

References Card.elements, ElementContainer.GetOrCreateElement(), RecipeSource.GetReqSkill(), EClass.pc, UIText.SetText(), source, and Element.Value.

Referenced by UIRecipeInfo.RefreshQuality().

◆ ShouldShowHighlight()

virtual bool Recipe.ShouldShowHighlight ( HitResult  r)
inlinevirtual

Definition at line 468 of file Recipe.cs.

469 {
470 return r != HitResult.Valid;
471 }
HitResult
Definition: HitResult.cs:2

◆ ToggleTrack()

void Recipe.ToggleTrack ( QuestTrackCraft  quest)
inline

Definition at line 1042 of file Recipe.cs.

1043 {
1044 if (quest != null && quest.idRecipe == id)
1045 {
1046 EClass.game.quests.Remove(quest);
1047 }
1048 else
1049 {
1050 if (quest != null)
1051 {
1052 EClass.game.quests.Remove(quest);
1053 }
1054 QuestTrackCraft questTrackCraft = Quest.Create("track_craft") as QuestTrackCraft;
1055 questTrackCraft.SetRecipe(this);
1056 EClass.game.quests.Start(questTrackCraft);
1057 }
1059 {
1060 EClass.player.questTracker = true;
1061 EClass.ui.widgets.ActivateWidget("QuestTracker");
1063 }
1065 }
static UI ui
Definition: EClass.cs:17
void Remove(Quest q)
Definition: QuestManager.cs:67
Quest Start(string id, string idGlobalChara)
Definition: QuestManager.cs:41
void SetRecipe(Recipe r)
static Quest Create(string _id, string _idPerson=null, Chara c=null, bool assignQuest=true)
Definition: Quest.cs:241
static void RefreshButtons()
static WidgetQuestTracker Instance

References Quest.Create(), EClass.game, QuestTrackCraft.idRecipe, WidgetQuestTracker.Instance, Game.quests, WidgetQuestTracker.Refresh(), WidgetHotbar.RefreshButtons(), QuestManager.Remove(), QuestTrackCraft.SetRecipe(), QuestManager.Start(), and EClass.ui.

Referenced by WidgetCodex.RefreshList(), and LayerCraft.RefreshTrackButton().

◆ TryGetFirstTimeBonus()

void Recipe.TryGetFirstTimeBonus ( )
inline

Definition at line 1005 of file Recipe.cs.

1006 {
1007 if (HasFirstTimeBonus())
1008 {
1010 Element reqSkill = source.GetReqSkill();
1011 int num = 1 + ((!IsStaticLV()) ? (reqSkill.Value / 20) : 0);
1012 Msg.Say("firstTimeCraft", Name);
1013 EClass.pc.Pick(ThingGen.Create("ticket_fortune").SetNum(num));
1014 }
1015 }
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4542
string Name
Definition: Recipe.cs:212
bool HasFirstTimeBonus()
Definition: Recipe.cs:992

References RecipeManager.craftedRecipes, ThingGen.Create(), RecipeSource.GetReqSkill(), HasFirstTimeBonus(), IsStaticLV(), Name, EClass.pc, Chara.Pick(), EClass.player, Player.recipes, Msg.Say(), Card.SetNum(), source, and Element.Value.

Referenced by AI_UseCrafter.Run().

◆ WriteNote()

virtual void Recipe.WriteNote ( UINote  n)
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 829 of file Recipe.cs.

830 {
831 n.Clear();
832 n.Build();
833 }
void Clear()
Definition: UINote.cs:35
void Build()
Definition: UINote.cs:49

References UINote.Build(), and UINote.Clear().

Referenced by UIRecipeInfo.Refresh().

◆ WriteReqFactory()

void Recipe.WriteReqFactory ( UINote  n,
bool  hasFactory = true 
)
inline

Definition at line 835 of file Recipe.cs.

836 {
838 {
839 n.AddHeaderTopic("reqFactory".lang(source.NameFactory.TagColor(hasFactory ? FontColor.Default : FontColor.Bad)));
840 n.Space(8);
841 }
842 }
FontColor
Definition: FontColor.cs:2
string NameFactory
Definition: RecipeSource.cs:75
bool NeedFactory
Definition: RecipeSource.cs:63
UIItem AddHeaderTopic(string text, Sprite sprite=null)
Definition: UINote.cs:89
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62

References UINote.AddHeaderTopic(), RecipeSource.NameFactory, RecipeSource.NeedFactory, source, and UINote.Space().

Referenced by ButtonGrid.WriteReqMat().

◆ WriteReqSkill()

void Recipe.WriteReqSkill ( UINote  n)
inline

Definition at line 844 of file Recipe.cs.

845 {
846 n.AddHeaderTopic("reqSkill");
847 Element reqSkill = source.GetReqSkill();
848 int value = EClass.pc.elements.GetOrCreateElement(reqSkill).Value;
849 Color textColor = EClass.Colors.Skin.GetTextColor((value >= reqSkill.Value) ? FontColor.Good : FontColor.Warning);
850 n.AddText(null, reqSkill.Name + " " + reqSkill.Value + " (" + value + ")", textColor).text1.SetSize(-1);
851 n.Space(8);
852 }
SkinColorProfile Skin
virtual string Name
Definition: ELEMENT.cs:311
Color GetTextColor(FontColor fontColor)
UIText text1
Definition: UIItem.cs:6
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
UIText SetSize(int a)
Definition: UIText.cs:231

References UINote.AddHeaderTopic(), UINote.AddText(), Color, EClass.Colors, Card.elements, ElementContainer.GetOrCreateElement(), RecipeSource.GetReqSkill(), SkinColorProfile.GetTextColor(), Element.Name, EClass.pc, UIText.SetSize(), ColorProfile.Skin, source, UINote.Space(), UIItem.text1, and Element.Value.

Referenced by ButtonGrid.WriteReqMat().

Member Data Documentation

◆ _dir

◆ _source

RecipeSource Recipe._source

Definition at line 202 of file Recipe.cs.

Referenced by Create().

◆ id

◆ idMat

int Recipe.idMat = -1

Definition at line 196 of file Recipe.cs.

Referenced by Build(), Create(), and GetColorMaterial().

◆ idSkin

◆ IngAsProduct

bool Recipe.IngAsProduct

◆ ingredients

◆ recipeCache

Dictionary<string, Recipe> Recipe.recipeCache = new Dictionary<string, Recipe>()
static

Definition at line 175 of file Recipe.cs.

Referenced by GetOrCreate().

◆ state

State Recipe.state

Definition at line 200 of file Recipe.cs.

◆ sync

int Recipe.sync

Definition at line 194 of file Recipe.cs.

◆ UseStock

◆ VirtualBlock

Property Documentation

◆ CanRotate

virtual bool Recipe.CanRotate
get

Definition at line 298 of file Recipe.cs.

299 {
300 get
301 {
302 if (tileType.CanRotate(buildMode: true))
303 {
304 return tileRow._tiles.Length > 1;
305 }
306 return false;
307 }
308 }
virtual bool CanRotate(bool buildMode)
Definition: TileType.cs:302

Referenced by ActionMode.GetHintText(), and AM_Build.RotateUnderMouse().

◆ CostMoney

virtual int Recipe.CostMoney
get

Definition at line 296 of file Recipe.cs.

Referenced by UIRecipeInfo.Refresh(), and UIRecipeInfo.RefreshList().

◆ DefaultMaterial

SourceMaterial.Row Recipe.DefaultMaterial
get

◆ H

virtual int Recipe.H
get

Definition at line 268 of file Recipe.cs.

269 {
270 get
271 {
272 if (_dir % 2 != 0)
273 {
274 return renderRow.W;
275 }
276 return renderRow.H;
277 }
278 }

Referenced by UIInspector.DrawHighlight(), HotItemHeld.OnRenderTile(), and AI_HaulResource.Run().

◆ IsBlock

virtual bool Recipe.IsBlock
get

◆ IsBridge

◆ IsFloor

bool Recipe.IsFloor
get

Definition at line 242 of file Recipe.cs.

Referenced by AM_Build.HitTest().

◆ IsFloorOrBridge

virtual bool Recipe.IsFloorOrBridge
get

Definition at line 226 of file Recipe.cs.

Referenced by HasSameTile(), and AM_Build.OnRenderTile().

◆ IsObj

bool Recipe.IsObj
get

Definition at line 244 of file Recipe.cs.

Referenced by HasSameTile().

◆ IsThing

virtual bool Recipe.IsThing
get

Definition at line 252 of file Recipe.cs.

Referenced by TaskBuild.GetHitResult(), and AM_Build.IsFillMode().

◆ IsWallOrFence

bool Recipe.IsWallOrFence
get

Definition at line 248 of file Recipe.cs.

Referenced by TaskBuild.GetHitResult(), HasSameTile(), and AM_Build.OnProcessTiles().

◆ MaxAltitude

int Recipe.MaxAltitude
get

Definition at line 228 of file Recipe.cs.

229 {
230 get
231 {
233 {
234 return tileType.MaxAltitude;
235 }
236 return 0;
237 }
238 }
virtual bool IsThing
Definition: Recipe.cs:252
virtual BlockRenderMode blockRenderMode
Definition: TileType.cs:285

Referenced by HotItemHeld.CanChangeHeightByWheel(), AM_Build.InputWheel(), and UIPlaceHelper.Refresh().

◆ Mold

virtual Card Recipe.Mold
get

Definition at line 254 of file Recipe.cs.

Referenced by TaskBuild._GetHitResult().

◆ MultiSize

bool Recipe.MultiSize
get

Definition at line 282 of file Recipe.cs.

283 {
284 get
285 {
286 if (W == 1)
287 {
288 return H != 1;
289 }
290 return true;
291 }
292 }
virtual int H
Definition: Recipe.cs:269
virtual int W
Definition: Recipe.cs:257

Referenced by UIInspector.DrawHighlight(), TaskBuild.GetHitResult(), and HotItemHeld.OnRenderTile().

◆ Name

string Recipe.Name
get

Definition at line 212 of file Recipe.cs.

Referenced by GridItemRecipe.SetButton(), UICardInfo.SetRecipe(), and TryGetFirstTimeBonus().

◆ RecipeLv

int Recipe.RecipeLv
get

Definition at line 240 of file Recipe.cs.

Referenced by GetQualityBonus().

◆ renderRow

◆ RequireIngredients

virtual bool Recipe.RequireIngredients
get

Definition at line 280 of file Recipe.cs.

Referenced by BuildIngredientList(), and HitSummary.Execute().

◆ source

◆ tileRow

virtual TileRow Recipe.tileRow
get

◆ tileSelector

BaseTileSelector Recipe.tileSelector
get

Definition at line 294 of file Recipe.cs.

◆ tileType

◆ W

virtual int Recipe.W
get

Definition at line 256 of file Recipe.cs.

257 {
258 get
259 {
260 if (_dir % 2 != 0)
261 {
262 return renderRow.H;
263 }
264 return renderRow.W;
265 }
266 }

Referenced by UIInspector.DrawHighlight(), HotItemHeld.OnRenderTile(), and AI_HaulResource.Run().


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