Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ItemsSacrificedUnlocksTracker.cs
Go to the documentation of this file.
2using System.IO;
3using Terraria.ID;
4
6
8{
9 public const int POSITIVE_SACRIFICE_COUNT_CAP = 9999;
10
12
14
15 public int LastEditId { get; private set; }
16
23
24 public int GetSacrificeCount(int itemId)
25 {
27 {
28 itemId = value;
29 }
31 return value2;
32 }
33
44
46 {
48 {
49 itemId = value;
50 }
52 if (!CreativeItemSacrificesCatalog.Instance.TryGetSacrificeCountCapToUnlockInfiniteItems(itemId, out amountNeededTotal))
53 {
54 return false;
55 }
57 return true;
58 }
59
60 public void RegisterItemSacrifice(int itemId, int amount)
61 {
63 {
64 itemId = value;
65 }
66 if (ContentSamples.ItemPersistentIdsByNetIds.TryGetValue(itemId, out var value2))
67 {
69 value3 += amount;
70 int value4 = Utils.Clamp(value3, 0, 9999);
74 }
75 }
76
87
88 public void Save(BinaryWriter writer)
89 {
91 writer.Write(dictionary.Count);
92 foreach (KeyValuePair<string, int> item in dictionary)
93 {
94 writer.Write(item.Key);
95 writer.Write(item.Value);
96 }
97 }
98
100 {
101 int num = reader.ReadInt32();
102 for (int i = 0; i < num; i++)
103 {
104 string key = reader.ReadString();
105 int value = reader.ReadInt32();
107 {
109 {
110 value2 = value3;
111 }
114 {
115 key = value4;
116 }
117 }
119 }
120 }
121
123 {
124 int num = reader.ReadInt32();
125 for (int i = 0; i < num; i++)
126 {
127 reader.ReadString();
128 reader.ReadInt32();
129 }
130 }
131
138
140 {
141 }
142
143 public void MarkContentsDirty()
144 {
145 LastEditId++;
146 }
147}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
virtual string ReadString()
virtual int ReadInt32()
void ValidateWorld(BinaryReader reader, int gameVersionSaveWasMadeOn)
void Load(BinaryReader reader, int gameVersionSaveWasMadeOn)
bool TryGetSacrificeNumbers(int itemId, out int amountWeHave, out int amountNeededTotal)
void SetSacrificeCountDirectly(string persistentId, int sacrificeCount)
static Dictionary< int, string > ItemPersistentIdsByNetIds
static Dictionary< int, int > CreativeResearchItemPersistentIdOverride
static Dictionary< string, int > ItemNetIdsByPersistentIds