Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ProgressionEventCondition.cs
Go to the documentation of this file.
3
5
7{
8 private const string Identifier = "PROGRESSION_EVENT";
9
11
12 private static bool _isListenerHooked;
13
14 private int[] _eventIDs;
15
17 : base("PROGRESSION_EVENT_" + eventID)
18 {
19 _eventIDs = new int[1] { eventID };
20 ListenForPickup(this);
21 }
22
24 : base("PROGRESSION_EVENT_" + eventIDs[0])
25 {
27 ListenForPickup(this);
28 }
29
30 private static void ListenForPickup(ProgressionEventCondition condition)
31 {
33 {
34 AchievementsHelper.OnProgressionEvent += ProgressionEventListener;
35 _isListenerHooked = true;
36 }
37 for (int i = 0; i < condition._eventIDs.Length; i++)
38 {
39 if (!_listeners.ContainsKey(condition._eventIDs[i]))
40 {
42 }
43 _listeners[condition._eventIDs[i]].Add(condition);
44 }
45 }
46
47 private static void ProgressionEventListener(int eventID)
48 {
49 if (!_listeners.ContainsKey(eventID))
50 {
51 return;
52 }
54 {
55 item.Complete();
56 }
57 }
58
60 {
62 }
63
65 {
67 }
68
70 {
72 for (int i = 0; i < eventIDs.Length; i++)
73 {
74 array[i] = new ProgressionEventCondition(eventIDs[i]);
75 }
76 return array;
77 }
78}
static Dictionary< int, List< ProgressionEventCondition > > _listeners
static ProgressionEventCondition Create(params int[] eventIDs)
static ProgressionEventCondition[] CreateMany(params int[] eventIDs)
static void ListenForPickup(ProgressionEventCondition condition)