diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/achievement.c | 6 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 33 |
4 files changed, 32 insertions, 10 deletions
diff --git a/src/map/achievement.c b/src/map/achievement.c index 057ea29c3..7ab80e183 100644 --- a/src/map/achievement.c +++ b/src/map/achievement.c @@ -301,6 +301,9 @@ static int achievement_validate_type(struct map_session_data *sd, enum achieveme Assert_ret(criteria->goal != 0); + if (battle_config.feature_enable_achievement == 0) + return 0; + if (type == ACH_QUEST) { ShowError("achievement_validate_type: ACH_QUEST is not handled by this function. (use achievement_validate())\n"); return 0; @@ -358,6 +361,9 @@ static bool achievement_validate(struct map_session_data *sd, int aid, unsigned Assert_retr(false, progress > 0); Assert_retr(false, obj_idx < MAX_ACHIEVEMENT_OBJECTIVES); + if (battle_config.feature_enable_achievement == 0) + return false; + if ((ad = achievement->get(aid)) == NULL) { ShowError("achievement_validate: Invalid Achievement %d provided.", aid); return false; diff --git a/src/map/battle.c b/src/map/battle.c index 1b7bf909e..798f50b13 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7414,6 +7414,7 @@ static const struct battle_data { { "min_item_sell_price", &battle_config.min_item_sell_price, 0, 0, INT_MAX, }, { "display_fake_hp_when_dead", &battle_config.display_fake_hp_when_dead, 1, 0, 1, }, { "magicrod_type", &battle_config.magicrod_type, 0, 0, 1, }, + { "features/enable_achievement_system", &battle_config.feature_enable_achievement, 1, 0, 1, }, }; static bool battle_set_value_sub(int index, int value) diff --git a/src/map/battle.h b/src/map/battle.h index c797e665a..7e03f0a8e 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -578,6 +578,8 @@ struct Battle_Config { int display_fake_hp_when_dead; int magicrod_type; + + int feature_enable_achievement; }; /* criteria for battle_config.idletime_critera */ diff --git a/src/map/script.c b/src/map/script.c index bba559df8..3b99c16f0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10604,24 +10604,36 @@ static BUILDIN(gettime) return true; } -/*========================================== +/* * GetTimeStr("TimeFMT", Length); - *------------------------------------------*/ + */ static BUILDIN(gettimestr) { char *tmpstr; const char *fmtstr; int maxlen; - time_t now = time(NULL); + time_t now; + + fmtstr = script_getstr(st, 2); + maxlen = script_getnum(st, 3); - fmtstr=script_getstr(st,2); - maxlen=script_getnum(st,3); + if (script_hasdata(st, 4)) { + int timestamp = script_getnum(st, 4); + if (timestamp < 0) { + ShowWarning("buildin_gettimestr: UNIX timestamp must be in positive value.\n"); + return false; + } + + now = (time_t)timestamp; + } else { + now = time(NULL); + } - tmpstr=(char *)aMalloc((maxlen+1)*sizeof(char)); - strftime(tmpstr,maxlen,fmtstr,localtime(&now)); - tmpstr[maxlen]='\0'; + tmpstr = (char *)aMalloc((maxlen +1)*sizeof(char)); + strftime(tmpstr, maxlen, fmtstr, localtime(&now)); + tmpstr[maxlen] = '\0'; - script_pushstr(st,tmpstr); + script_pushstr(st, tmpstr); return true; } @@ -14857,6 +14869,7 @@ static BUILDIN(getinventorylist) } pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_expire"), j),sd->status.inventory[i].expire_time); pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_bound"), j),sd->status.inventory[i].bound); + pc->setreg(sd, reference_uid(script->add_variable("@inventorylist_idx"), j), i); j++; } } @@ -25378,7 +25391,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(savepoint,"sii"), BUILDIN_DEF(gettimetick,"i"), BUILDIN_DEF(gettime,"i"), - BUILDIN_DEF(gettimestr,"si"), + BUILDIN_DEF(gettimestr, "si?"), BUILDIN_DEF(openstorage,""), BUILDIN_DEF(guildopenstorage,""), BUILDIN_DEF(itemskill,"vi?"), |