summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c30
-rw-r--r--src/map/battle.c18
-rw-r--r--src/map/battle.h8
-rw-r--r--src/map/battleground.c6
-rw-r--r--src/map/battleground.h6
-rw-r--r--src/map/chrif.c10
-rw-r--r--src/map/chrif.h16
-rw-r--r--src/map/clif.c72
-rw-r--r--src/map/clif.h28
-rw-r--r--src/map/elemental.c14
-rw-r--r--src/map/elemental.h10
-rw-r--r--src/map/guild.c6
-rw-r--r--src/map/guild.h4
-rw-r--r--src/map/homunculus.c2
-rw-r--r--src/map/homunculus.h2
-rw-r--r--src/map/instance.c2
-rw-r--r--src/map/instance.h2
-rw-r--r--src/map/irc-bot.c6
-rw-r--r--src/map/irc-bot.h8
-rw-r--r--src/map/map.c10
-rw-r--r--src/map/map.h10
-rw-r--r--src/map/mapreg.h2
-rw-r--r--src/map/mapreg_sql.c2
-rw-r--r--src/map/mercenary.c4
-rw-r--r--src/map/mercenary.h4
-rw-r--r--src/map/mob.c81
-rw-r--r--src/map/mob.h30
-rw-r--r--src/map/npc.c23
-rw-r--r--src/map/npc.h12
-rw-r--r--src/map/party.c3
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/pc.c41
-rw-r--r--src/map/pc.h54
-rw-r--r--src/map/pet.c27
-rw-r--r--src/map/pet.h20
-rw-r--r--src/map/script.c12
-rw-r--r--src/map/script.h2
-rw-r--r--src/map/skill.c231
-rw-r--r--src/map/skill.h58
-rw-r--r--src/map/status.c37
-rw-r--r--src/map/status.h9
-rw-r--r--src/map/unit.c30
-rw-r--r--src/map/unit.h24
43 files changed, 481 insertions, 497 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index c815967c2..7ec589956 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -4260,7 +4260,8 @@ ACMD(servertime) {
} else if (battle_config.night_duration == 0) {
if (map->night_flag == 1) { // we start with night
timer_data = timer->get(pc->day_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in night for %s.
+ sprintf(temp, msg_txt(233), // Game time: The game is actually in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
clif->message(fd, temp);
clif->message(fd, msg_txt(234)); // Game time: After, the game will be in permanent daylight.
} else
@@ -4268,7 +4269,8 @@ ACMD(servertime) {
} else if (battle_config.day_duration == 0) {
if (map->night_flag == 0) { // we start with day
timer_data = timer->get(pc->night_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ sprintf(temp, msg_txt(235), // Game time: The game is actualy in daylight for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
clif->message(fd, temp);
clif->message(fd, msg_txt(236)); // Game time: After, the game will be in permanent night.
} else
@@ -4277,22 +4279,28 @@ ACMD(servertime) {
if (map->night_flag == 0) {
timer_data = timer->get(pc->night_timer_tid);
timer_data2 = timer->get(pc->day_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ sprintf(temp, msg_txt(235), // Game time: The game is actualy in daylight for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
- sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)); // Game time: After, the game will be in night for %s.
+ sprintf(temp, msg_txt(237), // Game time: After, the game will be in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)));
else
- sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)); // Game time: After, the game will be in night for %s.
+ sprintf(temp, msg_txt(237), // Game time: After, the game will be in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)));
clif->message(fd, temp);
} else {
timer_data = timer->get(pc->day_timer_tid);
timer_data2 = timer->get(pc->night_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,timer->gettick()) / 1000)); // Game time: The game is actualy in night for %s.
+ sprintf(temp, msg_txt(233), // Game time: The game is actualy in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick()) / 1000)));
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0)
- sprintf(temp, msg_txt(239), txt_time((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)); // Game time: After, the game will be in daylight for %s.
+ sprintf(temp, msg_txt(239), // Game time: After, the game will be in daylight for %s.
+ txt_time((unsigned int)((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)));
else
- sprintf(temp, msg_txt(239), txt_time(DIFF_TICK(timer_data2->tick, timer_data->tick) / 1000)); // Game time: After, the game will be in daylight for %s.
+ sprintf(temp, msg_txt(239), // Game time: After, the game will be in daylight for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data2->tick, timer_data->tick) / 1000)));
clif->message(fd, temp);
}
sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s.
@@ -5250,7 +5258,7 @@ ACMD(useskill) {
*------------------------------------------*/
ACMD(displayskill) {
struct status_data *st;
- unsigned int tick;
+ int64 tick;
uint16 skill_id;
uint16 skill_lv = 1;
@@ -6086,8 +6094,8 @@ ACMD(summon)
int mob_id = 0;
int duration = 0;
struct mob_data *md;
- unsigned int tick=timer->gettick();
-
+ int64 tick=timer->gettick();
+
if (!message || !*message || sscanf(message, "%23s %d", name, &duration) < 1)
{
clif->message(fd, msg_txt(1225)); // Please enter a monster name (usage: @summon <monster name> {duration}).
diff --git a/src/map/battle.c b/src/map/battle.c
index 050f3f26e..94222f663 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -196,7 +196,7 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int
return bl_list[rnd()%c];
}
-int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
+int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) {
struct delay_damage *dat = (struct delay_damage *)data;
if ( dat ) {
@@ -244,7 +244,7 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
return 0;
}
-int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects) {
+int battle_delay_damage(int64 tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects) {
struct delay_damage *dat;
struct status_change *sc;
nullpo_ret(src);
@@ -349,7 +349,7 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
y = sg->val3 & 0xffff;
skill->unitsetting(src,su->group->skill_id,su->group->skill_lv,x,y,1);
sg->val3 = -1;
- sg->limit = DIFF_TICK(timer->gettick(),sg->tick)+300;
+ sg->limit = DIFF_TICK32(timer->gettick(),sg->tick)+300;
}
}
}
@@ -5269,14 +5269,14 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama
status_zap(tbl, rhp, rsp);
}
// Deals the same damage to targets in area. [pakpil]
-int battle_damage_area( struct block_list *bl, va_list ap) {
- unsigned int tick;
+int battle_damage_area(struct block_list *bl, va_list ap) {
+ int64 tick;
int amotion, dmotion, damage;
struct block_list *src;
nullpo_ret(bl);
- tick=va_arg(ap, unsigned int);
+ tick = va_arg(ap, int64);
src=va_arg(ap,struct block_list *);
amotion=va_arg(ap,int);
dmotion=va_arg(ap,int);
@@ -5302,7 +5302,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) {
/*==========================================
* Do a basic physical attack (call trough unit_attack_timer)
*------------------------------------------*/
-enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, unsigned int tick, int flag) {
+enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, int64 tick, int flag) {
struct map_session_data *sd = NULL, *tsd = NULL;
struct status_data *sstatus, *tstatus;
struct status_change *sc, *tsc;
@@ -6617,7 +6617,7 @@ void Hercules_report(char* date, char *time_c) {
#undef BFLAG_LENGTH
}
-static int Hercules_report_timer(int tid, unsigned int tick, int id, intptr_t data) {
+static int Hercules_report_timer(int tid, int64 tick, int id, intptr_t data) {
if( chrif->isconnected() ) {/* char server relays it, so it must be online. */
Hercules_report(__DATE__,__TIME__);
}
@@ -6761,7 +6761,7 @@ int battle_config_read(const char* cfgName)
void do_init_battle(void) {
battle->delay_damage_ers = ers_new(sizeof(struct delay_damage),"battle.c::delay_damage_ers",ERS_OPT_CLEAR);
- timer->add_func_list(battle_delay_damage_sub, "battle_delay_damage_sub");
+ timer->add_func_list(battle->delay_damage_sub, "battle_delay_damage_sub");
#ifndef STATS_OPT_OUT
timer->add_func_list(Hercules_report_timer, "Hercules_report_timer");
diff --git a/src/map/battle.h b/src/map/battle.h
index a2212a647..bf08ab8d6 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -518,11 +518,11 @@ struct battle_interface {
/* battlegrounds final damage calculation */
int64 (*calc_bg_damage) (struct block_list *src, struct block_list *bl, int64 damage, int div_, uint16 skill_id, uint16 skill_lv, int flag);
/* normal weapon attack */
- enum damage_lv (*weapon_attack) (struct block_list *bl, struct block_list *target, unsigned int tick, int flag);
+ enum damage_lv (*weapon_attack) (struct block_list *bl, struct block_list *target, int64 tick, int flag);
/* calculate weapon attack */
struct Damage (*calc_weapon_attack) (struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag);
/* delays damage or skills by a timer */
- int (*delay_damage) (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects);
+ int (*delay_damage) (int64 tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects);
/* drain damage */
void (*drain) (struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss);
/* damage return/reflect */
@@ -566,7 +566,7 @@ struct battle_interface {
int (*get_targeted_sub) (struct block_list *bl, va_list ap);
int (*get_enemy_sub) (struct block_list *bl, va_list ap);
int (*get_enemy_area_sub) (struct block_list *bl, va_list ap);
- int (*delay_damage_sub) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*delay_damage_sub) (int tid, int64 tick, int id, intptr_t data);
int (*blewcount_bonus) (struct map_session_data *sd, uint16 skill_id);
/* skill range criteria */
int (*range_type) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv);
@@ -587,7 +587,7 @@ struct battle_interface {
/* picks a random enemy within the specified range */
struct block_list* (*get_enemy_area) (struct block_list *src, int x, int y, int range, int type, int ignore_id);
/* damages area, originally for royal guard's reflect damage */
- int (*damage_area) ( struct block_list *bl, va_list ap);
+ int (*damage_area) (struct block_list *bl, va_list ap);
};
struct battle_interface *battle;
diff --git a/src/map/battleground.c b/src/map/battleground.c
index e7fe4085b..62688659e 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -249,7 +249,7 @@ int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) {
return 0;
}
-int bg_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int bg_send_xy_timer(int tid, int64 tick, int id, intptr_t data) {
bg->team_db->foreach(bg->team_db, bg->send_xy_timer_sub, tick);
return 0;
}
@@ -534,7 +534,7 @@ void bg_begin(struct bg_arena *arena) {
/* currently running only on solo mode so we do it evenly */
}
}
-int bg_begin_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int bg_begin_timer(int tid, int64 tick, int id, intptr_t data) {
bg->begin(bg->arena[id]);
bg->arena[id]->begin_timer = INVALID_TIMER;
return 0;
@@ -553,7 +553,7 @@ void bg_queue_pregame(struct bg_arena *arena) {
}
arena->begin_timer = timer->add( timer->gettick() + (arena->pregame_duration*1000), bg->begin_timer, arena->id, 0 );
}
-int bg_fillup_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int bg_fillup_timer(int tid, int64 tick, int id, intptr_t data) {
bg->queue_pregame(bg->arena[id]);
bg->arena[id]->fillup_timer = INVALID_TIMER;
return 0;
diff --git a/src/map/battleground.h b/src/map/battleground.h
index 1c224e1c2..a5e540924 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -84,9 +84,9 @@ struct battleground_interface {
int (*id2pos) (int queue_id, int account_id);
void (*queue_pc_cleanup) (struct map_session_data *sd);
void (*begin) (struct bg_arena *arena);
- int (*begin_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*begin_timer) (int tid, int64 tick, int id, intptr_t data);
void (*queue_pregame) (struct bg_arena *arena);
- int (*fillup_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*fillup_timer) (int tid, int64 tick, int id, intptr_t data);
void (*queue_ready_ack) (struct bg_arena *arena, struct map_session_data *sd, bool response);
void (*match_over) (struct bg_arena *arena, bool canceled);
void (*queue_check) (struct bg_arena *arena);
@@ -102,7 +102,7 @@ struct battleground_interface {
int (*team_get_id) (struct block_list *bl);
int (*send_message) (struct map_session_data *sd, const char *mes, int len);
int (*send_xy_timer_sub) (DBKey key, DBData *data, va_list ap);
- int (*send_xy_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data);
/* */
void (*config_read) (void);
};
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 5308eada9..4efc5bce4 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -682,7 +682,7 @@ int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) {
return 0;
}
-int auth_db_cleanup(int tid, unsigned int tick, int id, intptr_t data) {
+int auth_db_cleanup(int tid, int64 tick, int id, intptr_t data) {
chrif_check(0);
chrif->auth_db->foreach(chrif->auth_db, chrif->auth_db_cleanup_sub);
return 0;
@@ -1139,7 +1139,7 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
#ifdef ENABLE_SC_SAVING
int i, count=0;
- unsigned int tick;
+ int64 tick;
struct status_change_data data;
struct status_change *sc = &sd->sc;
const struct TimerData *td;
@@ -1159,7 +1159,7 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
td = timer->get(sc->data[i]->timer);
if (td == NULL || td->func != status->change_timer || DIFF_TICK(td->tick,tick) < 0)
continue;
- data.tick = DIFF_TICK(td->tick,tick); //Duration that is left before ending.
+ data.tick = DIFF_TICK32(td->tick,tick); //Duration that is left before ending.
} else
data.tick = -1; //Infinite duration
data.type = i;
@@ -1462,7 +1462,7 @@ int chrif_parse(int fd) {
return 0;
}
-int send_usercount_tochar(int tid, unsigned int tick, int id, intptr_t data) {
+int send_usercount_tochar(int tid, int64 tick, int id, intptr_t data) {
chrif_check(-1);
WFIFOHEAD(chrif->fd,4);
@@ -1509,7 +1509,7 @@ int send_users_tochar(void) {
* timerFunction
* Chk the connection to char server, (if it down)
*------------------------------------------*/
-int check_connect_char_server(int tid, unsigned int tick, int id, intptr_t data) {
+int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) {
static int displayed = 0;
if ( chrif->fd <= 0 || session[chrif->fd] == NULL ) {
if ( !displayed ) {
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 0617a6702..9df4b9931 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -30,11 +30,11 @@ enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE };
struct auth_node {
int account_id, char_id;
int login_id1, login_id2, sex, fd;
- time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
- struct map_session_data *sd; //Data from logged on char.
- struct mmo_charstatus *char_dat; //Data from char server.
- unsigned int node_created; //timestamp for node timeouts
- enum sd_state state; //To track whether player was login in/out or changing maps.
+ time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
+ struct map_session_data *sd; //Data from logged on char.
+ struct mmo_charstatus *char_dat; //Data from char server.
+ int64 node_created; //timestamp for node timeouts
+ enum sd_state state; //To track whether player was login in/out or changing maps.
};
/*=====================================
@@ -109,15 +109,15 @@ struct chrif_interface {
void (*skillid2idx) (int fd);
bool (*sd_to_auth) (TBL_PC* sd, enum sd_state state);
- int (*check_connect_char_server) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*check_connect_char_server) (int tid, int64 tick, int id, intptr_t data);
bool (*auth_logout) (TBL_PC* sd, enum sd_state state);
void (*save_ack) (int fd);
int (*reconnect) (DBKey key, DBData *data, va_list ap);
int (*auth_db_cleanup_sub) (DBKey key, DBData *data, va_list ap);
void (*char_ask_name_answer) (int acc, const char* player_name, uint16 type, uint16 answer);
int (*auth_db_final) (DBKey key, DBData *data, va_list ap);
- int (*send_usercount_tochar) (int tid, unsigned int tick, int id, intptr_t data);
- int (*auth_db_cleanup) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*send_usercount_tochar) (int tid, int64 tick, int id, intptr_t data);
+ int (*auth_db_cleanup) (int tid, int64 tick, int id, intptr_t data);
int (*connect) (int fd);
int (*connectack) (int fd);
diff --git a/src/map/clif.c b/src/map/clif.c
index decdfc2ce..9810e2a17 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -595,7 +595,7 @@ void clif_authok(struct map_session_data *sd)
struct packet_authok p;
p.PacketType = authokType;
- p.startTime = timer->gettick();
+ p.startTime = (unsigned int)timer->gettick();
WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); /* do the stupid client math */
p.xSize = p.ySize = 5; /* not-used */
@@ -787,14 +787,13 @@ void clif_clearunit_area(struct block_list* bl, clr_type type)
/// Used to make monsters with player-sprites disappear after dying
/// like normal monsters, because the client does not remove those
/// automatically.
-int clif_clearunit_delayed_sub(int tid, unsigned int tick, int id, intptr_t data) {
+int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) {
struct block_list *bl = (struct block_list *)data;
clif->clearunit_area(bl, (clr_type) id);
ers_free(clif->delay_clearunit_ers,bl);
return 0;
}
-void clif_clearunit_delayed(struct block_list* bl, clr_type type, unsigned int tick)
-{
+void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) {
struct block_list *tbl = ers_alloc(clif->delay_clearunit_ers, struct block_list);
memcpy (tbl, bl, sizeof (struct block_list));
timer->add(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)tbl);
@@ -1156,7 +1155,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
p.head = vd->hair_style;
p.weapon = vd->weapon;
p.accessory = vd->head_bottom;
- p.moveStartTime = timer->gettick();
+ p.moveStartTime = (unsigned int)timer->gettick();
#if PACKETVER < 7
p.shield = vd->shield;
#endif
@@ -1526,7 +1525,7 @@ void clif_walkok(struct map_session_data *sd)
WFIFOHEAD(fd, packet_len(0x87));
WFIFOW(fd,0)=0x87;
- WFIFOL(fd,2)=timer->gettick();
+ WFIFOL(fd,2)=(unsigned int)timer->gettick();
WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8);
WFIFOSET(fd,packet_len(0x87));
}
@@ -1597,7 +1596,7 @@ void clif_move(struct unit_data *ud)
WBUFW(buf,0)=0x86;
WBUFL(buf,2)=bl->id;
WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
- WBUFL(buf,12)=timer->gettick();
+ WBUFL(buf,12)=(unsigned int)timer->gettick();
clif->send(buf, packet_len(0x86), bl, AREA_WOS);
if (disguised(bl)) {
WBUFL(buf,2)=-bl->id;
@@ -1609,7 +1608,7 @@ void clif_move(struct unit_data *ud)
/*==========================================
* Delays the map->quit of a player after they are disconnected. [Skotlex]
*------------------------------------------*/
-int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) {
+int clif_delayquit(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd = NULL;
//Remove player from map server
@@ -4430,8 +4429,7 @@ int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, i
/// 10 = critical hit
/// 11 = lucky dodge
/// 12 = (touch skill?)
-int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int64 in_damage, int div, int type, int64 in_damage2)
-{
+int clif_damage(struct block_list* src, struct block_list* dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, int type, int64 in_damage2) {
unsigned char buf[33];
struct status_change *sc;
int damage,damage2;
@@ -4459,7 +4457,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
WBUFW(buf,0)=cmd;
WBUFL(buf,2)=src->id;
WBUFL(buf,6)=dst->id;
- WBUFL(buf,10)=tick;
+ WBUFL(buf,10)=(uint32)tick;
WBUFL(buf,14)=sdelay;
WBUFL(buf,18)=ddelay;
#if PACKETVER < 20071113
@@ -4516,7 +4514,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic
*------------------------------------------*/
void clif_takeitem(struct block_list* src, struct block_list* dst)
{
- //clif_damage(src,dst,0,0,0,0,0,1,0);
+ //clif->damage(src,dst,0,0,0,0,0,1,0);
unsigned char buf[32];
nullpo_retv(src);
@@ -5097,7 +5095,7 @@ void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_f
/// Skill cooldown display icon (ZC_SKILL_POSTDELAY).
/// 043d <skill ID>.W <tick>.L
-void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick)
+void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration)
{
#if PACKETVER>=20081112
int fd;
@@ -5108,7 +5106,7 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned
WFIFOHEAD(fd,packet_len(0x43d));
WFIFOW(fd,0) = 0x43d;
WFIFOW(fd,2) = skill_id;
- WFIFOL(fd,4) = tick;
+ WFIFOL(fd,4) = duration;
WFIFOSET(fd,packet_len(0x43d));
#endif
}
@@ -5117,7 +5115,7 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned
/// Skill attack effect and damage.
/// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL)
/// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2)
-int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 in_damage,int div,uint16 skill_id,uint16 skill_lv,int type) {
+int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) {
unsigned char buf[64];
struct status_change *sc;
int damage;
@@ -5138,7 +5136,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
WBUFW(buf,2)=skill_id;
WBUFL(buf,4)=src->id;
WBUFL(buf,8)=dst->id;
- WBUFL(buf,12)=tick;
+ WBUFL(buf,12)=(uint32)tick;
WBUFL(buf,16)=sdelay;
WBUFL(buf,20)=ddelay;
if (battle_config.hide_woe_damage && map_flag_gvg2(src->m)) {
@@ -5169,7 +5167,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
WBUFW(buf,2)=skill_id;
WBUFL(buf,4)=src->id;
WBUFL(buf,8)=dst->id;
- WBUFL(buf,12)=tick;
+ WBUFL(buf,12)=(uint32)tick;
WBUFL(buf,16)=sdelay;
WBUFL(buf,20)=ddelay;
if (battle_config.hide_woe_damage && map_flag_gvg2(src->m)) {
@@ -5205,7 +5203,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int
/// Ground skill attack effect and damage (ZC_NOTIFY_SKILL_POSITION).
/// 0115 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <x>.W <y>.W <damage>.W <level>.W <div>.W <type>.B
#if 0
-int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type) {
+int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int damage, int div, uint16 skill_id, uint16 skill_lv, int type) {
unsigned char buf[64];
struct status_change *sc;
@@ -5225,7 +5223,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned in
WBUFW(buf,2)=skill_id;
WBUFL(buf,4)=src->id;
WBUFL(buf,8)=dst->id;
- WBUFL(buf,12)=tick;
+ WBUFL(buf,12)=(uint32)tick;
WBUFL(buf,16)=sdelay;
WBUFL(buf,20)=ddelay;
WBUFW(buf,24)=dst->x;
@@ -5295,8 +5293,7 @@ int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 ski
/// Non-damaging ground skill effect (ZC_NOTIFY_GROUNDSKILL).
/// 0117 <skill id>.W <src id>.L <level>.W <x>.W <y>.W <tick>.L
-void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,int y,int tick)
-{
+void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) {
unsigned char buf[32];
nullpo_retv(src);
@@ -5307,7 +5304,7 @@ void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,i
WBUFW(buf,8)=val;
WBUFW(buf,10)=x;
WBUFW(buf,12)=y;
- WBUFL(buf,14)=tick;
+ WBUFL(buf,14)=(uint32)tick;
if(disguised(src)) {
clif->send(buf,packet_len(0x117),src,AREA_WOS);
WBUFL(buf,4)=-src->id;
@@ -9431,7 +9428,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd,0,0);
clif->send_petstatus(sd);
-// skill->unit_move(&sd->pd->bl,gettick(),1);
+// skill->unit_move(&sd->pd->bl,timer->gettick(),1);
}
}
@@ -9649,12 +9646,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
/// Server's tick (ZC_NOTIFY_TIME).
/// 007f <time>.L
-void clif_notify_time(struct map_session_data* sd, unsigned long time) {
+void clif_notify_time(struct map_session_data* sd, int64 time) {
int fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x7f));
WFIFOW(fd,0) = 0x7f;
- WFIFOL(fd,2) = time;
+ WFIFOL(fd,2) = (uint32)time;
WFIFOSET(fd,packet_len(0x7f));
}
@@ -9750,7 +9747,7 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd)
if( timer->gettick() < sd->progressbar.timeout && sd->st )
sd->st->state = END;
- sd->state.workinprogress = sd->progressbar.npc_id = sd->progressbar.timeout = 0;
+ sd->progressbar.timeout = sd->state.workinprogress = sd->progressbar.npc_id = 0;
npc->scriptcont(sd, npc_id, false);
}
@@ -9863,7 +9860,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
clif->charnameack(fd, bl);
}
-int clif_undisguise_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data * sd;
if( (sd = map->id2sd(id)) ) {
sd->fontcolor_tid = INVALID_TIMER;
@@ -10131,8 +10128,7 @@ void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) {
}
-void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick)
-{
+void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) {
if (pc_isdead(sd)) {
clif->clearunit_area(&sd->bl, CLR_DEAD);
return;
@@ -11254,8 +11250,7 @@ void clif_parse_SkillUp(int fd,struct map_session_data *sd)
pc->skillup(sd,RFIFOW(fd,2));
}
-void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
-{
+void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) {
int lv;
if( !hd )
@@ -11276,8 +11271,7 @@ void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_dat
unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv);
}
-void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
-{
+void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) {
int lv;
if( !hd )
return;
@@ -11297,8 +11291,7 @@ void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_da
unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv);
}
-void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
-{
+void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) {
int lv;
if( !md )
@@ -11319,8 +11312,7 @@ void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_ses
unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv);
}
-void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
-{
+void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) {
int lv;
if( !md )
return;
@@ -11351,7 +11343,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
{
uint16 skill_id, skill_lv;
int tmp, target_id;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]);
skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]);
@@ -11452,7 +11444,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
*------------------------------------------*/
void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo)
{
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) )
return; //Using a target skill on the ground? WRONG.
@@ -15581,7 +15573,7 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag)
unsigned int seconds;
int hours, minutes;
- seconds = DIFF_TICK(timer_data->tick, timer->gettick()) / 1000 + 60;
+ seconds = (unsigned int)(DIFF_TICK(timer_data->tick, timer->gettick()) / 1000 + 60);
hours = seconds / (60 * 60);
seconds = seconds - (60 * 60 * hours);
minutes = seconds / 60;
diff --git a/src/map/clif.h b/src/map/clif.h
index 6d0fc0fc1..d7e0199bc 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -542,7 +542,7 @@ struct clif_interface {
/* unit-related */
void (*clearunit_single) (int id, clr_type type, int fd);
void (*clearunit_area) (struct block_list* bl, clr_type type);
- void (*clearunit_delayed) (struct block_list* bl, clr_type type, unsigned int tick);
+ void (*clearunit_delayed) (struct block_list* bl, clr_type type, int64 tick);
void (*walkok) (struct map_session_data *sd);
void (*move) (struct unit_data *ud);
void (*move2) (struct block_list *bl, struct view_data *vd, struct unit_data *ud);
@@ -556,7 +556,7 @@ struct clif_interface {
void (*skill_setunit) (struct skill_unit *su);
void (*skill_delunit) (struct skill_unit *su);
void (*skillunit_update) (struct block_list* bl);
- int (*clearunit_delayed_sub) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*clearunit_delayed_sub) (int tid, int64 tick, int id, intptr_t data);
void (*set_unit_idle) (struct block_list* bl, struct map_session_data *tsd,enum send_target target);
void (*spawn_unit) (struct block_list* bl, enum send_target target);
void (*spawn_unit2) (struct block_list* bl, enum send_target target);
@@ -600,7 +600,7 @@ struct clif_interface {
void (*scriptclear) (struct map_session_data *sd, int npcid);
/* client-user-interface-related */
void (*viewpoint) (struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color);
- int (*damage) (struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2);
+ int (*damage) (struct block_list* src, struct block_list* dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2);
void (*sitting) (struct block_list* bl);
void (*standing) (struct block_list* bl);
void (*arrow_create_list) (struct map_session_data *sd);
@@ -616,7 +616,7 @@ struct clif_interface {
int (*outsight) (struct block_list *bl,va_list ap);
void (*skillcastcancel) (struct block_list* bl);
void (*skill_fail) (struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype);
- void (*skill_cooldown) (struct map_session_data *sd, uint16 skill_id, unsigned int tick);
+ void (*skill_cooldown) (struct map_session_data *sd, uint16 skill_id, unsigned int duration);
void (*skill_memomessage) (struct map_session_data* sd, int type);
void (*skill_mapinfomessage) (struct map_session_data *sd, int type);
void (*skill_produce_mix_list) (struct map_session_data *sd, int skill_id, int trigger);
@@ -682,7 +682,7 @@ struct clif_interface {
void (*movetoattack) (struct map_session_data *sd,struct block_list *bl);
void (*solved_charname) (int fd, int charid, const char* name);
void (*charnameupdate) (struct map_session_data *ssd);
- int (*delayquit) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*delayquit) (int tid, int64 tick, int id, intptr_t data);
void (*getareachar_pc) (struct map_session_data* sd,struct map_session_data* dstsd);
void (*disconnect_ack) (struct map_session_data* sd, short result);
void (*PVPInfo) (struct map_session_data* sd);
@@ -700,9 +700,9 @@ struct clif_interface {
void (*wedding_effect) (struct block_list *bl);
void (*divorced) (struct map_session_data* sd, const char* name);
void (*callpartner) (struct map_session_data *sd);
- int (*skill_damage) (struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int64 damage,int div,uint16 skill_id,uint16 skill_lv,int type);
+ int (*skill_damage) (struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, uint16 skill_lv, int type);
int (*skill_nodamage) (struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail);
- void (*skill_poseffect) (struct block_list *src,uint16 skill_id,int val,int x,int y,int tick);
+ void (*skill_poseffect) (struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick);
void (*skill_estimation) (struct map_session_data *sd,struct block_list *dst);
void (*skill_warppoint) (struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4);
void (*skillcasting) (struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime);
@@ -960,11 +960,11 @@ struct clif_interface {
void (*adopt_reply) (struct map_session_data *sd, int type);
void (*adopt_request) (struct map_session_data *sd, struct map_session_data *src, int p_id);
void (*readbook) (int fd, int book_id, int page);
- void (*notify_time) (struct map_session_data* sd, unsigned long time);
+ void (*notify_time) (struct map_session_data* sd, int64 time);
void (*user_count) (struct map_session_data* sd, int count);
void (*noask_sub) (struct map_session_data *src, struct map_session_data *target, int type);
void (*bc_ready) (void);
- int (*undisguise_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*undisguise_timer) (int tid, int64 tick, int id, intptr_t data);
/* Hercules Channel System */
void (*chsys_create) (struct hChSysCh *channel, char *name, char *pass, unsigned char color);
void (*chsys_msg) (struct hChSysCh *channel, struct map_session_data *sd, char *msg);
@@ -998,7 +998,7 @@ struct clif_interface {
void (*pEmotion) (int fd, struct map_session_data *sd);
void (*pHowManyConnections) (int fd, struct map_session_data *sd);
void (*pActionRequest) (int fd, struct map_session_data *sd);
- void (*pActionRequest_sub) (struct map_session_data *sd, int action_type, int target_id, unsigned int tick);
+ void (*pActionRequest_sub) (struct map_session_data *sd, int action_type, int target_id, int64 tick);
void (*pRestart) (int fd, struct map_session_data *sd);
void (*pWisMessage) (int fd, struct map_session_data* sd);
void (*pBroadcast) (int fd, struct map_session_data* sd);
@@ -1032,12 +1032,12 @@ struct clif_interface {
void (*pStatusUp) (int fd,struct map_session_data *sd);
void (*pSkillUp) (int fd,struct map_session_data *sd);
void (*pUseSkillToId) (int fd, struct map_session_data *sd);
- void (*pUseSkillToId_homun) (struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id);
- void (*pUseSkillToId_mercenary) (struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id);
+ void (*pUseSkillToId_homun) (struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id);
+ void (*pUseSkillToId_mercenary) (struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id);
void (*pUseSkillToPos) (int fd, struct map_session_data *sd);
void (*pUseSkillToPosSub) (int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo);
- void (*pUseSkillToPos_homun) (struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo);
- void (*pUseSkillToPos_mercenary) (struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo);
+ void (*pUseSkillToPos_homun) (struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo);
+ void (*pUseSkillToPos_mercenary) (struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo);
void (*pUseSkillToPosMoreInfo) (int fd, struct map_session_data *sd);
void (*pUseSkillMap) (int fd, struct map_session_data* sd);
void (*pRequestMemo) (int fd,struct map_session_data *sd);
diff --git a/src/map/elemental.c b/src/map/elemental.c
index 3251ca992..f15b735b2 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -148,7 +148,7 @@ int elemental_get_lifetime(struct elemental_data *ed) {
return 0;
td = timer->get(ed->summon_timer);
- return (td != NULL) ? DIFF_TICK(td->tick, timer->gettick()) : 0;
+ return (td != NULL) ? DIFF_TICK32(td->tick, timer->gettick()) : 0;
}
int elemental_save(struct elemental_data *ed) {
@@ -169,7 +169,7 @@ int elemental_save(struct elemental_data *ed) {
return 1;
}
-int elemental_summon_end_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int elemental_summon_end_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
struct elemental_data *ed;
@@ -388,7 +388,7 @@ int elemental_clean_effect(struct elemental_data *ed) {
return 1;
}
-int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned int tick) {
+int elemental_action(struct elemental_data *ed, struct block_list *bl, int64 tick) {
struct skill_condition req;
uint16 skill_id, skill_lv;
int i;
@@ -636,7 +636,7 @@ int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap) {
return 0;
}
-int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, unsigned int tick) {
+int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, int64 tick) {
struct block_list *target = NULL;
int master_dist, view_range, mode;
@@ -723,7 +723,7 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s
}
if( battle->check_range(&ed->bl,target,view_range) && rnd()%100 < 2 ) { // 2% chance to cast attack skill.
- if( elemental->action(ed,target,tick) )
+ if( elemental->action(ed,target,tick) )
return 1;
}
@@ -746,14 +746,14 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s
}
int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) {
- unsigned int tick = va_arg(ap,unsigned int);
+ int64 tick = va_arg(ap,int64);
if(sd->status.ele_id && sd->ed)
elemental->ai_sub_timer(sd->ed,sd,tick);
return 0;
}
-int elemental_ai_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int elemental_ai_timer(int tid, int64 tick, int id, intptr_t data) {
map->foreachpc(elemental->ai_sub_foreachclient,tick);
return 0;
}
diff --git a/src/map/elemental.h b/src/map/elemental.h
index b42d5c0b7..3cd819d53 100644
--- a/src/map/elemental.h
+++ b/src/map/elemental.h
@@ -57,7 +57,7 @@ struct elemental_data {
int summon_timer;
int skill_timer;
- unsigned last_thinktime, last_linktime, last_spdrain_time;
+ int64 last_thinktime, last_linktime, last_spdrain_time;
short min_chase;
int target_id, attacked_id;
};
@@ -99,7 +99,7 @@ struct elemental_interface {
int (*set_target) (struct map_session_data *sd, struct block_list *bl);
int (*clean_single_effect) (struct elemental_data *ed, uint16 skill_id);
int (*clean_effect) (struct elemental_data *ed);
- int (*action) (struct elemental_data *ed, struct block_list *bl, unsigned int tick);
+ int (*action) (struct elemental_data *ed, struct block_list *bl, int64 tick);
struct skill_condition (*skill_get_requirements) (uint16 skill_id, uint16 skill_lv);
int (*read_skilldb) (void);
@@ -108,11 +108,11 @@ struct elemental_interface {
int (*search_index) (int class_);
void (*summon_init) (struct elemental_data *ed);
- int (*summon_end_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*summon_end_timer) (int tid, int64 tick, int id, intptr_t data);
int (*ai_sub_timer_activesearch) (struct block_list *bl, va_list ap);
- int (*ai_sub_timer) (struct elemental_data *ed, struct map_session_data *sd, unsigned int tick);
+ int (*ai_sub_timer) (struct elemental_data *ed, struct map_session_data *sd, int64 tick);
int (*ai_sub_foreachclient) (struct map_session_data *sd, va_list ap);
- int (*ai_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*ai_timer) (int tid, int64 tick, int id, intptr_t data);
int (*read_db) (void);
};
diff --git a/src/map/guild.c b/src/map/guild.c
index 9b3eaaff8..0ae45bede 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -279,8 +279,7 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
return 0;
}
-int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int guild_payexp_timer(int tid, int64 tick, int id, intptr_t data) {
guild->expcache_db->clear(guild->expcache_db,guild->payexp_timer_sub);
return 0;
}
@@ -314,8 +313,7 @@ int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
}
//Code from party_send_xy_timer [Skotlex]
-int guild_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int guild_send_xy_timer(int tid, int64 tick, int id, intptr_t data) {
guild->db->foreach(guild->db,guild->send_xy_timer_sub,tick);
return 0;
}
diff --git a/src/map/guild.h b/src/map/guild.h
index 566ca7ce4..348a6c7e4 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -148,13 +148,13 @@ struct guild_interface {
/* guild aura */
void (*aura_refresh) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
/* */
- int (*payexp_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*payexp_timer) (int tid, int64 tick, int id, intptr_t data);
TBL_PC* (*sd_check) (int guild_id, int account_id, int char_id);
bool (*read_guildskill_tree_db) (char* split[], int columns, int current);
bool (*read_castledb) (char* str[], int columns, int current);
int (*payexp_timer_sub) (DBKey key, DBData *data, va_list ap);
int (*send_xy_timer_sub) (DBKey key, DBData *data, va_list ap);
- int (*send_xy_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data);
DBData (*create_expcache) (DBKey key, va_list args);
int (*eventlist_db_final) (DBKey key, DBData *data, va_list ap);
int (*expcache_db_final) (DBKey key, DBData *data, va_list ap);
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 1e47053fe..52f0572c0 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -615,7 +615,7 @@ bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) {
return true;
}
-int homunculus_hunger_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
struct homun_data *hd;
diff --git a/src/map/homunculus.h b/src/map/homunculus.h
index 2cb558930..e3ec38f7b 100644
--- a/src/map/homunculus.h
+++ b/src/map/homunculus.h
@@ -117,7 +117,7 @@ struct homunculus_interface {
void (*save) (struct homun_data *hd);
unsigned char (*menu) (struct map_session_data *sd,unsigned char menu_num);
bool (*feed) (struct map_session_data *sd, struct homun_data *hd);
- int (*hunger_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*hunger_timer) (int tid, int64 tick, int id, intptr_t data);
void (*hunger_timer_delete) (struct homun_data *hd);
int (*change_name) (struct map_session_data *sd,char *name);
bool (*change_name_ack) (struct map_session_data *sd, char* name, int flag);
diff --git a/src/map/instance.c b/src/map/instance.c
index 83b538ffc..6b96c3112 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -480,7 +480,7 @@ void instance_del_map(int16 m) {
/*--------------------------------------
* Timer to destroy instance by process or idle
*--------------------------------------*/
-int instance_destroy_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int instance_destroy_timer(int tid, int64 tick, int id, intptr_t data) {
instance->destroy(id);
return 0;
}
diff --git a/src/map/instance.h b/src/map/instance.h
index 449ca42c6..27a9401b4 100644
--- a/src/map/instance.h
+++ b/src/map/instance.h
@@ -70,7 +70,7 @@ struct instance_interface {
void (*check_kick) (struct map_session_data *sd);
void (*set_timeout) (int instance_id, unsigned int progress_timeout, unsigned int idle_timeout);
bool (*valid) (int instance_id);
- int (*destroy_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*destroy_timer) (int tid, int64 tick, int id, intptr_t data);
};
struct instance_interface *instance;
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index 5225672af..f67446629 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -29,7 +29,7 @@ char send_string[IRC_MESSAGE_LENGTH];
* Timer callback to (re-)connect to an IRC server
* @see timer->do_timer
*/
-int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) {
struct hSockOpt opt;
if( ircbot->isOn || ++ircbot->fails >= 3 )
return 0;
@@ -52,7 +52,7 @@ int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) {
* Timer callback to send identification commands to an IRC server
* @see timer->do_timer
*/
-int irc_identify_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) {
if( !ircbot->isOn )
return 0;
@@ -70,7 +70,7 @@ int irc_identify_timer(int tid, unsigned int tick, int id, intptr_t data) {
* Timer callback to join channels (and optionally send NickServ commands)
* @see timer->do_timer
*/
-int irc_join_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int irc_join_timer(int tid, int64 tick, int id, intptr_t data) {
if( !ircbot->isOn )
return 0;
diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h
index aafbfccde..52ff0c9be 100644
--- a/src/map/irc-bot.h
+++ b/src/map/irc-bot.h
@@ -22,7 +22,7 @@ struct irc_func {
struct irc_bot_interface {
int fd;
bool isIn, isOn;
- unsigned int last_try;
+ int64 last_try;
unsigned char fails;
unsigned long ip;
unsigned short port;
@@ -43,9 +43,9 @@ struct irc_bot_interface {
/* */
struct irc_func* (*func_search) (char* function_name);
/* */
- int (*connect_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*identify_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*join_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*connect_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*identify_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*join_timer) (int tid, int64 tick, int id, intptr_t data);
/* */
void (*send)(char *str);
void (*relay) (char *name, const char *msg);
diff --git a/src/map/map.c b/src/map/map.c
index 81bd732df..b50297ca6 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -134,7 +134,7 @@ int map_freeblock_unlock (void) {
// Timer function to check if there some remaining lock and remove them if so.
// Called each 1s
-int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int map_freeblock_timer(int tid, int64 tick, int id, intptr_t data) {
if (map->block_free_lock > 0) {
ShowError("map_freeblock_timer: block_free_lock(%d) is invalid.\n", map->block_free_lock);
map->block_free_lock = 1;
@@ -266,8 +266,7 @@ int map_delblock(struct block_list* bl)
* Pass flag as 1 to prevent doing skill->unit_move checks
* (which are executed by default on BL_CHAR types)
*------------------------------------------*/
-int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
-{
+int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) {
int x0 = bl->x, y0 = bl->y;
struct status_change *sc = NULL;
int moveblock = ( x0/BLOCK_SIZE != x1/BLOCK_SIZE || y0/BLOCK_SIZE != y1/BLOCK_SIZE);
@@ -1312,7 +1311,7 @@ int map_get_new_object_id(void)
* Timered function to clear the floor (remove remaining item)
* Called each flooritem_lifetime ms
*------------------------------------------*/
-int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int map_clearflooritem_timer(int tid, int64 tick, int id, intptr_t data) {
struct flooritem_data* fitem = (struct flooritem_data*)idb_get(map->id_db, id);
if (fitem == NULL || fitem->bl.type != BL_ITEM || (fitem->cleartimer != tid)) {
@@ -2296,8 +2295,7 @@ int map_removemobs_sub(struct block_list *bl, va_list ap)
return 1;
}
-int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int map_removemobs_timer(int tid, int64 tick, int id, intptr_t data) {
int count;
const int16 m = id;
diff --git a/src/map/map.h b/src/map/map.h
index 6e4878dfd..c8b043acb 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -339,7 +339,7 @@ struct flooritem_data {
unsigned char subx,suby;
int cleartimer;
int first_get_charid,second_get_charid,third_get_charid;
- unsigned int first_get_tick,second_get_tick,third_get_tick;
+ int64 first_get_tick,second_get_tick,third_get_tick;
struct item item_data;
};
@@ -900,7 +900,7 @@ struct map_interface {
// blocklist manipulation
int (*addblock) (struct block_list* bl);
int (*delblock) (struct block_list* bl);
- int (*moveblock) (struct block_list *bl, int x1, int y1, unsigned int tick);
+ int (*moveblock) (struct block_list *bl, int x1, int y1, int64 tick);
//blocklist nb in one cell
int (*count_oncell) (int16 m,int16 x,int16 y,int type);
struct skill_unit * (*find_skill_unit_oncell) (struct block_list* target,int16 x,int16 y,uint16 skill_id,struct skill_unit* out_unit, int flag);
@@ -912,8 +912,8 @@ struct map_interface {
// npc
bool (*addnpc) (int16 m,struct npc_data *nd);
// map item
- int (*clearflooritem_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*removemobs_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*clearflooritem_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*removemobs_timer) (int tid, int64 tick, int id, intptr_t data);
void (*clearflooritem) (struct block_list* bl);
int (*addflooritem) (struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags);
// player to map session
@@ -1001,7 +1001,7 @@ struct map_interface {
void (*do_shutdown) (void);
- int (*freeblock_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*freeblock_timer) (int tid, int64 tick, int id, intptr_t data);
int (*searchrandfreecell) (int16 m, int16 *x, int16 *y, int stack);
int (*count_sub) (struct block_list *bl, va_list ap);
DBData (*create_charid2nick) (DBKey key, va_list args);
diff --git a/src/map/mapreg.h b/src/map/mapreg.h
index 3c1d0ba0e..c8f229cef 100644
--- a/src/map/mapreg.h
+++ b/src/map/mapreg.h
@@ -34,7 +34,7 @@ struct mapreg_interface {
bool (*setregstr) (int uid, const char *str);
void (*load) (void);
void (*save) (void);
- int (*save_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*save_timer) (int tid, int64 tick, int id, intptr_t data);
void (*reload) (void);
bool (*config_read) (const char *w1, const char *w2);
};
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index 902b7c39b..c94e42d5d 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -228,7 +228,7 @@ void script_save_mapreg(void) {
}
}
-int script_autosave_mapreg(int tid, unsigned int tick, int id, intptr_t data) {
+int script_autosave_mapreg(int tid, int64 tick, int id, intptr_t data) {
mapreg->save();
return 0;
}
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 8b8353f46..8c74a5e1e 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -94,7 +94,7 @@ int mercenary_get_lifetime(struct mercenary_data *md)
return 0;
td = timer->get(md->contract_timer);
- return (td != NULL) ? DIFF_TICK(td->tick, timer->gettick()) : 0;
+ return (td != NULL) ? DIFF_TICK32(td->tick, timer->gettick()) : 0;
}
int mercenary_get_guild(struct mercenary_data *md)
@@ -217,7 +217,7 @@ int mercenary_save(struct mercenary_data *md)
return 1;
}
-int merc_contract_end_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int merc_contract_end_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
struct mercenary_data *md;
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index 47f37ac66..3245606cf 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -43,7 +43,7 @@ struct mercenary_data {
int contract_timer;
unsigned devotion_flag : 1;
- unsigned int masterteleport_timer;
+ int64 masterteleport_timer;
};
/*=====================================
@@ -89,7 +89,7 @@ struct mercenary_interface {
int (*killbonus) (struct mercenary_data *md);
int (*search_index) (int class_);
- int (*contract_end_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*contract_end_timer) (int tid, int64 tick, int id, intptr_t data);
bool (*read_db_sub) (char* str[], int columns, int current);
bool (*read_skill_db_sub) (char* str[], int columns, int current);
};
diff --git a/src/map/mob.c b/src/map/mob.c
index 7023bcb9d..97f8ea6c1 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -332,8 +332,7 @@ int mob_get_random_id(int type, int flag, int lv)
/*==========================================
* Kill Steal Protection [Zephyrus]
*------------------------------------------*/
-bool mob_ksprotected (struct block_list *src, struct block_list *target)
-{
+bool mob_ksprotected(struct block_list *src, struct block_list *target) {
struct block_list *s_bl, *t_bl;
struct map_session_data
*sd, // Source
@@ -341,7 +340,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
*t_sd; // Mob Target
struct status_change_entry *sce;
struct mob_data *md;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
char output[128];
if( !battle_config.ksprotection )
@@ -559,8 +558,8 @@ int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0
/*==========================================
* Set a Guardian's guild data [Skotlex]
*------------------------------------------*/
-int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr_t data)
-{ //Needed because the guild_data may not be available at guardian spawn time.
+int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) {
+ //Needed because the guild_data may not be available at guardian spawn time.
struct block_list* bl = map->id2bl(id);
struct mob_data* md;
struct guild* g;
@@ -779,18 +778,17 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range, int state
/*==========================================
* Links nearby mobs (supportive mobs)
*------------------------------------------*/
-int mob_linksearch(struct block_list *bl,va_list ap)
-{
+int mob_linksearch(struct block_list *bl,va_list ap) {
struct mob_data *md;
int class_;
struct block_list *target;
- unsigned int tick;
+ int64 tick;
nullpo_ret(bl);
md=(struct mob_data *)bl;
class_ = va_arg(ap, int);
target = va_arg(ap, struct block_list *);
- tick=va_arg(ap, unsigned int);
+ tick = va_arg(ap, int64);
if (md->class_ == class_ && DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME
&& !md->target_id)
@@ -809,7 +807,7 @@ int mob_linksearch(struct block_list *bl,va_list ap)
/*==========================================
* mob spawn with delay (timer function)
*------------------------------------------*/
-int mob_delayspawn(int tid, unsigned int tick, int id, intptr_t data) {
+int mob_delayspawn(int tid, int64 tick, int id, intptr_t data) {
struct block_list* bl = map->id2bl(id);
struct mob_data* md = BL_CAST(BL_MOB, bl);
@@ -884,8 +882,8 @@ int mob_count_sub(struct block_list *bl, va_list ap) {
int mob_spawn (struct mob_data *md)
{
int i=0;
- unsigned int tick = timer->gettick();
- int c =0;
+ int64 tick = timer->gettick();
+ int64 c = 0;
md->last_thinktime = tick;
if (md->bl.prev != NULL)
@@ -1185,7 +1183,7 @@ int mob_warpchase_sub(struct block_list *bl,va_list ap) {
/*==========================================
* Processing of slave monsters
*------------------------------------------*/
-int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) {
+int mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) {
struct block_list *bl;
bl=map->id2bl(md->master_id);
@@ -1268,8 +1266,7 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) {
* when trying to pick new targets when the current chosen target is
* unreachable.
*------------------------------------------*/
-int mob_unlocktarget(struct mob_data *md, unsigned int tick)
-{
+int mob_unlocktarget(struct mob_data *md, int64 tick) {
nullpo_ret(md);
switch (md->state.skillstate) {
@@ -1308,8 +1305,7 @@ int mob_unlocktarget(struct mob_data *md, unsigned int tick)
/*==========================================
* Random walk
*------------------------------------------*/
-int mob_randomwalk(struct mob_data *md,unsigned int tick)
-{
+int mob_randomwalk(struct mob_data *md, int64 tick) {
const int retrycount=20;
int i,x,y,c,d;
int speed;
@@ -1383,8 +1379,7 @@ int mob_warpchase(struct mob_data *md, struct block_list *target)
/*==========================================
* AI of MOB whose is near a Player
*------------------------------------------*/
-bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
-{
+bool mob_ai_sub_hard(struct mob_data *md, int64 tick) {
struct block_list *tbl = NULL, *abl = NULL;
int mode;
int view_range, can_move;
@@ -1645,10 +1640,9 @@ bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
return true;
}
-int mob_ai_sub_hard_timer(struct block_list *bl,va_list ap)
-{
+int mob_ai_sub_hard_timer(struct block_list *bl, va_list ap) {
struct mob_data *md = (struct mob_data*)bl;
- unsigned int tick = va_arg(ap, unsigned int);
+ int64 tick = va_arg(ap, int64);
if (mob->ai_sub_hard(md, tick))
{ //Hard AI triggered.
if(!md->state.spotted)
@@ -1661,9 +1655,9 @@ int mob_ai_sub_hard_timer(struct block_list *bl,va_list ap)
/*==========================================
* Serious processing for mob in PC field of view (foreachclient)
*------------------------------------------*/
-int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) {
- unsigned int tick;
- tick=va_arg(ap,unsigned int);
+int mob_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) {
+ int64 tick;
+ tick=va_arg(ap, int64);
map->foreachinrange(mob->ai_sub_hard_timer,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB,tick);
return 0;
@@ -1672,16 +1666,15 @@ int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) {
/*==========================================
* Negligent mode MOB AI (PC is not in near)
*------------------------------------------*/
-int mob_ai_sub_lazy(struct mob_data *md, va_list args)
-{
- unsigned int tick;
+int mob_ai_sub_lazy(struct mob_data *md, va_list args) {
+ int64 tick;
nullpo_ret(md);
if(md->bl.prev == NULL)
return 0;
- tick = va_arg(args,unsigned int);
+ tick = va_arg(args, int64);
if (battle_config.mob_ai&0x20 && map->list[md->bl.m].users>0)
return (int)mob->ai_sub_hard(md, tick);
@@ -1715,7 +1708,7 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args)
md->last_thinktime=tick;
if (md->master_id) {
- mob->ai_sub_hard_slavemob (md,tick);
+ mob->ai_sub_hard_slavemob(md,tick);
return 0;
}
@@ -1740,7 +1733,7 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args)
/*==========================================
* Negligent processing for mob outside PC field of view (interval timer function)
*------------------------------------------*/
-int mob_ai_lazy(int tid, unsigned int tick, int id, intptr_t data) {
+int mob_ai_lazy(int tid, int64 tick, int id, intptr_t data) {
map->foreachmob(mob->ai_sub_lazy,tick);
return 0;
}
@@ -1748,7 +1741,7 @@ int mob_ai_lazy(int tid, unsigned int tick, int id, intptr_t data) {
/*==========================================
* Serious processing for mob in PC field of view (interval timer function)
*------------------------------------------*/
-int mob_ai_hard(int tid, unsigned int tick, int id, intptr_t data) {
+int mob_ai_hard(int tid, int64 tick, int id, intptr_t data) {
if (battle_config.mob_ai&0x20)
map->foreachmob(mob->ai_sub_lazy,tick);
@@ -1785,8 +1778,7 @@ struct item_drop* mob_setlootitem(struct item* item)
/*==========================================
* item drop with delay (timer function)
*------------------------------------------*/
-int mob_delay_item_drop(int tid, unsigned int tick, int id, intptr_t data)
-{
+int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data) {
struct item_drop_list *list;
struct item_drop *ditem, *ditem_prev;
list=(struct item_drop_list *)data;
@@ -1840,7 +1832,7 @@ void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct ite
dlist->item = ditem;
}
-int mob_timer_delete(int tid, unsigned int tick, int id, intptr_t data) {
+int mob_timer_delete(int tid, int64 tick, int id, intptr_t data) {
struct block_list* bl = map->id2bl(id);
struct mob_data* md = BL_CAST(BL_MOB, bl);
@@ -1885,7 +1877,7 @@ int mob_deleteslave(struct mob_data *md) {
return 0;
}
// Mob respawning through KAIZEL or NPC_REBIRTH [Skotlex]
-int mob_respawn(int tid, unsigned int tick, int id, intptr_t data) {
+int mob_respawn(int tid, int64 tick, int id, intptr_t data) {
struct block_list *bl = map->id2bl(id);
if(!bl) return 0;
@@ -2069,7 +2061,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
} pt[DAMAGELOG_SIZE];
int i, temp, count, m = md->bl.m, pnum = 0;
int dmgbltypes = 0; // bitfield of all bl types, that caused damage to the mob and are elligible for exp distribution
- unsigned int mvp_damage, tick = timer->gettick();
+ unsigned int mvp_damage;
+ int64 tick = timer->gettick();
bool rebirth, homkillonly;
mstatus = &md->status;
@@ -2610,7 +2603,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
void mob_revive(struct mob_data *md, unsigned int hp)
{
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
md->state.skillstate = MSS_IDLE;
md->last_thinktime = tick;
md->next_walktime = tick+rnd()%50+5000;
@@ -2695,8 +2688,8 @@ int mob_random_class (int *value, size_t count)
*------------------------------------------*/
int mob_class_change (struct mob_data *md, int class_)
{
- unsigned int tick = timer->gettick();
- int i, c, hp_rate;
+ int64 tick = timer->gettick(), c = 0;
+ int i, hp_rate;
nullpo_ret(md);
@@ -3032,8 +3025,7 @@ struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2) {
/*==========================================
* Skill use judging
*------------------------------------------*/
-int mobskill_use(struct mob_data *md, unsigned int tick, int event)
-{
+int mobskill_use(struct mob_data *md, int64 tick, int event) {
struct mob_skill *ms;
struct block_list *fbl = NULL; //Friend bl, which can either be a BL_PC or BL_MOB depending on the situation. [Skotlex]
struct block_list *bl;
@@ -3249,8 +3241,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
/*==========================================
* Skill use event processing
*------------------------------------------*/
-int mobskill_event(struct mob_data *md, struct block_list *src, unsigned int tick, int flag)
-{
+int mobskill_event(struct mob_data *md, struct block_list *src, int64 tick, int flag) {
int target_id, res = 0;
if(md->bl.prev == NULL || md->status.hp <= 0)
@@ -3487,7 +3478,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
{
if( md->deletetimer != INVALID_TIMER )
timer->delete(md->deletetimer, mob->timer_delete);
- md->deletetimer = timer->add (timer->gettick() + duration, mob->timer_delete, md->bl.id, 0);
+ md->deletetimer = timer->add(timer->gettick() + duration, mob->timer_delete, md->bl.id, 0);
}
}
diff --git a/src/map/mob.h b/src/map/mob.h
index 210983675..2f425e285 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -166,7 +166,7 @@ struct mob_data {
int areanpc_id; //Required in OnTouchNPC (to avoid multiple area touchs)
unsigned int bg_id; // BattleGround System
- unsigned int next_walktime,last_thinktime,last_linktime,last_pcneartime,dmgtick;
+ int64 next_walktime, last_thinktime, last_linktime, last_pcneartime, dmgtick;
short move_fail_count;
short lootitem_count;
short min_chase;
@@ -175,7 +175,7 @@ struct mob_data {
int master_id,master_dist;
int8 skill_idx;// key of array
- unsigned int skilldelay[MAX_MOBSKILL];
+ int64 skilldelay[MAX_MOBSKILL];
char npc_event[EVENT_NAME_LENGTH];
/**
* Did this monster summon something?
@@ -266,7 +266,7 @@ struct mob_interface {
struct mob_db* (*db) (int index);
struct mob_chat* (*chat) (short id);
int (*makedummymobdb) (int);
- int (*spawn_guardian_sub) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*spawn_guardian_sub) (int tid, int64 tick, int id, intptr_t data);
int (*skill_id2skill_idx) (int class_, uint16 skill_id);
int (*db_searchname) (const char *str);
int (*db_searchname_array_sub) (struct mob_db *mob, const char *str, int flag);
@@ -287,7 +287,7 @@ struct mob_interface {
int (*spawn_bg) (const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id);
int (*can_reach) (struct mob_data *md, struct block_list *bl, int range, int state);
int (*linksearch) (struct block_list *bl, va_list ap);
- int (*delayspawn) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*delayspawn) (int tid, int64 tick, int id, intptr_t data);
int (*setdelayspawn) (struct mob_data *md);
int (*count_sub) (struct block_list *bl, va_list ap);
int (*spawn) (struct mob_data *md);
@@ -298,24 +298,24 @@ struct mob_interface {
int (*ai_sub_hard_bg_ally) (struct block_list *bl, va_list ap);
int (*ai_sub_hard_lootsearch) (struct block_list *bl, va_list ap);
int (*warpchase_sub) (struct block_list *bl, va_list ap);
- int (*ai_sub_hard_slavemob) (struct mob_data *md, unsigned int tick);
- int (*unlocktarget) (struct mob_data *md, unsigned int tick);
- int (*randomwalk) (struct mob_data *md, unsigned int tick);
+ int (*ai_sub_hard_slavemob) (struct mob_data *md, int64 tick);
+ int (*unlocktarget) (struct mob_data *md, int64 tick);
+ int (*randomwalk) (struct mob_data *md, int64 tick);
int (*warpchase) (struct mob_data *md, struct block_list *target);
- bool (*ai_sub_hard) (struct mob_data *md, unsigned int tick);
+ bool (*ai_sub_hard) (struct mob_data *md, int64 tick);
int (*ai_sub_hard_timer) (struct block_list *bl, va_list ap);
int (*ai_sub_foreachclient) (struct map_session_data *sd, va_list ap);
int (*ai_sub_lazy) (struct mob_data *md, va_list args);
- int (*ai_lazy) (int tid, unsigned int tick, int id, intptr_t data);
- int (*ai_hard) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*ai_lazy) (int tid, int64 tick, int id, intptr_t data);
+ int (*ai_hard) (int tid, int64 tick, int id, intptr_t data);
struct item_drop* (*setdropitem) (int nameid, int qty, struct item_data *data);
struct item_drop* (*setlootitem) (struct item *item);
- int (*delay_item_drop) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*delay_item_drop) (int tid, int64 tick, int id, intptr_t data);
void (*item_drop) (struct mob_data *md, struct item_drop_list *dlist, struct item_drop *ditem, int loot, int drop_rate, unsigned short flag);
- int (*timer_delete) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*timer_delete) (int tid, int64 tick, int id, intptr_t data);
int (*deleteslave_sub) (struct block_list *bl, va_list ap);
int (*deleteslave) (struct mob_data *md);
- int (*respawn) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*respawn) (int tid, int64 tick, int id, intptr_t data);
void (*log_damage) (struct mob_data *md, struct block_list *src, int damage);
void (*damage) (struct mob_data *md, struct block_list *src, int damage);
int (*dead) (struct mob_data *md, struct block_list *src, int type);
@@ -334,8 +334,8 @@ struct mob_interface {
struct block_list* (*getmasterhpltmaxrate) (struct mob_data *md, int rate);
int (*getfriendstatus_sub) (struct block_list *bl, va_list ap);
struct mob_data* (*getfriendstatus) (struct mob_data *md, int cond1, int cond2);
- int (*skill_use) (struct mob_data *md, unsigned int tick, int event);
- int (*skill_event) (struct mob_data *md, struct block_list *src, unsigned int tick, int flag);
+ int (*skill_use) (struct mob_data *md, int64 tick, int event);
+ int (*skill_event) (struct mob_data *md, struct block_list *src, int64 tick, int flag);
int (*is_clone) (int class_);
int (*clone_spawn) (struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, int mode, int flag, unsigned int duration);
int (*clone_delete) (struct mob_data *md);
diff --git a/src/map/npc.c b/src/map/npc.c
index e4416c19f..ff95cf82d 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -215,7 +215,7 @@ struct npc_data* npc_name2id(const char* name)
/**
* Timer to check for idle time and timeout the dialog if necessary
**/
-int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int npc_rr_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) {
#ifdef SECURE_NPCTIMEOUT
struct map_session_data* sd = NULL;
unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT;
@@ -394,8 +394,7 @@ int npc_event_doall(const char* name)
* Clock event execution
* OnMinute/OnClock/OnHour/OnDay/OnDDHHMM
*------------------------------------------*/
-int npc_event_do_clock(int tid, unsigned int tick, int id, intptr_t data)
-{
+int npc_event_do_clock(int tid, int64 tick, int id, intptr_t data) {
static struct tm ev_tm_b; // tracks previous execution time
time_t clock;
struct tm* t;
@@ -493,9 +492,9 @@ struct timer_event_data {
/*==========================================
* triger 'OnTimerXXXX' events
*------------------------------------------*/
-int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data) {
+int npc_timerevent(int tid, int64 tick, int id, intptr_t data) {
int old_rid, old_timer;
- unsigned int old_tick;
+ int64 old_tick;
struct npc_data* nd=(struct npc_data *)map->id2bl(id);
struct npc_timerevent_list *te;
struct timer_event_data *ted = (struct timer_event_data*)data;
@@ -529,8 +528,7 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data) {
ted->next++;
if( nd->u.scr.timeramount > ted->next )
{
- int next;
- next = nd->u.scr.timer_event[ ted->next ].timer - nd->u.scr.timer_event[ ted->next - 1 ].timer;
+ int next = nd->u.scr.timer_event[ ted->next ].timer - nd->u.scr.timer_event[ ted->next - 1 ].timer;
ted->time += next;
if( sd )
sd->npc_timer_id = timer->add(tick+next,npc->timerevent,id,(intptr_t)ted);
@@ -564,7 +562,7 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data) {
*------------------------------------------*/
int npc_timerevent_start(struct npc_data* nd, int rid) {
int j;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
struct map_session_data *sd = NULL; //Player to whom script is attached.
nullpo_ret(nd);
@@ -642,7 +640,7 @@ int npc_timerevent_stop(struct npc_data* nd)
if( !sd && nd->u.scr.timertick )
{
- nd->u.scr.timer += DIFF_TICK(timer->gettick(),nd->u.scr.timertick); // Set 'timer' to the time that has passed since the beginning of the timers
+ nd->u.scr.timer += DIFF_TICK32(timer->gettick(),nd->u.scr.timertick); // Set 'timer' to the time that has passed since the beginning of the timers
nd->u.scr.timertick = 0; // Set 'tick' to zero so that we know it's off.
}
@@ -688,7 +686,7 @@ void npc_timerevent_quit(struct map_session_data* sd)
if( ev )
{
int old_rid,old_timer;
- unsigned int old_tick;
+ int64 old_tick;
//Set timer related info.
old_rid = (nd->u.scr.rid == sd->bl.id ? 0 : nd->u.scr.rid); // Detach rid if the last attached player logged off.
@@ -715,9 +713,8 @@ void npc_timerevent_quit(struct map_session_data* sd)
* Get the tick value of an NPC timer
* If it's stopped, return stopped time
*------------------------------------------*/
-int npc_gettimerevent_tick(struct npc_data* nd)
-{
- int tick;
+int64 npc_gettimerevent_tick(struct npc_data* nd) {
+ int64 tick;
nullpo_ret(nd);
// TODO: Get player attached timer's tick. Now we can just get it by using 'getnpctimer' inside OnTimer event.
diff --git a/src/map/npc.h b/src/map/npc.h
index f809cb19c..e1ec6e5e4 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -35,7 +35,7 @@ struct npc_data {
char exname[NAME_LENGTH+1];// unique npc name
int chat_id;
int touching_id;
- unsigned int next_walktime;
+ int64 next_walktime;
uint8 dir;
unsigned size : 2;
@@ -54,7 +54,7 @@ struct npc_data {
short xs,ys; // OnTouch area radius
int guild_id;
int timer,timerid,timeramount,rid;
- unsigned int timertick;
+ int64 timertick;
struct npc_timerevent_list *timer_event;
int label_list_num;
struct npc_label_list *label_list;
@@ -160,14 +160,14 @@ struct npc_interface {
int (*event_do) (const char *name);
int (*event_doall_id) (const char *name, int rid);
int (*event_doall) (const char *name);
- int (*event_do_clock) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*event_do_clock) (int tid, int64 tick, int id, intptr_t data);
void (*event_do_oninit) (void);
int (*timerevent_export) (struct npc_data *nd, int i);
- int (*timerevent) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*timerevent) (int tid, int64 tick, int id, intptr_t data);
int (*timerevent_start) (struct npc_data *nd, int rid);
int (*timerevent_stop) (struct npc_data *nd);
void (*timerevent_quit) (struct map_session_data *sd);
- int (*gettimerevent_tick) (struct npc_data *nd);
+ int64 (*gettimerevent_tick) (struct npc_data *nd);
int (*settimerevent_tick) (struct npc_data *nd, int newtimer);
int (*event) (struct map_session_data *sd, const char *eventname, int ontouch);
int (*touch_areanpc_sub) (struct block_list *bl, va_list ap);
@@ -229,7 +229,7 @@ struct npc_interface {
/**
* For the Secure NPC Timeout option (check config/Secure.h) [RR]
**/
- int (*secure_timeout_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*secure_timeout_timer) (int tid, int64 tick, int id, intptr_t data);
};
struct npc_interface *npc;
diff --git a/src/map/party.c b/src/map/party.c
index 904110452..ab05c23f7 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -831,8 +831,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
return 0;
}
-int party_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) {
struct party_data* p;
DBIterator *iter = db_iterator(party->db);
diff --git a/src/map/party.h b/src/map/party.h
index 208edb846..ab14d1a31 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -123,7 +123,7 @@ struct party_interface {
/* */
int (*vforeachsamemap) (int (*func)(struct block_list *,va_list),struct map_session_data *sd,int range, va_list ap);
int (*foreachsamemap) (int (*func)(struct block_list *,va_list),struct map_session_data *sd,int range,...);
- int (*send_xy_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data);
void (*fill_member) (struct party_member* member, struct map_session_data* sd, unsigned int leader);
TBL_PC* (*sd_check) (int party_id, int account_id, int char_id);
void (*check_state) (struct party_data *p);
diff --git a/src/map/pc.c b/src/map/pc.c
index b39ae1c59..22413d567 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -117,7 +117,7 @@ bool pc_should_log_commands(struct map_session_data *sd)
return pc_group_should_log_commands(sd->group);
}
-int pc_invincible_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
if( (sd=(struct map_session_data *)map->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
@@ -155,7 +155,7 @@ void pc_delinvincibletimer(struct map_session_data* sd)
}
}
-int pc_spiritball_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
int i;
@@ -419,7 +419,7 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
/*==========================================
Rental System
*------------------------------------------*/
-int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_inventory_rental_end(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd = map->id2sd(id);
if( sd == NULL )
return 0;
@@ -447,7 +447,7 @@ int pc_inventory_rental_clear(struct map_session_data *sd)
void pc_inventory_rentals(struct map_session_data *sd)
{
int i, c = 0;
- unsigned int expire_tick, next_tick = UINT_MAX;
+ int64 expire_tick, next_tick = INT64_MAX;
for( i = 0; i < MAX_INVENTORY; i++ )
{ // Check for Rentals on Inventory
@@ -464,7 +464,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
} else {
- expire_tick = (unsigned int)(sd->status.inventory[i].expire_time - time(NULL)) * 1000;
+ expire_tick = (int64)(sd->status.inventory[i].expire_time - time(NULL)) * 1000;
clif->rental_time(sd->fd, sd->status.inventory[i].nameid, (int)(expire_tick / 1000));
next_tick = min(expire_tick, next_tick);
c++;
@@ -927,7 +927,7 @@ int pc_isequip(struct map_session_data *sd,int n)
*------------------------------------------*/
bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers) {
int i;
- unsigned long tick = timer->gettick();
+ int64 tick = timer->gettick();
uint32 ip = session[sd->fd]->client_addr;
sd->login_id2 = login_id2;
@@ -1971,7 +1971,7 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
return 0;
}
-int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd = map->id2sd(id);
struct s_autobonus *autobonus = (struct s_autobonus *)data;
@@ -4026,7 +4026,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
{
int flag=0;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
struct map_session_data *first_sd = NULL,*second_sd = NULL,*third_sd = NULL;
struct party_data *p=NULL;
@@ -4276,7 +4276,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
* 1 = success
*------------------------------------------*/
int pc_useitem(struct map_session_data *sd,int n) {
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
int amount, nameid, i;
struct script_code *item_script;
@@ -4343,7 +4343,7 @@ int pc_useitem(struct map_session_data *sd,int n) {
if( i < MAX_ITEMDELAYS ) {
if( sd->item_delay[i].nameid ) {// found
if( DIFF_TICK(sd->item_delay[i].tick, tick) > 0 ) {
- int e_tick = DIFF_TICK(sd->item_delay[i].tick, tick)/1000;
+ int e_tick = (int)(DIFF_TICK(sd->item_delay[i].tick, tick)/1000);
clif->msgtable_num(sd->fd, 0x746, e_tick + 1); // [%d] seconds left until you can use
return 0; // Delay has not expired yet
}
@@ -5642,7 +5642,7 @@ const char* job_name(int class_)
}
}
-int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
struct block_list *tbl;
@@ -6600,7 +6600,7 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype)
clif->resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
}
-int pc_respawn_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_respawn_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd = map->id2sd(id);
if( sd != NULL )
{
@@ -6647,7 +6647,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
*------------------------------------------*/
int pc_dead(struct map_session_data *sd,struct block_list *src) {
int i=0,j=0,k=0;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
for(k = 0; k < 5; k++)
if (sd->devotion[k]){
@@ -8250,7 +8250,7 @@ int pc_setregistry_str(struct map_session_data *sd,const char *reg,const char *v
/*==========================================
* Exec eventtimer for player sd (retrieved from map_session (id))
*------------------------------------------*/
-int pc_eventtimer(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_eventtimer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd=map->id2sd(id);
char *p = (char *)data;
int i;
@@ -9011,7 +9011,7 @@ int pc_calc_pvprank(struct map_session_data *sd) {
/*==========================================
* Calculate next sd ranking calculation from config
*------------------------------------------*/
-int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
sd=map->id2sd(id);
@@ -9224,10 +9224,9 @@ int pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y)
}
/*==========================================
- * Save 1 player data at autosave intervalle
+ * Save 1 player data at autosave intervall
*------------------------------------------*/
-int pc_autosave(int tid, unsigned int tick, int id, intptr_t data)
-{
+int pc_autosave(int tid, int64 tick, int id, intptr_t data) {
int interval;
struct s_mapiterator* iter;
struct map_session_data* sd;
@@ -9278,7 +9277,7 @@ int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) {
* timer to do the day [Yor]
* data: 0 = called by timer, 1 = gmcommand/script
*------------------------------------------------*/
-int map_day_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int map_day_timer(int tid, int64 tick, int id, intptr_t data) {
char tmp_soutput[1024];
if (data == 0 && battle_config.day_duration <= 0) // if we want a day
@@ -9298,7 +9297,7 @@ int map_day_timer(int tid, unsigned int tick, int id, intptr_t data) {
* timer to do the night [Yor]
* data: 0 = called by timer, 1 = gmcommand/script
*------------------------------------------------*/
-int map_night_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int map_night_timer(int tid, int64 tick, int id, intptr_t data) {
char tmp_soutput[1024];
if (data == 0 && battle_config.night_duration <= 0) // if we want a night
@@ -9370,7 +9369,7 @@ bool pc_can_use_command(struct map_session_data *sd, const char *command) {
return atcommand->can_use(sd,command);
}
-int pc_charm_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
int i, type;
diff --git a/src/map/pc.h b/src/map/pc.h
index ff6246b22..cdf4f9dce 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -210,10 +210,10 @@ struct map_session_data {
char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
int npc_timer_id; //For player attached npc timers. [Skotlex]
unsigned int chatID;
- time_t idletime;
- struct{
+ int64 idletime;
+ struct {
int npc_id;
- unsigned int timeout;
+ int64 timeout;
} progressbar; //Progress Bar [Inkfish]
struct{
char name[NAME_LENGTH];
@@ -229,17 +229,17 @@ struct map_session_data {
int cloneskill_id, reproduceskill_id;
int menuskill_id, menuskill_val, menuskill_val2;
int invincible_timer;
- unsigned int canlog_tick;
- unsigned int canuseitem_tick; // [Skotlex]
- unsigned int canusecashfood_tick;
- unsigned int canequip_tick; // [Inkfish]
- unsigned int cantalk_tick;
- unsigned int canskill_tick; // used to prevent abuse from no-delay ACT files
- unsigned int cansendmail_tick; // [Mail System Flood Protection]
- unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
+ int64 canlog_tick;
+ int64 canuseitem_tick; // [Skotlex]
+ int64 canusecashfood_tick;
+ int64 canequip_tick; // [Inkfish]
+ int64 cantalk_tick;
+ int64 canskill_tick; /// used to prevent abuse from no-delay ACT files
+ int64 cansendmail_tick; /// Mail System Flood Protection
+ int64 ks_floodprotect_tick; /// [Kill Steal Protection]
struct {
short nameid;
- unsigned int tick;
+ int64 tick;
} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
short weapontype1,weapontype2;
short disguise; // [Valaris]
@@ -460,7 +460,7 @@ struct map_session_data {
* @info
* - It is updated on every NPC iteration as mentioned above
**/
- unsigned int npc_idle_tick;
+ int64 npc_idle_tick;
/* */
enum npc_timeout_type npc_idle_type;
#endif
@@ -485,7 +485,7 @@ struct map_session_data {
bool stealth;
unsigned char fontcolor;
unsigned int fontcolor_tid;
- unsigned int hchsysch_tick;
+ int64 hchsysch_tick;
/* [Ind/Hercules] */
struct sc_display_entry **sc_display;
@@ -695,7 +695,7 @@ enum { ADDITEM_EXIST , ADDITEM_NEW , ADDITEM_OVERAMOUNT };
* All cooldowns are reset when server is restarted.
**/
struct item_cd {
- unsigned int tick[MAX_ITEMDELAYS];//tick
+ int64 tick[MAX_ITEMDELAYS];//tick
short nameid[MAX_ITEMDELAYS];//skill id
};
@@ -796,7 +796,7 @@ struct pc_interface {
int (*addautobonus) (struct s_autobonus *bonus,char max,const char *bonus_script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill);
int (*exeautobonus) (struct map_session_data* sd,struct s_autobonus *bonus);
- int (*endautobonus) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*endautobonus) (int tid, int64 tick, int id, intptr_t data);
int (*delautobonus) (struct map_session_data* sd,struct s_autobonus *bonus,char max,bool restore);
int (*bonus) (struct map_session_data *sd,int type,int val);
@@ -878,7 +878,7 @@ struct pc_interface {
int (*addeventtimercount) (struct map_session_data *sd,const char *name,int tick);
int (*calc_pvprank) (struct map_session_data *sd);
- int (*calc_pvprank_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*calc_pvprank_timer) (int tid, int64 tick, int id, intptr_t data);
int (*ismarried) (struct map_session_data *sd);
int (*marriage) (struct map_session_data *sd,struct map_session_data *dstsd);
@@ -909,8 +909,8 @@ struct pc_interface {
int (*set_hate_mob) (struct map_session_data *sd, int pos, struct block_list *bl);
int (*readdb) (void);
- int (*map_day_timer) (int tid, unsigned int tick, int id, intptr_t data); // by [yor]
- int (*map_night_timer) (int tid, unsigned int tick, int id, intptr_t data); // by [yor]
+ int (*map_day_timer) (int tid, int64 tick, int id, intptr_t data); // by [yor]
+ int (*map_night_timer) (int tid, int64 tick, int id, intptr_t data); // by [yor]
// Rental System
void (*inventory_rentals) (struct map_session_data *sd);
int (*inventory_rental_clear) (struct map_session_data *sd);
@@ -934,10 +934,10 @@ struct pc_interface {
int (*level_penalty_mod) (int diff, unsigned char race, unsigned short mode, int type);
int (*calc_skillpoint) (struct map_session_data* sd);
- int (*invincible_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*spiritball_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*invincible_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*spiritball_timer) (int tid, int64 tick, int id, intptr_t data);
int (*check_banding) ( struct block_list *bl, va_list ap );
- int (*inventory_rental_end) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*inventory_rental_end) (int tid, int64 tick, int id, intptr_t data);
void (*check_skilltree) (struct map_session_data *sd, int skill_id);
int (*bonus_autospell) (struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id);
int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id);
@@ -945,16 +945,16 @@ struct pc_interface {
int (*bonus_addeff_onskill) (struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target);
int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate);
void (*calcexp) (struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src);
- int (*respawn_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*respawn_timer) (int tid, int64 tick, int id, intptr_t data);
int (*jobchange_killclone) (struct block_list *bl, va_list ap);
int (*getstat) (struct map_session_data* sd, int type);
int (*setstat) (struct map_session_data* sd, int type, int val);
- int (*eventtimer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*eventtimer) (int tid, int64 tick, int id, intptr_t data);
int (*daynight_timer_sub) (struct map_session_data *sd,va_list ap);
- int (*charm_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*charm_timer) (int tid, int64 tick, int id, intptr_t data);
bool (*readdb_levelpenalty) (char* fields[], int columns, int current);
- int (*autosave) (int tid, unsigned int tick, int id, intptr_t data);
- int (*follow_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*autosave) (int tid, int64 tick, int id, intptr_t data);
+ int (*follow_timer) (int tid, int64 tick, int id, intptr_t data);
void (*read_skill_tree) (void);
int (*isUseitem) (struct map_session_data *sd,int n);
int (*show_steal) (struct block_list *bl,va_list ap);
diff --git a/src/map/pet.c b/src/map/pet.c
index 023059a6b..a20cc0df0 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -186,7 +186,7 @@ int pet_sc_check(struct map_session_data *sd, int type)
return 0;
}
-int pet_hungry(int tid, unsigned int tick, int id, intptr_t data) {
+int pet_hungry(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
struct pet_data *pd;
int interval;
@@ -666,7 +666,7 @@ int pet_equipitem(struct map_session_data *sd,int index) {
clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom);
if (battle_config.pet_equip_required) {
//Skotlex: start support timers if need
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
if (pd->s_skill && pd->s_skill->timer == INVALID_TIMER) {
if (pd->s_skill->id)
pd->s_skill->timer=timer->add(tick+pd->s_skill->delay*1000, pet->skill_support_timer, sd->bl.id, 0);
@@ -771,8 +771,7 @@ int pet_food(struct map_session_data *sd, struct pet_data *pd)
return 0;
}
-int pet_randomwalk(struct pet_data *pd,unsigned int tick)
-{
+int pet_randomwalk(struct pet_data *pd, int64 tick) {
nullpo_ret(pd);
Assert((pd->msd == 0) || (pd->msd->pd == pd));
@@ -812,8 +811,7 @@ int pet_randomwalk(struct pet_data *pd,unsigned int tick)
return 0;
}
-int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, unsigned int tick)
-{
+int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick) {
struct block_list *target = NULL;
if(pd->bl.prev == NULL || sd == NULL || sd->bl.prev == NULL)
@@ -924,16 +922,15 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, unsigned i
return 0;
}
-int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
-{
- unsigned int tick = va_arg(ap,unsigned int);
+int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) {
+ int64 tick = va_arg(ap,int64);
if(sd->status.pet_id && sd->pd)
pet->ai_sub_hard(sd->pd,sd,tick);
return 0;
}
-int pet_ai_hard(int tid, unsigned int tick, int id, intptr_t data) {
+int pet_ai_hard(int tid, int64 tick, int id, intptr_t data) {
map->foreachpc(pet->ai_sub_foreachclient,tick);
return 0;
@@ -966,7 +963,7 @@ int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
return 0;
}
-int pet_delay_item_drop(int tid, unsigned int tick, int id, intptr_t data) {
+int pet_delay_item_drop(int tid, int64 tick, int id, intptr_t data) {
struct item_drop_list *list;
struct item_drop *ditem, *ditem_prev;
list=(struct item_drop_list *)data;
@@ -1034,7 +1031,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
/*==========================================
* pet bonus giving skills [Valaris] / Rewritten by [Skotlex]
*------------------------------------------*/
-int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd=map->id2sd(id);
struct pet_data *pd;
int bonus;
@@ -1075,7 +1072,7 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data) {
/*==========================================
* pet recovery skills [Valaris] / Rewritten by [Skotlex]
*------------------------------------------*/
-int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd=map->id2sd(id);
struct pet_data *pd;
@@ -1102,7 +1099,7 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data) {
return 0;
}
-int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pet_heal_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd=map->id2sd(id);
struct status_data *st;
struct pet_data *pd;
@@ -1139,7 +1136,7 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
/*==========================================
* pet support skills [Skotlex]
*------------------------------------------*/
-int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd=map->id2sd(id);
struct pet_data *pd;
struct status_data *st;
diff --git a/src/map/pet.h b/src/map/pet.h
index 2f8e0b7c2..f95e860a2 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -86,7 +86,7 @@ struct pet_data {
unsigned skillbonus : 1;
} state;
int move_fail_count;
- unsigned int next_walktime,last_thinktime;
+ int64 next_walktime, last_thinktime;
short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex]
struct pet_recovery* recovery;
@@ -116,7 +116,7 @@ struct pet_interface {
int (*attackskill) (struct pet_data *pd, int target_id);
int (*target_check) (struct map_session_data *sd, struct block_list *bl, int type);
int (*sc_check) (struct map_session_data *sd, int type);
- int (*hungry) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*hungry) (int tid, int64 tick, int id, intptr_t data);
int (*search_petDB_index) (int key, int type);
int (*hungry_timer_delete) (struct pet_data *pd);
int (*performance) (struct map_session_data *sd, struct pet_data *pd);
@@ -135,16 +135,16 @@ struct pet_interface {
int (*change_name) (struct map_session_data *sd, char *name);
int (*change_name_ack) (struct map_session_data *sd, char *name, int flag);
int (*equipitem) (struct map_session_data *sd, int index);
- int (*randomwalk) (struct pet_data *pd, unsigned int tick);
- int (*ai_sub_hard) (struct pet_data *pd, struct map_session_data *sd, unsigned int tick);
+ int (*randomwalk) (struct pet_data *pd, int64 tick);
+ int (*ai_sub_hard) (struct pet_data *pd, struct map_session_data *sd, int64 tick);
int (*ai_sub_foreachclient) (struct map_session_data *sd, va_list ap);
- int (*ai_hard) (int tid, unsigned int tick, int id, intptr_t data);
- int (*delay_item_drop) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*ai_hard) (int tid, int64 tick, int id, intptr_t data);
+ int (*delay_item_drop) (int tid, int64 tick, int id, intptr_t data);
int (*lootitem_drop) (struct pet_data *pd, struct map_session_data *sd);
- int (*skill_bonus_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*recovery_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*heal_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*skill_support_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*skill_bonus_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*recovery_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*heal_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*skill_support_timer) (int tid, int64 tick, int id, intptr_t data);
int (*read_db) ();
};
diff --git a/src/map/script.c b/src/map/script.c
index efc3e0264..6198f21da 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3184,7 +3184,7 @@ void script_stop_instances(struct script_code *code) {
/*==========================================
* Timer function for sleep
*------------------------------------------*/
-int run_script_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int run_script_timer(int tid, int64 tick, int id, intptr_t data) {
struct script_state *st = idb_get(script->st_db,(int)data);
if( st ) {
TBL_PC *sd = map->id2sd(st->rid);
@@ -7993,7 +7993,7 @@ BUILDIN(gettimetick) { /* Asgard Version */
case 0:
default:
//type 0:(System Ticks)
- script_pushint(st,timer->gettick());
+ script_pushint(st,(int)timer->gettick()); // TODO: change this to int64 when we'll support 64 bit script values
break;
}
return true;
@@ -8821,7 +8821,7 @@ BUILDIN(getnpctimer) {
}
switch( type ) {
- case 0: val = npc->gettimerevent_tick(nd); break;
+ case 0: val = (int)npc->gettimerevent_tick(nd); break; // FIXME: change this to int64 when we'll support 64 bit script values
case 1:
if( nd->u.scr.rid ) {
sd = map->id2sd(nd->u.scr.rid);
@@ -9505,7 +9505,7 @@ BUILDIN(getstatus)
if( td ) {
// return the amount of time remaining
- script_pushint(st, td->tick - timer->gettick());
+ script_pushint(st, (int)(td->tick - timer->gettick())); // TODO: change this to int64 when we'll support 64 bit script values
}
}
break;
@@ -12688,7 +12688,7 @@ BUILDIN(summon)
const char *str,*event="";
TBL_PC *sd;
struct mob_data *md;
- int tick = timer->gettick();
+ int64 tick = timer->gettick();
sd=script->rid2sd(st);
if (!sd) return true;
@@ -14543,7 +14543,7 @@ BUILDIN(checkidle) {
sd = script->rid2sd(st);
if (sd)
- script_pushint(st, DIFF_TICK(last_tick, sd->idletime));
+ script_pushint(st, DIFF_TICK32(last_tick, sd->idletime)); // TODO: change this to int64 when we'll support 64 bit script values
else
script_pushint(st, 0);
diff --git a/src/map/script.h b/src/map/script.h
index 400916af8..c6cb6070b 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -536,7 +536,7 @@ struct script_interface {
void (*label_add)(int key, int pos);
void (*run) (struct script_code *rootscript,int pos,int rid,int oid);
void (*run_main) (struct script_state *st);
- int (*run_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*run_timer) (int tid, int64 tick, int id, intptr_t data);
int (*set_var) (struct map_session_data *sd, char *name, void *val);
void (*stop_instances) (struct script_code *code);
void (*free_code) (struct script_code* code);
diff --git a/src/map/skill.c b/src/map/skill.c
index 36a509876..b70e58c46 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -639,7 +639,7 @@ struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill
/*==========================================
*
*------------------------------------------*/
-int skill_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, unsigned int tick) {
+int skill_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, int64 tick) {
struct map_session_data *sd, *dstsd;
struct mob_data *md, *dstmd;
struct status_data *sstatus, *tstatus;
@@ -1569,7 +1569,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
return 0;
}
-int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, unsigned int tick) {
+int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, int64 tick) {
int temp, skill_lv, i, type, notok;
struct block_list *tbl;
@@ -1667,7 +1667,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1
* type of skills, so not every instance of skill->additional_effect needs a call
* to this one.
*/
-int skill_counter_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, unsigned int tick) {
+int skill_counter_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int64 tick) {
int rate;
struct map_session_data *sd=NULL;
struct map_session_data *dstsd=NULL;
@@ -2109,7 +2109,7 @@ int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type)
* flag&0x2000 is used to signal that the skill_lv should be passed as -1 to the
* client (causes player characters to not scream skill name)
*-------------------------------------------------------------------------*/
-int skill_attack (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) {
+int skill_attack(int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
struct Damage dmg;
struct status_data *sstatus, *tstatus;
struct status_change *sc;
@@ -2357,7 +2357,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
break;
} //Switch End
if (flag) { //Possible to chain
- if ( (flag = DIFF_TICK(sd->ud.canact_tick, tick)) < 50 ) flag = 50;/* less is a waste. */
+ if ( (flag = DIFF_TICK32(sd->ud.canact_tick, tick)) < 50 ) flag = 50;/* less is a waste. */
sc_start2(src,SC_COMBOATTACK,100,skill_id,bl->id,flag);
clif->combo_delay(src, flag);
}
@@ -2767,21 +2767,21 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
* Checking bl battle flag and display dammage
* then call func with source,target,skill_id,skill_lv,tick,flag
*------------------------------------------*/
-int skill_area_sub (struct block_list *bl, va_list ap) {
+int skill_area_sub(struct block_list *bl, va_list ap) {
struct block_list *src;
uint16 skill_id,skill_lv;
int flag;
- unsigned int tick;
+ int64 tick;
SkillFunc func;
nullpo_ret(bl);
- src=va_arg(ap,struct block_list *);
- skill_id=va_arg(ap,int);
- skill_lv=va_arg(ap,int);
- tick=va_arg(ap,unsigned int);
- flag=va_arg(ap,int);
- func=va_arg(ap,SkillFunc);
+ src = va_arg(ap,struct block_list *);
+ skill_id = va_arg(ap,int);
+ skill_lv = va_arg(ap,int);
+ tick = va_arg(ap,int64);
+ flag = va_arg(ap,int);
+ func = va_arg(ap,SkillFunc);
if(battle->check_target(src,bl,flag) > 0) {
// several splash skills need this initial dummy packet to display correctly
@@ -3036,14 +3036,14 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
/*==========================================
* what the hell it doesn't need to receive this many params, it doesn't do anything ~_~
*------------------------------------------*/
-int skill_area_sub_count (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) {
+int skill_area_sub_count(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
return 1;
}
/*==========================================
*
*------------------------------------------*/
-int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
+int skill_timerskill(int tid, int64 tick, int id, intptr_t data) {
struct block_list *src = map->id2bl(id),*target;
struct unit_data *ud = unit->bl2ud(src);
struct skill_timerskill *skl;
@@ -3153,7 +3153,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
case WL_TETRAVORTEX_WIND:
case WL_TETRAVORTEX_GROUND:
clif->skill_nodamage(src, target, skl->skill_id, skl->skill_lv, 1);
- skill_attack(BF_MAGIC, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag);
+ skill->attack(BF_MAGIC, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag);
skill->toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify
if( skl->type == 4 ){
const enum sc_type scs[] = { SC_BURNING, SC_BLOODING, SC_FROSTMISTY, SC_STUN }; // status inflicts are depend on what summoned element is used.
@@ -3269,8 +3269,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
/*==========================================
*
*------------------------------------------*/
-int skill_addtimerskill (struct block_list *src, unsigned int tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag)
-{
+int skill_addtimerskill(struct block_list *src, int64 tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag) {
int i;
struct unit_data *ud;
nullpo_retr(1, src);
@@ -3334,7 +3333,7 @@ int skill_activate_reverbetion( struct block_list *bl, va_list ap) {
return 0;
if( su->alive && (sg = su->group) && sg->skill_id == WM_REVERBERATION ) {
map->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, timer->gettick());
- su->limit=DIFF_TICK(timer->gettick(),sg->tick);
+ su->limit=DIFF_TICK32(timer->gettick(),sg->tick);
sg->unit_id = UNT_USED_TRAPS;
}
return 0;
@@ -3355,7 +3354,7 @@ int skill_reveal_trap (struct block_list *bl, va_list ap) {
*
*
*------------------------------------------*/
-int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag) {
+int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
struct map_session_data *sd = NULL;
struct status_data *tstatus;
struct status_change *sc;
@@ -4557,8 +4556,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
/*==========================================
*
*------------------------------------------*/
-int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
-{
+int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
struct block_list *target, *src;
struct map_session_data *sd;
struct mob_data *md;
@@ -4885,8 +4883,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
/*==========================================
*
*------------------------------------------*/
-int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
-{
+int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
struct map_session_data *sd, *dstsd;
struct mob_data *md, *dstmd;
struct homun_data *hd;
@@ -4965,11 +4962,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
- return skill->castend_damage_id (src, bl, skill_id, skill_lv, tick, flag);
+ return skill->castend_damage_id(src, bl, skill_id, skill_lv, tick, flag);
}
break;
case NPC_SMOKING: //Since it is a self skill, this one ends here rather than in damage_id. [Skotlex]
- return skill->castend_damage_id (src, bl, skill_id, skill_lv, tick, flag);
+ return skill->castend_damage_id(src, bl, skill_id, skill_lv, tick, flag);
case MH_STEINWAND: {
struct block_list *s_src = battle->get_master(src);
short ret = 0;
@@ -7107,8 +7104,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case UNT_TALKIEBOX:
su->group->unit_id = UNT_USED_TRAPS;
clif->changetraplook(bl, UNT_USED_TRAPS);
- su->group->limit=DIFF_TICK(tick+1500,su->group->tick);
- su->limit=DIFF_TICK(tick+1500,su->group->tick);
+ su->group->limit=DIFF_TICK32(tick+1500,su->group->tick);
+ su->limit=DIFF_TICK32(tick+1500,su->group->tick);
}
}
}
@@ -9119,7 +9116,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
md->special_state.ai = AI_ZANZOU;
if( md->deletetimer != INVALID_TIMER )
timer->delete(md->deletetimer, mob->timer_delete);
- md->deletetimer = timer->add (timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, md->bl.id, 0);
+ md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, md->bl.id, 0);
mob->spawn( md );
pc->setinvincibletimer(sd,500);// unlock target lock
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -9352,7 +9349,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
/*==========================================
*
*------------------------------------------*/
-int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data) {
+int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) {
struct block_list* src = map->id2bl(id);
int maxcount;
struct map_session_data *sd;
@@ -9652,8 +9649,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
/*==========================================
*
*------------------------------------------*/
-int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
-{
+int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
struct map_session_data* sd;
struct status_change* sc;
struct status_change_entry *sce;
@@ -9968,7 +9964,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA;
if( md->deletetimer != INVALID_TIMER )
timer->delete(md->deletetimer, mob->timer_delete);
- md->deletetimer = timer->add (timer->gettick() + skill->get_time(skill_id,skill_lv), mob->timer_delete, md->bl.id, 0);
+ md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id,skill_lv), mob->timer_delete, md->bl.id, 0);
mob->spawn (md); //Now it is ready for spawning.
}
}
@@ -10066,7 +10062,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
{
if( md->deletetimer != INVALID_TIMER )
timer->delete(md->deletetimer, mob->timer_delete);
- md->deletetimer = timer->add (tick + i, mob->timer_delete, md->bl.id, 0);
+ md->deletetimer = timer->add(tick + i, mob->timer_delete, md->bl.id, 0);
}
mob->spawn (md);
}
@@ -10197,7 +10193,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
md->special_state.ai = AI_FLORA;
if( md->deletetimer != INVALID_TIMER )
timer->delete(md->deletetimer, mob->timer_delete);
- md->deletetimer = timer->add (timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, md->bl.id, 0);
+ md->deletetimer = timer->add(timer->gettick() + skill->get_time(skill_id, skill_lv), mob->timer_delete, md->bl.id, 0);
mob->spawn( md );
}
}
@@ -10605,7 +10601,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
old_sg->skill_id == SA_VIOLENTGALE
) && old_sg->limit > 0)
{ //Use the previous limit (minus the elapsed time) [Skotlex]
- limit = old_sg->limit - DIFF_TICK(timer->gettick(), old_sg->tick);
+ limit = old_sg->limit - DIFF_TICK32(timer->gettick(), old_sg->tick);
if (limit < 0) //This can happen...
limit = skill->get_time(skill_id,skill_lv);
}
@@ -10962,7 +10958,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_
/*==========================================
*
*------------------------------------------*/
-int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned int tick) {
+int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick) {
struct skill_unit_group *sg;
struct block_list *ss;
struct status_change *sc;
@@ -11002,14 +10998,14 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
if( status->change_start(bl,type,10000,sg->skill_lv,1,sg->group_id,0,sec,8) ) {
const struct TimerData* td = sc->data[type]?timer->get(sc->data[type]->timer):NULL;
if( td )
- sec = DIFF_TICK(td->tick, tick);
+ sec = DIFF_TICK32(td->tick, tick);
map->moveblock(bl, src->bl.x, src->bl.y, tick);
clif->fixpos(bl);
sg->val2 = bl->id;
}
else
sec = 3000; //Couldn't trap it?
- sg->limit = DIFF_TICK(tick,sg->tick)+sec;
+ sg->limit = DIFF_TICK32(tick,sg->tick)+sec;
}
break;
case UNT_SAFETYWALL:
@@ -11135,7 +11131,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
// case UNT_ICEWALL: //Destroy the cell. [Skotlex]
// src->val1 = 0;
// if(src->limit + sg->tick > tick + 700)
- // src->limit = DIFF_TICK(tick+700,sg->tick);
+ // src->limit = DIFF_TICK32(tick+700,sg->tick);
// break;
case UNT_MOONLIT:
@@ -11173,7 +11169,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
/*==========================================
*
*------------------------------------------*/
-int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, unsigned int tick) {
+int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int64 tick) {
struct skill_unit_group *sg;
struct block_list *ss;
TBL_PC* tsd;
@@ -11217,7 +11213,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if ((ts = skill->unitgrouptickset_search(bl,sg,tick))) {
//Not all have it, eg: Traps don't have it even though they can be hit by Heaven's Drive [Skotlex]
- diff = DIFF_TICK(tick,ts->tick);
+ diff = DIFF_TICK32(tick,ts->tick);
if (diff < 0)
return 0;
ts->tick = tick+sg->interval;
@@ -11317,7 +11313,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
status->charge(ss, 0, 8); //costs additional 8 SP if miss
} else { // mobs
//should end when out of sp.
- sg->limit = DIFF_TICK(tick,sg->tick);
+ sg->limit = DIFF_TICK32(tick,sg->tick);
break;
}
} while( x == bl->x && y == bl->y
@@ -11360,7 +11356,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
skill->blown(&src->bl,bl,skill->get_blewcount(sg->skill_id,sg->skill_lv),unit->getdir(bl),0);
sg->unit_id = UNT_USED_TRAPS;
clif->changetraplook(&src->bl, UNT_USED_TRAPS);
- sg->limit=DIFF_TICK(tick,sg->tick)+1500;
+ sg->limit=DIFF_TICK32(tick,sg->tick)+1500;
}
break;
@@ -11371,7 +11367,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( status->change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, 8) ) {
const struct TimerData* td = tsc->data[type]?timer->get(tsc->data[type]->timer):NULL;
if( td )
- sec = DIFF_TICK(td->tick, tick);
+ sec = DIFF_TICK32(td->tick, tick);
if( sg->unit_id == UNT_MANHOLE || battle_config.skill_trap_type || !map_flag_gvg2(src->bl.m) ) {
unit->movepos(bl, src->bl.x, src->bl.y, 0, 0);
clif->fixpos(bl);
@@ -11388,7 +11384,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
**/
clif->changetraplook(&src->bl, UNT_ANKLESNARE);
}
- sg->limit = DIFF_TICK(tick,sg->tick)+sec;
+ sg->limit = DIFF_TICK32(tick,sg->tick)+sec;
sg->interval = -1;
src->range = 0;
}
@@ -11440,7 +11436,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
if (sg->unit_id != UNT_FIREPILLAR_ACTIVE)
clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
- sg->limit=DIFF_TICK(tick,sg->tick)+1500 +
+ sg->limit=DIFF_TICK32(tick,sg->tick)+1500 +
(sg->unit_id== UNT_CLUSTERBOMB || sg->unit_id== UNT_ICEBOUNDTRAP?1000:0);// Cluster Bomb/Icebound has 1s to disappear once activated.
sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again.
break;
@@ -11452,7 +11448,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
clif->talkiebox(&src->bl, sg->valstr);
sg->unit_id = UNT_USED_TRAPS;
clif->changetraplook(&src->bl, UNT_USED_TRAPS);
- sg->limit = DIFF_TICK(tick, sg->tick) + 5000;
+ sg->limit = DIFF_TICK32(tick, sg->tick) + 5000;
sg->val2 = -1;
}
break;
@@ -11629,7 +11625,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
&src->bl,tick);
sg->unit_id = UNT_USED_TRAPS;
//clif->changetraplook(&src->bl, UNT_FIREPILLAR_ACTIVE);
- sg->limit=DIFF_TICK(tick,sg->tick)+1500;
+ sg->limit=DIFF_TICK32(tick,sg->tick)+1500;
break;
/**
* 3rd stuff
@@ -11682,7 +11678,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_REVERBERATION:
clif->changetraplook(&src->bl,UNT_USED_TRAPS);
map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
- sg->limit = DIFF_TICK(tick,sg->tick)+1000;
+ sg->limit = DIFF_TICK32(tick,sg->tick)+1000;
sg->unit_id = UNT_USED_TRAPS;
break;
@@ -11694,7 +11690,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( !(status_get_mode(bl)&MD_BOSS) && ss != bl && battle->check_target(&src->bl, bl, BCT_PARTY) > 0 ) {
if( !(tsc && tsc->data[type]) ){
sc_start(bl, type, 100, sg->skill_lv, skill->get_time2(sg->skill_id,sg->skill_lv));
- sg->limit = DIFF_TICK(tick,sg->tick);
+ sg->limit = DIFF_TICK32(tick,sg->tick);
sg->unit_id = UNT_USED_TRAPS;
}
}
@@ -11706,13 +11702,13 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( sc_start(bl, type, 100, sg->skill_lv, sec) ) {
const struct TimerData* td = tsc->data[type]?timer->get(tsc->data[type]->timer):NULL;
if( td )
- sec = DIFF_TICK(td->tick, tick);
+ sec = DIFF_TICK32(td->tick, tick);
///map->moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett]
clif->fixpos(bl);
sg->val2 = bl->id;
} else
sec = 3000; // Couldn't trap it?
- sg->limit = DIFF_TICK(tick, sg->tick) + sec;
+ sg->limit = DIFF_TICK32(tick, sg->tick) + sec;
} else if( tsc->data[SC_THORNS_TRAP] && bl->id == sg->val2 )
skill->attack(skill->get_type(GN_THORNS_TRAP), ss, ss, bl, sg->skill_id, sg->skill_lv, tick, SD_LEVEL|SD_ANIMATION);
}
@@ -11750,7 +11746,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( battle->check_target(&src->bl,bl,BCT_ENEMY) > 0 )
skill->attack(skill->get_type(GN_HELLS_PLANT_ATK), ss, &src->bl, bl, GN_HELLS_PLANT_ATK, sg->skill_lv, tick, 0);
if( ss != bl) //The caster is the only one who can step on the Plants, without destroying them
- sg->limit = DIFF_TICK(tick, sg->tick) + 100;
+ sg->limit = DIFF_TICK32(tick, sg->tick) + 100;
break;
case UNT_CLOUD_KILL:
@@ -11800,7 +11796,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_VACUUM_EXTREME:
{// TODO: official behavior in gvg area. [malufett]
- int sec = sg->limit - DIFF_TICK(tick, sg->tick);
+ int sec = sg->limit - DIFF_TICK32(tick, sg->tick);
int range = skill->get_unit_range(sg->skill_id, sg->skill_lv);
if( tsc && !tsc->data[type] &&
@@ -11863,7 +11859,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_LAVA_SLIDE:
skill->attack(BF_WEAPON, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0);
if(++sg->val1 > 4) //after 5 stop hit and destroy me
- sg->limit = DIFF_TICK(tick, sg->tick);
+ sg->limit = DIFF_TICK32(tick, sg->tick);
break;
case UNT_POISON_MIST:
@@ -11880,7 +11876,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
/*==========================================
* Triggered when a char steps out of a skill cell
*------------------------------------------*/
-int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned int tick) {
+int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick) {
struct skill_unit_group *sg;
struct status_change *sc;
struct status_change_entry *sce;
@@ -11923,7 +11919,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
if (target && target==bl) {
if (sce && sce->val3 == sg->group_id)
status_change_end(bl, type, INVALID_TIMER);
- sg->limit = DIFF_TICK(tick,sg->tick)+1000;
+ sg->limit = DIFF_TICK32(tick,sg->tick)+1000;
}
}
break;
@@ -11934,7 +11930,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
/*==========================================
* Triggered when a char steps out of a skill group (entirely) [Skotlex]
*------------------------------------------*/
-int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned int tick) {
+int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) {
struct status_change *sc;
struct status_change_entry *sce;
enum sc_type type;
@@ -12040,10 +12036,10 @@ int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned int tick
* flag&1: Invoke onplace function (otherwise invoke onout)
* flag&4: Invoke a onleft call (the unit might be scheduled for deletion)
*------------------------------------------*/
-int skill_unit_effect (struct block_list* bl, va_list ap) {
+int skill_unit_effect(struct block_list* bl, va_list ap) {
struct skill_unit* su = va_arg(ap,struct skill_unit*);
struct skill_unit_group* group = su->group;
- unsigned int tick = va_arg(ap,unsigned int);
+ int64 tick = va_arg(ap,int64);
unsigned int flag = va_arg(ap,unsigned int);
uint16 skill_id;
bool dissonance;
@@ -12079,8 +12075,7 @@ int skill_unit_effect (struct block_list* bl, va_list ap) {
/*==========================================
*
*------------------------------------------*/
-int skill_unit_ondamaged (struct skill_unit *src, struct block_list *bl, int64 damage, unsigned int tick)
-{
+int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl, int64 damage, int64 tick) {
struct skill_unit_group *sg;
nullpo_ret(src);
@@ -14187,8 +14182,7 @@ void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) {
}
}
-void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
-{
+void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) {
int c,n=4;
uint8 dir = map->calc_dir(src,bl->x,bl->y);
struct square tc;
@@ -14525,10 +14519,10 @@ int skill_sit (struct map_session_data *sd, int type)
/*==========================================
*
*------------------------------------------*/
-int skill_frostjoke_scream (struct block_list *bl, va_list ap) {
+int skill_frostjoke_scream(struct block_list *bl, va_list ap) {
struct block_list *src;
uint16 skill_id,skill_lv;
- unsigned int tick;
+ int64 tick;
nullpo_ret(bl);
nullpo_ret(src=va_arg(ap,struct block_list*));
@@ -14536,7 +14530,7 @@ int skill_frostjoke_scream (struct block_list *bl, va_list ap) {
skill_id=va_arg(ap,int);
skill_lv=va_arg(ap,int);
if(!skill_lv) return 0;
- tick=va_arg(ap,unsigned int);
+ tick=va_arg(ap,int64);
if (src == bl || status->isdead(bl))
return 0;
@@ -14569,22 +14563,22 @@ void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill
/*==========================================
*
*------------------------------------------*/
-int skill_attack_area (struct block_list *bl, va_list ap) {
+int skill_attack_area(struct block_list *bl, va_list ap) {
struct block_list *src,*dsrc;
int atk_type,skill_id,skill_lv,flag,type;
- unsigned int tick;
+ int64 tick;
if(status->isdead(bl))
return 0;
atk_type = va_arg(ap,int);
- src=va_arg(ap,struct block_list*);
- dsrc=va_arg(ap,struct block_list*);
- skill_id=va_arg(ap,int);
- skill_lv=va_arg(ap,int);
- tick=va_arg(ap,unsigned int);
- flag=va_arg(ap,int);
- type=va_arg(ap,int);
+ src = va_arg(ap,struct block_list*);
+ dsrc = va_arg(ap,struct block_list*);
+ skill_id = va_arg(ap,int);
+ skill_lv = va_arg(ap,int);
+ tick = va_arg(ap,int64);
+ flag = va_arg(ap,int);
+ type = va_arg(ap,int);
if (skill->area_temp[1] == bl->id) //This is the target of the skill, do a full attack and skip target checks.
@@ -14739,7 +14733,7 @@ int skill_detonator(struct block_list *bl, va_list ap) {
map->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag,bl,su->group->tick);
}
clif->changetraplook(bl, UNT_USED_TRAPS);
- su->group->limit = DIFF_TICK(timer->gettick(),su->group->tick) +
+ su->group->limit = DIFF_TICK32(timer->gettick(),su->group->tick) +
(unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : (unit_id == UNT_FIRINGTRAP ? 0 : 1500)) );
su->group->unit_id = UNT_USED_TRAPS;
break;
@@ -14876,15 +14870,15 @@ int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap)
/*==========================================
*
*------------------------------------------*/
-int skill_trap_splash (struct block_list *bl, va_list ap) {
+int skill_trap_splash(struct block_list *bl, va_list ap) {
struct block_list *src;
- int tick;
+ int64 tick;
struct skill_unit *su;
struct skill_unit_group *sg;
struct block_list *ss;
src = va_arg(ap,struct block_list *);
su = (struct skill_unit *)src;
- tick = va_arg(ap,int);
+ tick = va_arg(ap,int64);
if( !su->alive || bl->prev == NULL )
return 0;
@@ -14962,7 +14956,7 @@ int skill_trap_splash (struct block_list *bl, va_list ap) {
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
clif->changetraplook(bl, UNT_USED_TRAPS);
- su->group->limit = DIFF_TICK(timer->gettick(),su->group->tick) + 1500;
+ su->group->limit = DIFF_TICK32(timer->gettick(),su->group->tick) + 1500;
su->group->unit_id = UNT_USED_TRAPS;
}
break;
@@ -15288,11 +15282,11 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
if(i == MAX_SKILLUNITGROUP) {
// array is full, make room by discarding oldest group
int j=0;
- unsigned maxdiff=0,x,tick=timer->gettick();
+ int64 maxdiff = 0, x, tick = timer->gettick();
for(i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i];i++)
- if((x=DIFF_TICK(tick,ud->skillunit[i]->tick))>maxdiff){
- maxdiff=x;
- j=i;
+ if( (x=DIFF_TICK(tick,ud->skillunit[i]->tick)) > maxdiff ) {
+ maxdiff = x;
+ j = i;
}
skill->del_unitgroup(ud->skillunit[j],ALC_MARK);
//Since elements must have shifted, we use the last slot.
@@ -15479,7 +15473,7 @@ int skill_clear_unitgroup (struct block_list *src)
/*==========================================
*
*------------------------------------------*/
-struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_list *bl, struct skill_unit_group *group, int tick) {
+struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl, struct skill_unit_group *group, int64 tick) {
int i,j=-1,k,s,id;
struct unit_data *ud;
struct skill_unit_group_tickset *set;
@@ -15519,10 +15513,10 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis
/*==========================================
*
*------------------------------------------*/
-int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
+int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap) {
struct skill_unit* su = va_arg(ap,struct skill_unit *);
struct skill_unit_group* group = su->group;
- unsigned int tick = va_arg(ap,unsigned int);
+ int64 tick = va_arg(ap,int64);
if( !su->alive || bl->prev == NULL )
return 0;
@@ -15546,7 +15540,7 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
struct skill_unit* su = DB->data2ptr(data);
struct skill_unit_group* group = su->group;
- unsigned int tick = va_arg(ap,unsigned int);
+ int64 tick = va_arg(ap,int64);
bool dissonance;
struct block_list* bl = &su->bl;
@@ -15570,8 +15564,8 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
case UNT_GROUNDDRIFT_FIRE:
group->unit_id = UNT_USED_TRAPS;
//clif->changetraplook(bl, UNT_FIREPILLAR_ACTIVE);
- group->limit=DIFF_TICK(tick+1500,group->tick);
- su->limit=DIFF_TICK(tick+1500,group->tick);
+ group->limit=DIFF_TICK32(tick+1500,group->tick);
+ su->limit=DIFF_TICK32(tick+1500,group->tick);
break;
case UNT_ANKLESNARE:
@@ -15650,8 +15644,8 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
}
clif->changetraplook(bl,UNT_USED_TRAPS);
map->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
- group->limit = DIFF_TICK(tick,group->tick)+1000;
- su->limit = DIFF_TICK(tick,group->tick)+1000;
+ group->limit = DIFF_TICK32(tick,group->tick)+1000;
+ su->limit = DIFF_TICK32(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
break;
@@ -15672,8 +15666,8 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
break;
}
// This unit isn't removed while SC_BANDING is active.
- group->limit = DIFF_TICK(tick+group->interval,group->tick);
- su->limit = DIFF_TICK(tick+group->interval,group->tick);
+ group->limit = DIFF_TICK32(tick+group->interval,group->tick);
+ su->limit = DIFF_TICK32(tick+group->interval,group->tick);
}
break;
@@ -15686,7 +15680,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
// icewall loses 50 hp every second
su->val1 -= SKILLUNITTIMER_INTERVAL/20; // trap's hp
if( su->val1 <= 0 && su->limit + group->tick > tick + 700 )
- su->limit = DIFF_TICK(tick+700,group->tick);
+ su->limit = DIFF_TICK32(tick+700,group->tick);
break;
case UNT_BLASTMINE:
case UNT_SKIDTRAP:
@@ -15703,7 +15697,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
skill->delunit(su);
else {
clif->changetraplook(bl, group->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
- group->limit = DIFF_TICK(tick, group->tick) + 1500;
+ group->limit = DIFF_TICK32(tick, group->tick) + 1500;
group->unit_id = UNT_USED_TRAPS;
}
}
@@ -15712,15 +15706,15 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
if( su->val1 <= 0 ) {
clif->changetraplook(bl,UNT_USED_TRAPS);
map->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
- group->limit = DIFF_TICK(tick,group->tick)+1000;
- su->limit = DIFF_TICK(tick,group->tick)+1000;
+ group->limit = DIFF_TICK32(tick,group->tick)+1000;
+ su->limit = DIFF_TICK32(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
}
break;
case UNT_WALLOFTHORN:
if( su->val1 <= 0 ) {
group->unit_id = UNT_USED_TRAPS;
- group->limit = DIFF_TICK(tick, group->tick) + 1500;
+ group->limit = DIFF_TICK32(tick, group->tick) + 1500;
}
break;
}
@@ -15757,7 +15751,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
/*==========================================
* Executes on all skill units every SKILLUNITTIMER_INTERVAL miliseconds.
*------------------------------------------*/
-int skill_unit_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int skill_unit_timer(int tid, int64 tick, int id, intptr_t data) {
map->freeblock_lock();
skill->unit_db->foreach(skill->unit_db, skill->unit_timer_sub, tick);
@@ -15770,12 +15764,12 @@ int skill_unit_timer(int tid, unsigned int tick, int id, intptr_t data) {
/*==========================================
*
*------------------------------------------*/
-int skill_unit_move_sub (struct block_list* bl, va_list ap) {
+int skill_unit_move_sub(struct block_list* bl, va_list ap) {
struct skill_unit* su = (struct skill_unit *)bl;
struct skill_unit_group* group = su->group;
struct block_list* target = va_arg(ap,struct block_list*);
- unsigned int tick = va_arg(ap,unsigned int);
+ int64 tick = va_arg(ap,int64);
int flag = va_arg(ap,int);
bool dissonance;
@@ -15867,7 +15861,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) {
* units to figure out when they have left a group.
* flag&4: Force a onleft event (triggered when the bl is killed, for example)
*------------------------------------------*/
-int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) {
+int skill_unit_move(struct block_list *bl, int64 tick, int flag) {
nullpo_ret(bl);
if( bl->prev == NULL )
@@ -15892,10 +15886,9 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) {
/*==========================================
*
*------------------------------------------*/
-int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 dx, int16 dy)
-{
+int skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx, int16 dy) {
int i,j;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
int *m_flag;
struct skill_unit *su1;
struct skill_unit *su2;
@@ -16749,7 +16742,7 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
md->special_state.ai = AI_FLORA;
if( md->deletetimer != INVALID_TIMER )
timer->delete(md->deletetimer, mob->timer_delete);
- md->deletetimer = timer->add (timer->gettick() + skill->get_time(NC_MAGICDECOY,skill_id), mob->timer_delete, md->bl.id, 0);
+ md->deletetimer = timer->add(timer->gettick() + skill->get_time(NC_MAGICDECOY,skill_id), mob->timer_delete, md->bl.id, 0);
mob->spawn(md);
md->status.matk_min = md->status.matk_max = 250 + (50 * skill_id);
}
@@ -16947,13 +16940,13 @@ int skill_changematerial(struct map_session_data *sd, int n, unsigned short *ite
/**
* for Royal Guard's LG_TRAMPLE
**/
-int skill_destroy_trap( struct block_list *bl, va_list ap ) {
+int skill_destroy_trap(struct block_list *bl, va_list ap) {
struct skill_unit *su = (struct skill_unit *)bl;
struct skill_unit_group *sg;
- unsigned int tick;
+ int64 tick;
nullpo_ret(su);
- tick = va_arg(ap, unsigned int);
+ tick = va_arg(ap, int64);
if (su->alive && (sg = su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP) {
switch( sg->unit_id ) {
@@ -16980,7 +16973,7 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) {
/*==========================================
*
*------------------------------------------*/
-int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data) {
+int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd = map->id2sd(id);
struct skill_cd * cd = NULL;
@@ -17035,7 +17028,7 @@ int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data) {
int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) {
struct skill_cd* cd = NULL;
uint16 idx = skill->get_index(skill_id);
- unsigned int now = timer->gettick();
+ int64 now = timer->gettick();
nullpo_retr (-1, sd);
@@ -17099,7 +17092,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
return 0;
}
-int skill_blockhomun_end(int tid, unsigned int tick, int id, intptr_t data) { //[orn]
+int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data) { //[orn]
struct homun_data *hd = (TBL_HOM*)map->id2bl(id);
if (data <= 0 || data >= MAX_SKILL)
return 0;
@@ -17124,7 +17117,7 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) { /
return timer->add(timer->gettick() + tick, skill->blockhomun_end, hd->bl.id, idx);
}
-int skill_blockmerc_end(int tid, unsigned int tick, int id, intptr_t data) {//[orn]
+int skill_blockmerc_end(int tid, int64 tick, int id, intptr_t data) {//[orn]
struct mercenary_data *md = (TBL_MER*)map->id2bl(id);
if( data <= 0 || data >= MAX_SKILL )
return 0;
@@ -17592,7 +17585,7 @@ int skill_get_elemental_type( uint16 skill_id , uint16 skill_lv ) {
void skill_cooldown_save(struct map_session_data * sd) {
int i;
struct skill_cd* cd = NULL;
- unsigned int now = 0;
+ int64 now = 0;
// always check to make sure the session properly exists
nullpo_retv(sd);
@@ -17605,7 +17598,7 @@ void skill_cooldown_save(struct map_session_data * sd) {
// process each individual cooldown associated with the character
for( i = 0; i < cd->cursor; i++ ) {
- cd->entry[i]->duration = DIFF_TICK(cd->entry[i]->started+cd->entry[i]->duration,now);
+ cd->entry[i]->duration = DIFF_TICK32(cd->entry[i]->started+cd->entry[i]->duration,now);
if( cd->entry[i]->timer != INVALID_TIMER ) {
timer->delete(cd->entry[i]->timer,skill->blockpc_end);
cd->entry[i]->timer = INVALID_TIMER;
@@ -17620,7 +17613,7 @@ void skill_cooldown_save(struct map_session_data * sd) {
void skill_cooldown_load(struct map_session_data * sd) {
int i;
struct skill_cd* cd = NULL;
- unsigned int now = 0;
+ int64 now = 0;
// always check to make sure the session properly exists
nullpo_retv(sd);
diff --git a/src/map/skill.h b/src/map/skill.h
index c968eebde..fca4952ef 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1686,7 +1686,7 @@ struct skill_unit_group {
int map;
int target_flag; //Holds BCT_* flag for battle_check_target
int bl_flag; //Holds BL_* flag for map_foreachin* functions
- unsigned int tick;
+ int64 tick;
int limit,interval;
uint16 skill_id,skill_lv;
@@ -1715,7 +1715,7 @@ struct skill_unit {
};
struct skill_unit_group_tickset {
- unsigned int tick;
+ int64 tick;
int id;
};
@@ -1750,7 +1750,7 @@ struct skill_cd_entry {
int total;/* used for display on newer clients */
#endif
short skidx;//the skill index entries belong to
- unsigned int started;/* gettick() of when it started, used vs duration to measure how much left upon logout */
+ int64 started;/* gettick() of when it started, used vs duration to measure how much left upon logout */
int timer;/* timer id */
uint16 skill_id;//skill id
};
@@ -1791,7 +1791,7 @@ struct s_skill_spellbook_db {
int point;
};
-typedef int (*SkillFunc)(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag);
+typedef int (*SkillFunc)(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 tick, int flag);
/**
* Skill.c Interface
@@ -1883,13 +1883,13 @@ struct skill_interface {
int (*get_casttype2) (uint16 index);
int (*name2id) (const char* name);
int (*isammotype) (struct map_session_data *sd, int skill);
- int (*castend_id) (int tid, unsigned int tick, int id, intptr_t data);
- int (*castend_pos) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*castend_id) (int tid, int64 tick, int id, intptr_t data);
+ int (*castend_pos) (int tid, int64 tick, int id, intptr_t data);
int (*castend_map) ( struct map_session_data *sd,uint16 skill_id, const char *mapname);
int (*cleartimerskill) (struct block_list *src);
- int (*addtimerskill) (struct block_list *src,unsigned int tick,int target,int x,int y,uint16 skill_id,uint16 skill_lv,int type,int flag);
- int (*additional_effect) ( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,int dmg_lv,unsigned int tick);
- int (*counter_additional_effect) ( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,unsigned int tick);
+ int (*addtimerskill) (struct block_list *src, int64 tick, int target, int x, int y, uint16 skill_id, uint16 skill_lv, int type, int flag);
+ int (*additional_effect) (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, int64 tick);
+ int (*counter_additional_effect) (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int64 tick);
int (*blown) (struct block_list* src, struct block_list* target, int count, int8 dir, int flag);
int (*break_equip) (struct block_list *bl, unsigned short where, int rate, int flag);
int (*strip_equip) (struct block_list *bl, unsigned short where, int rate, int lv, int time);
@@ -1901,8 +1901,8 @@ struct skill_interface {
int (*del_unitgroup) (struct skill_unit_group *group, const char* file, int line, const char* func);
int (*clear_unitgroup) (struct block_list *src);
int (*clear_group) (struct block_list *bl, int flag);
- int (*unit_onplace) (struct skill_unit *src, struct block_list *bl, unsigned int tick);
- int (*unit_ondamaged) (struct skill_unit *src,struct block_list *bl,int64 damage,unsigned int tick);
+ int (*unit_onplace) (struct skill_unit *src, struct block_list *bl, int64 tick);
+ int (*unit_ondamaged) (struct skill_unit *src, struct block_list *bl, int64 damage, int64 tick);
int (*cast_fix) ( struct block_list *bl, uint16 skill_id, uint16 skill_lv);
int (*cast_fix_sc) ( struct block_list *bl, int time);
int (*vf_cast_fix) ( struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv);
@@ -1912,12 +1912,12 @@ struct skill_interface {
int (*consume_requirement) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type);
struct skill_condition (*get_requirement) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
int (*check_pc_partner) (struct map_session_data *sd, uint16 skill_id, uint16* skill_lv, int range, int cast_flag);
- int (*unit_move) (struct block_list *bl,unsigned int tick,int flag);
- int (*unit_onleft) (uint16 skill_id, struct block_list *bl,unsigned int tick);
- int (*unit_onout) (struct skill_unit *src, struct block_list *bl, unsigned int tick);
+ int (*unit_move) (struct block_list *bl, int64 tick, int flag);
+ int (*unit_onleft) (uint16 skill_id, struct block_list *bl, int64 tick);
+ int (*unit_onout) (struct skill_unit *src, struct block_list *bl, int64 tick);
int (*unit_move_unit_group) ( struct skill_unit_group *group, int16 m,int16 dx,int16 dy);
int (*sit) (struct map_session_data *sd, int type);
- void (*brandishspear) (struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag);
+ void (*brandishspear) (struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag);
void (*repairweapon) (struct map_session_data *sd, int idx);
void (*identify) (struct map_session_data *sd,int idx);
void (*weaponrefine) (struct map_session_data *sd,int idx);
@@ -1932,25 +1932,25 @@ struct skill_interface {
int (*can_produce_mix) ( struct map_session_data *sd, int nameid, int trigger, int qty);
int (*produce_mix) ( struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty );
int (*arrow_create) ( struct map_session_data *sd,int nameid);
- int (*castend_nodamage_id) ( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag );
- int (*castend_damage_id) ( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag );
- int (*castend_pos2) ( struct block_list *src, int x,int y,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag);
+ int (*castend_nodamage_id) (struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag);
+ int (*castend_damage_id) (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick,int flag);
+ int (*castend_pos2) (struct block_list *src, int x, int y, uint16 skill_id, uint16 skill_lv, int64 tick, int flag);
int (*blockpc_start) (struct map_session_data *sd, uint16 skill_id, int tick);
int (*blockhomun_start) (struct homun_data *hd, uint16 skill_id, int tick);
int (*blockmerc_start) (struct mercenary_data *md, uint16 skill_id, int tick);
- int (*attack) ( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag );
+ int (*attack) (int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag);
int (*attack_area) (struct block_list *bl,va_list ap);
int (*area_sub) (struct block_list *bl, va_list ap);
- int (*area_sub_count) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag);
+ int (*area_sub_count) (struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 tick, int flag);
int (*check_unit_range) (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv);
int (*check_unit_range_sub) (struct block_list *bl, va_list ap);
int (*check_unit_range2) (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv);
int (*check_unit_range2_sub) (struct block_list *bl, va_list ap);
void (*toggle_magicpower) (struct block_list *bl, uint16 skill_id);
int (*magic_reflect) (struct block_list* src, struct block_list* bl, int type);
- int (*onskillusage) (struct map_session_data *sd, struct block_list *bl, uint16 skill_id, unsigned int tick);
+ int (*onskillusage) (struct map_session_data *sd, struct block_list *bl, uint16 skill_id, int64 tick);
int (*cell_overlap) (struct block_list *bl, va_list ap);
- int (*timerskill) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*timerskill) (int tid, int64 tick, int id, intptr_t data);
int (*trap_splash) (struct block_list *bl, va_list ap);
int (*check_condition_mercenary) (struct block_list *bl, int skill_id, int lv, int type);
struct skill_unit_group *(*locate_element_field) (struct block_list *bl);
@@ -1963,26 +1963,26 @@ struct skill_interface {
int (*greed) (struct block_list *bl, va_list ap);
int (*destroy_trap) ( struct block_list *bl, va_list ap );
int (*icewall_block) (struct block_list *bl,va_list ap);
- struct skill_unit_group_tickset *(*unitgrouptickset_search) (struct block_list *bl, struct skill_unit_group *group, int tick);
+ struct skill_unit_group_tickset *(*unitgrouptickset_search) (struct block_list *bl, struct skill_unit_group *group, int64 tick);
bool (*dance_switch) (struct skill_unit* su, int flag);
int (*check_condition_char_sub) (struct block_list *bl, va_list ap);
int (*check_condition_mob_master_sub) (struct block_list *bl, va_list ap);
void (*brandishspear_first) (struct square *tc, uint8 dir, int16 x, int16 y);
void (*brandishspear_dir) (struct square* tc, uint8 dir, int are);
- int (*get_fixed_cast) ( uint16 skill_id ,uint16 skill_lv );
+ int (*get_fixed_cast) ( uint16 skill_id ,uint16 skill_lv );
int (*sit_count) (struct block_list *bl, va_list ap);
int (*sit_in) (struct block_list *bl, va_list ap);
int (*sit_out) (struct block_list *bl, va_list ap);
void (*unitsetmapcell) (struct skill_unit *src, uint16 skill_id, uint16 skill_lv, cell_t cell, bool flag);
- int (*unit_onplace_timer) (struct skill_unit *src, struct block_list *bl, unsigned int tick);
+ int (*unit_onplace_timer) (struct skill_unit *src, struct block_list *bl, int64 tick);
int (*unit_effect) (struct block_list* bl, va_list ap);
int (*unit_timer_sub_onplace) (struct block_list* bl, va_list ap);
int (*unit_move_sub) (struct block_list* bl, va_list ap);
- int (*blockpc_end) (int tid, unsigned int tick, int id, intptr_t data);
- int (*blockhomun_end) (int tid, unsigned int tick, int id, intptr_t data);
- int (*blockmerc_end) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*blockpc_end) (int tid, int64 tick, int id, intptr_t data);
+ int (*blockhomun_end) (int tid, int64 tick, int id, intptr_t data);
+ int (*blockmerc_end) (int tid, int64 tick, int id, intptr_t data);
int (*split_atoi) (char *str, int *val);
- int (*unit_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*unit_timer) (int tid, int64 tick, int id, intptr_t data);
int (*unit_timer_sub) (DBKey key, DBData *data, va_list ap);
void (*init_unit_layout) (void);
bool (*parse_row_skilldb) (char* split[], int columns, int current);
diff --git a/src/map/status.c b/src/map/status.c
index 5f6444971..fc032686e 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -7806,7 +7806,13 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = 11-val1; //Chance to consume: 11-skill_lv%
break;
case SC_RUN:
- val4 = timer->gettick(); //Store time at which you started running.
+ {
+ //Store time at which you started running.
+ int64 currenttick = timer->gettick();
+ // Note: this int64 value is stored in two separate int32 variables (FIXME)
+ val3 = (int)(currenttick&0x00000000ffffffff);
+ val4 = (int)((currenttick&0xffffffff00000000)>>32);
+ }
tick = -1;
break;
case SC_KAAHI:
@@ -8189,7 +8195,13 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick_time = 1000; // [GodLesZ] tick time
break;
case SC_WUGDASH:
- val4 = timer->gettick(); //Store time at which you started running.
+ {
+ //Store time at which you started running.
+ int64 currenttick = timer->gettick();
+ // Note: this int64 value is stored in two separate int32 variables (FIXME)
+ val3 = (int)(currenttick&0x00000000ffffffff);
+ val4 = (int)((currenttick&0xffffffff00000000)>>32);
+ }
tick = -1;
break;
case SC__SHADOWFORM: {
@@ -9315,6 +9327,10 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
{
struct unit_data *ud = unit->bl2ud(bl);
bool begin_spurt = true;
+ // Note: this int64 value is stored in two separate int32 variables (FIXME)
+ int64 starttick = (int64)sce->val3&0x00000000ffffffff;
+ starttick |= ((int64)sce->val4<<32)&0xffffffff00000000;
+
if (ud) {
if(!ud->state.running)
begin_spurt = false;
@@ -9323,7 +9339,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
unit->stop_walking(bl,1);
}
if (begin_spurt && sce->val1 >= 7
- && DIFF_TICK(timer->gettick(), sce->val4) <= 1000
+ && DIFF_TICK(timer->gettick(), starttick) <= 1000
&& (!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0))
)
sc_start(bl,SC_STRUP,100,sce->val1,skill->get_time2(status->sc2skill(type), sce->val1));
@@ -9932,7 +9948,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
return 1;
}
-int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int kaahi_heal_timer(int tid, int64 tick, int id, intptr_t data) {
struct block_list *bl;
struct status_change *sc;
struct status_change_entry *sce;
@@ -9970,7 +9986,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
* For recusive status, like for each 5s we drop sp etc.
* Reseting the end timer.
*------------------------------------------*/
-int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
enum sc_type type = (sc_type)data;
struct block_list *bl;
struct map_session_data *sd;
@@ -10786,7 +10802,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) {
struct block_list* src = va_arg(ap,struct block_list*);
struct status_change_entry* sce = va_arg(ap,struct status_change_entry*);
enum sc_type type = (sc_type)va_arg(ap,int); //gcc: enum args get promoted to int
- unsigned int tick = va_arg(ap,unsigned int);
+ int64 tick = va_arg(ap, int64);
if (status->isdead(bl))
return 0;
@@ -11040,7 +11056,7 @@ int status_change_clear_buffs (struct block_list* bl, int type) {
int status_change_spread( struct block_list *src, struct block_list *bl ) {
int i, flag = 0;
struct status_change *sc = status->get_sc(src);
- unsigned int tick;
+ int64 tick;
struct status_change_data data;
if( !sc || !sc->count )
@@ -11082,7 +11098,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) {
const struct TimerData *td = timer->get(sc->data[i]->timer);
if (td == NULL || td->func != status->change_timer || DIFF_TICK(td->tick,tick) < 0)
continue;
- data.tick = DIFF_TICK(td->tick,tick);
+ data.tick = DIFF_TICK32(td->tick,tick);
} else
data.tick = INVALID_TIMER;
break;
@@ -11310,8 +11326,9 @@ int status_natural_heal(struct block_list* bl, va_list args) {
}
//Natural heal main timer.
-int status_natural_heal_timer(int tid, unsigned int tick, int id, intptr_t data) {
- status->natural_heal_diff_tick = DIFF_TICK(tick,status->natural_heal_prev_tick);
+int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) {
+ // This difference is always positive and lower than UINT_MAX (~24 days)
+ status->natural_heal_diff_tick = (unsigned int)cap_value(DIFF_TICK(tick,status->natural_heal_prev_tick), 0, UINT_MAX);
map->foreachregen(status->natural_heal);
status->natural_heal_prev_tick = tick;
return 0;
diff --git a/src/map/status.h b/src/map/status.h
index 9b1721d1a..9edf29d2c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1858,7 +1858,8 @@ struct status_interface {
sc_conf_type sc_conf[SC_MAX];
struct eri *data_ers; //For sc_data entries
struct status_data dummy;
- unsigned int natural_heal_prev_tick,natural_heal_diff_tick;
+ int64 natural_heal_prev_tick;
+ unsigned int natural_heal_diff_tick;
/* */
int (*init) (void);
void (*final) (void);
@@ -1902,8 +1903,8 @@ struct status_interface {
int (*get_sc_def) (struct block_list *bl, enum sc_type type, int rate, int tick, int flag);
int (*change_start) (struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,int tick,int flag);
int (*change_end_) (struct block_list* bl, enum sc_type type, int tid, const char* file, int line);
- int (*kaahi_heal_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*change_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*kaahi_heal_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*change_timer) (int tid, int64 tick, int id, intptr_t data);
int (*change_timer_sub) (struct block_list* bl, va_list ap);
int (*change_clear) (struct block_list* bl, int type);
int (*change_clear_buffs) (struct block_list* bl, int type);
@@ -1967,7 +1968,7 @@ struct status_interface {
void (*display_add) (struct map_session_data *sd, enum sc_type type, int dval1, int dval2, int dval3);
void (*display_remove) (struct map_session_data *sd, enum sc_type type);
int (*natural_heal) (struct block_list *bl, va_list args);
- int (*natural_heal_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*natural_heal_timer) (int tid, int64 tick, int id, intptr_t data);
bool (*readdb_job1) (char *fields[], int columns, int current);
bool (*readdb_job2) (char *fields[], int columns, int current);
bool (*readdb_sizefix) (char *fields[], int columns, int current);
diff --git a/src/map/unit.c b/src/map/unit.c
index a9cbd605e..7b4ac2c50 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -82,9 +82,6 @@ struct unit_data* unit_bl2ud2(struct block_list *bl) {
return unit->bl2ud(bl);
}
-int unit_attack_timer(int tid, unsigned int tick, int id, intptr_t data);
-int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data);
-
int unit_walktoxy_sub(struct block_list *bl)
{
int i;
@@ -137,7 +134,7 @@ int unit_walktoxy_sub(struct block_list *bl)
return 1;
}
-int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
int i;
int x,y,dx,dy;
uint8 dir;
@@ -322,7 +319,7 @@ int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data) {
return 0;
}
-int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
struct block_list *bl = map->id2bl(id);
if (!bl || bl->prev == NULL)
@@ -402,7 +399,7 @@ static inline void set_mobstate(struct block_list* bl, int flag)
md->state.skillstate = md->state.aggressive ? MSS_FOLLOW : MSS_RUSH;
}
-int unit_walktobl_sub(int tid, unsigned int tick, int id, intptr_t data) {
+int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data) {
struct block_list *bl = map->id2bl(id);
struct unit_data *ud = bl?unit->bl2ud(bl):NULL;
@@ -854,7 +851,7 @@ int unit_stop_walking(struct block_list *bl,int type)
{
struct unit_data *ud;
const struct TimerData* td;
- unsigned int tick;
+ int64 tick;
nullpo_ret(bl);
ud = unit->bl2ud(bl);
@@ -1001,7 +998,7 @@ int unit_can_move(struct block_list *bl) {
* Resume running after a walk delay
*------------------------------------------*/
-int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data) {
+int unit_resume_running(int tid, int64 tick, int id, intptr_t data) {
struct unit_data *ud = (struct unit_data *)data;
TBL_PC * sd = map->id2sd(id);
@@ -1025,8 +1022,7 @@ int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data) {
* if type is 0, this is a damage induced delay: if previous delay is active, do not change it.
* if type is 1, this is a skill induced delay: walk-delay may only be increased, not decreased.
*------------------------------------------*/
-int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type)
-{
+int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) {
struct unit_data *ud = unit->bl2ud(bl);
if (delay <= 0 || !ud) return 0;
@@ -1073,7 +1069,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
struct status_change *sc;
struct map_session_data *sd = NULL;
struct block_list * target = NULL;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
int temp = 0, range;
nullpo_ret(src);
@@ -1437,7 +1433,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
struct unit_data *ud = NULL;
struct status_change *sc;
struct block_list bl;
- unsigned int tick = timer->gettick();
+ int64 tick = timer->gettick();
int range;
nullpo_ret(src);
@@ -1795,8 +1791,7 @@ int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir)
/*==========================================
* Continuous Attack (function timer)
*------------------------------------------*/
-int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
-{
+int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
struct block_list *target;
struct unit_data *ud;
struct status_data *sstatus;
@@ -1923,7 +1918,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
return 1;
}
-int unit_attack_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int unit_attack_timer(int tid, int64 tick, int id, intptr_t data) {
struct block_list *bl;
bl = map->id2bl(id);
if(bl && unit->attack_timer_sub(bl, tid, tick) == 0)
@@ -1940,7 +1935,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
{
struct map_session_data *sd = NULL;
struct unit_data *ud = unit->bl2ud( bl);
- unsigned int tick=timer->gettick();
+ int64 tick = timer->gettick();
int ret=0, skill_id;
nullpo_ret(bl);
@@ -2021,8 +2016,7 @@ int unit_counttargeted(struct block_list* bl)
/*==========================================
*
*------------------------------------------*/
-int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int64 damage,int div,int type,int64 damage2)
-{
+int unit_fixdamage(struct block_list *src, struct block_list *target, int64 tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2) {
nullpo_ret(target);
if(damage+damage2 <= 0)
diff --git a/src/map/unit.h b/src/map/unit.h
index be7b789d9..0567688a1 100644
--- a/src/map/unit.h
+++ b/src/map/unit.h
@@ -30,10 +30,10 @@ struct unit_data {
int target_to;
int attacktimer;
int walktimer;
- int chaserange;
- unsigned int attackabletime;
- unsigned int canact_tick;
- unsigned int canmove_tick;
+ int chaserange;
+ int64 attackabletime;
+ int64 canact_tick;
+ int64 canmove_tick;
uint8 dir;
unsigned char walk_count;
unsigned char target_count;
@@ -77,12 +77,12 @@ struct unit_interface {
/* */
struct unit_data* (*bl2ud) (struct block_list *bl);
struct unit_data* (*bl2ud2) (struct block_list *bl);
- int (*attack_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*walktoxy_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*attack_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*walktoxy_timer) (int tid, int64 tick, int id, intptr_t data);
int (*walktoxy_sub) (struct block_list *bl);
- int (*delay_walktoxy_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*delay_walktoxy_timer) (int tid, int64 tick, int id, intptr_t data);
int (*walktoxy) (struct block_list *bl, short x, short y, int flag);
- int (*walktobl_sub) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*walktobl_sub) (int tid, int64 tick, int id, intptr_t data);
int (*walktobl) (struct block_list *bl, struct block_list *tbl, int range, int flag);
int (*run) (struct block_list *bl);
int (*wugdash) (struct block_list *bl, struct map_session_data *sd);
@@ -96,8 +96,8 @@ struct unit_interface {
int (*skilluse_id) (struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv);
int (*is_walking) (struct block_list *bl);
int (*can_move) (struct block_list *bl);
- int (*resume_running) (int tid, unsigned int tick, int id, intptr_t data);
- int (*set_walkdelay) (struct block_list *bl, unsigned int tick, int delay, int type);
+ int (*resume_running) (int tid, int64 tick, int id, intptr_t data);
+ int (*set_walkdelay) (struct block_list *bl, int64 tick, int delay, int type);
int (*skilluse_id2) (struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel);
int (*skilluse_pos) (struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv);
int (*skilluse_pos2) (struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel);
@@ -109,11 +109,11 @@ struct unit_interface {
bool (*can_reach_pos) (struct block_list *bl, int x, int y, int easy);
bool (*can_reach_bl) (struct block_list *bl, struct block_list *tbl, int range, int easy, short *x, short *y);
int (*calc_pos) (struct block_list *bl, int tx, int ty, uint8 dir);
- int (*attack_timer_sub) (struct block_list *src, int tid, unsigned int tick);
+ int (*attack_timer_sub) (struct block_list *src, int tid, int64 tick);
int (*skillcastcancel) (struct block_list *bl, int type);
void (*dataset) (struct block_list *bl);
int (*counttargeted) (struct block_list *bl);
- int (*fixdamage) (struct block_list *src, struct block_list *target, unsigned int tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2);
+ int (*fixdamage) (struct block_list *src, struct block_list *target, int64 tick, int sdelay, int ddelay, int64 damage, int div, int type, int64 damage2);
int (*changeviewsize) (struct block_list *bl, short size);
int (*remove_map) (struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func);
void (*remove_map_pc) (struct map_session_data *sd, clr_type clrtype);