Elin Decompiled Documentation EA 23.189 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 (int a, int start, int step, int rate=75)
 
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 628 of file Recipe.cs.

629 {
630 if (mat == -1)
631 {
632 mat = 2;
633 }
634 EClass.pc.PlaySound(EClass.sources.materials.rows[mat].GetSoundImpact());
635 pos.cell.isModified = true;
636 switch (source.type)
637 {
638 case "Block":
639 {
640 int ramp = tileRow.id;
641 if (ramp == 3)
642 {
643 ramp = EClass.sources.materials.rows[mat].ramp;
644 }
646 {
647 EClass._map.SetRoofBlock(pos.x, pos.z, mat, ramp, dir, altitude);
648 break;
649 }
650 if (pos.HasObj && !pos.sourceObj.tileType.CanBuiltOnBlock)
651 {
653 EClass._map.SetObj(pos.x, pos.z);
654 }
655 EClass._map.SetBlock(pos.x, pos.z, mat, ramp, dir);
656 if (tileType.IsBlockPass && pos.HasChara)
657 {
658 foreach (Chara item in pos.ListCharas())
659 {
660 chara.Kick(item, ignoreSelf: false, karmaLoss: false);
661 }
662 }
664 {
665 pos.cell.objDir = dir;
666 }
667 {
668 foreach (Card item2 in pos.ListCards())
669 {
670 if (item2.isThing && item2.placeState == PlaceState.roaming)
671 {
672 item2._Move(item2.pos.GetNearestPoint());
673 }
674 }
675 break;
676 }
677 }
678 case "Floor":
679 if (pos.HasObj && pos.sourceObj.tileType.RemoveOnFloorChange && (!BuildMenu.Instance || !EClass.debug.ignoreBuildRule))
680 {
681 EClass._map.SetObj(pos.x, pos.z);
682 }
683 EClass._map.SetFloor(pos.x, pos.z, mat, tileRow.id, dir);
684 break;
685 case "Bridge":
686 if (pos.sourceObj.tileType.RemoveOnFloorChange)
687 {
688 EClass._map.SetObj(pos.x, pos.z);
689 }
690 EClass._map.SetBridge(pos.x, pos.z, Mathf.Clamp(bridgeHeight + altitude, 0, 255), mat, tileRow.id, dir);
691 break;
692 case "Obj":
693 EClass._map.SetObj(pos.x, pos.z, mat, tileRow.id, 1, dir, ignoreRandomMat: true);
695 {
696 EClass._map.SetBlockDir(pos.x, pos.z, dir);
697 }
698 if (pos.growth != null)
699 {
701 }
702 break;
703 }
704 }
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:5541
virtual bool isThing
Definition: Card.cs:2043
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5852
PlaceState placeState
Definition: Card.cs:81
Point pos
Definition: Card.cs:57
Definition: Chara.cs:10
void Kick(Point p, bool ignoreSelf=false)
Definition: Chara.cs:5488
bool ignoreBuildRule
Definition: CoreDebug.cs:185
Definition: EClass.cs:5
static Scene scene
Definition: EClass.cs:30
static Map _map
Definition: EClass.cs:18
static SourceManager sources
Definition: EClass.cs:42
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
void SetDefaultStage()
Definition: GrowSystem.cs:259
void SetBridge(int x, int z, int height=0, int idMat=0, int idBridge=0, int dir=0)
Definition: Map.cs:972
void SetBlockDir(int x, int z, int dir)
Definition: Map.cs:1165
void MineObjSound(Point point)
Definition: Map.cs:1937
void SetFloor(int x, int z, int idMat=0, int idFloor=0)
Definition: Map.cs:957
void SetBlock(int x, int z, int idMat=0, int idBlock=0)
Definition: Map.cs:996
void SetRoofBlock(int x, int z, int idMat, int idBlock, int dir, int height)
Definition: Map.cs:987
void SetObj(int x, int z, int id=0, int value=1, int dir=0)
Definition: Map.cs:1535
List< Card > ListCards(bool includeMasked=false)
Definition: Point.cs:1035
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:607
int z
Definition: Point.cs:39
SourceObj.Row sourceObj
Definition: Point.cs:69
List< Chara > ListCharas()
Definition: Point.cs:1155
bool HasObj
Definition: Point.cs:137
GrowSystem growth
Definition: Point.cs:77
bool HasChara
Definition: Point.cs:226
string type
Definition: RecipeSource.cs:7
virtual TileRow tileRow
Definition: Recipe.cs:209
virtual TileType tileType
Definition: Recipe.cs:216
RecipeSource source
Definition: Recipe.cs:205
ActionMode actionMode
Definition: Scene.cs:79
SourceMaterial materials
int id
Definition: TileRow.cs:8
virtual bool AltitudeAsDir
Definition: TileType.cs:209
virtual bool ChangeBlockDir
Definition: TileType.cs:127
virtual bool IsBlockPass
Definition: TileType.cs:153

