· 4 years ago · Apr 09, 2021, 02:06 PM
1--[[
2
3 Daily Rewards - API
4 1.0.0 - 2020/10/22
5 by Waffle (Manticore) (META) (Programming) (https://www.coregames.com/user/581ff579fd864966aec56450754db1fb)
6 + Nicholas Foreman (META) (Programming) (https://www.coregames.com/user/f9df3457225741c89209f6d484d0eba8)
7
8
91. Setup
10
11 1) Select the script you wish to use the API in the hierarchy.
12 2) While keeping the script selected, navigate to: Project Content > Imported Content > Daily Rewards Calendar > Dependencies
13 3) In the dependencies, you will see this API (API_DailyRewards)
14 4) Drag-and-drop this asset reference into the custom properties of the script you are attempting to use it in
15
16
172. Usage
18
19 Edit the data in this script to change reward amounts and types.
20
21 1) Editting rewards
22 a) Find the day you want to edit (the key for this is day)
23 b) Adjust the type, value, and image accordingly
24
25 2) Adding a new Image
26 a) Click on this script in the Project Content tab, keeping it open in the Properties tab
27 b) Switch to Core Content and find the Image you wish to use
28 c) Drag-and-drop the image to the custom properties of this script and rename accordingly
29 d) Create a new entry in API.Images following this format:
30 IMAGE_NAME = script:GetCustomProperty("ImageName"),
31
32 3) Adding a new RewardType
33 a) Try to keep rewards as specific as possible, such as "Hats," "Armor," etc. if you system expects it to
34 b) Create a new entry in API.RewardType following this format:
35 REWARD_TYPE_NAME = [PREVIOUS_REWARD_TYPE + 1],
36
37
383. Exposed Variables
39
40 Enum RewardType
41 CURRENCY
42 ITEM
43 • This is used by scripts to just track what type of reward you are rewarding
44 table Images
45 • You would use this to determine what icons are shown throughout the days
46
47
483b. Exposed Functions
49
50 table API.GetReward(int day)
51 Returns a reward table based on the day passed
52
53--]]
54
55local API = {}
56
57------------------------------------------------------------------------------------------------------------------------
58-- API STATIC VARIABLES
59------------------------------------------------------------------------------------------------------------------------
60
61API.Images = {
62 CURRENCY_SMALL = script:GetCustomProperty("CurrencySmall"),
63 CURRENCY_LARGE = script:GetCustomProperty("CurrencyLarge"),
64 CURRENCY_M1 = script:GetCustomProperty("DailyPieceOr1"),
65 CURRENCY_M2 = script:GetCustomProperty("DailyMoney1"),
66 CURRENCY_M3 = script:GetCustomProperty("DailyLingotOr1"),
67 CURRENCY_MEDALS = script:GetCustomProperty("DailyMedals"),
68 CURRENCY_ORB = script:GetCustomProperty("DailyOrb2remake"),
69 CURRENCY_BM = script:GetCustomProperty("DailyBM1"),
70 CURRENCY_TOY = script:GetCustomProperty("DailyCadoSurprise1"),
71 CURRENCY_AOS = script:GetCustomProperty("DailyAOSofficial"),
72}
73
74API.RewardType = {
75 CURRENCY = 1,
76 ITEM = 2,
77 Money = 3,
78 BM = 4,
79 Medals = 5,
80 Orb = 6,
81 Toy = 7,
82 AOS = 8,
83
84 -- Add additional reward types, to be used by you
85}
86
87--REWARD_TYPE_NAME = [PREVIOUS_REWARD_TYPE + 1],
88
89API.rewards = {
90 {
91 day = 1,
92 type = API.RewardType.Money,
93 value = 20,
94 image = API.Images.CURRENCY_M1, --money
95 },
96 {
97 day = 2,
98 type = API.RewardType.BM,
99 value = 20,
100 image = API.Images.CURRENCY_BM, --bm
101 },
102 {
103 day = 3,
104 type = API.RewardType.Money,
105 value = 20,
106 image = API.Images.CURRENCY_M1, --money
107 },
108 {
109 day = 4,
110 type = API.RewardType.BM,
111 value = 20,
112 image = API.Images.CURRENCY_BM, --bm
113 },
114 {
115 day = 5,
116 type = API.RewardType.Money,
117 value = 20,
118 image = API.Images.CURRENCY_M1, --money
119 },
120 {
121 day = 6,
122 type = API.RewardType.Money,
123 value = 100,
124 image = API.Images.CURRENCY_M2, --money x5
125 },
126 {
127 day = 7,
128 type = API.RewardType.Medals,
129 value = 7,
130 image = API.Images.CURRENCY_MEDALS, --medals x7
131 },
132 {
133 day = 8,
134 type = API.RewardType.BM,
135 value = 30,
136 image = API.Images.CURRENCY_BM, --bm
137 },
138 {
139 day = 9,
140 type = API.RewardType.Money,
141 value = 30,
142 image = API.Images.CURRENCY_M1,-- money
143 },
144 {
145 day = 10,
146 type = API.RewardType.BM,
147 value = 30,
148 image = API.Images.CURRENCY_BM, --bm
149 },
150 {
151 day = 11,
152 type = API.RewardType.Money,
153 value = 30,
154 image = API.Images.CURRENCY_M1, --money
155 },
156 {
157 day = 12,
158 type = API.RewardType.BM,
159 value = 30,
160 image = API.Images.CURRENCY_BM, --bm
161 },
162 {
163 day = 13,
164 type = API.RewardType.Money,
165 value = 150,
166 image = API.Images.CURRENCY_M2, --money
167 },
168 {
169 day = 14,
170 type = API.RewardType.Medals,
171 value = 7,
172 image = API.Images.CURRENCY_MEDALS, -- medals
173 },
174 {
175 day = 15,
176 type = API.RewardType.Money,
177 value = 40,
178 image = API.Images.CURRENCY_M1, -- money
179 },
180 {
181 day = 16,
182 type = API.RewardType.BM,
183 value = 40,
184 image = API.Images.CURRENCY_BM, --BM
185 },
186 {
187 day = 17,
188 type = API.RewardType.Money,
189 value = 40,
190 image = API.Images.CURRENCY_M1, -- money
191 },
192 {
193 day = 18,
194 type = API.RewardType.BM,
195 value = 40,
196 image = API.Images.CURRENCY_BM, -- BM
197 },
198 {
199 day = 19,
200 type = API.RewardType.Money,
201 value = 40,
202 image = API.Images.CURRENCY_M1, -- money
203 },
204 {
205 day = 20,
206 type = API.RewardType.Orb,
207 value = 10,
208 image = API.Images.CURRENCY_ORB, -- orb
209 },
210 {
211 day = 21,
212 type = API.RewardType.Medals,
213 value = 7,
214 image = API.Images.CURRENCY_MEDALS, -- medals
215 },
216 {
217 day = 22,
218 type = API.RewardType.BM,
219 value = 50,
220 image = API.Images.CURRENCY_BM, -- bm
221 },
222 {
223 day = 23,
224 type = API.RewardType.Money,
225 value = 50,
226 image = API.Images.CURRENCY_M1, -- money
227 },
228 {
229 day = 24,
230 type = API.RewardType.BM,
231 value = 50,
232 image = API.Images.CURRENCY_BM, -- bm
233 },
234 {
235 day = 25,
236 type = API.RewardType.Money,
237 value = 50,
238 image = API.Images.CURRENCY_M1, -- money
239 },
240 {
241 day = 26,
242 type = API.RewardType.BM, --
243 value = 50,
244 image = API.Images.CURRENCY_BM, -- bm
245 },
246 {
247 day = 27,
248 type = API.RewardType.Money,
249 value = 150,
250 image = API.Images.CURRENCY_M2, -- money
251 },
252 {
253 day = 28,
254 type = API.RewardType.Medals,
255 value = 7,
256 image = API.Images.CURRENCY_MEDALS, -- medals
257 },
258 {
259 day = 29,
260 type = API.RewardType.Money,
261 value = 1000,
262 image = API.Images.CURRENCY_M3, -- money x1000
263 },
264 {
265 day = 30,
266 type = API.RewardType.Toy,
267 value = 1,
268 image = API.Images.CURRENCY_TOY, -- cado x1
269 },
270 {
271 day = 31,
272 type = API.RewardType.AOS,
273 value = 1,
274 image = API.Images.CURRENCY_AOS, -- aos
275 },
276}
277
278------------------------------------------------------------------------------------------------------------------------
279-- API STATIC FUNCTIONS
280------------------------------------------------------------------------------------------------------------------------
281
282-- table GetReward(int)
283-- Returns a reward table based on the day passed
284function API.GetReward(day)
285 for _, reward in pairs(API.rewards) do
286 if(reward.day == day) then
287 return reward
288 end
289 end
290end
291
292------------------------------------------------------------------------------------------------------------------------
293-- RETURN STATEMENT
294------------------------------------------------------------------------------------------------------------------------
295
296return API