Elin Decompiled Documentation EA 23.307 Stable
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 IsAlmostFull(int threshold = 2)
289 {
290 return base.Count + threshold >= GridSize;
291 }
292
293 public bool IsFull(int y = 0)
294 {
295 if (IsMagicChest)
296 {
297 if (base.Count < MaxCapacity)
298 {
299 if (owner.trait.IsFridge)
300 {
301 return !owner.isOn;
302 }
303 return false;
304 }
305 return true;
306 }
307 if (y != 0)
308 {
309 return false;
310 }
312 {
313 return true;
314 }
315 if (!HasGrid)
316 {
317 return base.Count >= GridSize;
318 }
319 return GetFreeGridIndex() == -1;
320 }
321
322 public bool IsOverflowing()
323 {
324 if (!HasGrid || IsMagicChest)
325 {
326 return false;
327 }
328 int num = 0;
329 using (Enumerator enumerator = GetEnumerator())
330 {
331 while (enumerator.MoveNext())
332 {
333 Thing current = enumerator.Current;
334 if (current.invY != 1 && !current.isEquipped)
335 {
336 num++;
337 }
338 }
339 }
340 if (num > grid.Count)
341 {
342 return true;
343 }
344 return false;
345 }
346
347 public int GetFreeGridIndex()
348 {
349 for (int i = 0; i < grid.Count; i++)
350 {
351 if (grid[i] == null)
352 {
353 return i;
354 }
355 }
356 return -1;
357 }
358
359 public void OnRemove(Thing t)
360 {
361 if (HasGrid && t.invY == 0)
362 {
363 int num = grid.IndexOf(t);
364 if (num != -1)
365 {
366 grid[num] = null;
367 }
368 }
369 }
370
371 public void SetSize(int w, int h)
372 {
373 owner.c_containerSize = w * 100 + h;
375 }
376
377 public Thing TryStack(Thing target, int destInvX = -1, int destInvY = -1)
378 {
379 using Enumerator enumerator = GetEnumerator();
380 while (enumerator.MoveNext())
381 {
382 Thing current = enumerator.Current;
383 if (destInvX == -1 && current.CanSearchContents && owner.GetRootCard().IsPC)
384 {
385 Thing thing = current.things.TryStack(target, destInvX, destInvY);
386 if (thing != target)
387 {
388 return thing;
389 }
390 }
391 if ((destInvX == -1 || (current.invX == destInvX && current.invY == destInvY)) && current != target && target.TryStackTo(current))
392 {
393 return current;
394 }
395 }
396 return target;
397 }
398
399 public Thing CanStack(Thing target, int destInvX = -1, int destInvY = -1)
400 {
401 using Enumerator enumerator = GetEnumerator();
402 while (enumerator.MoveNext())
403 {
404 Thing current = enumerator.Current;
405 if (current != target && target.CanStackTo(current))
406 {
407 return current;
408 }
409 }
410 return target;
411 }
412
413 public DestData GetDest(Thing t, bool tryStack = true)
414 {
415 DestData d = default(DestData);
416 if (!owner.IsPC)
417 {
418 SearchDest(this, searchEmpty: true, searchStack: true);
419 return d;
420 }
421 if (t.trait.CanOnlyCarry && IsFull())
422 {
423 return d;
424 }
425 ContainerFlag flag = t.category.GetRoot().id.ToEnum<ContainerFlag>();
426 if (flag == ContainerFlag.none)
427 {
428 flag = ContainerFlag.other;
429 }
430 _listContainers.Clear();
431 _listContainers.Add(this);
432 TrySearchContainer(owner);
433 _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)));
434 if (tryStack)
435 {
436 foreach (ThingContainer listContainer in _listContainers)
437 {
438 SearchDest(listContainer, searchEmpty: false, searchStack: true);
439 if (d.IsValid)
440 {
441 return d;
442 }
443 }
444 }
445 foreach (ThingContainer listContainer2 in _listContainers)
446 {
447 SearchDest(listContainer2, searchEmpty: true, searchStack: false);
448 if (d.IsValid)
449 {
450 return d;
451 }
452 }
453 return d;
454 void SearchDest(ThingContainer things, bool searchEmpty, bool searchStack)
455 {
456 if (!t.IsContainer || t.things.Count <= 0 || !things.owner.IsContainer || things.owner.trait is TraitToolBelt)
457 {
458 if (searchStack && tryStack)
459 {
460 Thing thing = things.CanStack(t);
461 if (thing != t)
462 {
463 d.stack = thing;
464 return;
465 }
466 }
467 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))
468 {
469 d.container = things.owner;
470 }
471 }
472 }
473 void TrySearchContainer(Card c)
474 {
475 foreach (Thing thing2 in c.things)
476 {
477 if (thing2.CanSearchContents)
478 {
479 TrySearchContainer(thing2);
480 }
481 }
482 if (c.things != this)
483 {
484 Window.SaveData windowSaveData = c.GetWindowSaveData();
485 if (windowSaveData != null && (!windowSaveData.noRotten || !t.IsDecayed) && (!windowSaveData.onlyRottable || t.trait.Decay != 0))
486 {
487 if (windowSaveData.userFilter)
488 {
489 switch (windowSaveData.IsFilterPass(t.GetName(NameStyle.Full, 1)))
490 {
491 case Window.SaveData.FilterResult.Block:
492 return;
493 case Window.SaveData.FilterResult.PassWithoutFurtherTest:
494 _listContainers.Add(c.things);
495 return;
496 }
497 }
498 if (windowSaveData.advDistribution)
499 {
500 foreach (int cat in windowSaveData.cats)
501 {
502 if (t.category.uid == cat)
503 {
504 _listContainers.Add(c.things);
505 break;
506 }
507 }
508 return;
509 }
510 if (!windowSaveData.flag.HasFlag(flag))
511 {
512 _listContainers.Add(c.things);
513 }
514 }
515 }
516 }
517 }
518
519 public bool IsFull(Thing t, bool recursive = true, bool tryStack = true)
520 {
521 if (!IsFull() || (tryStack && CanStack(t) != t))
522 {
523 return false;
524 }
525 if (!recursive)
526 {
527 return true;
528 }
529 return !GetDest(t, tryStack).IsValid;
530 }
531
532 public void AddCurrency(Card owner, string id, int a, SourceMaterial.Row mat = null)
533 {
534 int num = a;
535 foreach (Thing item in ListCurrency(id))
536 {
537 if (!(item.id != id) && (mat == null || item.material == mat) && (num <= 0 || item.Num + num > 0))
538 {
539 if (num > 0)
540 {
541 item.ModNum(num);
542 return;
543 }
544 if (item.Num + num >= 0)
545 {
546 item.ModNum(num);
547 return;
548 }
549 num += item.Num;
550 item.ModNum(-item.Num);
551 }
552 }
553 if (num != 0 && num > 0)
554 {
555 Thing thing = ThingGen.Create(id);
556 if (mat != null)
557 {
558 thing.ChangeMaterial(mat);
559 }
560 owner.AddThing(thing, tryStack: false).SetNum(num);
561 }
562 }
563
564 public void DestroyAll(Func<Thing, bool> funcExclude = null)
565 {
566 this.ForeachReverse(delegate(Thing t)
567 {
568 if (funcExclude == null || !funcExclude(t))
569 {
570 t.Destroy();
571 Remove(t);
572 }
573 });
574 if (grid != null)
575 {
576 for (int i = 0; i < grid.Count; i++)
577 {
578 grid[i] = null;
579 }
580 }
581 }
582
583 public Thing Find(int uid)
584 {
585 using (Enumerator enumerator = GetEnumerator())
586 {
587 while (enumerator.MoveNext())
588 {
589 Thing current = enumerator.Current;
590 if (current.CanSearchContents)
591 {
592 Thing thing = current.things.Find(uid);
593 if (thing != null)
594 {
595 return thing;
596 }
597 }
598 if (current.uid == uid)
599 {
600 return current;
601 }
602 }
603 }
604 return null;
605 }
606
607 public Thing Find<T>() where T : Trait
608 {
609 using (Enumerator enumerator = GetEnumerator())
610 {
611 while (enumerator.MoveNext())
612 {
613 Thing current = enumerator.Current;
614 if (current.CanSearchContents)
615 {
616 Thing thing = current.things.Find<T>();
617 if (thing != null)
618 {
619 return thing;
620 }
621 }
622 if (current.trait is T)
623 {
624 return current;
625 }
626 }
627 }
628 return null;
629 }
630
631 public Thing FindBest<T>(Func<Thing, int> func) where T : Trait
632 {
633 List<Thing> list = List((Thing t) => t.trait is T, onlyAccessible: true);
634 if (list.Count == 0)
635 {
636 return null;
637 }
638 list.Sort((Thing a, Thing b) => func(b) - func(a));
639 return list[0];
640 }
641
642 public Thing Find(Func<Thing, bool> func, bool recursive = true)
643 {
644 using (Enumerator enumerator = GetEnumerator())
645 {
646 while (enumerator.MoveNext())
647 {
648 Thing current = enumerator.Current;
649 if (recursive && current.CanSearchContents)
650 {
651 Thing thing = current.things.Find(func);
652 if (thing != null)
653 {
654 return thing;
655 }
656 }
657 if (func(current))
658 {
659 return current;
660 }
661 }
662 }
663 return null;
664 }
665
666 public Thing Find(string id, string idMat)
667 {
668 return Find(id, idMat.IsEmpty() ? (-1) : EClass.sources.materials.alias[idMat].id);
669 }
670
671 public Thing Find(string id, int idMat = -1, int refVal = -1)
672 {
673 using (Enumerator enumerator = GetEnumerator())
674 {
675 while (enumerator.MoveNext())
676 {
677 Thing current = enumerator.Current;
678 if (current.CanSearchContents)
679 {
680 Thing thing = current.things.Find(id, idMat, refVal);
681 if (thing != null)
682 {
683 return thing;
684 }
685 }
686 if (current.id == id && (idMat == -1 || current.material.id == idMat) && (refVal == -1 || current.refVal == refVal))
687 {
688 return current;
689 }
690 }
691 }
692 return null;
693 }
694
696 {
697 List<Thing> list = new List<Thing>();
698 using (Enumerator enumerator = GetEnumerator())
699 {
700 while (enumerator.MoveNext())
701 {
702 Thing current = enumerator.Current;
703 if (!current.IsContainer && current.trait.CanBeStolen && !current.HasTag(CTAG.gift) && (!current.IsEquipmentOrRangedOrAmmo || !current.IsUnique))
704 {
705 list.Add(current);
706 }
707 }
708 }
709 if (list.Count == 0)
710 {
711 return null;
712 }
713 list.Sort((Thing a, Thing b) => Compare(a) - Compare(b));
714 return list[0];
715 static int Compare(Thing a)
716 {
717 return a.SelfWeight + (a.isEquipped ? 10000 : 0);
718 }
719 }
720
721 public ThingStack GetThingStack(string id, int refVal = -1)
722 {
723 ThingStack s = new ThingStack();
724 bool isOrigin = EClass.sources.cards.map[id].isOrigin;
725 return GetThingStack(id, s, isOrigin, refVal);
726 }
727
728 public ThingStack GetThingStack(string id, ThingStack s, bool isOrigin, int refVal = -1)
729 {
730 using Enumerator enumerator = GetEnumerator();
731 while (enumerator.MoveNext())
732 {
733 Thing current = enumerator.Current;
734 if (current.CanSearchContents)
735 {
736 current.things.GetThingStack(id, s, isOrigin, refVal);
737 }
738 if ((refVal == -1 || current.refVal == refVal) && current.IsIdentified && (current.id == id || (isOrigin && current.source._origin == id)))
739 {
740 s.Add(current);
741 }
742 }
743 return s;
744 }
745
746 public ThingStack GetThingStack(string id)
747 {
748 ThingStack s = new ThingStack();
749 bool isOrigin = EClass.sources.cards.map[id].isOrigin;
750 return GetThingStack(id, s, isOrigin);
751 }
752
753 public ThingStack GetThingStack(string id, ThingStack s, bool isOrigin)
754 {
755 using Enumerator enumerator = GetEnumerator();
756 while (enumerator.MoveNext())
757 {
758 Thing current = enumerator.Current;
759 if (current.CanSearchContents)
760 {
761 current.things.GetThingStack(id, s, isOrigin);
762 }
763 if (current.id == id || (isOrigin && current.source._origin == id))
764 {
765 s.Add(current);
766 }
767 }
768 return s;
769 }
770
771 public long GetCurrency(string id, ref long sum, SourceMaterial.Row mat = null)
772 {
773 using (Enumerator enumerator = GetEnumerator())
774 {
775 while (enumerator.MoveNext())
776 {
777 Thing current = enumerator.Current;
778 if (current.CanSearchContents)
779 {
780 current.things.GetCurrency(id, ref sum, mat);
781 }
782 if (current.id == id && (mat == null || current.material == mat))
783 {
784 sum += current.Num;
785 }
786 }
787 }
788 if (sum < 0)
789 {
790 sum = 2147483647L;
791 }
792 return sum;
793 }
794
795 public List<Thing> ListCurrency(string id)
796 {
797 List<Thing> list = new List<Thing>();
798 list.Clear();
799 _ListCurrency(list, id);
800 return list;
801 }
802
803 private void _ListCurrency(List<Thing> tempList, string id)
804 {
805 using Enumerator enumerator = GetEnumerator();
806 while (enumerator.MoveNext())
807 {
808 Thing current = enumerator.Current;
809 if (current.CanSearchContents)
810 {
811 current.things._ListCurrency(tempList, id);
812 }
813 if (current.id == id)
814 {
815 tempList.Add(current);
816 }
817 }
818 }
819
820 public List<Thing> List(Func<Thing, bool> func, bool onlyAccessible = false)
821 {
822 List<Thing> list = new List<Thing>();
823 list.Clear();
824 _List(list, func, onlyAccessible);
825 return list;
826 }
827
828 public void _List(List<Thing> tempList, Func<Thing, bool> func, bool onlyAccessible = false)
829 {
830 if (onlyAccessible && !owner.trait.CanSearchContent)
831 {
832 return;
833 }
834 using Enumerator enumerator = GetEnumerator();
835 while (enumerator.MoveNext())
836 {
837 Thing current = enumerator.Current;
838 current.things._List(tempList, func, onlyAccessible);
839 if (func(current))
840 {
841 tempList.Add(current);
842 }
843 }
844 }
845
846 public void AddFactory(HashSet<string> hash)
847 {
848 using Enumerator enumerator = GetEnumerator();
849 while (enumerator.MoveNext())
850 {
851 Thing current = enumerator.Current;
852 if (current.CanSearchContents)
853 {
854 current.things.AddFactory(hash);
855 }
856 if (current.trait.IsFactory)
857 {
858 hash.Add(current.id);
859 }
860 if (current.trait.ToggleType == ToggleType.Fire && current.isOn)
861 {
862 hash.Add("fire");
863 }
864 }
865 }
866
867 public void Foreach(Action<Thing> action, bool onlyAccessible = true)
868 {
869 using Enumerator enumerator = GetEnumerator();
870 while (enumerator.MoveNext())
871 {
872 Thing current = enumerator.Current;
873 if (!onlyAccessible || current.CanSearchContents)
874 {
875 current.things.Foreach(action);
876 }
877 action(current);
878 }
879 }
880
881 public void Foreach(Func<Thing, bool> action, bool onlyAccessible = true)
882 {
883 using Enumerator enumerator = GetEnumerator();
884 while (enumerator.MoveNext())
885 {
886 Thing current = enumerator.Current;
887 if (!onlyAccessible || current.CanSearchContents)
888 {
889 current.things.Foreach(action);
890 }
891 if (action(current))
892 {
893 break;
894 }
895 }
896 }
897}
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:1909
string id
Definition: Card.cs:36
bool IsUnique
Definition: Card.cs:2131
SourceMaterial.Row material
Definition: Card.cs:2091
Card ChangeMaterial(int idNew, bool ignoreFixedMaterial=false)
Definition: Card.cs:3119
int invY
Definition: Card.cs:1995
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3182
ICardParent parent
Definition: Card.cs:56
bool IsHotItem
Definition: Card.cs:122
Thing SetNum(int a)
Definition: Card.cs:3579
bool HasTag(CTAG tag)
Definition: Card.cs:2637
int uid
Definition: Card.cs:125
int refVal
Definition: Card.cs:209
Trait trait
Definition: Card.cs:54
Window.SaveData GetWindowSaveData()
Definition: Card.cs:2558
void Destroy()
Definition: Card.cs:5198
ThingContainer things
Definition: Card.cs:39
virtual bool IsPC
Definition: Card.cs:2185
virtual bool isChara
Definition: Card.cs:2123
Card GetRootCard()
Definition: Card.cs:3510
int invX
Definition: Card.cs:1983
bool isOn
Definition: Card.cs:545
bool TryStackTo(Thing to)
Definition: Card.cs:3481
Thing Add(string id, int num=1, int lv=1)
Definition: Card.cs:3159
int Num
Definition: Card.cs:161
SourceCategory.Row category
Definition: Card.cs:2089
bool IsIdentified
Definition: Card.cs:2419
bool IsContainer
Definition: Card.cs:2129
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)
bool IsAlmostFull(int threshold=2)
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:2158
bool CanSearchContents
Definition: Thing.cs:98
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:532
override bool CanStackTo(Thing to)
Definition: Thing.cs:1677
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