References EClass._map, Card._Move(), Scene.actionMode, TileType.AltitudeAsDir, TileType.ChangeBlockDir, EClass.debug, Point.GetNearestPoint(), Point.growth, Point.HasChara, Point.HasObj, TileRow.id, CoreDebug.ignoreBuildRule, BuildMenu.Instance, TileType.IsBlockPass, ActionMode.IsRoofEditMode(), Card.isThing, item, Chara.Kick(), Point.ListCards(), Point.ListCharas(), SourceManager.materials, Map.MineObjSound(), EClass.pc, Card.placeState, Card.PlaySound(), Card.pos, EClass.scene, Map.SetBlock(), Map.SetBlockDir(), Map.SetBridge(), 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 623 of file Recipe.cs.

624 {
625 Build(task.owner, null, task.pos, (ingredients.Count > 0) ? ingredients[0].mat : task.recipe.idMat, task.dir, task.altitude, task.bridgeHeight);
626 }
new Chara owner
Definition: AIAct.cs:14
int idMat
Definition: Recipe.cs:197
List< Ingredient > ingredients
Definition: Recipe.cs:182
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.

Referenced by TaskBuild.OnProgressComplete().

◆ BuildIngredientList() [1/2]

virtual void Recipe.BuildIngredientList ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 527 of file Recipe.cs.

528 {
530 {
532 }
533 }
List< Recipe.Ingredient > GetIngredients()
virtual bool RequireIngredients
Definition: Recipe.cs:281
bool UseStock
Definition: Recipe.cs:185

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 535 of file Recipe.cs.

536 {
537 UseStock = true;
538 Ingredient item = new Ingredient
539 {
540 id = t.id,
541 tag = null,
542 req = 1,
543 uid = t.uid,
544 thing = t,
545 mat = t.material.id
546 };
547 ingredients.Add(item);
548 }
string id
Definition: Card.cs:33
int uid
Definition: Card.cs:120

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 554 of file Recipe.cs.

