summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-25 00:50:57 +0200
committerHaru <haru@dotalux.com>2013-09-25 00:50:57 +0200
commita67007e744f44a74746e0b658160ddc8179d2c0a (patch)
treed6536346cdc16eb7c6ab1759be23ca9983fb0012 /src
parent44c9ba35b0bc2d9f4dc82db20be824e6e0d320e7 (diff)
downloadhercules-a67007e744f44a74746e0b658160ddc8179d2c0a.tar.gz
hercules-a67007e744f44a74746e0b658160ddc8179d2c0a.tar.bz2
hercules-a67007e744f44a74746e0b658160ddc8179d2c0a.tar.xz
hercules-a67007e744f44a74746e0b658160ddc8179d2c0a.zip
Renamed iDuel interface to duel
- Note to plugin developers: change your GET_SYMBOL("iDuel") to GET_SYMBOL("duel"). Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c45
-rw-r--r--src/map/duel.c92
-rw-r--r--src/map/duel.h14
-rw-r--r--src/map/map.c8
-rw-r--r--src/map/pc.c4
-rw-r--r--src/map/unit.c4
6 files changed, 77 insertions, 90 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 948ce786f..46c70ef1a 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -7739,8 +7739,7 @@ ACMD(showdelay)
* @reject - reject invitation
* @leave - leave duel
*------------------------------------------*/
-ACMD(invite)
-{
+ACMD(invite) {
unsigned int did = sd->duel_group;
struct map_session_data *target_sd = iMap->nick2sd((char *)message);
@@ -7750,8 +7749,8 @@ ACMD(invite)
return true;
}
- if(iDuel->duel_list[did].max_players_limit > 0 &&
- iDuel->duel_list[did].members_count >= iDuel->duel_list[did].max_players_limit) {
+ if(duel->list[did].max_players_limit > 0 &&
+ duel->list[did].members_count >= duel->list[did].max_players_limit) {
// "Duel: Limit of players is reached."
clif->message(fd, msg_txt(351));
@@ -7777,18 +7776,17 @@ ACMD(invite)
return true;
}
- iDuel->invite(did, sd, target_sd);
+ duel->invite(did, sd, target_sd);
// "Duel: Invitation has been sent."
clif->message(fd, msg_txt(354));
return true;
}
-ACMD(duel)
-{
+ACMD(duel) {
unsigned int maxpl = 0;
if(sd->duel_group > 0) {
- iDuel->showinfo(sd->duel_group, sd);
+ duel->showinfo(sd->duel_group, sd);
return true;
}
@@ -7798,7 +7796,7 @@ ACMD(duel)
return true;
}
- if(!iDuel->checktime(sd)) {
+ if(!duel->checktime(sd)) {
char output[CHAT_SIZE_MAX];
// "Duel: You can take part in duel only one time per %d minutes."
sprintf(output, msg_txt(356), battle_config.duel_time_interval);
@@ -7812,18 +7810,18 @@ ACMD(duel)
clif->message(fd, msg_txt(357)); // "Duel: Invalid value."
return true;
}
- iDuel->create(sd, maxpl);
+ duel->create(sd, maxpl);
} else {
struct map_session_data *target_sd;
target_sd = iMap->nick2sd((char *)message);
if(target_sd != NULL) {
unsigned int newduel;
- if((newduel = iDuel->create(sd, 2)) != -1) {
+ if((newduel = duel->create(sd, 2)) != -1) {
if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
clif->message(fd, msg_txt(353)); // "Duel: Player already in duel."
return true;
}
- iDuel->invite(newduel, sd, target_sd);
+ duel->invite(newduel, sd, target_sd);
clif->message(fd, msg_txt(354)); // "Duel: Invitation has been sent."
}
} else {
@@ -7833,28 +7831,26 @@ ACMD(duel)
}
}
} else
- iDuel->create(sd, 0);
+ duel->create(sd, 0);
return true;
}
-ACMD(leave)
-{
+ACMD(leave) {
if(sd->duel_group <= 0) {
// "Duel: @leave without @duel."
clif->message(fd, msg_txt(358));
return true;
}
- iDuel->leave(sd->duel_group, sd);
+ duel->leave(sd->duel_group, sd);
clif->message(fd, msg_txt(359)); // "Duel: You left the duel."
return true;
}
-ACMD(accept)
-{
- if(!iDuel->checktime(sd)) {
+ACMD(accept) {
+ if(!duel->checktime(sd)) {
char output[CHAT_SIZE_MAX];
// "Duel: You can take part in duel only one time per %d minutes."
sprintf(output, msg_txt(356), battle_config.duel_time_interval);
@@ -7868,28 +7864,27 @@ ACMD(accept)
return true;
}
- if( iDuel->duel_list[sd->duel_invite].max_players_limit > 0 && iDuel->duel_list[sd->duel_invite].members_count >= iDuel->duel_list[sd->duel_invite].max_players_limit )
- {
+ if( duel->list[sd->duel_invite].max_players_limit > 0
+ && duel->list[sd->duel_invite].members_count >= duel->list[sd->duel_invite].max_players_limit ) {
// "Duel: Limit of players is reached."
clif->message(fd, msg_txt(351));
return true;
}
- iDuel->accept(sd->duel_invite, sd);
+ duel->accept(sd->duel_invite, sd);
// "Duel: Invitation has been accepted."
clif->message(fd, msg_txt(361));
return true;
}
-ACMD(reject)
-{
+ACMD(reject) {
if(sd->duel_invite <= 0) {
// "Duel: @reject without invititation."
clif->message(fd, msg_txt(362));
return true;
}
- iDuel->reject(sd->duel_invite, sd);
+ duel->reject(sd->duel_invite, sd);
// "Duel: Invitation has been rejected."
clif->message(fd, msg_txt(363));
return true;
diff --git a/src/map/duel.c b/src/map/duel.c
index c3b241e9e..8be1baf5c 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -54,40 +54,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 +95,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 +103,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 +118,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 +138,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 +154,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 +177,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;
}
diff --git a/src/map/duel.h b/src/map/duel.h
index 9fa33833a..7802f6163 100644
--- a/src/map/duel.h
+++ b/src/map/duel.h
@@ -21,8 +21,8 @@ struct duel {
struct duel_interface {
/* vars */
- struct duel duel_list[MAX_DUEL];
- int duel_count;
+ struct duel list[MAX_DUEL];
+ int count;
/* funcs */
//Duel functions // [LuzZza]
@@ -34,12 +34,12 @@ struct duel_interface {
void (*showinfo) (const unsigned int did, struct map_session_data* sd);
int (*checktime) (struct map_session_data* sd);
- void (*do_init_duel) (void);
- void (*do_final_duel) (void);
-} iDuel_s;
+ void (*init) (void);
+ void (*final) (void);
+} duel_s;
-struct duel_interface *iDuel;
+struct duel_interface *duel;
-void iDuel_defaults(void);
+void duel_defaults(void);
#endif /* _DUEL_H_ */
diff --git a/src/map/map.c b/src/map/map.c
index eff45f472..6c9cd5828 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -4941,7 +4941,7 @@ void do_final(void)
iStatus->do_final_status();
unit->final();
bg->final();
- iDuel->do_final_duel();
+ duel->final();
elemental->do_final_elemental();
do_final_maps();
vending->final();
@@ -5153,7 +5153,7 @@ void map_hp_symbols(void) {
HPM->share(trade,"trade");
HPM->share(iStatus,"iStatus");
HPM->share(chat, "chat");
- HPM->share(iDuel,"iDuel");
+ HPM->share(duel,"duel");
HPM->share(elemental,"elemental");
HPM->share(intif,"intif");
HPM->share(mercenary,"mercenary");
@@ -5207,7 +5207,7 @@ void map_load_defaults(void) {
trade_defaults();
status_defaults();
chat_defaults();
- iDuel_defaults();
+ duel_defaults();
elemental_defaults();
intif_defaults();
mercenary_defaults();
@@ -5422,7 +5422,7 @@ int do_init(int argc, char *argv[])
npc->init();
unit->init();
bg->init();
- iDuel->do_init_duel();
+ duel->init();
vending->init();
npc->event_do_oninit(); // Init npcs (OnInit)
diff --git a/src/map/pc.c b/src/map/pc.c
index b5bceb2c7..45b4c4c25 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6734,9 +6734,9 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
// Leave duel if you die [LuzZza]
if(battle_config.duel_autoleave_when_die) {
if(sd->duel_group > 0)
- iDuel->leave(sd->duel_group, sd);
+ duel->leave(sd->duel_group, sd);
if(sd->duel_invite > 0)
- iDuel->reject(sd->duel_invite, sd);
+ duel->reject(sd->duel_invite, sd);
}
if (sd->npc_id && sd->st && sd->st->state != RUN)
diff --git a/src/map/unit.c b/src/map/unit.c
index 0551baaea..1b5e2d072 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2177,7 +2177,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
sd->pvp_rank = 0;
}
if(sd->duel_group > 0)
- iDuel->leave(sd->duel_group, sd);
+ duel->leave(sd->duel_group, sd);
if(pc_issit(sd)) {
pc->setstand(sd);
@@ -2354,7 +2354,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
pc->stop_following(sd);
if( sd->duel_invite > 0 )
- iDuel->reject(sd->duel_invite, sd);
+ duel->reject(sd->duel_invite, sd);
// Notify friends that this char logged out. [Skotlex]
iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);