16 if ((result = this._sourceCard) ==
null)
18 result = (this._sourceCard =
EClass.sources.cards.map.TryGetValue(base.source.row.idString,
null));
30 return this.sourceCard;
40 return this.Mold.trait.tileType;
47 return this.Mold.renderer;
56 return this.sourceCard.id;
61 public override string GetDetail()
63 return this.sourceCard.GetDetail();
67 public override string GetIdThing()
74 public override bool CanRotate
78 return this.tileType.CanRotate(
true);
84 public override bool IsThing
94 public override Card Mold
99 if ((result = this._mold) ==
null)
101 result = (this._mold = this.CreateMold());
113 return this.sourceCard._origin ==
"dish";
118 public override void OnRenderMarker(
Point point,
bool active, HitResult result,
bool main,
int dir,
int bridgeHeight)
120 this.Mold.ignoreStackHeight = Input.GetKey(KeyCode.LeftControl);
121 this.Mold.SetFreePos(point);
122 this.freePos = this.Mold.freePos;
123 this.fx = this.Mold.fx;
124 this.fy = this.Mold.fy;
125 this.Mold.RenderMarker(point, active, result, main, dir,
false);
126 if (!point.cell.skipRender)
128 this.Mold.trait.OnRenderTile(point, result, dir);
133 public override void BuildIngredientList()
135 if (this.ingredients.Count != 0)
139 base.BuildIngredientList();
140 if (!
EClass.core.IsGameStarted ||
EClass.core.game.isLoading)
144 if (this.isDish &&
EClass.pc.Evalue(1650) >= 2)
146 bool flag = this.ingredients.Count < 3;
147 using (List<
Recipe.
Ingredient>.Enumerator enumerator = this.ingredients.GetEnumerator())
149 while (enumerator.MoveNext())
151 if (enumerator.Current.id ==
"seasoning")
170 public override void OnChangeIngredient()
176 this.Mold.ChangeMaterial(this.GetMainMaterial());
177 if (base.source.colorIng != 0)
179 this.Mold.Dye(this.GetColorMaterial());
184 public override void OnSelected()
190 public Card CreateMold()
192 if (this._mold !=
null)
194 this._mold.Destroy();
198 this.ingredients[0].RefreshThing();
200 if (this.UseStock && this.ingredients[0].thing !=
null)
202 this._mold = this.ingredients[0].thing.Duplicate(1);
206 if (this.sourceCard.isChara)
208 this._mold =
CharaGen.Create(this.idCard, -1);
212 this._mold =
ThingGen.Create(this.idCard, -1, -1);
214 this.OnChangeIngredient();
216 this._mold.dir = this._dir;
217 this._mold.altitude =
ActionMode.Build.altitude;
218 this._mold.idSkin = this.idSkin;
223 public override Thing Craft(BlessedState blessed,
bool sound =
false, List<Thing> ings =
null,
bool model =
false)
225 string text = this.idCard;
226 int idMat = this.GetMainMaterial().id;
227 Element reqSkill = base.source.GetReqSkill();
228 int num = reqSkill.Value -
EClass.pc.Evalue(reqSkill.id);
229 int qualityBonus = base.GetQualityBonus();
230 int num2 = this.renderRow.LV + qualityBonus;
231 bool flag = qualityBonus < 0;
232 CardRow cardRow =
EClass.sources.cards.map.TryGetValue(text,
null);
236 foreach (
Thing thing
in ings)
238 if (thing !=
null && thing.IsDecayed)
244 if (
EClass.debug.godCraft || model)
248 else if (cardRow !=
null && cardRow.tag.Contains(
"no_fail"))
252 else if (this.isDish && !
EClass.scene.actionMode.IsBuildMode)
256 text = this.GetIdFailDish();
267 if (!(
id ==
"weapon_stone") && !(
id ==
"weapon_wood"))
269 if (
id ==
"weapon_anvil")
280 }.RandomItem<
string>();
281 idMat = ings[1].material.id;
295 }.RandomItem<
string>();
298 if (!this.isDish && num2 < 1)
302 if (
EClass.sources.cards.map[text].tag.Contains(
"noQuality"))
306 if (
EClass.sources.cards.map[text].tag.Contains(
"noMaterialChange"))
312 qualityBonus = qualityBonus,
313 rarity = (flag ? Rarity.Crude : Rarity.Normal)
316 if (thing2.trait.CraftNum > 1)
318 thing2.SetNum(thing2.trait.CraftNum);
320 thing2.idSkin = this.idSkin;
321 thing2.Identify(
false, IDTSource.Identify);
322 thing2.isCrafted =
true;
323 if (base.source.colorIng != 0)
325 thing2.Dye(this.GetColorMaterial());
327 if (thing2.IsContainer)
329 thing2.RemoveThings();
332 thing2.SetBlessedState(blessed);
337 this.MakeDish(thing2);
342 this.MixIngredients(thing2);
344 if (this.isDish && flag2)
346 thing2.decay = thing2.MaxDecay + 1;
348 thing2.trait.OnCrafted(
this);
354 if (
EClass.pc.held ==
null || !thing2.TryStackTo(
EClass.pc.held.Thing))
356 EClass.pc.HoldCard(thing2, -1);
360 thing2.PlaySoundDrop(
false);
362 Msg.Say(
"crafted", thing2,
null,
null,
null);
363 if (thing2.Num >
EClass.rnd(1000) ||
EClass.debug.enable)
365 EClass.player.recipes.ComeUpWithRandomRecipe(thing2.category.id, 0);
367 if (this.isDish && (
EClass.debug.enable || (
EClass.player.flags.canComupWithFoodRecipe &&
EClass.rnd(30) == 0)))
369 EClass.player.recipes.ComeUpWithRandomRecipe(thing2.category.id, 0);
370 EClass.player.flags.canComupWithFoodRecipe =
false;
376 public void MakeDish(
Thing t)
378 Rand.SetSeed(
EClass.pc.turn);
379 List<Thing> list =
new List<Thing>();
382 list.Add(ingredient.thing);
384 CraftUtil.MakeDish(t, list, base.GetQualityBonus());
389 public void MixIngredients(
Thing t)
391 Rand.SetSeed(
EClass.pc.turn);
392 List<Thing> list =
new List<Thing>();
395 list.Add(ingredient.thing);
402 public string GetIdFailDish()
404 string category = this.sourceCard.category;
405 uint num = <PrivateImplementationDetails>.ComputeStringHash(category);
406 if (num <= 2191978763U)
408 if (num <= 1612508523U)
410 if (num != 228605988U)
412 if (num == 1612508523U)
414 if (category ==
"meal_bread")
416 return "fail_dough_bread";
420 else if (category ==
"meal_meat")
425 else if (num != 1937649754U)
427 if (num != 2035834996U)
429 if (num == 2191978763U)
431 if (category ==
"meal_cake")
433 return "fail_dough_cake";
437 else if (category ==
"meal_noodle")
439 return "fail_noodle";
442 else if (category ==
"meal_vegi")
447 else if (num <= 2808738325U)
449 if (num != 2235373338U)
451 if (num == 2808738325U)
453 if (category ==
"meal_fish")
459 else if (category ==
"meal_rice")
464 else if (num != 3150879124U)
466 if (num != 3348186596U)
468 if (num == 4237839943U)
470 if (category ==
"meal_fruit")
476 else if (category ==
"meal_egg")
481 else if (category ==
"meal_soup")
489 public override void Build(
TaskBuild task)
492 if (task.target !=
null)
496 else if (this.IngAsProduct)
498 if (task.resources.Count == 0)
500 Thing thing = this.ingredients[0].RefreshThing();
506 Thing item = thing.Split(1);
507 task.resources.Add(item);
508 if (this.ingredients[0].thing.isDestroyed ||
this.ingredients[0].thing.ExistsOnMap)
510 this.ingredients[0].thing =
null;
513 card = task.resources[0];
517 if (this.sourceCard.isChara)
529 card.ChangeMaterial(this.GetMainMaterial());
531 if (base.source.colorIng != 0)
533 card.Dye(this.GetColorMaterial());
535 if (card.IsContainer)
541 this.Build(task.owner, card, task.pos,
this.ingredients[0].mat, task.dir, task.altitude, task.bridgeHeight);
542 card.renderer.PlayAnime(AnimeID.Place,
default(Vector3),
false);
546 public override void Build(
Chara chara,
Card t,
Point pos,
int mat,
int dir,
int altitude,
int bridgeHeight)
552 EClass.pc.PlaySound(
EClass.sources.materials.rows[mat].GetSoundImpact(
null), 1f,
true);
554 t.idSkin = this.idSkin;
555 EClass._zone.AddCard(t, pos);
560 t.SetPlaceState(PlaceState.installed,
true);
561 t.altitude = altitude;
562 t.isPlayerCreation =
true;
563 if (
EClass._zone.idCurrentSubset !=
null)
565 t.isSubsetCard =
true;
567 t.ignoreStackHeight = Input.GetKey(KeyCode.LeftControl);
568 if (
ActionMode.Build.IsActive && t.trait.MaskOnBuild)
572 if (
EClass.scene.actionMode.IsRoofEditMode(t) && t.isThing)
575 t.SetPlaceState(PlaceState.roaming,
false);
577 t.ForeachPoint(delegate(
Point p,
bool main)
579 base.<Build>g__CheckBlock|0(p);
581 t.freePos = this.freePos;
587 t.renderer.RefreshSprite();
591 public override void OnChangeAltitude(
int a)
593 this.Mold.altitude = a;
597 public override void Rotate()
599 this.Mold.Rotate(
false);
600 this._dir = this.Mold.dir;
608 public override void SetDir(
int d)
615 public override void WriteNote(UINote n)
618 if (!this.Mold.isChara)
620 this.Mold.elements.AddNote(n,
null,
null,
ElementContainer.NoteMode.Default,
false,
null,
null);
626 public override Recipe Duplicate()
629 recipeCard._mold = this._mold;