555 {
556 Thing thing = null;
557 string type = source.type;
558 thing = ((type == "Block") ? ThingGen.CreateBlock(tileRow.id, GetMainMaterial().id) : ((!(type == "Obj")) ? ThingGen.CreateFloor(tileRow.id, GetMainMaterial().id, source.isBridge) : ThingGen.CreateObj(tileRow.id, GetMainMaterial().id)));
559 if (thing == null)
560 {
561 return null;
562 }
563 thing.trait.OnCrafted(this, ings);
564 thing.SetBlessedState(blessed);
565 if (model)
566 {
567 return thing;
568 }
569 Msg.Say("crafted", thing);
570 thing = EClass.pc.AddCard(thing) as Thing;
571 if (thing.GetRootCard() == EClass.pc)
572 {
573 EClass.pc.HoldCard(thing);
574 }
575 return thing;
576 }
Card AddCard(Card c)
Definition: Card.cs:3043
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:3787
Trait trait
Definition: Card.cs:51
Card GetRootCard()
Definition: Card.cs:3324
void HoldCard(Card t, int num=-1)
Definition: Chara.cs:4351
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:485
static Thing CreateBlock(int id, int idMat)
Definition: ThingGen.cs:101
static Thing CreateObj(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:655

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

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 326 of file Recipe.cs.

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

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 344 of file Recipe.cs.

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

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 366 of file Recipe.cs.

367 {
369 Recipe orCreate = GetOrCreate(EClass.sources.cards.map[id].RecipeID);
370 orCreate.BuildIngredientList();
371 Msg.Say("dropReward");
372 foreach (Ingredient ingredient in orCreate.ingredients)
373 {
374 Thing thing = ThingGen.Create(ingredient.id).SetNum(ingredient.req);
375 if (ingredient == orCreate.ingredients[0])
376 {
377 thing.ChangeMaterial(idMatMain);
378 thing.SetNum(num);
379 }
380 EClass.player.DropReward(thing, silent: true);
381 }
382 }
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:2994
Thing SetNum(int a)
Definition: Card.cs:3393
static Player player
Definition: EClass.cs:12
Thing DropReward(Thing t, bool silent=false)
Definition: Player.cs:2439
static void BuildList()
static Recipe GetOrCreate(string id)
Definition: Recipe.cs:311
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
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 895 of file Recipe.cs.

896 {
897 return IO.DeepCopy(this);
898 }
Definition: IO.cs:11

◆ GetBoxType()

BaseTileSelector.BoxType Recipe.GetBoxType ( )
inline

Definition at line 466 of file Recipe.cs.

467 {
469 {
470 return BaseTileSelector.BoxType.Box;
471 }
472 return BaseTileSelector.BoxType.Fence;
473 }
virtual BaseTileSelector.BoxType BoxType
Definition: TileType.cs:263

References TileType.BoxType, and tileType.

◆ GetColorMaterial()

virtual SourceMaterial.Row Recipe.GetColorMaterial ( )
inlinevirtual

Definition at line 499 of file Recipe.cs.

500 {
501 if (idMat != -1)
502 {
503 return EClass.sources.materials.rows[idMat];
504 }
505 if (UseStock)
506 {
507 ingredients[0].RefreshThing();
508 Thing thing = ingredients[0].thing;
509 if (thing != null)
510 {
511 if (!thing.isDyed)
512 {
513 return thing.material;
514 }
515 return thing.DyeMat;
516 }
517 return EClass.sources.materials.rows[3];
518 }
519 int num = ((ingredients.Count > 0) ? ingredients[source.colorIng].mat : 3);
520 if (num == -1)
521 {
522 num = 3;
523 }
524 return EClass.sources.materials.rows[num];
525 }
SourceMaterial.Row DyeMat
Definition: Card.cs:1902
SourceMaterial.Row material
Definition: Card.cs:2013
bool isDyed
Definition: Card.cs:444

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

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

◆ GetDefaultColor()

int Recipe.GetDefaultColor ( )
inline

Definition at line 475 of file Recipe.cs.

476 {
477 if (UseStock)
478 {
479 Thing thing = ingredients[0].thing;
480 return renderRow.GetColorInt(thing.isDyed ? thing.DyeMat : thing.material);
481 }
483 }
SourceMaterial.Row DefaultMaterial
Definition: Recipe.cs:207
virtual RenderRow renderRow
Definition: Recipe.cs:211
int GetColorInt(SourceMaterial.Row mat)
Definition: RenderRow.cs:424

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 800 of file Recipe.cs.

801 {
802 return renderRow.GetText("detail").IsEmpty(source.GetDetail());
803 }
string GetDetail()
string GetText(string id="name", bool returnNull=false)
Definition: SourceData.cs:553

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 440 of file Recipe.cs.

441 {
442 if (source.row is SourceBlock.Row)
443 {
444 return (source.row as SourceBlock.Row).idThing;
445 }
446 if (source.row is SourceFloor.Row)
447 {
448 if (!IsBridge)
449 {
450 return "floor";
451 }
452 return "platform";
453 }
454 if (source.row is SourceObj.Row)
455 {
456 return "obj";
457 }
458 return null;
459 }
RenderRow row
Definition: RecipeSource.cs:5
bool IsBridge
Definition: Recipe.cs:251

References IsBridge, RecipeSource.row, and source.

Referenced by UIRecipeInfo.Refresh().

◆ GetMainMaterial()

virtual SourceMaterial.Row Recipe.GetMainMaterial ( )
inlinevirtual

Definition at line 485 of file Recipe.cs.

486 {
487 int num = -1;
488 if (ingredients.Count > 0)
489 {
490 num = ((ingredients[0].thing == null) ? ingredients[0].mat : ingredients[0].thing.material.id);
491 }
492 if (num == -1)
493 {
494 num = 3;
495 }
496 return EClass.sources.materials.rows[num];
497 }

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 931 of file Recipe.cs.

932 {
933 int num = 999;
934 for (int i = 0; i < ingredients.Count; i++)
935 {
936 Ingredient ingredient = ingredients[i];
937 Thing thing = ingredient.thing;
938 int num2 = 0;
939 if (!ingredient.optional || thing != null)
940 {
941 if (thing != null && !thing.isDestroyed)
942 {
943 num2 = thing.Num / ingredient.req;
944 }
945 if (num2 < num)
946 {
947 num = num2;
948 }
949 }
950 }
951 return num;
952 }
bool isDestroyed
Definition: Card.cs:73

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 778 of file Recipe.cs.

779 {
780 if (UseStock && ingredients[0].thing == null)
781 {
782 return "";
783 }
784 string text = (UseStock ? ingredients[0].thing.Name : source.Name);
785 if (text == "")
786 {
787 text = ("card_" + source.id).lang();
788 }
789 if (text == "*r")
790 {
791 text = source.row.GetText("aka");
792 }
793 if (text == "*r")
794 {
795 text = "(" + source.row.GetField<string>("id") + ")";
796 }
797 return text.ToTitleCase();
798 }

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 311 of file Recipe.cs.

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

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

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

◆ GetQualityBonus()

int Recipe.GetQualityBonus ( )
inline

Definition at line 398 of file Recipe.cs.

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

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 1004 of file Recipe.cs.

1005 {
1006 QuestTrackCraft result = null;
1007 foreach (Quest item in EClass.game.quests.list)
1008 {
1009 if (item is QuestTrackCraft)
1010 {
1011 result = item as QuestTrackCraft;
1012 break;
1013 }
1014 }
1015 return result;
1016 }
static Game game
Definition: EClass.cs:8
QuestManager quests
Definition: Game.cs:179
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 423 of file Recipe.cs.

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

References RecipeSource.row, and source.

Referenced by UIRecipeInfo.Refresh().

◆ GetRenderer()

virtual IRenderer Recipe.GetRenderer ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 830 of file Recipe.cs.

831 {
832 return tileRow.renderData;
833 }
RenderData renderData
Definition: RenderRow.cs:71

References RenderRow.renderData, and tileRow.

Referenced by UICardInfo.UpdateRecipe().

◆ GetSortVal()

int Recipe.GetSortVal ( )
inline

Definition at line 962 of file Recipe.cs.

963 {
964 Element reqSkill = source.GetReqSkill();
965 return reqSkill.source.id * 10000 - reqSkill.Value;
966 }
int Value
Definition: ELEMENT.cs:290

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

Referenced by LayerCraft.RefreshCategory().

◆ HasFirstTimeBonus()

bool Recipe.HasFirstTimeBonus ( )
inline

Definition at line 968 of file Recipe.cs.

969 {
970 if (IsStaticLV())
971 {
972 return false;
973 }
974 if (EClass.player.recipes.craftedRecipes.Contains(id))
975 {
976 return false;
977 }
978 return true;
979 }
RecipeManager recipes
Definition: Player.cs:1017
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 578 of file Recipe.cs.

579 {
580 if (IsObj)
581 {
582 if (point.growth != null && point.sourceObj == tileRow && point.cell.matObj == GetColorMaterial())
583 {
584 return true;
585 }
586 if (dir == point.cell.objDir && point.cell.matObj == GetColorMaterial() && point.sourceObj == tileRow)
587 {
588 return true;
589 }
590 }
591 else if (IsBridge)
592 {
593 if (dir == point.cell.floorDir && point.matBridge == GetColorMaterial() && point.sourceBridge == tileRow && Mathf.Clamp(bridgeHeight + altitude, 0, 255) == point.cell.bridgeHeight)
594 {
595 return true;
596 }
597 }
598 else if (IsFloorOrBridge)
599 {
600 if (dir == point.cell.floorDir && point.matFloor == GetColorMaterial() && point.sourceFloor == tileRow)
601 {
602 return true;
603 }
604 }
605 else if (IsWallOrFence)
606 {
607 if (point.matBlock == GetColorMaterial() && point.sourceBlock == tileRow && dir == point.cell.blockDir)
608 {
609 return true;
610 }
611 }
612 else if (IsBlock && point.matBlock == GetColorMaterial() && point.sourceBlock == tileRow)
613 {
614 if (point.sourceBlock.tileType.AltitudeAsDir && dir != point.cell.objDir)
615 {
616 return false;
617 }
618 return true;
619 }
620 return false;
621 }
SourceMaterial.Row matObj
Definition: Cell.cs:1036
int floorDir
Definition: Cell.cs:922
int objDir
Definition: Cell.cs:910
byte bridgeHeight
Definition: Cell.cs:74
int blockDir
Definition: Cell.cs:898
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
Cell cell
Definition: Point.cs:51
SourceFloor.Row sourceBridge
Definition: Point.cs:67
bool IsObj
Definition: Recipe.cs:245
virtual bool IsFloorOrBridge
Definition: Recipe.cs:227
virtual bool IsBlock
Definition: Recipe.cs:247
bool IsWallOrFence
Definition: Recipe.cs:249
virtual SourceMaterial.Row GetColorMaterial()
Definition: Recipe.cs:499

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, Point.sourceBlock, Point.sourceBridge, Point.sourceFloor, Point.sourceObj, and tileRow.

Referenced by TaskBuild.GetHitResult().

◆ IsCraftable()

bool Recipe.IsCraftable ( )
inline

Definition at line 905 of file Recipe.cs.

906 {
907 foreach (Ingredient ingredient in ingredients)
908 {
909 if (ingredient.optional)
910 {
911 continue;
912 }
913 ThingStack thingStack = EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.AroundPC);
914 bool flag = false;
915 foreach (Thing item in thingStack.list)
916 {
917 if (item.Num >= ingredient.req)
918 {
919 flag = true;
920 break;
921 }
922 }
923 if (!flag)
924 {
925 return false;
926 }
927 }
928 return true;
929 }
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 384 of file Recipe.cs.

