diff options
Diffstat (limited to 'src/map/duel.c')
-rw-r--r-- | src/map/duel.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/map/duel.c b/src/map/duel.c index 21f5c0c93..e18e2fc45 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -26,10 +26,10 @@ struct duel_interface *duel; void duel_savetime(struct map_session_data* sd) { time_t clock; struct tm *t; - + time(&clock); t = localtime(&clock); - + pc_setglobalreg(sd, script->add_str("PC_LAST_DUEL_TIME"), t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min); } @@ -37,12 +37,12 @@ int duel_checktime(struct map_session_data* sd) { int diff; time_t clock; struct tm *t; - + time(&clock); t = localtime(&clock); - + diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, script->add_str("PC_LAST_DUEL_TIME") ); - + return !(diff >= 0 && diff < battle_config.duel_time_interval); } @@ -55,7 +55,7 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va) nullpo_retr(1, sd); nullpo_retr(1, ssd); if (sd->duel_group != ssd->duel_group) return 0; - + sprintf(output, " %d. %s", ++(*p), sd->status.name); clif_disp_onlyself(ssd, output, strlen(output)); return 1; @@ -84,21 +84,21 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd) { int duel_create(struct map_session_data* sd, const unsigned int maxpl) { int i=1; char output[256]; - + nullpo_ret(sd); while(i < MAX_DUEL && duel->list[i].members_count > 0) i++; if(i == MAX_DUEL) return 0; - + duel->count++; sd->duel_group = i; duel->list[i].members_count++; duel->list[i].invites_count = 0; duel->list[i].max_players_limit = maxpl; - + safestrncpy(output, msg_sd(sd,372), sizeof(output)); // " -- Duel has been created (@invite/@leave) --" clif_disp_onlyself(sd, output, strlen(output)); - + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); clif->maptypeproperty2(&sd->bl,SELF); return i; @@ -115,7 +115,7 @@ void duel_invite(const unsigned int did, struct map_session_data* sd, struct map target_sd->duel_invite = did; duel->list[did].invites_count++; - + // "Blue -- Player %s invites you to PVP duel (@accept/@reject) --" sprintf(output, msg_sd(target_sd,374), sd->status.name); clif->broadcast((struct block_list *)target_sd, output, strlen(output)+1, BC_BLUE, SELF); @@ -132,19 +132,18 @@ static int duel_leave_sub(struct map_session_data* sd, va_list va) void duel_leave(const unsigned int did, struct map_session_data* sd) { char output[256]; - + nullpo_retv(sd); // " <- Player %s has left duel --" sprintf(output, msg_sd(sd,375), sd->status.name); clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS); - + duel->list[did].members_count--; - if(duel->list[did].members_count == 0) { map->foreachpc(duel_leave_sub, did); duel->count--; } - + sd->duel_group = 0; duel_savetime(sd); clif->map_property(sd, MAPPROPERTY_NOTHING); @@ -153,13 +152,13 @@ void duel_leave(const unsigned int did, struct map_session_data* sd) { void duel_accept(const unsigned int did, struct map_session_data* sd) { char output[256]; - + nullpo_retv(sd); duel->list[did].members_count++; sd->duel_group = sd->duel_invite; duel->list[did].invites_count--; sd->duel_invite = 0; - + // " -> Player %s has accepted duel --" sprintf(output, msg_sd(sd,376), sd->status.name); clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS); @@ -170,12 +169,12 @@ void duel_accept(const unsigned int did, struct map_session_data* sd) { void duel_reject(const unsigned int did, struct map_session_data* sd) { char output[256]; - + nullpo_retv(sd); // " -- Player %s has rejected duel --" sprintf(output, msg_sd(sd,377), sd->status.name); clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS); - + duel->list[did].invites_count--; sd->duel_invite = 0; } |