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