385 {
386 switch (source.idFactory)
387 {
388 case "factory_floor":
389 case "factory_block":
390 case "factory_wall":
391 case "factory_platform":
392 return true;
393 default:
394 return renderRow.Category.IsChildOf("block");
395 }
396 }
string idFactory
Definition: RecipeSource.cs:85
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 839 of file Recipe.cs.

840 {
841 }

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 706 of file Recipe.cs.

707 {
708 if (dir != -1)
709 {
710 _dir = dir;
711 }
712 RenderParam renderParam = tileRow.GetRenderParam(DefaultMaterial, _dir, point, bridgeHeight);
713 renderParam.matColor = (active ? EClass.Colors.blockColors.Active : EClass.Colors.blockColors.Inactive);
714 point.ApplyAnime(renderParam);
715 if (tileType.IsWater)
716 {
718 {
719 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
720 }
721 return;
722 }
724 {
725 Vector3 v = point.Position();
727 {
729 }
730 }
732 {
733 if (bridgeHeight > 0 && !point.cell.skipRender && EClass.screen.guide.isActive)
734 {
735 EClass.screen.guide.passGuideFloor.Add(point, (float)result, 0.3f);
736 }
737 if (!tileType.IsWallOrFence && (point.HasChara || (point.HasObj && point.cell.blocked)))
738 {
739 Vector3 v2 = point.Position();
741 {
743 }
744 return;
745 }
747 {
748 EClass.screen.tileMap.SetRoofHeight(renderParam, point.cell, point.x, point.z, 0, bridgeHeight, tileType.IsWallOrFence ? _dir : (-1), ignoreAltitudeY: true);
749 }
750 renderParam.y = renderParam.y - EClass.screen.tileMap.rendererBlockMarker.offset.y + renderRow.renderData.offset.y;
751 renderParam.z += EClass.setting.render.tileMarkerZ;
752 int num = ((tileType.blockRenderMode != BlockRenderMode.Pillar) ? 1 : (_dir + 1 + ((_dir >= 7) ? _dir : 0)));
753 if (num == 1)
754 {
756 }
757 else
758 {
760 }
761 }
763 {
764 if (point.HasObj)
765 {
766 _ = ref point.Position();
767 }
768 renderParam.z += ((point.cell.liquidLv > 0) ? (-0.01f) : EClass.setting.render.tileMarkerZFloor);
770 }
771 else
772 {
773 renderParam.z += EClass.setting.render.tileMarkerZ;
774 renderRow.renderData.Draw(renderParam);
775 }
776 }
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:270
BlockColors blockColors
static ColorProfile Colors
Definition: EClass.cs:38
static BaseGameScreen screen
Definition: EClass.cs:32
static GameSetting setting
Definition: EClass.cs:34
RenderSetting render
Definition: GameSetting.cs:301
void Add(Point point, float tile=0f, float color=0f)
Definition: MeshPass.cs:122
ref Vector3 Position(int height)
Definition: Point.cs:536
RenderParam ApplyAnime(RenderParam p)
Definition: Point.cs:1309
bool HasNonWallBlock
Definition: Point.cs:182
int _dir
Definition: Recipe.cs:193
void Draw(RenderParam p, int tile)
Definition: RenderData.cs:128
void DrawRepeat(RenderParam p, int count, float size, bool skipFirst=false)
Definition: RenderData.cs:214
Vector3 offset
Definition: RenderData.cs:18
MeshPass pass
Definition: RenderData.cs:16
virtual RenderParam GetRenderParam(SourceMaterial.Row mat, int dir, Point point=null, int bridgeHeight=-1)
Definition: RenderRow.cs:388
bool isActive
Definition: ScreenGuide.cs:15
MeshPass passGuideBlock
Definition: ScreenGuide.cs:5
MeshPass passGuideFloor
Definition: ScreenGuide.cs:7
virtual float RepeatSize
Definition: TileType.cs:231
virtual bool IsWallOrFence
Definition: TileType.cs:143
virtual bool IsWater
Definition: TileType.cs:163

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 835 of file Recipe.cs.

