This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
/
08_AddMod.c
59 lines (46 loc) · 1.98 KB
/
08_AddMod.c
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
#include "c/ModioC.h"
void onAddMod(void *object, ModioResponse response, ModioMod mod)
{
bool *wait = object;
printf("Add mod response code: %i\n", response.code);
if (response.code == 201)
{
printf("Mod added!\n");
printf("Mod id: %i\n", mod.id);
printf("Mod name: %s\n", mod.name);
}
*wait = false;
}
int main(void)
{
modioInit(MODIO_ENVIRONMENT_TEST, 7, (char *)"e91c01b8882f4affeddd56c96111977b", NULL);
if (!modioIsLoggedIn())
{
printf("You are not logged in, please login before creating a mod.\n");
return 0;
}
bool wait = true;
// The Mod Creator helps setting up the fields before creating a Mod
ModioModCreator mod_creator;
modioInitModCreator(&mod_creator);
modioSetModCreatorLogoPath(&mod_creator, (char *)"../ModExample/logo.png");
modioSetModCreatorName(&mod_creator, (char *)"Example Mod Test");
modioSetModCreatorHomepageURL(&mod_creator, (char *)"http://www.webpage.com");
modioSetModCreatorSummary(&mod_creator, (char *)"Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples. Mod added via the SDK examples.");
modioAddModCreatorTag(&mod_creator, (char *)"Easy");
modioAddModCreatorTag(&mod_creator, (char *)"Medium");
modioSetModCreatorDescription(&mod_creator, (char *)"This mod description was added via the SDK examples. This mod description was added via the SDK examples.");
modioSetModCreatorMetadataBlob(&mod_creator, (char *)"Optional metadata");
modioSetModCreatorMaturityOption(&mod_creator, MODIO_MATURITY_VIOLENCE | MODIO_MATURITY_ALCOHOL);
printf("Adding mod...\n");
// Now we can create the new mod. Remember, this mod wont have a Modfile right away, you should be adding one after the mod was created successfully
modioAddMod(&wait, mod_creator, &onAddMod);
modioFreeModCreator(&mod_creator);
while (wait)
{
modioProcess();
}
modioShutdown();
printf("Process finished\n");
return 0;
}