prontera,155,185,5 script kjhfkhsjd 1_F_MARIA,{
// #Attendance_require = 0;
// end;
mes callsub(YYYYMMDD);
#Attendance_require = callsub(YYYYMMDD);
close;
YYYYMMDD:
return gettime(GETTIME_YEAR) * 10000 + gettime(GETTIME_MONTH) * 100 + gettime(GETTIME_DAYOFMONTH);
}
#include "common/hercules.h"
#include "map/pc.h"
#include "map/clif.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"
HPExport struct hplugin_info pinfo = {
"attendance_requirement",
SERVER_TYPE_MAP,
"",
HPM_VERSION,
};
// copy from src\map\date.c
int date_get_date(void)
{
time_t t;
struct tm * lt;
t = time(NULL);
lt = localtime(&t);
return
(lt->tm_year + 1900) * 10000 +
(lt->tm_mon + 1) * 100 +
(lt->tm_mday);
}
static void clif_parse_attendance_reward_request_pre(int *fd, struct map_session_data **sd) {
if ((*sd)->state.trading || pc_isdead(*sd) || pc_isvending(*sd))
return;
if (pc_readaccountreg(*sd, script->add_variable("#Attendance_require")) != date_get_date()) {
clif->messagecolor_self((*sd)->fd, COLOR_RED, "You don't meet the requirement.");
hookStop();
}
return;
}
HPExport void plugin_init (void) {
addHookPre(clif, pAttendanceRewardRequest, clif_parse_attendance_reward_request_pre);
}
this has been tested working
btw remember the attendance system are bind to each character in the account
https://github.com/HerculesWS/Hercules/blob/da14478a8c0c616a6aa5481694c550143bc9b9f3/sql-files/main.sql#L245-L246 <-- under `char` table
so I guess what you doing there is the reward can claim for each character in the account once the quest has completed