836 {
837 }

Referenced by UIRecipeInfo.Refresh().

◆ Rotate()

virtual void Recipe.Rotate ( )
inlinevirtual

Reimplemented in RecipeCard.

Definition at line 843 of file Recipe.cs.

844 {
845 if (EInput.isShiftDown || Input.GetMouseButton(1))
846 {
847 _dir--;
848 }
849 else
850 {
851 _dir++;
852 }
854 {
856 {
857 _dir = 0;
858 }
859 if (_dir < 0)
860 {
861 _dir = tileType.MaxAltitude - 1;
862 }
863 }
864 else
865 {
866 int num = tileRow._tiles.Length;
868 {
869 num = 2;
870 }
871 if (_dir < 0)
872 {
873 _dir = num - 1;
874 }
875 if (_dir >= num)
876 {
877 _dir = 0;
878 }
879 }
880 if ((bool)BuildMenu.Instance)
881 {
883 }
884 }
UIRecipeInfo info1
Definition: BuildMenu.cs:27
Definition: EInput.cs:8
static bool isShiftDown
Definition: EInput.cs:261
TileType tileType
Definition: RenderRow.cs:77
int[] _tiles
Definition: RenderRow.cs:12
virtual int MaxAltitude
Definition: TileType.cs:207
static TileTypeDoor Door
Definition: TileType.cs:95
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 993 of file Recipe.cs.

