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