Elin Decompiled Documentation EA 23.291 Nightly Patch 1
Loading...
Searching...
No Matches
ThingContainer.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5
6public class ThingContainer : List<Thing>
7{
8 public struct DestData
9 {
11
12 public Thing stack;
13
14 public bool IsValid
15 {
16 get
17 {
18 if (stack == null)
19 {
20 return container != null;
21 }
22 return true;
23 }
24 }
25 }
26
27 [JsonIgnore]
28 public static List<Thing> listUnassigned = new List<Thing>();
29
30 [JsonIgnore]
31 public const int InvYHotbar = 1;
32
33 [JsonIgnore]
34 public int width;
35
36 [JsonIgnore]
37 public int height;
38
39 [JsonIgnore]
40 public Card owner;
41
42 [JsonIgnore]
43 public List<Thing> grid;
44
45 private static List<ThingContainer> _listContainers = new List<ThingContainer>();
46
47 [JsonIgnore]
48 public int GridSize => width * height;
49
50 [JsonIgnore]
51 public bool HasGrid => grid != null;
52
53 [JsonIgnore]
54 public bool IsMagicChest => owner.trait is TraitMagicChest;
55
56 [JsonIgnore]
57 public int MaxCapacity
58 {
59 get
60 {
61 if (!IsMagicChest)
62 {
63 return GridSize;
64 }
65 return 100 + owner.c_containerUpgrade.cap;
66 }
67 }
68
69 public void SetOwner(Card owner)
70 {
71 this.owner = owner;
72 width = owner.c_containerSize / 100;
73 height = owner.c_containerSize % 100;
74 if (width == 0)
75 {
76 width = 8;
77 height = 5;
78 }
79 }
80
81 public void ChangeSize(int w, int h)
82 {
83 width = w;
84 height = h;
85 owner.c_containerSize = w * 100 + h;
87 Debug.Log(base.Count + "/" + width + "/" + height + "/" + GridSize);
88 }
89
91 {
92 using (Enumerator enumerator = GetEnumerator())
93 {
94 while (enumerator.MoveNext())
95 {
96 Thing current = enumerator.Current;
97 if (current.IsContainer)
98 {
100 }
101 }
102 }
103 RefreshGrid();
104 }
105
106 public void RefreshGrid()
107 {
108 if (GridSize == 0)
109 {
110 return;
111 }
112 grid = new List<Thing>(new Thing[GridSize]);
113 using (Enumerator enumerator = GetEnumerator())
114 {
115 while (enumerator.MoveNext())
116 {
117 Thing current = enumerator.Current;
118 if (ShouldShowOnGrid(current))
119 {
120 if (current.invX >= GridSize || current.invX < 0 || grid[current.invX] != null)
121 {
122 listUnassigned.Add(current);
123 }
124 else
125 {
126 grid[current.invX] = current;
127 }
128 }
129 }
130 }
131 foreach (Thing item in listUnassigned)
132 {
133 int freeGridIndex = GetFreeGridIndex();
134 if (freeGridIndex == -1)
135 {
136 break;
137 }
138 grid[freeGridIndex] = item;
139 item.invX = freeGridIndex;
140 }
141 listUnassigned.Clear();
142 }
143
144 public void RefreshGrid(UIMagicChest magic, Window.SaveData data)
145 {
146 magic.filteredList.Clear();
147 magic.cats.Clear();
148 magic.catCount.Clear();
149 grid = new List<Thing>(new Thing[GridSize]);
150 string text = magic.lastSearch;
151 bool flag = !text.IsEmpty();
152 bool flag2 = !magic.idCat.IsEmpty();
153 Window.SaveData.CategoryType category = data.category;
154 bool flag3 = category != Window.SaveData.CategoryType.None;
155 string text2 = "";
156 bool flag4 = text != null && text.Length >= 2 && (text[0] == '@' || text[0] == '@');
157 if (flag4)
158 {
159 text = text.Substring(1);
160 }
161 using (Enumerator enumerator = GetEnumerator())
162 {
163 while (enumerator.MoveNext())
164 {
165 Thing current = enumerator.Current;
166 if (flag3)
167 {
168 switch (category)
169 {
170 case Window.SaveData.CategoryType.Main:
171 text2 = current.category.GetRoot().id;
172 break;
174 text2 = current.category.GetSecondRoot().id;
175 break;
176 case Window.SaveData.CategoryType.Exact:
177 text2 = current.category.id;
178 break;
179 }
180 magic.cats.Add(text2);
181 if (magic.catCount.ContainsKey(text2))
182 {
183 magic.catCount[text2]++;
184 }
185 else
186 {
187 magic.catCount.Add(text2, 1);
188 }
189 }
190 if (flag)
191 {
192 if (flag4)
193 {
194 if (!current.MatchEncSearch(text))
195 {
196 continue;
197 }
198 }
199 else
200 {
201 if (current.tempName == null)
202 {
203 current.tempName = current.GetName(NameStyle.Full, 1).ToLower();
204 }
205 if (!current.tempName.Contains(text) && !current.source.GetSearchName(jp: false).Contains(text) && !current.source.GetSearchName(jp: true).Contains(text))
206 {
207 continue;
208 }
209 }
210 }
211 if (!flag2 || !(text2 != magic.idCat))
212 {
213 magic.filteredList.Add(current);
214 }
215 }
216 }
217 if (flag2 && !magic.cats.Contains(magic.idCat))
218 {
219 magic.idCat = "";
220 RefreshGrid(magic, data);
221 return;
222 }
223 magic.pageMax = (magic.filteredList.Count - 1) / GridSize;
224 if (magic.page > magic.pageMax)
225 {
226 magic.page = magic.pageMax;
227 }
228 for (int i = 0; i < GridSize; i++)
229 {
230 int num = magic.page * GridSize + i;
231 if (num >= magic.filteredList.Count)
232 {
233 break;
234 }
235 Thing thing = magic.filteredList[num];
236 grid[i] = thing;
237 thing.invX = i;
238 }
239 magic.RefreshCats();
240 }
241
242 public bool IsOccupied(int x, int y)
243 {
244 using (Enumerator enumerator = GetEnumerator())
245 {
246 while (enumerator.MoveNext())
247 {
248 Thing current = enumerator.Current;
249 if (current.invY == y && current.invX == x)
250 {
251 return true;
252 }
253 }
254 }
255 return false;
256 }
257
258 public bool ShouldShowOnGrid(Thing t)
259 {
260 if (!owner.IsPC)
261 {
262 if (t.trait is TraitChestMerchant)
263 {
264 return false;
265 }
266 return true;
267 }
268 if (!t.isEquipped)
269 {
270 return !t.IsHotItem;
271 }
272 return false;
273 }
274
275 public void OnAdd(Thing t)
276 {
277 if (HasGrid && ShouldShowOnGrid(t))
278 {
279 int freeGridIndex = GetFreeGridIndex();
280 if (freeGridIndex != -1)
281 {
282 grid[freeGridIndex] = t;
283 }
284 t.pos.x = freeGridIndex;
285 }
286 }
287
288 public bool IsFull(int y = 0)
289 {
290 if (IsMagicChest)
291 {
292 if (base.Count < MaxCapacity)
293 {
294 if (owner.trait.IsFridge)
295 {
296 return !owner.isOn;
297 }
298 return false;
299 }
300 return true;
301 }
302 if (y != 0)
303 {
304 return false;
305 }
307 {
308 return true;
309 }
310 if (!HasGrid)
311 {
312 return base.Count >= GridSize;
313 }
314 return GetFreeGridIndex() == -1;
315 }
316
317 public bool IsOverflowing()
318 {
319 if (!HasGrid || IsMagicChest)
320 {
321 return false;
322 }
323 int num = 0;
324 using (Enumerator enumerator = GetEnumerator())
325 {
326 while (enumerator.MoveNext())
327 {
328 Thing current = enumerator.Current;
329 if (current.invY != 1 && !current.isEquipped)
330 {
331 num++;
332 }
333 }
334 }
335 if (num > grid.Count)
336 {
337 return true;
338 }
339 return false;
340 }
341
342 public int GetFreeGridIndex()
343 {
344 for (int i = 0; i < grid.Count; i++)
345 {
346 if (grid[i] == null)
347 {
348 return i;
349 }
350 }
351 return -1;
352 }
353
354 public void OnRemove(Thing t)
355 {
356 if (HasGrid && t.invY == 0)
357 {
358 int num = grid.IndexOf(t);
359 if (num != -1)
360 {
361 grid[num] = null;
362 }
363 }
364 }
365
366 public void SetSize(int w, int h)
367 {
368 owner.c_containerSize = w * 100 + h;
370 }
371
372 public Thing TryStack(Thing target, int destInvX = -1, int destInvY = -1)
373 {
374 using Enumerator enumerator = GetEnumerator();
375 while (enumerator.MoveNext())
376 {
377 Thing current = enumerator.Current;
378 if (destInvX == -1 && current.CanSearchContents && owner.GetRootCard().IsPC)
379 {
380 Thing thing = current.things.TryStack(target, destInvX, destInvY);
381 if (thing != target)
382 {
383 return thing;
384 }
385 }
386 if ((destInvX == -1 || (current.invX == destInvX && current.invY == destInvY)) && current != target && target.TryStackTo(current))
387 {
388 return current;
389 }
390 }
391 return target;
392 }
393
394 public Thing CanStack(Thing target, int destInvX = -1, int destInvY = -1)
395 {
396 using Enumerator enumerator = GetEnumerator();
397 while (enumerator.MoveNext())
398 {
399 Thing current = enumerator.Current;
400 if (current != target && target.CanStackTo(current))
401 {
402 return current;
403 }
404 }
405 return target;
406 }
407
408 public DestData GetDest(Thing t, bool tryStack = true)
409 {
410 DestData d = default(DestData);
411 if (!owner.IsPC)
412 {
413 SearchDest(this, searchEmpty: true, searchStack: true);
414 return d;
415 }
416 if (t.trait.CanOnlyCarry && IsFull())
417 {
418 return d;
419 }
420 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
421 if (flag == ContainerFlag.none)
422 {
423 flag = ContainerFlag.other;
424 }
425 _listContainers.Clear();
426 _listContainers.Add(this);
427 TrySearchContainer(owner);
428 _listContainers.Sort((ThingContainer a, ThingContainer b) => (b.owner.GetWindowSaveData()?.priority ?? 0) * 10 + (b.owner.IsPC ? 1 : 0) - ((a.owner.GetWindowSaveData()?.priority ?? 0) * 10 + (a.owner.IsPC ? 1 : 0)));
429 if (tryStack)
430 {
431 foreach (ThingContainer listContainer in _listContainers)
432 {
433 SearchDest(listContainer, searchEmpty: false, searchStack: true);
434 if (d.IsValid)
435 {
436 return d;
437 }
438 }
439 }
440 foreach (ThingContainer listContainer2 in _listContainers)
441 {
442 SearchDest(listContainer2, searchEmpty: true, searchStack: false);
443 if (d.IsValid)
444 {
445 return d;
446 }
447 }
448 return d;
449 void SearchDest(ThingContainer things, bool searchEmpty, bool searchStack)
450 {
451 if (!t.IsContainer || t.things.Count <= 0 || !things.owner.IsContainer || things.owner.trait is TraitToolBelt)
452 {
453 if (searchStack && tryStack)
454 {
455 Thing thing = things.CanStack(t);
456 if (thing != t)
457 {
458 d.stack = thing;
459 return;
460 }
461 }
462 if (searchEmpty && !things.IsFull() && !(things.owner.trait is TraitToolBelt) && (things.owner.isChara || things.owner.parent is Chara || (things.owner.parent as Thing)?.trait is TraitToolBelt))
463 {
464 d.container = things.owner;
465 }
466 }
467 }
468 void TrySearchContainer(Card c)
469 {
470 foreach (Thing thing2 in c.things)
471 {
472 if (thing2.CanSearchContents)
473 {
474 TrySearchContainer(thing2);
475 }
476 }
477 if (c.things != this)
478 {
479 Window.SaveData windowSaveData = c.GetWindowSaveData();
480 if (windowSaveData != null && (!windowSaveData.noRotten || !t.IsDecayed) && (!windowSaveData.onlyRottable || t.trait.Decay != 0))
481 {
482 if (windowSaveData.userFilter)
483 {
484 switch (windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1)))
485 {
486 case Window.SaveData.FilterResult.Block:
487 return;
488 case Window.SaveData.FilterResult.PassWithoutFurtherTest:
489 _listContainers.Add(c.things);
490 return;
491 }
492 }
493 if (windowSaveData.advDistribution)
494 {
495 foreach (int cat in windowSaveData.cats)
496 {
497 if (t.category.uid == cat)
498 {
499 _listContainers.Add(c.things);
500 break;
501 }
502 }
503 return;
504 }
505 if (!windowSaveData.flag.HasFlag(flag))
506 {
507 _listContainers.Add(c.things);
508 }
509 }
510 }
511 }
512 }
513
514 public bool IsFull(Thing t, bool recursive = true, bool tryStack = true)
515 {
516 if (!IsFull() || (tryStack && CanStack(t) != t))
517 {
518 return false;
519 }
520 if (!recursive)
521 {
522 return true;
523 }
524 return !GetDest(t, tryStack).IsValid;
525 }
526
527 public void AddCurrency(Card owner, string id, int a, SourceMaterial.Row mat = null)
528 {
529 int num = a;
530 foreach (Thing item in ListCurrency(id))
531 {
532 if (!(item.id != id) && (mat == null || item.material == mat) && (num <= 0 || item.Num + num > 0))
533 {
534 if (num > 0)
535 {
536 item.ModNum(num);
537 return;
538 }
539 if (item.Num + num >= 0)
540 {
541 item.ModNum(num);
542 return;
543 }
544 num += item.Num;
545 item.ModNum(-item.Num);
546 }
547 }
548 if (num != 0 && num > 0)
549 {
550 Thing thing = ThingGen.Create(id);
551 if (mat != null)
552 {
553 thing.ChangeMaterial(mat);
554 }
555 owner.AddThing(thing, tryStack: false).SetNum(num);
556 }
557 }
558
559 public void DestroyAll(Func<Thing, bool> funcExclude = null)
560 {
561 this.ForeachReverse(delegate(Thing t)
562 {
563 if (funcExclude == null || !funcExclude(t))
564 {
565 t.Destroy();
566 Remove(t);
567 }
568 });
569 if (grid != null)
570 {
571 for (int i = 0; i < grid.Count; i++)
572 {
573 grid[i] = null;
574 }
575 }
576 }
577
578 public Thing Find(int uid)
579 {
580 using (Enumerator enumerator = GetEnumerator())
581 {
582 while (enumerator.MoveNext())
583 {
584 Thing current = enumerator.Current;
585 if (current.CanSearchContents)
586 {
587 Thing thing = current.things.Find(uid);
588 if (thing != null)
589 {
590 return thing;
591 }
592 }
593 if (current.uid == uid)
594 {
595 return current;
596 }
597 }
598 }
599 return null;
600 }
601
602 public Thing Find<T>() where T : Trait
603 {
604 using (Enumerator enumerator = GetEnumerator())
605 {
606 while (enumerator.MoveNext())
607 {
608 Thing current = enumerator.Current;
609 if (current.CanSearchContents)
610 {
611 Thing thing = current.things.Find<T>();
612 if (thing != null)
613 {
614 return thing;
615 }
616 }
617 if (current.trait is T)
618 {
619 return current;
620 }
621 }
622 }
623 return null;
624 }
625
626 public Thing FindBest<T>(Func<Thing, int> func) where T : Trait
627 {
628 List<Thing> list = List((Thing t) => t.trait is T, onlyAccessible: true);
629 if (list.Count == 0)
630 {
631 return null;
632 }
633 list.Sort((Thing a, Thing b) => func(b) - func(a));
634 return list[0];
635 }
636
637 public Thing Find(Func<Thing, bool> func, bool recursive = true)
638 {
639 using (Enumerator enumerator = GetEnumerator())
640 {
641 while (enumerator.MoveNext())
642 {
643 Thing current = enumerator.Current;
644 if (recursive && current.CanSearchContents)
645 {
646 Thing thing = current.things.Find(func);
647 if (thing != null)
648 {
649 return thing;
650 }
651 }
652 if (func(current))
653 {
654 return current;
655 }
656 }
657 }
658 return null;
659 }
660
661 public Thing Find(string id, string idMat)
662 {
663 return Find(id, idMat.IsEmpty() ? (-1) : EClass.sources.materials.alias[idMat].id);
664 }
665
666 public Thing Find(string id, int idMat = -1, int refVal = -1)
667 {
668 using (Enumerator enumerator = GetEnumerator())
669 {
670 while (enumerator.MoveNext())
671 {
672 Thing current = enumerator.Current;
673 if (current.CanSearchContents)
674 {
675 Thing thing = current.things.Find(id, idMat, refVal);
676 if (thing != null)
677 {
678 return thing;
679 }
680 }
681 if (current.id == id && (idMat == -1 || current.material.id == idMat) && (refVal == -1 || current.refVal == refVal))
682 {
683 return current;
684 }
685 }
686 }
687 return null;
688 }
689
691 {
692 List<Thing> list = new List<Thing>();
693 using (Enumerator enumerator = GetEnumerator())
694 {
695 while (enumerator.MoveNext())
696 {
697 Thing current = enumerator.Current;
698 if (!current.IsContainer && current.trait.CanBeStolen && !current.HasTag(CTAG.gift) && (!current.IsEquipmentOrRangedOrAmmo || !current.IsUnique))
699 {
700 list.Add(current);
701 }
702 }
703 }
704 if (list.Count == 0)
705 {
706 return null;
707 }
708 list.Sort((Thing a, Thing b) => Compare(a) - Compare(b));
709 return list[0];
710 static int Compare(Thing a)
711 {
712 return a.SelfWeight + (a.isEquipped ? 10000 : 0);
713 }
714 }
715
716 public ThingStack GetThingStack(string id, int refVal = -1)
717 {
718 ThingStack s = new ThingStack();
719 bool isOrigin = EClass.sources.cards.map[id].isOrigin;
720 return GetThingStack(id, s, isOrigin, refVal);
721 }
722
723 public ThingStack GetThingStack(string id, ThingStack s, bool isOrigin, int refVal = -1)
724 {
725 using Enumerator enumerator = GetEnumerator();
726 while (enumerator.MoveNext())
727 {
728 Thing current = enumerator.Current;
729 if (current.CanSearchContents)
730 {
731 current.things.GetThingStack(id, s, isOrigin, refVal);
732 }
733 if ((refVal == -1 || current.refVal == refVal) && current.IsIdentified && (current.id == id || (isOrigin && current.source._origin == id)))
734 {
735 s.Add(current);
736 }
737 }
738 return s;
739 }
740
741 public ThingStack GetThingStack(string id)
742 {
743 ThingStack s = new ThingStack();
744 bool isOrigin = EClass.sources.cards.map[id].isOrigin;
745 return GetThingStack(id, s, isOrigin);
746 }
747
748 public ThingStack GetThingStack(string id, ThingStack s, bool isOrigin)
749 {
750 using Enumerator enumerator = GetEnumerator();
751 while (enumerator.MoveNext())
752 {
753 Thing current = enumerator.Current;
754 if (current.CanSearchContents)
755 {
756 current.things.GetThingStack(id, s, isOrigin);
757 }
758 if (current.id == id || (isOrigin && current.source._origin == id))
759 {
760 s.Add(current);
761 }
762 }
763 return s;
764 }
765
766 public long GetCurrency(string id, ref long sum, SourceMaterial.Row mat = null)
767 {
768 using (Enumerator enumerator = GetEnumerator())
769 {
770 while (enumerator.MoveNext())
771 {
772 Thing current = enumerator.Current;
773 if (current.CanSearchContents)
774 {
775 current.things.GetCurrency(id, ref sum, mat);
776 }
777 if (current.id == id && (mat == null || current.material == mat))
778 {
779 sum += current.Num;
780 }
781 }
782 }
783 if (sum < 0)
784 {
785 sum = 2147483647L;
786 }
787 return sum;
788 }
789
790 public List<Thing> ListCurrency(string id)
791 {
792 List<Thing> list = new List<Thing>();
793 list.Clear();
794 _ListCurrency(list, id);
795 return list;
796 }
797
798 private void _ListCurrency(List<Thing> tempList, string id)
799 {
800 using Enumerator enumerator = GetEnumerator();
801 while (enumerator.MoveNext())
802 {
803 Thing current = enumerator.Current;
804 if (current.CanSearchContents)
805 {
806 current.things._ListCurrency(tempList, id);
807 }
808 if (current.id == id)
809 {
810 tempList.Add(current);
811 }
812 }
813 }
814
815 public List<Thing> List(Func<Thing, bool> func, bool onlyAccessible = false)
816 {
817 List<Thing> list = new List<Thing>();
818 list.Clear();
819 _List(list, func, onlyAccessible);
820 return list;
821 }
822
823 public void _List(List<Thing> tempList, Func<Thing, bool> func, bool onlyAccessible = false)
824 {
825 if (onlyAccessible && !owner.trait.CanSearchContent)
826 {
827 return;
828 }
829 using Enumerator enumerator = GetEnumerator();
830 while (enumerator.MoveNext())
831 {
832 Thing current = enumerator.Current;
833 current.things._List(tempList, func, onlyAccessible);
834 if (func(current))
835 {
836 tempList.Add(current);
837 }
838 }
839 }
840
841 public void AddFactory(HashSet<string> hash)
842 {
843 using Enumerator enumerator = GetEnumerator();
844 while (enumerator.MoveNext())
845 {
846 Thing current = enumerator.Current;
847 if (current.CanSearchContents)
848 {
849 current.things.AddFactory(hash);
850 }
851 if (current.trait.IsFactory)
852 {
853 hash.Add(current.id);
854 }
855 if (current.trait.ToggleType == ToggleType.Fire && current.isOn)
856 {
857 hash.Add("fire");
858 }
859 }
860 }
861
862 public void Foreach(Action<Thing> action, bool onlyAccessible = true)
863 {
864 using Enumerator enumerator = GetEnumerator();
865 while (enumerator.MoveNext())
866 {
867 Thing current = enumerator.Current;
868 if (!onlyAccessible || current.CanSearchContents)
869 {
870 current.things.Foreach(action);
871 }
872 action(current);
873 }
874 }
875
876 public void Foreach(Func<Thing, bool> action, bool onlyAccessible = true)
877 {
878 using Enumerator enumerator = GetEnumerator();
879 while (enumerator.MoveNext())
880 {
881 Thing current = enumerator.Current;
882 if (!onlyAccessible || current.CanSearchContents)
883 {
884 current.things.Foreach(action);
885 }
886 if (action(current))
887 {
888 break;
889 }
890 }
891 }
892}
CTAG
Definition: CTAG.cs:2
ContainerFlag
Definition: ContainerFlag.cs:5
NameStyle
Definition: NameStyle.cs:2
ToggleType
Definition: ToggleType.cs:2
void Add(Act a, string s="")
Definition: ActPlan.cs:11
Definition: Card.cs:11
ContainerUpgrade c_containerUpgrade
Definition: Card.cs:1907
string id
Definition: Card.cs:36
bool IsUnique
Definition: Card.cs:2129
SourceMaterial.Row material
Definition: Card.cs:2089
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3117
int invY
Definition: Card.cs:1993
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3180
ICardParent parent
Definition: Card.cs:56
bool IsHotItem
Definition: Card.cs:120
Thing SetNum(int a)
Definition: Card.cs:3577
bool HasTag(CTAG tag)
Definition: Card.cs:2635
int uid
Definition: Card.cs:123
int refVal
Definition: Card.cs:207
Trait trait
Definition: Card.cs:54
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2556
void Destroy()
Definition: Card.cs:5170
ThingContainer things
Definition: Card.cs:39
virtual bool IsPC
Definition: Card.cs:2183
virtual bool isChara
Definition: Card.cs:2121
Card GetRootCard()
Definition: Card.cs:3508
int invX
Definition: Card.cs:1981
bool isOn
Definition: Card.cs:543
bool TryStackTo(Thing to)
Definition: Card.cs:3479
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3157
int Num
Definition: Card.cs:159
SourceCategory.Row category
Definition: Card.cs:2087
bool IsIdentified
Definition: Card.cs:2417
bool IsContainer
Definition: Card.cs:2127
Definition: Chara.cs:10
new TraitChara trait
Definition: Chara.cs:505
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:43
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceMaterial materials
SourceCard cards
Thing Find(string id, string idMat)
List< Thing > List(Func< Thing, bool > func, bool onlyAccessible=false)
void SetOwner(Card owner)
void RefreshGrid(UIMagicChest magic, Window.SaveData data)
Thing FindStealable()
void AddFactory(HashSet< string > hash)
void DestroyAll(Func< Thing, bool > funcExclude=null)
ThingStack GetThingStack(string id, ThingStack s, bool isOrigin)
ThingStack GetThingStack(string id)
Thing Find(int uid)
void OnAdd(Thing t)
Thing TryStack(Thing target, int destInvX=-1, int destInvY=-1)
List< Thing > grid
void AddCurrency(Card owner, string id, int a, SourceMaterial.Row mat=null)
List< Thing > ListCurrency(string id)
void _List(List< Thing > tempList, Func< Thing, bool > func, bool onlyAccessible=false)
void ChangeSize(int w, int h)
DestData GetDest(Thing t, bool tryStack=true)
bool IsOccupied(int x, int y)
void OnRemove(Thing t)
bool ShouldShowOnGrid(Thing t)
void SetSize(int w, int h)
static List< ThingContainer > _listContainers
void Foreach(Action< Thing > action, bool onlyAccessible=true)
Thing Find(string id, int idMat=-1, int refVal=-1)
static List< Thing > listUnassigned
Thing FindBest< T >(Func< Thing, int > func)
void Foreach(Func< Thing, bool > action, bool onlyAccessible=true)
Thing CanStack(Thing target, int destInvX=-1, int destInvY=-1)
const int InvYHotbar
ThingStack GetThingStack(string id, ThingStack s, bool isOrigin, int refVal=-1)
ThingStack GetThingStack(string id, int refVal=-1)
long GetCurrency(string id, ref long sum, SourceMaterial.Row mat=null)
void _ListCurrency(List< Thing > tempList, string id)
void RefreshGridRecursive()
Thing Find(Func< Thing, bool > func, bool recursive=true)
bool IsFull(Thing t, bool recursive=true, bool tryStack=true)
bool IsFull(int y=0)
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
void Add(Thing t)
Definition: ThingStack.cs:13
Definition: Thing.cs:8
SourceThing.Row source
Definition: Thing.cs:11
bool isEquipped
Definition: Thing.cs:17
string tempName
Definition: Thing.cs:15
override bool MatchEncSearch(string s)
Definition: Thing.cs:2152
bool CanSearchContents
Definition: Thing.cs:101
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:535
override bool CanStackTo(Thing to)
Definition: Thing.cs:1671
Definition: Trait.cs:7
virtual bool IsFactory
Definition: Trait.cs:143
virtual bool CanSearchContent
Definition: Trait.cs:230
virtual ToggleType ToggleType
Definition: Trait.cs:482
virtual bool CanBeStolen
Definition: Trait.cs:294
virtual bool IsSpecialContainer
Definition: Trait.cs:257
virtual bool IsFridge
Definition: Trait.cs:129
virtual bool CanOnlyCarry
Definition: Trait.cs:305
void RefreshCats()
string idCat
Definition: UIMagicChest.cs:47
Dictionary< string, int > catCount
Definition: UIMagicChest.cs:45
HashSet< string > cats
Definition: UIMagicChest.cs:41
string lastSearch
Definition: UIMagicChest.cs:53
List< Thing > filteredList
Definition: UIMagicChest.cs:35
FilterResult IsFilterPass(string text)
Definition: Window.cs:498
ContainerFlag flag
Definition: Window.cs:267
HashSet< int > cats
Definition: Window.cs:119
bool userFilter
Definition: Window.cs:132
bool noRotten
Definition: Window.cs:439
bool onlyRottable
Definition: Window.cs:451
bool advDistribution
Definition: Window.cs:427
Definition: Window.cs:13