994 {
995 List<int> list = new List<int>();
996 foreach (Ingredient ingredient in ingredients)
997 {
998 int item = ((ingredient.thing != null) ? ingredient.thing.uid : 0);
999 list.Add(item);
1000 }
1002 }
Dictionary< string, List< int > > lastIngredients
string id
Definition: Recipe.cs:179

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 886 of file Recipe.cs.

887 {
888 _dir = d;
889 if ((bool)BuildMenu.Instance)
890 {
892 }
893 }

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 900 of file Recipe.cs.

901 {
902 renderRow.SetImage(icon, null, renderRow.GetColorInt((ingredients != null && ingredients.Count > 0 && ingredients[0].thing != null) ? ingredients[0].thing.material : DefaultMaterial), setNativeSize: true, 0, idSkin);
903 }
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:351

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

Referenced by ButtonGrid.SetCraftRecipe().

◆ SetTextDifficulty()

void Recipe.SetTextDifficulty ( UIText  text)
inline

Definition at line 954 of file Recipe.cs.

955 {
956 Element reqSkill = source.GetReqSkill();
958 string text2 = reqSkill.Name + " " + reqSkill.Value;
959 text.SetText(text2);
960 }
ElementContainerCard elements
Definition: Card.cs:39
Element GetOrCreateElement(Element ele)
void SetText(string s)
Definition: UIText.cs:159

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 461 of file Recipe.cs.

