-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAPI.cs
More file actions
204 lines (186 loc) · 9.37 KB
/
API.cs
File metadata and controls
204 lines (186 loc) · 9.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
namespace Expeditions
{
/// <summary>
/// Big Friendly Class provides access to all the important and useful methods
/// required to interface with this mod!
/// <para>
/// To create an expedition, create a new .cs file which extends ModExpedition.
/// Once you've set them all up, add them to the game via the Mod class' Load()
/// override method by calling AddExpedition()
/// </para>
/// </summary>
public static class API
{
#region Fields
public static int ItemIDExpeditionBook { get { return Expeditions.bookID; } }
public static int ItemIDExpeditionBoard { get { return Expeditions.boardID; } }
public static int ItemIDExpeditionCoupon { get { return Expeditions.voucherID; } }
public static int ItemIDRustedBox { get { return Expeditions.stockBox1; } }
public static int ItemIDRelicBox { get { return Expeditions.stockBox2; } }
public static int CustomCurrencyIDExpeditionCoupon { get { return Expeditions.currencyVoucherID; } }
/// <summary> Morning, according to the merchant. </summary>
public static bool TimeMorning { get { return TimeChecker.TimeDayMorn; } }
/// <summary> Afternoon, according to the merchant. </summary>
public static bool TimeAfternoon { get { return TimeChecker.TimeDayNoon; } }
/// <summary> Evening, according to the merchant. </summary>
public static bool TimeEvening { get { return TimeChecker.TimeDayEve; } }
/// <summary> Early Night, according to the merchant. </summary>
public static bool TimeDusk { get { return TimeChecker.TimeNightDusk; } }
/// <summary> Mid Night, according to the merchant. </summary>
public static bool TimeNight { get { return TimeChecker.TimeNightMidnight; } }
/// <summary> Late Night, according to the merchant. </summary>
public static bool TimeDawn { get { return TimeChecker.TimeNightDawn; } }
/// <summary> Random Fact, did you know the traditional witching hour is 3-4AM? </summary>
public static bool TimeWitchingHour { get { return TimeChecker.WitchingHour; } }
/// <summary> Day time before the sun hits the top of the sky </summary>
public static bool TimeDayPreNoon { get { return TimeChecker.TimeDayPreNoon; } }
/// <summary> Day time after the sun hits the top of the sky </summary>
public static bool TimeDayPostNoon { get { return TimeChecker.TimeDayPostNoon; } }
/// <summary> Night time before the moon hits the top of the sky </summary>
public static bool TimeNightPreMid { get { return TimeChecker.TimeNightPreMid; } }
/// <summary> Night time after the moon hits the top of the sky </summary>
public static bool TimeNightPostMid { get { return TimeChecker.TimeNightPostMid; } }
/// <summary> Get the generated list of player inventory items </summary>
public static bool[] InInventory { get { return PlayerExplorer.itemContains; } }
#endregion
#region Methods
/// <summary>
/// Add your expedition to the list. Call this in your Mod's Load() method.
/// No Autoload support yet.
/// </summary>
/// <param name="mod">Your mod object</param>
/// <param name="modExpedition">Your CustomExpedition, usually just 'new CustomExpedition()'</param>
public static void AddExpedition(Mod mod, ModExpedition modExpedition)
{
Expeditions.AddExpeditionToList(modExpedition, mod);
}
/// <summary>
/// Returns the list that manages the expeditions. Don't mess with it unless you know what you're doing... consider FindExpedition().
/// </summary>
/// <returns>The list of ModExpeditions. Will not return null, only an empty list.</returns>
public static List<ModExpedition> GetExpeditionsList()
{
return Expeditions.GetExpeditionsList();
}
/// <summary>
/// Attempts to find the specified mod expedition by class name.
/// </summary>
/// <param name="mod">Your mod object</param>
/// <param name="name">The classname of the ModExpedition</param>
/// <returns>ModExpedition, or null if no result</returns>
public static ModExpedition FindModExpedition(Mod mod, string name)
{
return Expeditions.FindModExpedition(mod, name);
}
/// <summary>
/// Attempts to find the specified mod expedition by class name.
/// </summary>
/// <typeparam name="ClassName">The classname of the ModExpedition</typeparam>
/// <param name="mod">Your mod object</param>
/// <returns>ModExpedition, or null if no result</returns>
public static ModExpedition FindModExpedition<ClassName>(Mod mod)
{
return Expeditions.FindModExpedition<ClassName>(mod);
}
/// <summary>
/// Attempts to find the specified expedition by class name.
/// </summary>
/// <param name="mod">Your mod object</param>
/// <param name="name">The classname of the Expedition's ModExpedition</param>
/// <returns>Expedition, or an empty expedition if no result</returns>
public static Expedition FindExpedition(Mod mod, string name)
{
return Expeditions.FindExpedition(mod, name);
}
/// <summary>
/// Attempts to find the specified expedition by class name.
/// </summary>
/// <typeparam name="ClassName">The classname of the Expedition's ModExpedition</typeparam>
/// <param name="mod">Your mod object</param>
/// <returns>Expedition, or an empty expedition if no result</returns>
public static Expedition FindExpedition<ClassName>(Mod mod)
{
return Expeditions.FindExpedition<ClassName>(mod);
}
/// <summary>
/// Show the expedition as an item pickup.
/// Automatically called when expeditions meet prerequisites,
/// and can also be used eg. daily quests.
/// </summary>
/// <param name="expedition"></param>
public static void ShowExpeditionAsNewItem(Expedition expedition)
{
Expeditions.DisplayUnlockedExpedition(expedition);
}
/// <summary>
/// Net-friendly method to spawn item on top of my player.
/// An increased options version of player.QuickSpawnItem().
/// Doesn't spawn item if netMode is 2 (server)
/// </summary>
/// <param name="itemType">ItemID item type</param>
/// <param name="stack"></param>
/// <param name="prefix"></param>
public static void ClientSpawnItem(int itemType, int stack = 1, int prefix = 0)
{
Expeditions.ClientNetSpawnItem(itemType, stack, prefix);
}
/// <summary>
/// Net-friendly method to spawn item on top of my player.
/// An increased options version of player.QuickSpawnItem().
/// Doesn't spawn item if netMode is 2 (server)
/// </summary>
/// <param name="item"></param>
public static void ClientNetSpawnItem(Item item)
{
Expeditions.ClientNetSpawnItem(item);
}
/// <summary>
/// Takes a value and divides it into stacks of coins.
/// Doesn't spawn item if netMode is 2 (server)
/// </summary>
/// <param name="value">int[4] array of coin stacks from platinum[0] to copper[3]</param>
/// <returns></returns>
public static int[] DivideValueIntoMoneyStacks(int value)
{
return Expeditions.DivideValueIntoMoneyStack(value);
}
/// <summary>
/// Add an item to the shop using vouchers as a currency rather than coins.
/// Since specific expeditions give 1-3 depending on difficulty, a pricing guide:
/// <para/>1: Small reward item, eg. Relic Box
/// <para/>2: Main reward item, eg. A weapon
/// <para/>5: Major reward item, eg. Armour set
/// </summary>
/// <param name="shop">The NPC shop being added to. </param>
/// <param name="nextSlot">Shop's next slot. This will get incremented automagically. </param>
/// <param name="itemID">Item type being sold. </param>
/// <param name="price">Number of coupons needed. </param>
public static void AddShopItemVoucher(Chest shop, ref int nextSlot, int itemID, int price)
{
NPCExplore.AddVoucherPricedItem(shop, ref nextSlot, itemID, price);
}
/// <summary>
/// Check to see whether the expeditions is the daily one.
/// </summary>
/// <param name="expedition">The expedition to check</param>
/// <returns>True if the specified expedition is the daily one</returns>
public static bool IsDaily(Expedition expedition)
{
return WorldExplore.IsCurrentDaily(expedition);
}
/// <summary>
/// Check to see whether the expeditions is the daily one.
/// </summary>
/// <param name="modExpedition">The mod expedition to check</param>
/// <returns>True if the specified expedition is the daily one</returns>
public static bool IsDaily(ModExpedition modExpedition)
{
return WorldExplore.IsCurrentDaily(modExpedition.expedition);
}
#endregion
}
}