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