1
1
using System ;
2
2
using System . Collections . Generic ;
3
- using System . Linq ;
4
3
using Serilog ;
5
- using UndertaleModLib . Models ;
6
4
using Newtonsoft . Json ;
7
5
using System . IO ;
8
- using Microsoft . Win32 ;
9
6
10
7
namespace ModShardLauncher
11
8
{
@@ -115,7 +112,7 @@ public static void InjectLootScripts()
115
112
}
116
113
else
117
114
{
118
- scr_actionsLogUpdate (""invalid object "" + string(objectName));
115
+ scr_msl_log (""invalid object "" + string(objectName));
119
116
}
120
117
}
121
118
else
@@ -127,7 +124,7 @@ public static void InjectLootScripts()
127
124
}
128
125
else
129
126
{
130
- scr_actionsLogUpdate (""invalid object "" + string(objectName));
127
+ scr_msl_log (""invalid object "" + string(objectName));
131
128
}
132
129
}
133
130
}
@@ -160,11 +157,11 @@ public static void InjectLootScripts()
160
157
var min_lvl = scr_globaltile_dungeon_get(""mob_lvl_min"");
161
158
var max_lvl = scr_globaltile_dungeon_get(""mob_lvl_max"");
162
159
var tier = floor(((max_lvl + min_lvl) / 2));
163
- scr_actionsLogUpdate (""current tier: "" + string(tier));
160
+ scr_msl_log (""current tier: "" + string(tier));
164
161
165
162
if (!variable_struct_exists(refData, objectName))
166
163
{
167
- scr_actionsLogUpdate (""cant find object "" + objectName);
164
+ scr_msl_log (""cant find object "" + objectName);
168
165
file_text_close(refFile);
169
166
return -4;
170
167
}
@@ -173,31 +170,31 @@ public static void InjectLootScripts()
173
170
174
171
if (!variable_struct_exists(refStruct, ""DefaultTable""))
175
172
{
176
- scr_actionsLogUpdate (""cant find DefaultTable"");
173
+ scr_msl_log (""cant find DefaultTable"");
177
174
file_text_close(refFile);
178
175
return -4;
179
176
}
180
177
var defaultTable = variable_struct_get(refStruct, ""DefaultTable"");
181
178
182
179
if (!variable_struct_exists(refStruct, ""Ids""))
183
180
{
184
- scr_actionsLogUpdate (""cant find Ids"");
181
+ scr_msl_log (""cant find Ids"");
185
182
file_text_close(refFile);
186
183
return -4;
187
184
}
188
185
var idsStruct = variable_struct_get(refStruct, ""Ids"");
189
186
190
- if (variable_struct_exists(idsStruct, argument0.id))
187
+ if (variable_struct_exists(idsStruct, string( argument0.id) ))
191
188
{
192
189
var referenceLootTable = variable_struct_get(idsStruct, argument0.id);
193
- scr_actionsLogUpdate (""ref: "" + referenceLootTable);
190
+ scr_msl_log (""ref with id : "" + referenceLootTable);
194
191
file_text_close(refFile);
195
192
return referenceLootTable;
196
193
}
197
194
198
195
if (!variable_struct_exists(refStruct, ""Tiers""))
199
196
{
200
- scr_actionsLogUpdate (""cant find Tiers"");
197
+ scr_msl_log (""cant find Tiers"");
201
198
file_text_close(refFile);
202
199
return -4;
203
200
}
@@ -207,7 +204,7 @@ public static void InjectLootScripts()
207
204
208
205
for (var i = 0; i < array_length(tiers); i++;)
209
206
{
210
- if (tier < tiers[i])
207
+ if (tier < real( tiers[i]) )
211
208
{
212
209
indexTier = i - 1;
213
210
break;
@@ -221,13 +218,14 @@ public static void InjectLootScripts()
221
218
if (indexTier == -1)
222
219
{
223
220
var referenceLootTable = defaultTable;
221
+ scr_msl_log(""ref with default: "" + referenceLootTable);
224
222
}
225
223
else
226
224
{
227
225
var referenceLootTable = variable_struct_get(tiersStruct, tiers[indexTier]);
226
+ scr_msl_log(""ref with tier: "" + referenceLootTable);
228
227
}
229
228
230
- scr_actionsLogUpdate(""ref: "" + referenceLootTable);
231
229
file_text_close(refFile);
232
230
return referenceLootTable;
233
231
}" ;
@@ -238,7 +236,7 @@ public static void InjectLootScripts()
238
236
|| !variable_struct_exists(argument0, ""ListRarity"")
239
237
|| !variable_struct_exists(argument0, ""ListDurability""))
240
238
{
241
- scr_actionsLogUpdate (""no ItemsTable data"");
239
+ scr_msl_log (""no ItemsTable data"");
242
240
return 0;
243
241
}
244
242
@@ -251,7 +249,7 @@ public static void InjectLootScripts()
251
249
if (size_array != array_length(rarity) ||
252
250
size_array != array_length(durability))
253
251
{
254
- scr_actionsLogUpdate (""List with incorrect size"");
252
+ scr_msl_log (""List with incorrect size"");
255
253
return 0;
256
254
}
257
255
@@ -268,7 +266,7 @@ public static void InjectLootScripts()
268
266
if (!variable_struct_exists(argument0, ""ItemsTable"")
269
267
|| !variable_struct_exists(argument0, ""ListWeight""))
270
268
{
271
- scr_actionsLogUpdate (""no randomLoot data"");
269
+ scr_msl_log (""no randomLoot data"");
272
270
return 0;
273
271
}
274
272
@@ -279,7 +277,7 @@ public static void InjectLootScripts()
279
277
|| !variable_struct_exists(itemsTable, ""ListRarity"")
280
278
|| !variable_struct_exists(itemsTable, ""ListDurability""))
281
279
{
282
- scr_actionsLogUpdate (""no randomLoot data"");
280
+ scr_msl_log (""no randomLoot data"");
283
281
return 0;
284
282
}
285
283
@@ -304,10 +302,10 @@ public static void InjectLootScripts()
304
302
totalWeight += weight[_i];
305
303
}
306
304
}
307
- scr_actionsLogUpdate (""totalWeight "" + string(totalWeight));
305
+ scr_msl_log (""totalWeight "" + string(totalWeight));
308
306
309
307
var randomWeight = irandom(totalWeight - 1);
310
- scr_actionsLogUpdate (""randomWeight "" + string(randomWeight));
308
+ scr_msl_log (""randomWeight "" + string(randomWeight));
311
309
var cumulativeWeight = 0;
312
310
var index = -1;
313
311
@@ -327,12 +325,12 @@ public static void InjectLootScripts()
327
325
328
326
if (index != -1)
329
327
{
330
- scr_actionsLogUpdate (""found "" + string(index));
328
+ scr_msl_log (""found "" + string(index));
331
329
scr_msl_resolve_items(items[index], rarity[index], durability[index], argument1, argument2);
332
330
}
333
331
else
334
332
{
335
- scr_actionsLogUpdate (""found empty"");
333
+ scr_msl_log (""found empty"");
336
334
}
337
335
}
338
336
@@ -342,12 +340,12 @@ public static void InjectLootScripts()
342
340
string mslLootFunction = @"function scr_msl_resolve_loot_table(argument0, argument1)
343
341
{
344
342
var objectName = object_get_name(argument0.object_index);
345
- scr_actionsLogUpdate (""instance: "" + string(argument0.id) + "" of "" + objectName);
343
+ scr_msl_log (""instance: "" + string(argument0.id) + "" of "" + objectName);
346
344
347
345
var referenceLootTable = scr_msl_resolve_refence_table(argument0);
348
346
if (referenceLootTable == noone)
349
347
{
350
- scr_actionsLogUpdate (""Reference Table resolution failed"");
348
+ scr_msl_log (""Reference Table resolution failed"");
351
349
return 0;
352
350
}
353
351
@@ -357,30 +355,30 @@ public static void InjectLootScripts()
357
355
358
356
if (!variable_struct_exists(data, referenceLootTable))
359
357
{
360
- scr_actionsLogUpdate (""cant find ref "" + referenceLootTable);
358
+ scr_msl_log (""cant find ref "" + referenceLootTable);
361
359
file_text_close(file);
362
360
return 0;
363
361
}
364
362
var lootStruct = variable_struct_get(data, referenceLootTable);
365
363
366
364
if (!variable_struct_exists(lootStruct, ""GuaranteedItems""))
367
365
{
368
- scr_actionsLogUpdate (""no guaranteedItems"");
366
+ scr_msl_log (""no guaranteedItems"");
369
367
file_text_close(""loot_table.json"");
370
368
return 0;
371
369
}
372
370
var guaranteedItems = variable_struct_get(lootStruct, ""GuaranteedItems"");
373
371
374
372
if (!scr_msl_resolve_guaranteed_items(guaranteedItems, argument1, argument0))
375
373
{
376
- scr_actionsLogUpdate (""Guaranteed Items resolution failed"");
374
+ scr_msl_log (""Guaranteed Items resolution failed"");
377
375
file_text_close(""loot_table.json"");
378
376
return 0;
379
377
}
380
378
381
379
if (!variable_struct_exists(lootStruct, ""RandomLootMin"") || !variable_struct_exists(lootStruct, ""RandomLootMax"") || !variable_struct_exists(lootStruct, ""EmptyWeight""))
382
380
{
383
- scr_actionsLogUpdate (""no int"");
381
+ scr_msl_log (""no int"");
384
382
file_text_close(""loot_table.json"");
385
383
return 0;
386
384
}
@@ -390,11 +388,11 @@ public static void InjectLootScripts()
390
388
var emptyWeight = variable_struct_get(lootStruct, ""EmptyWeight"");
391
389
392
390
var iteration = randomLootMin + irandom(randomLootMax - randomLootMin);
393
- scr_actionsLogUpdate (""iteration "" + string(iteration));
391
+ scr_msl_log (""iteration "" + string(iteration));
394
392
395
393
if (!variable_struct_exists(lootStruct, ""RandomItemsTable""))
396
394
{
397
- scr_actionsLogUpdate (""no RandomItemsTable"");
395
+ scr_msl_log (""no RandomItemsTable"");
398
396
file_text_close(""loot_table.json"");
399
397
return 0;
400
398
}
0 commit comments