462 {
463 return r != HitResult.Valid;
464 }
HitResult
Definition: HitResult.cs:2

◆ ToggleTrack()

void Recipe.ToggleTrack ( QuestTrackCraft  quest)
inline

Definition at line 1018 of file Recipe.cs.

1019 {
1020 if (quest != null && quest.idRecipe == id)
1021 {
1022 EClass.game.quests.Remove(quest);
1023 }
1024 else
1025 {
1026 if (quest != null)
1027 {
1028 EClass.game.quests.Remove(quest);
1029 }
1030 QuestTrackCraft questTrackCraft = Quest.Create("track_craft") as QuestTrackCraft;
1031 questTrackCraft.SetRecipe(this);
1032 EClass.game.quests.Start(questTrackCraft);
1033 }
1035 {
1036 EClass.player.questTracker = true;
1037 EClass.ui.widgets.ActivateWidget("QuestTracker");
1039 }
1041 }
static UI ui
Definition: EClass.cs:16
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)
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 981 of file Recipe.cs.

982 {
983 if (HasFirstTimeBonus())
984 {
986 Element reqSkill = source.GetReqSkill();
987 int num = 1 + ((!IsStaticLV()) ? (reqSkill.Value / 20) : 0);
988 Msg.Say("firstTimeCraft", Name);
989 EClass.pc.Pick(ThingGen.Create("ticket_fortune").SetNum(num));
990 }
991 }
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4187
string Name
Definition: Recipe.cs:213
bool HasFirstTimeBonus()
Definition: Recipe.cs:968

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 805 of file Recipe.cs.

