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