summaryrefslogtreecommitdiff
path: root/src/map/duel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/duel.c')
-rw-r--r--src/map/duel.c110
1 files changed, 50 insertions, 60 deletions
diff --git a/src/map/duel.c b/src/map/duel.c
index c3b241e9e..1291dd02b 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -17,25 +17,23 @@
/*==========================================
* Duel organizing functions [LuzZza]
*------------------------------------------*/
-void duel_savetime(struct map_session_data* sd)
-{
- time_t timer;
+void duel_savetime(struct map_session_data* sd) {
+ time_t clock;
struct tm *t;
- time(&timer);
- t = localtime(&timer);
+ time(&clock);
+ t = localtime(&clock);
pc_setglobalreg(sd, "PC_LAST_DUEL_TIME", t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min);
}
-int duel_checktime(struct map_session_data* sd)
-{
+int duel_checktime(struct map_session_data* sd) {
int diff;
- time_t timer;
+ time_t clock;
struct tm *t;
- time(&timer);
- t = localtime(&timer);
+ time(&clock);
+ t = localtime(&clock);
diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, "PC_LAST_DUEL_TIME");
@@ -54,40 +52,38 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
return 1;
}
-void duel_showinfo(const unsigned int did, struct map_session_data* sd)
-{
+void duel_showinfo(const unsigned int did, struct map_session_data* sd) {
int p=0;
char output[256];
- if(iDuel->duel_list[did].max_players_limit > 0)
+ if(duel->list[did].max_players_limit > 0)
sprintf(output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
- did, iDuel->duel_count,
- iDuel->duel_list[did].members_count,
- iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count,
- iDuel->duel_list[did].max_players_limit);
+ did, duel->count,
+ duel->list[did].members_count,
+ duel->list[did].members_count + duel->list[did].invites_count,
+ duel->list[did].max_players_limit);
else
sprintf(output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --"
- did, iDuel->duel_count,
- iDuel->duel_list[did].members_count,
- iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count);
+ did, duel->count,
+ duel->list[did].members_count,
+ duel->list[did].members_count + duel->list[did].invites_count);
clif->disp_onlyself(sd, output, strlen(output));
iMap->map_foreachpc(duel_showinfo_sub, sd, &p);
}
-int duel_create(struct map_session_data* sd, const unsigned int maxpl)
-{
+int duel_create(struct map_session_data* sd, const unsigned int maxpl) {
int i=1;
char output[256];
- while(iDuel->duel_list[i].members_count > 0 && i < MAX_DUEL) i++;
+ while(duel->list[i].members_count > 0 && i < MAX_DUEL) i++;
if(i == MAX_DUEL) return 0;
- iDuel->duel_count++;
+ duel->count++;
sd->duel_group = i;
- iDuel->duel_list[i].members_count++;
- iDuel->duel_list[i].invites_count = 0;
- iDuel->duel_list[i].max_players_limit = maxpl;
+ duel->list[i].members_count++;
+ duel->list[i].invites_count = 0;
+ duel->list[i].max_players_limit = maxpl;
strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --"
clif->disp_onlyself(sd, output, strlen(output));
@@ -97,8 +93,7 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl)
return i;
}
-void duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd)
-{
+void duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd) {
char output[256];
// " -- Player %s invites %s to duel --"
@@ -106,7 +101,7 @@ void duel_invite(const unsigned int did, struct map_session_data* sd, struct map
clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
target_sd->duel_invite = did;
- iDuel->duel_list[did].invites_count++;
+ duel->list[did].invites_count++;
// "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
sprintf(output, msg_txt(374), sd->status.name);
@@ -121,19 +116,18 @@ static int duel_leave_sub(struct map_session_data* sd, va_list va)
return 0;
}
-void duel_leave(const unsigned int did, struct map_session_data* sd)
-{
+void duel_leave(const unsigned int did, struct map_session_data* sd) {
char output[256];
// " <- Player %s has left duel --"
sprintf(output, msg_txt(375), sd->status.name);
clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
- iDuel->duel_list[did].members_count--;
+ duel->list[did].members_count--;
- if(iDuel->duel_list[did].members_count == 0) {
+ if(duel->list[did].members_count == 0) {
iMap->map_foreachpc(duel_leave_sub, did);
- iDuel->duel_count--;
+ duel->count--;
}
sd->duel_group = 0;
@@ -142,13 +136,12 @@ void duel_leave(const unsigned int did, struct map_session_data* sd)
clif->maptypeproperty2(&sd->bl,SELF);
}
-void duel_accept(const unsigned int did, struct map_session_data* sd)
-{
+void duel_accept(const unsigned int did, struct map_session_data* sd) {
char output[256];
- iDuel->duel_list[did].members_count++;
+ duel->list[did].members_count++;
sd->duel_group = sd->duel_invite;
- iDuel->duel_list[did].invites_count--;
+ duel->list[did].invites_count--;
sd->duel_invite = 0;
// " -> Player %s has accepted duel --"
@@ -159,25 +152,22 @@ void duel_accept(const unsigned int did, struct map_session_data* sd)
clif->maptypeproperty2(&sd->bl,SELF);
}
-void duel_reject(const unsigned int did, struct map_session_data* sd)
-{
+void duel_reject(const unsigned int did, struct map_session_data* sd) {
char output[256];
// " -- Player %s has rejected duel --"
sprintf(output, msg_txt(377), sd->status.name);
clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
- iDuel->duel_list[did].invites_count--;
+ duel->list[did].invites_count--;
sd->duel_invite = 0;
}
-void do_final_duel(void)
-{
+void do_final_duel(void) {
}
-void do_init_duel(void)
-{
- memset(&iDuel->duel_list[0], 0, sizeof(iDuel->duel_list));
+void do_init_duel(void) {
+ memset(&duel->list[0], 0, sizeof(duel->list));
}
/*=====================================
@@ -185,20 +175,20 @@ void do_init_duel(void)
* Generated by HerculesInterfaceMaker
* created by Susu
*-------------------------------------*/
-void iDuel_defaults(void) {
- iDuel = &iDuel_s;
+void duel_defaults(void) {
+ duel = &duel_s;
/* vars */
- iDuel->duel_count = 0;
+ duel->count = 0;
/* funcs */
//Duel functions // [LuzZza]
- iDuel->create = duel_create;
- iDuel->invite = duel_invite;
- iDuel->accept = duel_accept;
- iDuel->reject = duel_reject;
- iDuel->leave = duel_leave;
- iDuel->showinfo = duel_showinfo;
- iDuel->checktime = duel_checktime;
-
- iDuel->do_init_duel = do_init_duel;
- iDuel->do_final_duel = do_final_duel;
+ duel->create = duel_create;
+ duel->invite = duel_invite;
+ duel->accept = duel_accept;
+ duel->reject = duel_reject;
+ duel->leave = duel_leave;
+ duel->showinfo = duel_showinfo;
+ duel->checktime = duel_checktime;
+
+ duel->init = do_init_duel;
+ duel->final = do_final_duel;
}