806 {
807 n.Clear();
808 n.Build();
809 }
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 811 of file Recipe.cs.

812 {
814 {
815 n.AddHeaderTopic("reqFactory".lang(source.NameFactory.TagColor(hasFactory ? FontColor.Default : FontColor.Bad)));
816 n.Space(8);
817 }
818 }
FontColor
Definition: FontColor.cs:2
string NameFactory
Definition: RecipeSource.cs:73
bool NeedFactory
Definition: RecipeSource.cs:61
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 820 of file Recipe.cs.

821 {
822 n.AddHeaderTopic("reqSkill");
823 Element reqSkill = source.GetReqSkill();
824 int value = EClass.pc.elements.GetOrCreateElement(reqSkill).Value;
825 Color textColor = EClass.Colors.Skin.GetTextColor((value >= reqSkill.Value) ? FontColor.Good : FontColor.Warning);
826 n.AddText(null, reqSkill.Name + " " + reqSkill.Value + " (" + value + ")", textColor).text1.SetSize(-1);
827 n.Space(8);
828 }
SkinColorProfile Skin
virtual string Name
Definition: ELEMENT.cs:302
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:227

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 203 of file Recipe.cs.

Referenced by Create().

◆ id

◆ idMat

int Recipe.idMat = -1

Definition at line 197 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 176 of file Recipe.cs.

Referenced by GetOrCreate().

◆ state

State Recipe.state

Definition at line 201 of file Recipe.cs.

◆ sync

int Recipe.sync

Definition at line 195 of file Recipe.cs.

◆ UseStock

◆ VirtualBlock

Property Documentation

◆ CanRotate

virtual bool Recipe.CanRotate
get

Definition at line 299 of file Recipe.cs.

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

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

◆ CostMoney

virtual int Recipe.CostMoney
get

Definition at line 297 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 269 of file Recipe.cs.

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

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

◆ IsBlock

virtual bool Recipe.IsBlock
get

◆ IsBridge

◆ IsFloor

bool Recipe.IsFloor
get

Definition at line 243 of file Recipe.cs.

Referenced by AM_Build.HitTest(), and TaskBuild.OnProgressComplete().

◆ IsFloorOrBridge

virtual bool Recipe.IsFloorOrBridge
get

Definition at line 227 of file Recipe.cs.

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

◆ IsObj

bool Recipe.IsObj
get

Definition at line 245 of file Recipe.cs.

Referenced by HasSameTile().

◆ IsThing

virtual bool Recipe.IsThing
get

Definition at line 253 of file Recipe.cs.

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

◆ IsWallOrFence

bool Recipe.IsWallOrFence
get

◆ MaxAltitude

int Recipe.MaxAltitude
get

Definition at line 229 of file Recipe.cs.

230 {
231 get
232 {
234 {
235 return tileType.MaxAltitude;
236 }
237 return 0;
238 }
239 }
virtual bool IsThing
Definition: Recipe.cs:253
virtual BlockRenderMode blockRenderMode
Definition: TileType.cs:267

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

◆ Mold

virtual Card Recipe.Mold
get

Definition at line 255 of file Recipe.cs.

Referenced by TaskBuild._GetHitResult().

◆ MultiSize

bool Recipe.MultiSize
get

Definition at line 283 of file Recipe.cs.

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

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

◆ Name

string Recipe.Name
get

Definition at line 213 of file Recipe.cs.

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

◆ RecipeLv

int Recipe.RecipeLv
get

Definition at line 241 of file Recipe.cs.

Referenced by GetQualityBonus().

◆ renderRow

◆ RequireIngredients

virtual bool Recipe.RequireIngredients
get

Definition at line 281 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 295 of file Recipe.cs.

◆ tileType

◆ W

virtual int Recipe.W
get

Definition at line 257 of file Recipe.cs.

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

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


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