Elin Decompiled Documentation EA 23.361 Nightly
Loading...
Searching...
No Matches
Thing.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5using UnityEngine.UI;
6
7public class Thing : Card
8{
9 public const int MaxFurnitureEnc = 12;
10
12
13 public int stackOrder;
14
15 public string tempName;
16
17 public bool isEquipped => base.c_equippedSlot != 0;
18
19 public bool IsMeleeWithAmmo
20 {
21 get
22 {
23 if (trait is TraitToolRange)
24 {
25 return isEquipped;
26 }
27 return false;
28 }
29 }
30
31 public int range => source.range;
32
33 public int Penetration
34 {
35 get
36 {
37 if (source.substats.Length == 0)
38 {
39 return 0;
40 }
41 return source.substats[0];
42 }
43 }
44
45 public override bool isThing => true;
46
47 public override CardRow sourceCard => source;
48
49 public override SourcePref Pref
50 {
51 get
52 {
53 SourcePref pref = trait.GetPref();
54 if (pref != null)
55 {
56 return pref;
57 }
58 CardRow cardRow = ((source.origin != null && !source.pref.UsePref) ? source.origin : source);
59 return cardRow.replacer.data?.pref ?? cardRow.pref;
60 }
61 }
62
63 public override int SelfWeight
64 {
65 get
66 {
67 if (!base.IsUnique)
68 {
69 return (int)((long)(base.isWeightChanged ? base.c_weight : source.weight) * (long)base.material.weight / 100);
70 }
71 if (!base.isWeightChanged)
72 {
73 return source.weight;
74 }
75 return base.c_weight;
76 }
77 }
78
79 public override int[] Tiles => TileRow._tiles;
80
81 public override RenderRow TileRow
82 {
83 get
84 {
85 if (trait is TraitFakeTile)
86 {
87 if (trait is TraitFakeBlock)
88 {
89 return EClass.sources.blocks[base.refVal];
90 }
91 return EClass.sources.objs[base.refVal];
92 }
93 return base.TileRow;
94 }
95 }
96
98 {
99 get
100 {
101 if (base.IsContainer && base.c_lockLv == 0 && !base.isNPCProperty)
102 {
103 return trait.CanSearchContent;
104 }
105 return false;
106 }
107 }
108
110 {
111 get
112 {
113 if (base.IsContainer && base.c_lockLv == 0 && !base.isNPCProperty)
114 {
115 Window.SaveData obj = GetObj<Window.SaveData>(2);
116 if (obj == null)
117 {
118 return false;
119 }
120 return obj.sharedType == ContainerSharedType.Shared;
121 }
122 return false;
123 }
124 }
125
126 public bool CanAutoFire(Chara c, Card tg, bool reloading = false)
127 {
128 if (GetRootCard() != c)
129 {
130 return false;
131 }
132 if (HasTag(CTAG.throwWeapon))
133 {
134 return true;
135 }
136 if (!trait.CanAutofire)
137 {
138 return false;
139 }
140 if (trait is TraitToolRange)
141 {
142 if ((c.IsPCFaction && c.body.IsTooHeavyToEquip(this)) || reloading)
143 {
144 return false;
145 }
146 }
147 else if (trait is TraitAbility && c.IsPC)
148 {
149 Act act = (trait as TraitAbility).act;
150 Element element = c.elements.GetElement(act.id);
151 if (act is Spell && (element == null || (element.vPotential == 0 && !EClass.pc.ability.Has(element.id))))
152 {
153 return false;
154 }
155 }
156 return true;
157 }
158
159 public int GetEfficiency()
160 {
161 return 50 + base.LV * 10 + base.encLV * 10 + (int)base.rarity * 10 + (int)base.blessedState * 10;
162 }
163
164 public override void SetSource()
165 {
166 source = EClass.sources.things.map.TryGetValue(id);
167 if (source != null && source.isOrigin)
168 {
170 id = source.id;
171 }
172 if (source == null)
173 {
174 Debug.LogWarning("Thing " + id + " not found");
175 id = "ash3";
177 }
178 }
179
180 public override void OnCreate(int genLv)
181 {
182 if (bp.blesstedState.HasValue)
183 {
184 SetBlessedState(bp.blesstedState.GetValueOrDefault());
185 }
186 else if (base.category.ignoreBless == 0 && bp.rarity == Rarity.Random && base.rarity != Rarity.Artifact)
187 {
188 if (EClass.rnd(25) == 0)
189 {
191 }
192 else if (EClass.rnd(25) == 0)
193 {
195 }
196 else if (EClass.rnd(50) == 0 && base.category.slot != 0)
197 {
199 }
200 }
201 if (!EClass.debug.autoIdentify && (!source.unknown_JP.IsEmpty() || (base.category.slot != 0 && base.rarity >= Rarity.Superior)))
202 {
203 base.c_IDTState = 5;
204 }
205 string text = id;
206 if (text == "bill_tax" || text == "bill")
207 {
208 base.c_bill = 100 + EClass.rnd(100);
209 }
210 if (base.category.slot != 0)
211 {
212 int num = 0;
213 if (base.rarity == Rarity.Superior)
214 {
215 num = EClass.rnd(3);
216 }
217 else if (base.rarity == Rarity.Legendary)
218 {
219 num = EClass.rnd(4) + 2;
220 }
221 else if (base.rarity == Rarity.Mythical)
222 {
223 num = EClass.rnd(3) + 5;
224 }
225 else if (base.rarity >= Rarity.Artifact)
226 {
227 num = EClass.rnd(2) + 1;
228 }
229 if (num > 0 && !HasTag(CTAG.godArtifact) && !HasTag(CTAG.noRandomEnc))
230 {
231 for (int i = 0; i < num; i++)
232 {
234 }
235 }
236 }
237 if (base.IsRangedWeapon && !IsMeleeWithAmmo)
238 {
239 if (HasTag(CTAG.godArtifact))
240 {
241 AddSocket();
242 AddSocket();
243 }
244 else
245 {
246 int num2 = 1;
247 int num3 = ((EClass.rnd(10) == 0) ? 1 : 0);
248 if (base.rarity == Rarity.Superior)
249 {
250 num2 = 2 + num3;
251 }
252 else if (base.rarity == Rarity.Legendary)
253 {
254 num2 = EClass.rnd(2) + 3 + num3;
255 }
256 else if (base.rarity == Rarity.Mythical)
257 {
258 num2 = EClass.rnd(2) + 4 + num3;
259 }
260 else if (base.rarity >= Rarity.Artifact)
261 {
262 num2 = EClass.rnd(2) + 1;
263 }
264 if (id == "bow_vindale")
265 {
266 num2 = 4;
267 }
268 if (num2 > 0)
269 {
270 for (int j = 0; j < num2; j++)
271 {
272 AddSocket();
273 }
274 if (!bp.isCraft)
275 {
276 for (int k = 0; k < EClass.rnd(num2 + 1); k++)
277 {
278 Tuple<SourceElement.Row, int> enchant = GetEnchant(genLv, (SourceElement.Row r) => r.tag.Contains("modRanged"), neg: false);
279 if (enchant != null && InvOwnerMod.IsValidRangedMod(this, enchant.Item1))
280 {
281 ApplySocket(enchant.Item1.id, enchant.Item2);
282 }
283 }
284 }
285 }
286 }
287 }
288 if (id == "shield_flower")
289 {
291 elements.SetBase(randomElement.alias.Replace("ele", "miasma_"), 20);
292 }
293 if ((bp.rarity != Rarity.Normal || bp.qualityBonus != 0) && base.rarity < Rarity.Artifact && base.category.tag.Contains("enc"))
294 {
295 int num4 = 0;
296 if (EClass.rnd(6) == 0)
297 {
298 if (bp.qualityBonus == 0)
299 {
300 num4 = EClass.rnd(EClass.rnd(14) + 1);
301 if (num4 == 1 && EClass.rnd(3) != 0)
302 {
303 num4 = 0;
304 }
305 if (num4 > 0)
306 {
308 }
309 }
310 else if (bp.qualityBonus < 0)
311 {
312 if (EClass.rnd(3) == 0)
313 {
314 num4 = 1;
315 }
316 }
317 else if (bp.qualityBonus >= 10)
318 {
319 num4 = Mathf.Min(bp.qualityBonus / 10 + 2, 8) + EClass.rnd(EClass.rnd(5) + 1);
320 }
321 }
322 if (num4 > 0)
323 {
324 if (num4 > 12)
325 {
326 num4 = 12;
327 }
328 SetEncLv(num4);
329 }
330 }
331 if (HasTag(CTAG.randomSkin))
332 {
333 base.idSkin = EClass.rnd(source.skins.Length + 1);
334 }
335 if (source.useDyeColor)
336 {
337 Dye(source.colorType.Split('/')[1]);
338 }
339 }
340
341 public override void ApplyMaterialElements(bool remove)
342 {
343 Chara chara = null;
345 {
346 chara = GetRootCard()?.Chara;
347 if (chara != null)
348 {
350 }
351 }
352 elements.ApplyMaterialElementMap(this, remove);
353 if (chara != null)
354 {
355 elements.SetParent(chara);
356 }
357 }
358
359 public override void ApplyMaterial(bool remove = false)
360 {
361 if (source.HasTag(CTAG.replica))
362 {
363 base.isReplica = true;
364 }
365 if (remove)
366 {
367 ApplyMaterialElements(remove: true);
368 bool flag = (base.isFireproof = false);
369 base.isAcidproof = flag;
370 return;
371 }
372 bool pvSet = false;
373 bool dmgSet = false;
374 bool hitSet = false;
375 if (sourceCard.quality == 4)
376 {
377 if (source.offense.Length != 0)
378 {
379 base.c_diceDim = source.offense[1];
380 }
381 if (source.offense.Length > 2)
382 {
383 SetBase(66, source.offense[2]);
384 }
385 if (source.offense.Length > 3)
386 {
387 SetBase(67, source.offense[3]);
388 }
389 if (source.defense.Length != 0)
390 {
391 SetBase(64, source.defense[0]);
392 }
393 if (source.defense.Length > 1)
394 {
395 SetBase(65, source.defense[1]);
396 }
397 }
398 else
399 {
400 int num = 120;
401 bool flag3 = !base.IsAmmo;
402 if (base.rarity <= Rarity.Crude)
403 {
404 num = 150;
405 }
406 else if (base.rarity == Rarity.Superior)
407 {
408 num = 100;
409 }
410 else if (base.rarity >= Rarity.Legendary)
411 {
412 num = 80;
413 }
414 if (source.offense.Length != 0)
415 {
416 base.c_diceDim = source.offense[1] * base.material.dice / (num + (flag3 ? EClass.rnd(25) : 0));
417 }
418 if (source.offense.Length > 2)
419 {
420 SetBase(66, source.offense[2] * base.material.atk * 9 / (num - (flag3 ? EClass.rnd(30) : 0)));
421 }
422 if (source.offense.Length > 3)
423 {
424 SetBase(67, source.offense[3] * base.material.dmg * 5 / (num - (flag3 ? EClass.rnd(30) : 0)));
425 }
426 if (source.defense.Length != 0)
427 {
428 SetBase(64, source.defense[0] * base.material.dv * 7 / (num - (flag3 ? EClass.rnd(30) : 0)));
429 }
430 if (source.defense.Length > 1)
431 {
432 SetBase(65, source.defense[1] * base.material.pv * 9 / (num - (flag3 ? EClass.rnd(30) : 0)));
433 }
434 }
435 if (base.isReplica)
436 {
437 if (source.offense.Length != 0)
438 {
439 base.c_diceDim = Mathf.Max(source.offense[1] / 3, 1);
440 }
441 if (source.offense.Length > 2)
442 {
443 SetBase(66, source.offense[2] / 3);
444 }
445 if (source.offense.Length > 3)
446 {
447 SetBase(67, source.offense[3] / 3);
448 }
449 if (source.defense.Length != 0)
450 {
451 SetBase(64, source.defense[0] / 3);
452 }
453 if (source.defense.Length > 1)
454 {
455 SetBase(65, source.defense[1] / 3);
456 }
457 }
458 if (base.IsEquipmentOrRangedOrAmmo)
459 {
460 if (base.IsWeapon || base.IsAmmo)
461 {
462 if (dmgSet)
463 {
464 elements.ModBase(67, base.encLV + ((base.blessedState == BlessedState.Blessed) ? 1 : 0));
465 }
466 }
467 else if (pvSet)
468 {
469 elements.ModBase(65, (base.encLV + ((base.blessedState == BlessedState.Blessed) ? 1 : 0)) * 2);
470 }
471 }
472 if (sockets != null)
473 {
474 for (int i = 0; i < sockets.Count; i++)
475 {
476 int num2 = sockets[i];
477 int num3 = num2 / 1000;
478 if (num3 == 67 && dmgSet)
479 {
480 elements.ModBase(67, num2 % 1000);
481 }
482 if (num3 == 66 && hitSet)
483 {
484 elements.ModBase(66, num2 % 1000);
485 }
486 if (num3 == 65 && pvSet)
487 {
488 elements.ModBase(65, num2 % 1000);
489 }
490 }
491 }
492 if (base.material == null || base.material.elements == null)
493 {
494 Debug.Log(base.idMaterial + "/" + base.material?.name + "/" + base.material?.elements);
495 }
496 ApplyMaterialElements(remove: false);
497 string[] bits = base.material.bits;
498 foreach (string text in bits)
499 {
500 if (!(text == "fire"))
501 {
502 if (text == "acid")
503 {
504 base.isAcidproof = true;
505 }
506 }
507 else
508 {
509 base.isFireproof = true;
510 }
511 }
512 if (base.rarity >= Rarity.Artifact)
513 {
514 bool flag = (base.isFireproof = true);
515 base.isAcidproof = flag;
516 }
517 _colorInt = 0;
518 void SetBase(int ele, int a)
519 {
520 elements.SetBase(ele, a);
521 if (ele == 67)
522 {
523 dmgSet = true;
524 }
525 if (ele == 65)
526 {
527 pvSet = true;
528 }
529 if (ele == 66)
530 {
531 hitSet = true;
532 }
533 }
534 }
535
536 public override string GetName(NameStyle style, int _num = -1)
537 {
538 int num = ((_num == -1) ? base.Num : _num);
539 string text = "";
540 string text2 = "";
541 string text3 = "";
542 string text4 = "";
543 string sig = "";
544 string text5 = "";
545 string text6 = source.GetText("unit");
546 ArticleStyle style2 = ((style == NameStyle.FullNoArticle) ? ArticleStyle.None : ArticleStyle.Default);
547 bool num2 = base.IsIdentified || source.unknown.IsEmpty();
548 bool isEquipmentOrRangedOrAmmo = base.IsEquipmentOrRangedOrAmmo;
549 bool flag = Lang.setting.nameStyle == 0;
550 if (num2)
551 {
552 if (base.c_idRefCard.IsEmpty() && !base.c_altName.IsEmpty())
553 {
554 text = base.c_altName;
555 }
556 else
557 {
558 string[] array = trait.GetName().Split(',');
559 text = array[0];
560 if (array.Length > 1)
561 {
562 text6 = array[1];
563 }
564 }
565 if (text.IsEmpty())
566 {
567 text = id;
568 }
569 if (isEquipmentOrRangedOrAmmo && base.IsIdentified && base.rarity >= Rarity.Legendary)
570 {
571 if (base.rarity != Rarity.Artifact && !base.material.GetTextArray("altName").IsEmpty())
572 {
573 text = base.material.GetTextArray("altName")[0] + Lang.space + text;
574 }
575 goto IL_0215;
576 }
577 if (source.naming == "m" || (source.naming == "ms" && base.material != source.DefaultMaterial))
578 {
579 if (isEquipmentOrRangedOrAmmo)
580 {
581 string[] textArray = base.material.GetTextArray("altName");
582 if (textArray != null && textArray.Length >= 2)
583 {
584 text = base.material.GetTextArray("altName")[1] + Lang.space + text;
585 goto IL_01f2;
586 }
587 }
588 text = "_of2".lang(base.material.GetName(), text);
589 }
590 goto IL_01f2;
591 }
592 text = "unknown";
593 string idUnknown = source.GetText("unknown");
594 if (idUnknown.StartsWith("#"))
595 {
596 Rand.UseSeed(EClass.game.seed + (trait.CanStack ? sourceCard._index : base.uid) + base.refVal, delegate
597 {
598 idUnknown = Lang.GetList(idUnknown.Remove(0, 1)).RandomItem();
599 });
600 }
601 text = idUnknown;
602 goto IL_0499;
603 IL_0499:
604 if (GetBool(125))
605 {
606 text = "_halfeaten".lang(text);
607 }
608 if (base.c_bill != 0)
609 {
610 text = "_of".lang(Lang._currency(base.c_bill, showUnit: true, 0), text);
611 }
612 trait.SetName(ref text);
613 if (base.tier > 0)
614 {
615 text = Lang.GetList((base.category.id == "fish") ? "quality_fish" : "quality_general")[Mathf.Clamp(base.tier, 0, 3)] + text;
616 }
617 switch (style)
618 {
619 case NameStyle.Simple:
620 return text;
621 case NameStyle.Ref:
622 return text;
623 default:
624 {
625 if (!base.c_refText.IsEmpty())
626 {
627 text = trait.LangRefText.lang(base.c_refText, text);
628 }
629 if (base.IsIdentified)
630 {
631 int hIT = base.HIT;
632 int dMG = base.DMG;
633 if ((base.IsMeleeWeapon || base.IsRangedWeapon || base.IsAmmo || hIT != 0 || dMG != 0) && source.offense.Length != 0)
634 {
635 string text7 = "";
636 if (source.offense[0] != 0)
637 {
638 text7 = text7 + source.offense[0] + "d" + base.c_diceDim;
639 }
640 if (dMG != 0)
641 {
642 text7 += ((base.IsMeleeWeapon || base.IsRangedWeapon || base.IsAmmo) ? dMG.ToText() : (dMG.ToString() ?? ""));
643 }
644 if (hIT != 0)
645 {
646 text7 = text7 + ((dMG != 0 || source.offense[0] != 0) ? ", " : "") + hIT;
647 }
648 text2 = text2 + " (" + text7.IsEmpty(" - ") + ")";
649 }
650 int dV = DV;
651 int pV = PV;
652 if (dV != 0 || pV != 0)
653 {
654 text2 += " [";
655 text2 = text2 + dV + ", " + pV;
656 text2 += "]";
657 }
659 {
660 text2 = text2 + " " + "itemCharges".lang(base.c_charges.ToString() ?? "");
661 }
662 }
663 else if (base.c_IDTState == 3 || base.c_IDTState == 1)
664 {
665 text2 = Lang.space + "(" + base.TextRarity.ToTitleCase() + ")";
666 }
667 if (base.IsDecayed)
668 {
669 text = "rotten".lang() + text;
670 }
671 else if (base.IsRotting)
672 {
673 text = "rotting".lang() + text;
674 }
675 if (base.IsIdentified)
676 {
677 if (base.blessedState != BlessedState.Normal)
678 {
679 text4 = ("bs" + base.blessedState).lang();
680 }
681 switch (base.rarity)
682 {
683 case Rarity.Artifact:
684 style2 = ArticleStyle.None;
685 text3 = "★";
686 text = (isEquipmentOrRangedOrAmmo ? text.Bracket(3) : text);
687 break;
688 case Rarity.Legendary:
689 case Rarity.Mythical:
690 style2 = ArticleStyle.The;
691 text3 = "☆";
692 if (isEquipmentOrRangedOrAmmo)
693 {
694 Rand.UseSeed(base.uid + EClass.game.seed, delegate
695 {
696 sig = AliasGen.GetRandomAlias(builtin: true).Bracket((base.rarity == Rarity.Mythical) ? 3 : 2);
697 });
698 sig = Lang.space + sig;
699 }
700 break;
701 }
702 }
703 if (base.encLV != 0)
704 {
705 if (base.category.tag.Contains("enc"))
706 {
707 if (base.c_altName.IsEmpty())
708 {
709 string[] list = Lang.GetList("quality_furniture");
710 text = "_qualityFurniture".lang(list[Mathf.Clamp(base.encLV - 1, 0, list.Length - 1)], text);
711 }
712 }
713 else
714 {
715 sig = sig + Lang.space + ((base.encLV > 0) ? ("+" + base.encLV) : (base.encLV.ToString() ?? ""));
716 }
717 }
718 if (base.c_lockLv != 0 && base.c_revealLock)
719 {
720 sig = sig + Lang.space + "+" + base.c_lockLv;
721 }
722 if (base.isLostProperty)
723 {
724 text = "_lostproperty".lang(text);
725 }
727 {
728 text5 += "equippedItem".lang();
729 }
730 if (!base.c_note.IsEmpty() && (!base.isBackerContent || EClass.core.config.backer.Show(base.c_note)))
731 {
732 string text8 = base.c_note;
733 if (text8.StartsWith('@'))
734 {
735 text8 = Lang.Note.map.TryGetValue(text8.TrimStart('@'))?.GetText("text") ?? base.c_note;
736 }
737 string text9 = (base.category.IsChildOf("book") ? "_written" : "_engraved");
738 if (id == "grave_dagger1" || id == "grave_dagger2")
739 {
740 text9 = "_daggerGrave";
741 }
742 text = ((!text8.Contains("_bracketLeft".lang())) ? text9.lang(text8, text) : (text9 + "Alt").lang(text8, text));
743 }
744 text = (flag ? ((num <= 1) ? (text4 + text) : "_unit".lang(num.ToFormat() ?? "", text4 + text, text6)) : ((trait is TraitAbility) ? text.ToTitleCase(wholeText: true) : ((!text6.IsEmpty() && (base.IsIdentified || source.unknown.IsEmpty())) ? "_unit".lang((num == 1) ? "" : (num.ToFormat() ?? ""), text, (text4 + text6).AddArticle(num, style2, source.unit)) : (text4 + text).AddArticle(num, style2, source.name))));
745 if (base.rarity >= Rarity.Legendary)
746 {
747 text = text.ToTitleCase(wholeText: true);
748 }
749 string text10 = ((base.isSale && things.Count > 0) ? "forSale2".lang() : ((base.isSale || (base.parentThing != null && base.parentThing.isSale && TraitSalesTag.CanTagSale(this, insideContainer: true))) ? "forSale".lang(Lang._currency(GetPrice(CurrencyType.Money, sell: true, PriceType.PlayerShop), "money")) : ""));
750 if (trait is TraitSalesTag && base.isOn && !GetStr(11).IsEmpty())
751 {
752 text10 += "soldOut".lang(EClass.sources.categories.map[GetStr(11)].GetName());
753 }
754 if (GetInt(101) != 0)
755 {
756 text5 = "_limitedStock".lang(text5);
757 }
758 return text5 + text3 + text + sig + text2 + text10;
759 }
760 }
761 IL_01f2:
762 if (source.naming == "ma")
763 {
764 text = base.material.GetName();
765 }
766 goto IL_0215;
767 IL_0215:
768 if (!base.c_idRefCard.IsEmpty() && trait.RefCardName != RefCardName.None)
769 {
770 string text11 = base.c_altName.IsEmpty(base.refCard.GetName());
771 if (!base.c_idRefCard2.IsEmpty())
772 {
773 text11 = "_and".lang(text11, base.c_altName2.IsEmpty(base.refCard2.GetName()));
774 }
775 if (!(text11 == "*r"))
776 {
777 text = ((!source.name2.IsEmpty()) ? source.GetTextArray("name2")[0].Replace("#1g", EClass.pc.faith.NameShort).Replace("#1b", base.c_extraNameRef.IsEmpty((base.refCard == null) ? text11 : (base.refCard.isChara ? base.refCard.GetName() : base.refCard.GetText()))).Replace("#1", base.c_extraNameRef.IsEmpty(text11)) : (source.naming.Contains("last") ? (text + Lang.space + text11) : (source.naming.Contains("first") ? (text11 + Lang.space + text) : ((!source.naming.Contains("of")) ? (text6.IsEmpty() ? "_of3" : "_of2").lang(text11, text) : "_of".lang(text11, text)))));
778 }
779 else
780 {
781 string text12 = base.refCard.GetText("aka");
782 if (!text12.IsEmpty())
783 {
784 text = "_of".lang(text12, text);
785 }
786 }
787 }
788 goto IL_0499;
789 }
790
791 public override string GetHoverText()
792 {
793 string text = "";
794 text = text + " <size=14>(" + Lang._weight(base.ChildrenAndSelfWeight) + ")</size> ";
796 {
797 text += Environment.NewLine;
798 text = text + "id:" + id + " tile:" + source.idRenderData + "/" + ((source.tiles.Length != 0) ? ((object)source.tiles[0]) : "-")?.ToString() + " num:" + base.Num + " lv:" + base.LV + " enc:" + base.encLV + " / " + base.material.alias;
799 }
800 string hoverText = trait.GetHoverText();
801 if (!hoverText.IsEmpty())
802 {
803 text = text + Environment.NewLine + hoverText;
804 }
805 return base.GetHoverText() + text;
806 }
807
808 public override string GetExtraName()
809 {
810 string text = "";
811 if (trait.ShowChildrenNumber && base.c_lockLv == 0 && EClass._zone.IsPCFactionOrTent)
812 {
813 if (things.Count > 0)
814 {
815 text += "childCount".lang(things.Count.ToString() ?? "");
816 }
817 else if (trait.CanOpenContainer)
818 {
819 text = text + " " + "empty".lang();
820 }
821 }
822 if ((trait is TraitRoomPlate || trait is TraitHouseBoard) && pos.IsValid)
823 {
824 Room room = pos.cell.room;
825 if (EClass.debug.enable && room != null && room.data.group != 0)
826 {
827 text = text + " #" + room.data.group;
828 }
829 }
830 return text;
831 }
832
833 public override int GetPrice(CurrencyType currency = CurrencyType.Money, bool sell = false, PriceType priceType = PriceType.Default, Chara c = null)
834 {
835 int price = base.GetPrice(currency, sell, priceType, c);
836 string str = GetStr("price_calc_override");
837 if (!str.IsEmpty())
838 {
839 var args = new
840 {
841 @base = price,
842 lv = base.LV,
843 rarity = base.rarityLv
844 };
845 if (str.TryEvaluateAsCalc(out int result, (object)args))
846 {
847 return result;
848 }
849 }
850 return price;
851 }
852
853 public List<Element> ListLimitedValidTraits(bool limit)
854 {
855 List<Element> list = new List<Element>();
856 if (base.ShowFoodEnc)
857 {
858 foreach (Element value in elements.dict.Values)
859 {
860 if (value.IsFoodTraitMain && value.Value > 0)
861 {
862 list.Add(value);
863 }
864 }
866 if (limit && list.Count > 5)
867 {
868 int num = list.Count - 5;
869 for (int num2 = 0; num2 < num; num2++)
870 {
871 list.RemoveAt(list.Count - 1);
872 }
873 }
874 }
875 return list;
876 }
877
878 public List<Element> ListValidTraits(bool isCraft, bool limit)
879 {
880 List<Element> list = ListLimitedValidTraits(limit);
881 bool showFoodEnc = base.ShowFoodEnc;
882 bool flag = EClass.debug.enable || EClass.pc.HasElement(1650);
883 if (showFoodEnc)
884 {
885 foreach (Element value in elements.dict.Values)
886 {
887 if (value.IsFoodTrait && !list.Contains(value) && (isCraft || flag || value.IsFoodTraitMain) && (!value.IsFoodTraitMain || value.Value < 0))
888 {
889 list.Add(value);
890 }
891 }
892 }
893 foreach (Element value2 in elements.dict.Values)
894 {
895 if ((isCraft || flag || ((!value2.IsFoodTrait || value2.IsFoodTraitMain) && (!showFoodEnc || !value2.IsTrait || value2.Value >= 0))) && !list.Contains(value2) && (value2.IsTrait || (value2.IsFoodTrait && !value2.IsFoodTraitMain)))
896 {
897 list.Add(value2);
898 }
899 }
900 return list;
901 }
902
903 public override void WriteNote(UINote n, Action<UINote> onWriteNote = null, IInspect.NoteMode mode = IInspect.NoteMode.Default, Recipe recipe = null)
904 {
905 if (sourceCard._origin == "dish")
906 {
907 CheckJustCooked();
908 }
909 string text = ((trait is TraitLunchLove) ? "_heart".lang().TagColor(FontColor.Bad) : "");
910 n.Clear();
911 string text2 = "";
912 TraitAbility traitAbility = trait as TraitAbility;
913 bool showEQStats = base.IsEquipmentOrRangedOrAmmo;
914 bool flag = mode == IInspect.NoteMode.Product;
915 bool flag2 = base.IsIdentified || flag;
916 text2 = base.Name;
917 if (base.rarity == Rarity.Legendary || base.rarity == Rarity.Mythical)
918 {
919 string text3 = (text2.Contains("『") ? "『" : (text2.Contains("《") ? "《" : ""));
920 if (text3 != "")
921 {
922 string[] array = text2.Split(text3);
923 text2 = array[0] + Environment.NewLine + text3 + array[1];
924 }
925 }
926 if (flag)
927 {
928 if (!(trait is TraitPotionAlchemy))
929 {
930 text2 = recipe.GetName();
931 }
932 if (trait.CraftNum > 1)
933 {
934 text2 = text2 + " x " + trait.CraftNum;
935 }
936 }
937 if (mode != IInspect.NoteMode.Recipe)
938 {
939 if (trait is TraitAbility)
940 {
941 EClass.pc.elements.GetOrCreateElement((trait as TraitAbility).act.id).AddHeaderAbility(n);
942 }
943 else
944 {
945 UIItem uIItem = n.AddHeaderCard(text2);
946 if (flag && !(recipe?.IsThing ?? true))
947 {
948 recipe.SetImage(uIItem.image2);
949 }
950 else
951 {
952 SetImage(uIItem.image2);
953 }
954 uIItem.image2.Rect().pivot = new Vector2(0.5f, 0.5f);
955 string text4 = base.Num.ToFormat() ?? "";
956 string text5 = (0.01f * (float)base.ChildrenAndSelfWeight * 0.1f).ToString((base.ChildrenAndSelfWeight == 0) ? "F0" : ((base.ChildrenAndSelfWeight >= 1000) ? "F1" : "F2")) + "s";
957 if (things.Count > 0)
958 {
959 text4 = text4 + " (" + things.Count + ")";
960 }
961 if (base.ChildrenAndSelfWeight != SelfWeight)
962 {
963 text5 = text5 + " (" + (Mathf.Ceil(0.01f * (float)SelfWeight) * 0.1f).ToString("F1") + "s)";
964 }
965 text2 = "_quantity".lang(text4 ?? "", text5);
967 {
968 text2 = text2 + "(" + base.ChildrenAndSelfWeight + ")";
969 }
970 if (flag && recipe != null && (bool)LayerCraft.Instance)
971 {
972 text2 = text2 + " " + "_recipe_lv".lang(recipe.RecipeLv.ToString() ?? "");
973 }
974 uIItem.text2.SetText(text2);
975 if (showEQStats && flag2)
976 {
977 text2 = "";
978 if (DV != 0 || PV != 0 || base.HIT != 0 || base.DMG != 0 || Penetration != 0)
979 {
980 if (base.DMG != 0)
981 {
982 text2 = text2 + "DMG".lang() + ((base.DMG > 0) ? "+" : "") + base.DMG + ", ";
983 }
984 if (base.HIT != 0)
985 {
986 text2 = text2 + "HIT".lang() + ((base.HIT > 0) ? "+" : "") + base.HIT + ", ";
987 }
988 if (DV != 0)
989 {
990 text2 = text2 + "DV".lang() + ((DV > 0) ? "+" : "") + DV + ", ";
991 }
992 if (PV != 0)
993 {
994 text2 = text2 + "PV".lang() + ((PV > 0) ? "+" : "") + PV + ", ";
995 }
996 if (Penetration != 0)
997 {
998 text2 = text2 + "PEN".lang() + ((Penetration > 0) ? "+" : "") + Penetration + "%, ";
999 }
1000 text2 = text2.TrimEnd(' ').TrimEnd(',');
1001 }
1002 if (!text2.IsEmpty())
1003 {
1004 n.AddText("NoteText_eqstats", text2);
1005 }
1006 if (trait is TraitToolRange traitToolRange)
1007 {
1008 n.AddText("NoteText_eqstats", "tip_range".lang(traitToolRange.BestDist.ToString() ?? ""));
1009 }
1010 }
1011 else
1012 {
1013 string text6 = "";
1015 {
1016 int totalQuality = GetTotalQuality();
1017 int totalQuality2 = GetTotalQuality(applyBonus: false);
1018 text6 = text6 + "Lv. " + base.LV + " TQ. " + GetTotalQuality() + ((totalQuality == totalQuality2) ? "" : (" (" + totalQuality2 + ")"));
1019 }
1020 if (HasElement(10))
1021 {
1022 text6 = text6 + (text6.IsEmpty() ? "" : " ") + "_nutrition".lang(Evalue(10).ToFormat() ?? "");
1023 }
1024 if ((base.category.IsChildOf("throw") || base.category.IsChildOf("resource") || trait.IsTool) && !(trait is TraitAbility))
1025 {
1026 text6 = text6 + (text6.IsEmpty() ? "" : " ") + "_hardness".lang(base.material.hardness.ToString() ?? "");
1027 }
1028 if (flag && recipe != null && (bool)LayerCraft.Instance)
1029 {
1030 text6 = text6 + (text6.IsEmpty() ? "" : " ") + "_max_quality".lang(recipe.GetQualityBonus().ToString() ?? "");
1031 }
1032 if (!text6.IsEmpty())
1033 {
1034 n.AddText("NoteText_eqstats", text6);
1035 }
1036 }
1037 }
1038 string detail = GetDetail();
1039 if (!detail.IsEmpty())
1040 {
1041 LayoutElement component = n.AddText("NoteText_flavor", detail).GetComponent<LayoutElement>();
1042 if (flag)
1043 {
1044 component.preferredWidth = 400f;
1045 }
1046 n.Space(8);
1047 }
1048 }
1049 if (trait is TraitBookPlan)
1050 {
1051 TraitBookPlan traitBookPlan = trait as TraitBookPlan;
1052 n.AddText("NoteText_flavor", traitBookPlan.source.GetDetail());
1053 n.Space(8);
1054 }
1055 if (traitAbility != null)
1056 {
1057 n.Space(8);
1058 Act act = traitAbility.CreateAct();
1059 Element orCreateElement = EClass.pc.elements.GetOrCreateElement(act.source.id);
1060 orCreateElement._WriteNote(n, EClass.pc.elements, null, isRef: false, addHeader: false);
1061 orCreateElement._WriteNote(n, EClass.pc, act);
1062 return;
1063 }
1065 {
1066 n.AddText("(id:" + id + " tile:" + (source.tiles.IsEmpty() ? "-" : ((object)source.tiles[0]))?.ToString() + ") lv:" + base.LV + " price:" + GetPrice());
1067 }
1068 Card root = GetRootCard();
1069 if (root != null && root != EClass.pc && root != this && root.ExistsOnMap && !((parent as Thing)?.trait is TraitChestMerchant))
1070 {
1071 n.AddText("isChildOf".lang(GetRootCard().Name), FontColor.ItemName);
1072 }
1073 if (flag2)
1074 {
1075 AddTextWithIcon("isMadeOf".lang(base.material.GetText(), base.material.hardness.ToString() ?? ""), EClass.core.refs.icons.enc.mat, FontColor.Default);
1076 }
1077 AddText("isCategorized".lang(base.category.GetText()), FontColor.Default);
1078 if (base.category.skill != 0)
1079 {
1080 int key = base.category.skill;
1081 int key2 = 132;
1082 if (base.IsRangedWeapon && !base.IsMeleeWeapon)
1083 {
1084 key2 = 133;
1085 }
1086 if (trait is TraitToolRangeCane)
1087 {
1088 key2 = 304;
1089 }
1090 if (Evalue(482) > 0)
1091 {
1092 key = 305;
1093 key2 = 304;
1094 }
1095 AddText("isUseSkill".lang(EClass.sources.elements.map[key].GetName().ToTitleCase(wholeText: true), EClass.sources.elements.map[key2].GetName().ToTitleCase(wholeText: true)), FontColor.Default);
1096 }
1097 if (base.IsContainer)
1098 {
1099 AddText("isContainer".lang(things.MaxCapacity.ToString() ?? ""), FontColor.Default);
1100 }
1101 if (base.c_lockLv != 0)
1102 {
1103 AddText((base.c_lockedHard ? "isLockedHard" : "isLocked").lang(base.c_lockLv.ToString() ?? ""), FontColor.Warning);
1104 }
1105 if (base.isCrafted && recipe == null)
1106 {
1107 AddText("isCrafted".lang(), FontColor.Default);
1108 }
1109 if (trait.Decay > 0)
1110 {
1111 string text7 = "";
1112 text7 = (base.IsDecayed ? "isRotten" : (base.IsRotting ? "isRotting" : ((!base.IsFresn) ? "isNotFresh" : "isFresh")));
1113 AddText(text7.lang(), FontColor.Default);
1114 }
1115 if (base.isDyed)
1116 {
1117 AddText("isDyed".lang(base.DyeMat.GetName() ?? ""), FontColor.Default);
1118 }
1119 if (base.IsEquipment)
1120 {
1121 text2 = "isEquipable".lang(Element.Get(base.category.slot).GetText());
1122 AddText(text2, FontColor.Default);
1123 }
1124 if (base.isFireproof)
1125 {
1126 AddText("isFreproof", FontColor.Default);
1127 }
1128 if (base.isAcidproof)
1129 {
1130 AddText("isAcidproof", FontColor.Default);
1131 }
1132 if (trait.OriginalElectricity > 0)
1133 {
1134 AddText("isGenerateElectricity".lang(trait.OriginalElectricity.ToString() ?? ""), FontColor.Default);
1135 }
1136 if (trait.OriginalElectricity < 0)
1137 {
1138 AddText("isConsumeElectricity".lang(Mathf.Abs(trait.OriginalElectricity).ToString() ?? ""), FontColor.Default);
1139 }
1140 if (base.IsUnique)
1141 {
1142 AddText("isPrecious", FontColor.Default);
1143 }
1144 if (base.isCopy)
1145 {
1146 AddText("isCopy", FontColor.Default);
1147 }
1148 if (flag && HasTag(CTAG.noMix))
1149 {
1150 AddText("isNoMix", FontColor.Default);
1151 }
1152 if (!trait.CanBeDestroyed)
1153 {
1154 AddText("isIndestructable", FontColor.Default);
1155 }
1156 if (GetInt(107) > 0)
1157 {
1158 AddText("isLicked", FontColor.Great);
1159 }
1160 if (HasRune())
1161 {
1162 AddTextWithIcon("isRuneAdded", EClass.core.refs.icons.enc.rune, FontColor.Great);
1163 }
1164 if (!base.c_idDeity.IsEmpty())
1165 {
1167 AddText("isDeity".lang(religion.Name), FontColor.Myth);
1168 }
1169 if (base.c_uidAttune != 0)
1170 {
1171 Chara chara = EClass.game.cards.globalCharas.Find(base.c_uidAttune);
1172 AddText("isAttuned".lang((chara == null) ? "???" : chara.NameSimple), FontColor.Ether);
1173 }
1174 if (GetBool(128))
1175 {
1176 AddText("isPartyFood", FontColor.Ether);
1177 }
1178 if (base.isGifted && GetRoot() != EClass.pc)
1179 {
1180 AddText("isGifted", FontColor.Ether);
1181 }
1182 if (base.isNPCProperty)
1183 {
1184 AddText("isNPCProperty", FontColor.Ether);
1185 }
1186 if (base.c_priceFix != 0)
1187 {
1188 AddText(((base.c_priceFix > 0) ? "isPriceUp" : "isPriceDown").lang(Mathf.Abs(base.c_priceFix).ToString() ?? ""), FontColor.Ether);
1189 }
1190 if (base.noSell)
1191 {
1192 AddText("isNoSell", FontColor.Ether);
1193 }
1194 if (trait.IsOnlyUsableByPc)
1195 {
1196 AddText("isOnlyUsableByPC", FontColor.Ether);
1197 }
1198 if (base.isStolen)
1199 {
1200 AddText("isStolen", FontColor.Ether);
1201 }
1202 if (base.c_isImportant)
1203 {
1204 AddText("isMarkedImportant", FontColor.Ether);
1205 }
1206 if (GetInt(25) != 0)
1207 {
1208 AddText("isDangerLv".lang((GetInt(25) + 1).ToString() ?? "", (EClass.pc.FameLv + 10).ToString() ?? ""), FontColor.Default);
1209 }
1210 FontColor col = FontColor.Util;
1211 if (trait is TraitToolCrowbar)
1212 {
1213 AddText("canPryOpen", col);
1214 }
1215 else if (trait is TraitTool && !(trait is TraitToolRange))
1216 {
1217 if (HasElement(220))
1218 {
1219 AddText("canMine".lang(), col);
1220 }
1221 if (HasElement(225))
1222 {
1223 AddText("canLumberjack".lang(), col);
1224 AddText("canLumberjack2".lang(), col);
1225 }
1226 if (HasElement(230))
1227 {
1228 AddText("canDig", col);
1229 }
1230 if (HasElement(286))
1231 {
1232 AddText("canFarm", col);
1233 }
1234 if (HasElement(245))
1235 {
1236 AddText("canFish", col);
1237 }
1238 if (HasElement(237))
1239 {
1240 AddText("canTame", col);
1241 }
1242 }
1243 if (trait is TraitToolMusic)
1244 {
1245 AddText("canPlayMusic".lang(), col);
1246 }
1247 if (Lang.Has("hint_" + trait.ToString()))
1248 {
1249 AddText("hint_" + trait.ToString(), FontColor.Util);
1250 }
1251 if (Lang.Has("hint_" + trait.ToString() + "2"))
1252 {
1253 AddText("hint_" + trait.ToString() + "2", FontColor.Util);
1254 }
1255 if (HasTag(CTAG.tourism))
1256 {
1257 AddText("isTourism", FontColor.Util);
1258 }
1259 string langPlaceType = base.TileType.LangPlaceType;
1260 if (langPlaceType == "place_Door" || langPlaceType == "place_WallMount")
1261 {
1262 AddText(base.TileType.LangPlaceType + "_hint".lang(), FontColor.Util);
1263 }
1264 if (trait.IsHomeItem)
1265 {
1266 AddText("isHomeItem".lang(), FontColor.Util);
1267 }
1268 if (HasTag(CTAG.throwWeapon))
1269 {
1270 AddText("isThrowWeapon", FontColor.Default);
1271 }
1272 if (EClass.debug.showExtra && HasTag(CTAG.throwWeaponEnemy))
1273 {
1274 AddText("isThrowWeaponEnemy", FontColor.Default);
1275 }
1276 if (trait is TraitFoodFishSlice)
1277 {
1278 AddText("isNoProcessIng", FontColor.Default);
1279 }
1280 if (trait.CanDrink(EClass.pc))
1281 {
1282 AddText("isDrinkable", FontColor.Default);
1283 }
1284 else if (trait.CanEat(EClass.pc))
1285 {
1286 AddText("isEdible", FontColor.Default);
1287 }
1288 if (FoodEffect.IsLeftoverable(this))
1289 {
1290 AddText("isLeftoverable", FontColor.Default);
1291 }
1292 if (HasTag(CTAG.rareResource))
1293 {
1294 AddText("isRareResource", FontColor.Great);
1295 }
1296 if (trait is TraitBed traitBed)
1297 {
1298 AddText("isBed".lang(traitBed.MaxHolders.ToString() ?? ""), FontColor.Default);
1299 }
1300 bool showAsEquipment = base.IsEquipmentOrRangedOrAmmo || base.IsThrownWeapon || trait is TraitToolMusic;
1301 bool showTraits = !showAsEquipment || base.ShowFoodEnc;
1302 bool infoMode = mode == IInspect.NoteMode.Info;
1303 List<Element> listTrait = ListValidTraits(isCraft: false, !infoMode);
1304 List<Element> list = ListValidTraits(isCraft: false, limit: false);
1305 if (list.Count - listTrait.Count <= 1)
1306 {
1307 listTrait = list;
1308 }
1309 if (flag2)
1310 {
1311 Element element = elements.GetElement(653);
1312 if (element != null)
1313 {
1314 AddText("isAlive".lang(element.vBase.ToString() ?? "", (element.vExp / 10).ToString() ?? "", (element.ExpToNext / 10).ToString() ?? ""), FontColor.Great);
1315 }
1316 string[] rangedSubCats = new string[2] { "eleConvert", "eleAttack" };
1317 elements.AddNote(n, delegate(Element e)
1318 {
1319 if (!showAsEquipment && !e.HasTag("itemEnc"))
1320 {
1321 return false;
1322 }
1323 if (trait is TraitToolRange && base.category.slot == 0 && !(e is Ability) && !rangedSubCats.Contains(e.source.categorySub) && !e.HasTag("modRanged"))
1324 {
1325 return false;
1326 }
1327 if (e.IsTrait || (showTraits && listTrait.Contains(e)))
1328 {
1329 return false;
1330 }
1331 if (!e.IsGlobalElement)
1332 {
1333 bool flag4 = base.IsWeapon || base.IsRangedWeapon || base.IsAmmo || base.IsThrownWeapon || trait is TraitToolMusic;
1334 if (base.IsEquipment && base.category.slot != 35 && source.elementMap.ContainsKey(e.id))
1335 {
1336 flag4 = true;
1337 }
1338 if (e.source.tag.Contains("weaponEnc") && !flag4)
1339 {
1340 return false;
1341 }
1342 if (e.source.IsWeaponEnc && !(base.category.IsChildOf("shield") || flag4))
1343 {
1344 return false;
1345 }
1346 }
1347 return (!showEQStats || (e.id != 64 && e.id != 65 && e.id != 66 && e.id != 67)) ? true : false;
1348 }, null, ElementContainer.NoteMode.Default, addRaceFeat: false, delegate(Element e, string s)
1349 {
1350 if (mode != IInspect.NoteMode.Info)
1351 {
1352 return s;
1353 }
1354 int num = e.Value;
1355 if (e.source.IsWeaponEnc && (!e.source.tag.Contains("modRanged") || e.id == 609) && isEquipped && root.isChara)
1356 {
1357 int num2 = e.id;
1358 if (num2 != 482 && (uint)(num2 - 660) > 2u && num2 != 666)
1359 {
1360 num = num * (100 + AttackProcess.GetTwoHandEncBonus(root.Chara, this)) / 100;
1361 }
1362 }
1363 string text9 = " (" + e.Value + ((e.Value == num) ? "" : (" → " + num)) + ")";
1364 string text10 = "_bracketLeft3".lang() + e.Name + "_bracketRight3".lang();
1365 return s + text9 + " " + text10;
1366 });
1367 if (sockets != null)
1368 {
1369 foreach (int socket in sockets)
1370 {
1371 AddText((socket == 0) ? "emptySocket".lang() : "socket".lang(EClass.sources.elements.map[socket / 1000].GetName(), (socket % 1000).ToString() ?? ""), FontColor.Gray);
1372 }
1373 }
1374 }
1375 trait.WriteNote(n, flag2);
1376 if (base.c_DNA != null)
1377 {
1378 bool flag3 = EClass.pc.HasElement(1274) && !LayerDragGrid.Instance && base.category.id != "relic";
1379 if (base.c_DNA.cost > 0)
1380 {
1381 n.AddText("NoteText_enc", "isCostFeatPoint".lang((flag3 ? (base.c_DNA.cost * EClass.pc.GeneCostMTP / 100 + " (" + base.c_DNA.cost + ")") : ((object)base.c_DNA.cost))?.ToString() ?? ""));
1382 }
1384 {
1385 n.AddText("NoteText_enc", "duration:" + base.c_DNA.GetDurationHour());
1386 }
1387 base.c_DNA.WriteNote(n, this, flag3 ? EClass.pc : null);
1388 if (flag3)
1389 {
1390 base.c_DNA.WriteNoteExtra(n, this, EClass.pc);
1391 }
1392 }
1393 if (flag2)
1394 {
1395 if (showTraits)
1396 {
1397 elements.AddNote(n, (Element e) => listTrait.Contains(e), null, ElementContainer.NoteMode.BonusTrait, addRaceFeat: false, (Element e, string s) => s + GetTextTrait(e), delegate
1398 {
1399 });
1400 if (listTrait.Count != list.Count)
1401 {
1402 AddText("traitOther".lang((list.Count - listTrait.Count).ToString() ?? ""), FontColor.Default);
1403 }
1404 }
1405 if (base.c_mixedFoodData != null)
1406 {
1407 n.AddHeader("isMixedFood");
1408 foreach (string text12 in base.c_mixedFoodData.texts)
1409 {
1410 AddText("_bullet".lang() + text12 + text, FontColor.Default);
1411 }
1412 }
1413 }
1414 else
1415 {
1416 AddText("isUnidentified".lang(), FontColor.Flavor);
1417 if (base.c_IDTState == 1)
1418 {
1419 AddText("isUnidentified2".lang(), FontColor.Flavor);
1420 }
1421 }
1422 if (mode == IInspect.NoteMode.Product && HasCraftBonusTrait())
1423 {
1424 n.AddHeader("HeaderAdditionalTrait", "additional_trait");
1425 foreach (Element item in ListCraftBonusTraits())
1426 {
1427 item.AddEncNote(n, this, ElementContainer.NoteMode.BonusTrait, (Element e, string s) => s + GetTextTrait(e));
1428 }
1429 }
1431 {
1432 n.AddText("decay:" + base.decay);
1433 n.AddText(base.isDyed + "/" + id + "/" + base.refVal + "/" + base.LV + "/" + trait);
1434 if (source.origin != null)
1435 {
1436 n.AddText(source.origin.id);
1437 }
1438 }
1439 if (id == "statue_weird")
1440 {
1441 AddText("weirdStatue", FontColor.Default);
1442 }
1443 if (base.isReplica)
1444 {
1445 AddText("isReplica", FontColor.Passive);
1446 }
1447 if (flag2 && mode != IInspect.NoteMode.Product)
1448 {
1449 Chara chara2 = GetRootCard() as Chara;
1450 if (base.parentCard?.trait is TraitChestMerchant)
1451 {
1452 chara2 = null;
1453 }
1454 if (base.c_equippedSlot != 0 && base.category.slot == 35 && chara2 != null)
1455 {
1456 AddAttackEvaluation(n, chara2, this);
1457 }
1458 if (base.IsThrownWeapon || base.IsRangedWeapon || (base.IsMeleeWeapon && base.c_equippedSlot == 0))
1459 {
1460 n.AddHeader("headerAttackEval");
1461 AttackProcess.Current.Prepare(chara2 ?? EClass.pc, this, null, null, 0, base.IsThrownWeapon);
1462 string text8 = AttackProcess.Current.GetText();
1463 text8 = text8.TagColor(() => true);
1464 n.AddText(text8);
1465 }
1466 }
1467 if (base.ammoData != null)
1468 {
1469 n.AddHeader("headerAttackAmmo");
1470 n.AddText(base.ammoData.Name);
1471 }
1472 onWriteNote?.Invoke(n);
1473 if (mode == IInspect.NoteMode.Product && base.IsEquipmentOrRangedOrAmmo)
1474 {
1475 AddText("isProductWarning", FontColor.Default);
1476 }
1477 if ((bool)LayerDragGrid.Instance)
1478 {
1480 }
1482 {
1483 foreach (Element value in elements.dict.Values)
1484 {
1485 n.AddText(value.source.alias + "/" + value.Value + "/" + value.vBase + "/" + value.vSource);
1486 }
1487 }
1488 n.Build();
1489 void AddText(string text9, FontColor color)
1490 {
1491 n.AddText("NoteText_enc", text9, color);
1492 }
1493 void AddTextWithIcon(string text9, Sprite sprite, FontColor color)
1494 {
1495 UIItem uIItem2 = n.AddText("NoteText_enc", text9, color);
1496 uIItem2.image1.SetActive(enable: true);
1497 uIItem2.image1.sprite = sprite;
1498 }
1499 string GetTextTrait(Element e)
1500 {
1501 string text9 = e.source.GetText("textExtra");
1502 if (text9.IsEmpty())
1503 {
1504 return "";
1505 }
1506 if (e.id == 710)
1507 {
1508 text9 = text9.Replace("#1", $"{0.1f * (float)(e.Value + 10):F1}");
1509 }
1510 string text10 = "";
1511 if (e.id == 2 && mode == IInspect.NoteMode.Product)
1512 {
1513 int num = recipe.GetQualityBonus() / 10;
1514 if (num >= 0)
1515 {
1516 num++;
1517 }
1518 text10 = "qualityLimit".lang(num.ToString() ?? "");
1519 }
1520 int num2 = e.Value / 10;
1521 num2 = ((e.Value < 0) ? (num2 - 1) : (num2 + 1));
1522 string text11 = num2.ToString() ?? "";
1523 if (EClass.pc.HasElement(1250) && HasElement(710) && e.IsFoodTrait && e.id != 710)
1524 {
1525 text11 = (int)((float)num2 * 0.1f * (float)(Evalue(710) + 10)) + " (" + num2 + ")";
1526 }
1527 text9 = "Lv." + text11 + text10 + " " + text9;
1528 if (infoMode && e.IsFoodTraitMain)
1529 {
1530 text9 += "traitAdditive".lang();
1531 }
1532 return (" <size=12>" + text9 + "</size>").TagColor(FontColor.Passive);
1533 }
1534 }
1535
1536 public static void AddAttackEvaluation(UINote n, Chara chara, Thing current = null)
1537 {
1538 n.AddHeader("headerAttackEval");
1539 int num = 0;
1540 foreach (BodySlot slot in chara.body.slots)
1541 {
1542 if (slot.thing == null || slot.elementId != 35 || slot.thing.source.offense.Length < 2)
1543 {
1544 continue;
1545 }
1546 AttackProcess.Current.Prepare(chara, slot.thing, null, null, num);
1547 string text = AttackProcess.Current.GetText();
1548 if (slot.thing == current)
1549 {
1550 text = text.TagColor(() => true);
1551 }
1552 n.AddText(text);
1553 num++;
1554 }
1555 AttackProcess.Current.Prepare(chara, null);
1556 string text2 = AttackProcess.Current.GetText();
1557 if (num == 0)
1558 {
1559 text2 = text2.TagColor(() => true);
1560 }
1561 n.AddText(text2);
1562 }
1563
1564 public override void SetRenderParam(RenderParam p)
1565 {
1566 p.matColor = base.colorInt;
1567 p.mat = base.material;
1568 if (!renderer.usePass)
1569 {
1570 return;
1571 }
1572 switch (trait.tileMode)
1573 {
1574 case Trait.TileMode.DefaultNoAnime:
1575 if (source._altTiles.Length != 0 && trait.UseAltTiles)
1576 {
1577 p.tile = source._altTiles[base.dir % source._altTiles.Length] * ((!flipX) ? 1 : (-1));
1578 }
1579 else
1580 {
1581 p.tile = sourceCard._tiles[base.dir % sourceCard._tiles.Length] * ((!flipX) ? 1 : (-1));
1582 }
1583 break;
1584 case Trait.TileMode.FakeBlock:
1585 {
1586 SourceBlock.Row row2 = EClass.sources.blocks[base.refVal];
1587 p.tile = row2._tiles[base.dir % row2._tiles.Length];
1588 if (row2.tileType.IsFullBlock)
1589 {
1590 p.color += 1572864f;
1591 }
1592 break;
1593 }
1594 case Trait.TileMode.FakeObj:
1595 {
1596 SourceObj.Row row = EClass.sources.objs[base.refVal];
1597 p.tile = row._tiles[base.dir % row._tiles.Length];
1598 break;
1599 }
1600 case Trait.TileMode.SignalAnime:
1601 if (source._altTiles.Length != 0 && trait.UseAltTiles)
1602 {
1603 p.tile = source._altTiles[base.dir % source._altTiles.Length] * ((!flipX) ? 1 : (-1));
1604 }
1605 else
1606 {
1607 p.tile = sourceCard._tiles[base.dir % sourceCard._tiles.Length] * ((!flipX) ? 1 : (-1));
1608 }
1609 if (animeCounter > 0f && source.anime.Length != 0)
1610 {
1611 animeCounter += Time.deltaTime;
1612 int num3 = (int)(animeCounter / (0.001f * (float)source.anime[1]));
1613 if (num3 > ((source.anime.Length > 2) ? source.anime[2] : source.anime[0]))
1614 {
1615 animeCounter = 0f;
1616 }
1617 else
1618 {
1619 p.tile += num3 % source.anime[0] * ((!flipX) ? 1 : (-1));
1620 }
1621 }
1622 break;
1623 case Trait.TileMode.Illumination:
1624 if (base.isOn || base.isRoofItem)
1625 {
1626 int num4 = (int)((float)base.uid + Time.realtimeSinceStartup * 5f);
1627 int num5 = (int)(Time.realtimeSinceStartup * 5f);
1628 p.tile = (sourceCard._tiles[base.dir % sourceCard._tiles.Length] + num4 % 3 + 1) * ((!flipX) ? 1 : (-1));
1629 if (num5 % 16 == 0)
1630 {
1631 p.color = 5242880f;
1632 }
1633 else if (num5 % 11 == 0)
1634 {
1635 p.color = 7864320f;
1636 }
1637 else
1638 {
1639 p.color = 13107200f;
1640 }
1641 }
1642 else
1643 {
1644 p.tile = sourceCard._tiles[base.dir % sourceCard._tiles.Length] * ((!flipX) ? 1 : (-1));
1645 }
1646 break;
1647 case Trait.TileMode.Door:
1648 if (source._altTiles.Length != 0 && trait.UseAltTiles)
1649 {
1650 p.tile = source._altTiles[base.dir % source._altTiles.Length] * ((!flipX) ? 1 : (-1));
1651 }
1652 else
1653 {
1654 p.tile = sourceCard._tiles[base.dir % sourceCard._tiles.Length] * ((!flipX) ? 1 : (-1));
1655 }
1656 if (parent is Zone && pos.cell.HasFullBlock)
1657 {
1658 p.tile += ((p.tile < 0f) ? (-64) : 64);
1659 }
1660 if (trait is TraitDoorSwing traitDoorSwing && traitDoorSwing.IsOpen())
1661 {
1662 p.tile += ((!(p.tile < 0f)) ? 1 : (-1));
1663 }
1664 break;
1665 default:
1666 {
1667 if (source._altTiles.Length != 0 && trait.UseAltTiles)
1668 {
1669 p.tile = source._altTiles[base.dir % source._altTiles.Length] * ((!flipX) ? 1 : (-1));
1670 }
1671 else
1672 {
1673 p.tile = sourceCard._tiles[base.dir % sourceCard._tiles.Length] * ((!flipX) ? 1 : (-1));
1674 }
1675 float time = Time.realtimeSinceStartup;
1676 if (source.animeNoSync)
1677 {
1678 Rand.UseSeed(base.uid, delegate
1679 {
1680 time += EClass.rnd(1000);
1681 });
1682 }
1683 if (source.anime.Length == 0 || !trait.IsAnimeOn)
1684 {
1685 break;
1686 }
1687 if (source.anime.Length > 2)
1688 {
1689 int num = (int)(time * 1000f / (float)source.anime[1] % (float)source.anime[2]);
1690 if (num == source.anime[0] - 1 && source.anime.Length > 3)
1691 {
1692 PlaySound("anime_sound" + source.anime[3]);
1693 }
1694 if (num < source.anime[0])
1695 {
1696 p.tile += num * ((!(p.tile < 0f)) ? 1 : (-1));
1697 }
1698 }
1699 else
1700 {
1701 int num2 = (int)(time * 1000f / (float)source.anime[1] % (float)source.anime[0]);
1702 p.tile += num2 * ((!(p.tile < 0f)) ? 1 : (-1));
1703 }
1704 break;
1705 }
1706 }
1707 if (trait.IdSkin != 0 && sourceCard.skins.Length != 0)
1708 {
1709 int num6 = sourceCard.skins.TryGet(trait.IdSkin - 1);
1710 num6 = num6 / 100 * (int)source.renderData.pass.pmesh.tiling.x + num6 % 100;
1711 p.tile += ((p.tile < 0f) ? (-num6) : num6);
1712 }
1713 }
1714
1715 public override SubPassData GetSubPassData()
1716 {
1717 Chara chara = GetRootCard() as Chara;
1718 if ((!trait.ShowAsTool || (chara == EClass.pc && HotItemHeld.disableTool)) && (chara?.held == this || (!base.isRoofItem && placeState != PlaceState.installed && renderer.data.subCrate.enable && parent is Zone)))
1719 {
1720 if (!renderer.data.subCrate.enable)
1721 {
1722 return EClass.setting.pass.subCrate;
1723 }
1724 return renderer.data.subCrate;
1725 }
1726 return SubPassData.Default;
1727 }
1728
1729 public override bool CanStackTo(Thing to)
1730 {
1731 if (trait.HasCharges || to.isEquipped || base.isModified || to.isModified || to.id != id || to.idMaterial != base.idMaterial || to.refVal != base.refVal || to.blessedState != base.blessedState || to.rarityLv != base.rarityLv || to.tier != base.tier || to.idSkin != base.idSkin || to.isGifted != base.isGifted)
1732 {
1733 return false;
1734 }
1735 if ((to.isDyed || base.isDyed) && to.c_dyeMat != base.c_dyeMat)
1736 {
1737 return false;
1738 }
1739 if (base.c_idRefCard != to.c_idRefCard || base.c_idRefCard2 != to.c_idRefCard2)
1740 {
1741 return false;
1742 }
1743 if (base.IsDecayed != to.IsDecayed)
1744 {
1745 return false;
1746 }
1747 if (!trait.CanStackTo(to))
1748 {
1749 return false;
1750 }
1751 if (base.noSell != to.noSell || base.isCopy != to.isCopy)
1752 {
1753 return false;
1754 }
1755 if (base.isStolen != to.isStolen)
1756 {
1757 return false;
1758 }
1759 if (base.isCrafted != to.isCrafted)
1760 {
1761 return false;
1762 }
1763 if ((to.isWeightChanged || base.isWeightChanged) && to.SelfWeight != SelfWeight)
1764 {
1765 return false;
1766 }
1767 if (to.c_IDTState != base.c_IDTState)
1768 {
1769 return false;
1770 }
1771 if (to.c_priceAdd != base.c_priceAdd || to.c_priceFix != base.c_priceFix || to.c_priceCopy != base.c_priceCopy)
1772 {
1773 return false;
1774 }
1775 if (to.ChildrenAndSelfWeight + base.ChildrenAndSelfWeight > 1000000000)
1776 {
1777 return false;
1778 }
1779 if (trait.IsRequireFuel && base.c_charges != to.c_charges)
1780 {
1781 return false;
1782 }
1783 if (base.c_altName != to.c_altName)
1784 {
1785 return false;
1786 }
1787 if (base.Num + to.Num <= 0)
1788 {
1789 return false;
1790 }
1791 bool flag = false;
1792 if (to.parent is Card)
1793 {
1794 Window.SaveData windowSaveData = (to.parent as Card).GetWindowSaveData();
1795 if (windowSaveData != null && windowSaveData.compress)
1796 {
1797 flag = true;
1798 }
1799 }
1800 if (flag)
1801 {
1802 if (base.encLV != to.encLV && !base.IsFood)
1803 {
1804 return false;
1805 }
1806 if (elements.dict.Count() != to.elements.dict.Count())
1807 {
1808 return false;
1809 }
1810 foreach (Element value in elements.dict.Values)
1811 {
1812 Element element = to.elements.GetElement(value.id);
1813 if (element == null)
1814 {
1815 return false;
1816 }
1817 if (element.Value != value.Value)
1818 {
1819 _ = value.id;
1820 _ = 770;
1821 }
1822 }
1823 int num = (to.encLV = Mathf.CeilToInt(MathEx.ClampToInt(((long)base.encLV * (long)base.Num + (long)to.encLV * (long)to.Num) / ((long)base.Num + (long)to.Num))));
1824 base.encLV = num;
1825 foreach (Element value2 in elements.dict.Values)
1826 {
1827 Element element2 = to.elements.GetElement(value2.id);
1828 value2.vBase = (element2.vBase = MathEx.ClampToInt(((long)value2.vBase * (long)base.Num + (long)element2.vBase * (long)to.Num) / ((long)base.Num + (long)to.Num)));
1829 }
1830 return true;
1831 }
1832 if (base.encLV != to.encLV)
1833 {
1834 return false;
1835 }
1836 if (elements.dict.Count() != to.elements.dict.Count())
1837 {
1838 return false;
1839 }
1840 foreach (Element value3 in elements.dict.Values)
1841 {
1842 Element element3 = to.elements.GetElement(value3.id);
1843 if (element3 == null || value3.vBase / 10 * 10 != element3.vBase / 10 * 10)
1844 {
1845 return false;
1846 }
1847 }
1848 return true;
1849 }
1850
1851 public void GetIngredients(Recipe.Ingredient ing, List<Thing> list)
1852 {
1853 if (ing.CanSetThing(this))
1854 {
1855 list.Add(this);
1856 }
1857 if (things.Count <= 0 || base.c_lockLv != 0 || base.isNPCProperty)
1858 {
1859 return;
1860 }
1861 foreach (Thing thing in things)
1862 {
1863 thing.GetIngredients(ing, list);
1864 }
1865 }
1866
1868 {
1869 if (isDestroyed)
1870 {
1871 return false;
1872 }
1873 if (GetRootCard().Dist(EClass.pc) > 1 || !ing.CanSetThing(this))
1874 {
1875 return false;
1876 }
1877 return true;
1878 }
1879
1880 public void GetRecipes(HashSet<Recipe> recipes)
1881 {
1882 }
1883
1884 public void GetDisassembles(List<Thing> list)
1885 {
1886 }
1887
1888 public void Disassemble()
1889 {
1890 }
1891
1892 public void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans = null)
1893 {
1894 int count = 1;
1895 UIContextMenu m = EClass.ui.CreateContextMenuInteraction();
1896 bool buy = trans != null;
1897 UIButton buttonBuy = null;
1898 UIItem itemSlider = null;
1899 itemSlider = m.AddSlider("sliderSplitMenu", "adjustmentNum", (float a) => (!EClass.core.IsGameStarted) ? "" : ("/" + base.Num), count, delegate(float b)
1900 {
1901 count = (int)b;
1902 if (trans != null)
1903 {
1904 trans.num = count;
1905 }
1906 UpdateButton();
1907 }, 1f, base.Num, isInt: true, hideOther: false, useInput: true).GetComponent<UIItem>();
1908 if (buy)
1909 {
1910 buttonBuy = m.AddButton("invBuy", delegate
1911 {
1912 Process();
1913 });
1914 }
1915 m.onDestroy = delegate
1916 {
1917 if ((!buy || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && !m.wasCanceled)
1918 {
1919 Process();
1920 }
1921 };
1922 m.Show();
1923 if ((bool)buttonBuy)
1924 {
1925 buttonBuy.gameObject.AddComponent<CanvasGroup>();
1926 }
1927 UpdateButton();
1928 void Process()
1929 {
1930 if (!EClass.core.IsGameStarted || button == null || button.card == null)
1931 {
1932 Debug.Log("Split bug1");
1933 }
1934 else if (button.card.isDestroyed || button.card.Num < count)
1935 {
1936 Debug.Log("Split bug2");
1937 }
1938 else if (EClass.pc.isDead)
1939 {
1940 Debug.Log("Split bug3");
1941 }
1942 else if (count != 0 && !Input.GetMouseButton(1))
1943 {
1944 if (trans != null)
1945 {
1946 trans.Process(startTransaction: true);
1947 }
1948 else
1949 {
1950 DragItemCard dragItemCard = new DragItemCard(button);
1951 if (count != base.Num)
1952 {
1953 Thing thing = button.card.Split(base.Num - count);
1954 button.invOwner.Container.AddThing(thing, tryStack: false);
1955 thing.invX = dragItemCard.from.invX;
1956 thing.invY = dragItemCard.from.invY;
1957 thing.posInvX = button.card.Thing.posInvX;
1958 thing.posInvY = button.card.Thing.posInvY;
1959 }
1960 EClass.ui.StartDrag(dragItemCard);
1961 }
1962 }
1963 }
1964 void UpdateButton()
1965 {
1966 itemSlider.text1.text = GetName(NameStyle.FullNoArticle, 1);
1967 itemSlider.text2.text = Lang._weight(SelfWeight * count);
1968 if ((bool)buttonBuy)
1969 {
1970 buttonBuy.mainText.SetText(trans.GetTextDetail());
1971 buttonBuy.mainText.RebuildLayoutTo<UIButton>();
1972 buttonBuy.interactable = trans.IsValid();
1973 buttonBuy.RebuildLayout(recursive: true);
1974 buttonBuy.gameObject.GetComponent<CanvasGroup>().alpha = (trans.IsValid() ? 1f : 0.9f);
1975 }
1976 }
1977 }
1978
1979 public void ShowSplitMenu2(ButtonGrid button, string lang, Action<int> onSplit = null)
1980 {
1981 int count = 1;
1982 UIContextMenu m = EClass.ui.CreateContextMenuInteraction();
1983 UIButton buttonBuy = null;
1984 UIItem itemSlider = null;
1985 itemSlider = m.AddSlider("sliderSplitMenu", "adjustmentNum", (float a) => (!EClass.core.IsGameStarted) ? "" : ("/" + base.Num), count, delegate(float b)
1986 {
1987 count = (int)b;
1988 UpdateButton();
1989 }, 1f, base.Num, isInt: true, hideOther: false, useInput: true).GetComponent<UIItem>();
1990 buttonBuy = m.AddButton("invBuy", delegate
1991 {
1992 Process();
1993 });
1994 m.onDestroy = delegate
1995 {
1996 if ((Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) && !m.wasCanceled)
1997 {
1998 Process();
1999 }
2000 };
2001 m.Show();
2002 if ((bool)buttonBuy)
2003 {
2004 buttonBuy.gameObject.AddComponent<CanvasGroup>();
2005 }
2006 UpdateButton();
2007 void Process()
2008 {
2009 if (!EClass.core.IsGameStarted || button == null || button.card == null)
2010 {
2011 Debug.Log("Split bug1");
2012 }
2013 else if (button.card.isDestroyed || button.card.Num < count)
2014 {
2015 Debug.Log("Split bug2");
2016 }
2017 else if (EClass.pc.isDead)
2018 {
2019 Debug.Log("Split bug3");
2020 }
2021 else if (count != 0 && !Input.GetMouseButton(1))
2022 {
2023 onSplit?.Invoke(count);
2024 }
2025 }
2026 void UpdateButton()
2027 {
2028 itemSlider.text1.text = GetName(NameStyle.FullNoArticle, 1);
2029 itemSlider.text2.text = Lang._weight(SelfWeight * count);
2030 buttonBuy.mainText.SetText(lang.lang(count.ToString() ?? ""));
2031 buttonBuy.mainText.RebuildLayoutTo<UIButton>();
2032 buttonBuy.interactable = true;
2033 buttonBuy.RebuildLayout(recursive: true);
2034 }
2035 }
2036
2037 public void DoAct(Act act)
2038 {
2039 if (!EClass.pc.HasNoGoal || (act.LocalAct && EClass._zone.IsRegion))
2040 {
2041 SE.Beep();
2042 return;
2043 }
2044 EClass.player.hotItemToRestore = EClass.player.currentHotItem;
2045 if (act.IsAct)
2046 {
2047 act.Perform(EClass.pc);
2048 return;
2049 }
2050 AIAct aI = act as AIAct;
2051 EClass.pc.SetAI(aI);
2053 }
2054
2055 public static Tuple<SourceElement.Row, int> GetEnchant(long lv, Func<SourceElement.Row, bool> func, bool neg)
2056 {
2057 List<SourceElement.Row> list = new List<SourceElement.Row>();
2058 int num = 0;
2059 long num2 = lv + 5 + EClass.rndSqrt(10);
2060 foreach (SourceElement.Row row in EClass.sources.elements.rows)
2061 {
2062 if ((!neg || !row.tag.Contains("flag")) && func(row) && row.LV < num2)
2063 {
2064 list.Add(row);
2065 num += row.chance;
2066 }
2067 }
2068 if (num == 0)
2069 {
2070 return null;
2071 }
2072 int num3 = EClass.rnd(num);
2073 int num4 = 0;
2074 foreach (SourceElement.Row item in list)
2075 {
2076 num4 += item.chance;
2077 if (num3 < num4)
2078 {
2079 string text = EClass.sources.elements.map[item.id].category;
2080 bool flag = text == "skill" || text == "attribute" || text == "resist";
2081 float num5 = 3f + Mathf.Min(lv / 10, 15f) + Mathf.Sqrt(lv * item.encFactor / 100);
2082 int num6 = (item.mtp + EClass.rnd(item.mtp + (int)num5)) / item.mtp * ((!(flag && neg)) ? 1 : (-1));
2083 if (item.encFactor == 0 && num6 > 25)
2084 {
2085 num6 = 25;
2086 }
2087 return new Tuple<SourceElement.Row, int>(item, num6);
2088 }
2089 }
2090 return null;
2091 }
2092
2093 public void TryLickEnchant(Chara c, bool msg = true, Chara tg = null, BodySlot slot = null)
2094 {
2095 if (!base.IsEquipment || base.IsCursed || base.rarity <= Rarity.Normal || GetInt(107) > 0)
2096 {
2097 return;
2098 }
2099 SetInt(107, 1);
2100 if (tg == null)
2101 {
2102 Rand.SetSeed(EClass.world.date.day + source._index + c.uid);
2103 if (msg)
2104 {
2105 c.Say("lick", c, this);
2106 PlaySound("offering");
2107 PlayEffect("mutation");
2108 }
2109 Element element = AddEnchant(base.LV);
2110 if (element != null)
2111 {
2112 SetInt(107, element.id);
2113 }
2114 }
2115 else
2116 {
2117 Rand.SetSeed(base.uid);
2118 List<Element> list = new List<Element>();
2119 foreach (Element value in elements.dict.Values)
2120 {
2121 if (value.id != 67 && value.id != 66 && value.id != 64 && value.id != 65)
2122 {
2123 list.Add(value);
2124 }
2125 }
2126 if (list.Count > 0)
2127 {
2128 Element element2 = list.RandomItem();
2129 elements.ModBase(element2.id, Mathf.Max(EClass.rnd(Mathf.Abs(element2.vBase / 5)), 1));
2130 SetInt(107, element2.id);
2131 }
2132 if (msg)
2133 {
2134 c.Say("lick2", c, tg, slot.name.ToLower());
2135 tg.PlaySound("offering");
2136 tg.PlayEffect("mutation");
2137 }
2138 }
2139 Rand.SetSeed();
2140 }
2141
2142 public Element AddEnchant(int lv = -1)
2143 {
2144 if (base.IsToolbelt || base.IsLightsource)
2145 {
2146 return null;
2147 }
2148 Tuple<SourceElement.Row, int> enchant = GetEnchant(lv, (SourceElement.Row r) => r.IsEncAppliable(base.category), base.IsCursed);
2149 if (enchant == null)
2150 {
2151 return null;
2152 }
2153 return elements.ModBase(enchant.Item1.id, enchant.Item2);
2154 }
2155
2156 public void RemoveEnchant()
2157 {
2158 }
2159
2160 public void Attune(Chara c)
2161 {
2162 Msg.Say("attuned", this, c);
2163 base.c_uidAttune = c.uid;
2164 }
2165
2166 public Thing Identify(bool show = true, IDTSource idtSource = IDTSource.Identify)
2167 {
2168 if (base.IsIdentified)
2169 {
2170 return this;
2171 }
2172 string @ref = "";
2173 string text = "";
2174 if (show)
2175 {
2176 @ref = GetName(NameStyle.Full, base.Num);
2177 }
2178 Rarity rarity = idtSource switch
2179 {
2180 IDTSource.SkillHigh => Rarity.Legendary,
2181 IDTSource.Skill => Rarity.Superior,
2182 _ => Rarity.Normal,
2183 };
2184 if (rarity != Rarity.Normal && ((base.IsEquipmentOrRangedOrAmmo && base.rarity >= rarity) || base.rarity >= Rarity.Mythical))
2185 {
2186 base.c_IDTState = 3;
2187 }
2188 else if (base.rarity >= Rarity.Mythical && idtSource != IDTSource.SuperiorIdentify)
2189 {
2190 base.c_IDTState = 1;
2191 }
2192 else
2193 {
2194 base.c_IDTState = 0;
2195 }
2196 if (show)
2197 {
2198 text = GetName(NameStyle.Full, base.Num);
2199 if (base.c_IDTState == 0)
2200 {
2201 Msg.Say("identified", @ref, text);
2202 }
2203 else
2204 {
2205 Msg.Say((idtSource == IDTSource.Skill) ? "identified3" : "identified2", @ref, text, base.TextRarity);
2206 }
2207 }
2208 if (base.IsIdentified)
2209 {
2210 GetRootCard()?.TryStack(this);
2211 }
2213 return this;
2214 }
2215
2216 public override bool MatchEncSearch(string s)
2217 {
2218 if (trait is TraitGene)
2219 {
2220 DNA dNA = base.c_DNA;
2221 if (dNA == null || dNA.type == DNA.Type.Brain || dNA.type == DNA.Type.Inferior)
2222 {
2223 return false;
2224 }
2225 for (int i = 0; i < dNA.vals.Count; i += 2)
2226 {
2227 SourceElement.Row row = EClass.sources.elements.map.TryGetValue(dNA.vals[i]);
2228 if (row.name.ToLower().Contains(s))
2229 {
2230 return true;
2231 }
2232 if (row.GetName().ToLower().Contains(s))
2233 {
2234 return true;
2235 }
2236 }
2237 }
2238 else
2239 {
2240 if (!base.IsIdentified)
2241 {
2242 return false;
2243 }
2244 foreach (Element value in elements.dict.Values)
2245 {
2246 if (value.Value != 0)
2247 {
2248 if (value.source.name.ToLower().Contains(s))
2249 {
2250 return true;
2251 }
2252 if (value.source.GetName().ToLower().Contains(s))
2253 {
2254 return true;
2255 }
2256 }
2257 }
2258 }
2259 return false;
2260 }
2261}
2262public static class THING
2263{
2264 public const string potionCureCorruption = "1165";
2265}
ArticleStyle
Definition: ArticleStyle.cs:2
BlessedState
Definition: BlessedState.cs:2
CTAG
Definition: CTAG.cs:2
@ currency
ContainerSharedType
CurrencyType
Definition: CurrencyType.cs:2
if(!match.Success)
FontColor
Definition: FontColor.cs:2
IDTSource
Definition: IDTSource.cs:2
NameStyle
Definition: NameStyle.cs:2
PlaceState
Definition: PlaceState.cs:2
PriceType
Definition: PriceType.cs:2
Rarity
Definition: Rarity.cs:2
RefCardName
Definition: RefCardName.cs:2
Definition: AIAct.cs:6
void SetTurbo(int mtp=-1)
Definition: AM_Adv.cs:1091
Definition: ACT.cs:62
virtual bool Perform()
Definition: ACT.cs:266
virtual bool LocalAct
Definition: ACT.cs:173
virtual bool IsAct
Definition: ACT.cs:101
static AM_Adv Adv
Definition: ActionMode.cs:15
int group
Definition: AreaData.cs:18
void Prepare(Chara _CC, Thing _weapon, Card _TC=null, Point _TP=null, int _attackIndex=0, bool _isThrow=false)
static AttackProcess Current
Definition: AttackProcess.cs:8
static int GetTwoHandEncBonus(Chara CC, Thing w)
string GetText()
AreaData data
Definition: BaseArea.cs:29
string name
Definition: BodySlot.cs:14
int elementId
Definition: BodySlot.cs:6
Thing thing
Definition: BodySlot.cs:8
Card card
Definition: ButtonGrid.cs:24
InvOwner invOwner
Definition: ButtonGrid.cs:28
BlessedState? blesstedState
Chara Find(string id)
Definition: CardManager.cs:20
GlobalCharaList globalCharas
Definition: CardManager.cs:46
int quality
Definition: CardRow.cs:19
CardRow origin
Definition: CardRow.cs:49
string _origin
Definition: CardRow.cs:15
string id
Definition: CardRow.cs:7
Definition: Card.cs:11
bool isDestroyed
Definition: Card.cs:78
int FameLv
Definition: Card.cs:2380
int c_priceFix
Definition: Card.cs:1176
bool isCrafted
Definition: Card.cs:797
int tier
Definition: Card.cs:413
bool IsDecayed
Definition: Card.cs:2369
virtual int PV
Definition: Card.cs:2409
int idMaterial
Definition: Card.cs:137
virtual Chara Chara
Definition: Card.cs:2134
int posInvY
Definition: Card.cs:353
Thing Split(int a)
Definition: Card.cs:3677
void AddSocket()
Definition: Card.cs:3734
ElementContainerCard elements
Definition: Card.cs:42
string id
Definition: Card.cs:36
bool IsThrownWeapon
Definition: Card.cs:2311
bool noSell
Definition: Card.cs:833
CardBlueprint bp
Definition: Card.cs:80
bool isCopy
Definition: Card.cs:881
string c_altName
Definition: Card.cs:1645
int c_priceAdd
Definition: Card.cs:1188
int c_dyeMat
Definition: Card.cs:1237
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3292
virtual int DV
Definition: Card.cs:2407
ICardParent parent
Definition: Card.cs:56
bool ExistsOnMap
Definition: Card.cs:2149
void ApplySocket(Thing t)
Definition: Card.cs:3743
int c_priceCopy
Definition: Card.cs:1200
int c_IDTState
Definition: Card.cs:1309
string GetStr(string id, string defaultStr=null)
Definition: Card.cs:2607
virtual void SetBlessedState(BlessedState s)
Definition: Card.cs:4088
bool HasTag(CTAG tag)
Definition: Card.cs:2740
string c_idRefCard2
Definition: Card.cs:1801
int uid
Definition: Card.cs:125
int refVal
Definition: Card.cs:209
Trait trait
Definition: Card.cs:54
int encLV
Definition: Card.cs:329
void SetEncLv(int a)
Definition: Card.cs:4057
bool isDyed
Definition: Card.cs:461
bool isWeightChanged
Definition: Card.cs:665
string NameSimple
Definition: Card.cs:2205
int rarityLv
Definition: Card.cs:305
virtual bool isChara
Definition: Card.cs:2147
virtual Thing Thing
Definition: Card.cs:2122
Card GetRootCard()
Definition: Card.cs:3619
bool GetBool(string id)
Definition: Card.cs:2569
int idSkin
Definition: Card.cs:365
bool isGifted
Definition: Card.cs:785
BlessedState blessedState
Definition: Card.cs:281
int _colorInt
Definition: Card.cs:70
bool isStolen
Definition: Card.cs:857
int ChildrenAndSelfWeight
Definition: Card.cs:2105
bool isModified
Definition: Card.cs:473
int genLv
Definition: Card.cs:197
int Num
Definition: Card.cs:161
int posInvX
Definition: Card.cs:341
int c_charges
Definition: Card.cs:1321
List< int > sockets
Definition: Card.cs:48
int GetInt(string id, int? defaultInt=null)
Definition: Card.cs:2579
bool HasElement(int ele, bool includeNagative=false)
Definition: Card.cs:6399
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7345
string c_idRefCard
Definition: Card.cs:1789
bool Has(int id)
bool IsTooHeavyToEquip(Thing thing)
Definition: CharaBody.cs:187
Definition: Chara.cs:10
CharaBody body
Definition: Chara.cs:96
Card held
Definition: Chara.cs:72
override bool IsPC
Definition: Chara.cs:632
AIAct SetAI(AIAct g)
Definition: Chara.cs:9575
override bool IsPCFaction
Definition: Chara.cs:691
int GeneCostMTP
Definition: Chara.cs:1127
Religion faith
Definition: Chara.cs:445
bool HasNoGoal
Definition: Chara.cs:1056
CharaAbility ability
Definition: Chara.cs:430
bool isDead
Definition: Chara.cs:395
BackerContentConfig backer
Definition: CoreConfig.cs:633
bool showExtra
Definition: CoreDebug.cs:184
bool enable
Definition: CoreDebug.cs:302
bool autoIdentify
Definition: CoreDebug.cs:205
Icons icons
Definition: CoreRef.cs:358
CoreRef refs
Definition: Core.cs:51
bool IsGameStarted
Definition: Core.cs:87
CoreConfig config
Definition: Core.cs:70
Definition: DNA.cs:9
Type type
Definition: DNA.cs:31
Type
Definition: DNA.cs:11
List< int > vals
Definition: DNA.cs:26
int day
Definition: Date.cs:62
DragInfo from
Definition: DragItemCard.cs:54
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static Core core
Definition: EClass.cs:7
static Zone _zone
Definition: EClass.cs:21
static int rndSqrt(int a)
Definition: EClass.cs:107
static World world
Definition: EClass.cs:41
static int rnd(long a)
Definition: EClass.cs:59
static SourceManager sources
Definition: EClass.cs:43
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static UI ui
Definition: EClass.cs:17
static GameSetting setting
Definition: EClass.cs:35
static int GetSortVal(Element a)
Dictionary< int, Element > dict
void SetParent(Card c)
void ApplyMaterialElementMap(Thing t, bool invert=false)
Element ModBase(int ele, int v)
Element SetBase(string alias, int v, int potential=0)
Element GetOrCreateElement(Element ele)
Element GetElement(string alias)
static SourceElement.Row GetRandomElement(int lv=1, bool useWeight=true)
Definition: ELEMENT.cs:593
int id
Definition: ELEMENT.cs:259
int vBase
Definition: ELEMENT.cs:261
SourceElement.Row source
Definition: ELEMENT.cs:282
int vExp
Definition: ELEMENT.cs:263
void _WriteNote(UINote n, Chara c, Act act)
Definition: ELEMENT.cs:643
int vPotential
Definition: ELEMENT.cs:265
static SourceElement.Row Get(int id)
Definition: ELEMENT.cs:410
bool HasTag(string tag)
Definition: ELEMENT.cs:482
int Value
Definition: ELEMENT.cs:301
bool IsFoodTrait
Definition: ELEMENT.cs:373
int vSource
Definition: ELEMENT.cs:271
bool IsGlobalElement
Definition: ELEMENT.cs:354
bool IsTrait
Definition: ELEMENT.cs:371
bool IsFoodTraitMain
Definition: ELEMENT.cs:376
virtual int ExpToNext
Definition: ELEMENT.cs:317
static bool IsLeftoverable(Thing food)
Definition: FoodEffect.cs:7
PassSetting pass
Definition: GameSetting.cs:350
ReligionManager religions
Definition: Game.cs:159
CardManager cards
Definition: Game.cs:156
int seed
Definition: Game.cs:201
int FurnitureBonus()
Definition: GuildThief.cs:26
Definition: Guild.cs:2
static GuildThief Thief
Definition: Guild.cs:60
static bool disableTool
Definition: HotItemHeld.cs:11
virtual void OnWriteNote(Thing t, UINote n)
static bool IsValidRangedMod(Thing t, SourceElement.Row row)
Definition: InvOwnerMod.cs:9
Card Container
Definition: InvOwner.cs:535
Definition: Lang.cs:7
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:171
static LangNote Note
Definition: Lang.cs:51
static string[] GetList(string id)
Definition: Lang.cs:113
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:161
static bool Has(string id)
Definition: Lang.cs:99
static LayerCraft Instance
Definition: LayerCraft.cs:8
InvOwnerDraglet owner
static LayerDragGrid Instance
static void SetDirty(Thing t)
Definition: MathEx.cs:2
static int ClampToInt(long a)
Definition: MathEx.cs:25
ProceduralMesh pmesh
Definition: MeshPass.cs:25
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
HotItem currentHotItem
Definition: Player.cs:1179
Thing eqBait
Definition: Player.cs:1185
Definition: Rand.cs:4
static void UseSeed(int seed, Action action)
Definition: Rand.cs:24
static void SetSeed(int a=-1)
Definition: Rand.cs:44
Definition: Recipe.cs:7
Religion Find(string id)
ReligionEyth Eyth
virtual string NameShort
Definition: Religion.cs:55
MeshPass pass
Definition: RenderData.cs:17
SpriteReplacer replacer
Definition: RenderRow.cs:92
RenderData renderData
Definition: RenderRow.cs:71
SourcePref pref
Definition: RenderRow.cs:68
TileType tileType
Definition: RenderRow.cs:77
int[] skins
Definition: RenderRow.cs:14
int[] _tiles
Definition: RenderRow.cs:12
int[] tiles
Definition: RenderRow.cs:10
Definition: Room.cs:4
Dictionary< string, CardRow > firstVariations
Definition: SourceCard.cs:11
override string GetName()
SourceCard cards
SourceObj objs
SourceThing things
SourceBlock blocks
SourceCategory categories
SourceElement elements
virtual bool IsRegion
Definition: Spatial.cs:515
Definition: SPELL.cs:712
SourcePref pref
Definition: SpriteData.cs:32
SpriteData data
static SubPassData Default
Definition: SubPassData.cs:7
Definition: Thing.cs:2263
const string potionCureCorruption
Definition: Thing.cs:2264
Definition: Thing.cs:8
void GetDisassembles(List< Thing > list)
Definition: Thing.cs:1884
void GetIngredients(Recipe.Ingredient ing, List< Thing > list)
Definition: Thing.cs:1851
SourceThing.Row source
Definition: Thing.cs:11
override void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
Definition: Thing.cs:903
void GetRecipes(HashSet< Recipe > recipes)
Definition: Thing.cs:1880
static Tuple< SourceElement.Row, int > GetEnchant(long lv, Func< SourceElement.Row, bool > func, bool neg)
Definition: Thing.cs:2055
bool IsValidIngredient(Recipe.Ingredient ing)
Definition: Thing.cs:1867
bool isEquipped
Definition: Thing.cs:17
void RemoveEnchant()
Definition: Thing.cs:2156
override void SetRenderParam(RenderParam p)
Definition: Thing.cs:1564
void ShowSplitMenu(ButtonGrid button, InvOwner.Transaction trans=null)
Definition: Thing.cs:1892
override int[] Tiles
Definition: Thing.cs:79
void Disassemble()
Definition: Thing.cs:1888
int range
Definition: Thing.cs:31
string tempName
Definition: Thing.cs:15
void TryLickEnchant(Chara c, bool msg=true, Chara tg=null, BodySlot slot=null)
Definition: Thing.cs:2093
void ShowSplitMenu2(ButtonGrid button, string lang, Action< int > onSplit=null)
Definition: Thing.cs:1979
override void SetSource()
Definition: Thing.cs:164
override SubPassData GetSubPassData()
Definition: Thing.cs:1715
override bool MatchEncSearch(string s)
Definition: Thing.cs:2216
override int SelfWeight
Definition: Thing.cs:64
override int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Thing.cs:833
Element AddEnchant(int lv=-1)
Definition: Thing.cs:2142
override bool isThing
Definition: Thing.cs:45
override void ApplyMaterialElements(bool remove)
Definition: Thing.cs:341
override string GetExtraName()
Definition: Thing.cs:808
int Penetration
Definition: Thing.cs:34
int GetEfficiency()
Definition: Thing.cs:159
bool CanSearchContents
Definition: Thing.cs:98
List< Element > ListLimitedValidTraits(bool limit)
Definition: Thing.cs:853
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:536
override void ApplyMaterial(bool remove=false)
Definition: Thing.cs:359
bool IsMeleeWithAmmo
Definition: Thing.cs:20
override string GetHoverText()
Definition: Thing.cs:791
const int MaxFurnitureEnc
Definition: Thing.cs:9
override SourcePref Pref
Definition: Thing.cs:50
int stackOrder
Definition: Thing.cs:13
static void AddAttackEvaluation(UINote n, Chara chara, Thing current=null)
Definition: Thing.cs:1536
override CardRow sourceCard
Definition: Thing.cs:47
void Attune(Chara c)
Definition: Thing.cs:2160
override void OnCreate(int genLv)
Definition: Thing.cs:180
bool CanAutoFire(Chara c, Card tg, bool reloading=false)
Definition: Thing.cs:126
override bool CanStackTo(Thing to)
Definition: Thing.cs:1729
bool IsSharedContainer
Definition: Thing.cs:110
List< Element > ListValidTraits(bool isCraft, bool limit)
Definition: Thing.cs:878
void DoAct(Act act)
Definition: Thing.cs:2037
Thing Identify(bool show=true, IDTSource idtSource=IDTSource.Identify)
Definition: Thing.cs:2166
virtual bool IsFullBlock
Definition: TileType.cs:177
override Act CreateAct()
Definition: TraitAbility.cs:13
override SourceElement.Row source
override bool IsOpen()
static bool CanTagSale(Card t, bool insideContainer=false)
Definition: TraitSalesTag.cs:9
Definition: Trait.cs:7
virtual string GetName()
Definition: Trait.cs:734
virtual bool Contains(RecipeSource r)
Definition: Trait.cs:621
virtual bool CanSearchContent
Definition: Trait.cs:230
virtual bool HasCharges
Definition: Trait.cs:341
virtual bool ShowCharges
Definition: Trait.cs:343
TileMode
Definition: Trait.cs:9
virtual string LangRefText
Definition: Trait.cs:383
virtual SourcePref GetPref()
Definition: Trait.cs:611
virtual bool CanStack
Definition: Trait.cs:163
virtual void SetName(ref string s)
Definition: Trait.cs:739
virtual bool CanAutofire
Definition: Trait.cs:145
UIText mainText
Definition: UIButton.cs:102
void Show(UIItem i)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
void AddButton(Func< string > funcText, UnityAction action=null)
Definition: UIItem.cs:5
Image image2
Definition: UIItem.cs:16
Image image1
Definition: UIItem.cs:14
UIText text2
Definition: UIItem.cs:8
Definition: UINote.cs:6
UIItem AddHeaderCard(string text, Sprite sprite=null)
Definition: UINote.cs:84
void Clear()
Definition: UINote.cs:35
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void SetText(string s)
Definition: UIText.cs:163
bool compress
Definition: Window.cs:415
Definition: Window.cs:13
GameDate date
Definition: World.cs:6
Definition: Zone.cs:12
bool IsPCFactionOrTent
Definition: Zone.cs:483
NoteMode
Definition: IInspect.cs:7