summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 18:13:16 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 18:13:16 +0000
commit08d47edb4cd49b4c4fa77085257127c8e2cee74a (patch)
tree9275f509d1dca8459ecaf7b6035130f67df74276 /src
parenta871325dd0d55160996124d4a67c7ba23d748be0 (diff)
downloadhercules-08d47edb4cd49b4c4fa77085257127c8e2cee74a.tar.gz
hercules-08d47edb4cd49b4c4fa77085257127c8e2cee74a.tar.bz2
hercules-08d47edb4cd49b4c4fa77085257127c8e2cee74a.tar.xz
hercules-08d47edb4cd49b4c4fa77085257127c8e2cee74a.zip
[Optimized]:
- clif_specialeffect to use the enums. [Improved]: - buildin_specialeffect and buildin_specialeffect2 to accept effect area definition. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6855 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c29
-rw-r--r--src/map/charcommand.c2
-rw-r--r--src/map/clif.c69
-rw-r--r--src/map/clif.h27
-rw-r--r--src/map/script.c8
-rw-r--r--src/map/skill.c6
6 files changed, 58 insertions, 83 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index bf0d3e2da..0b9467dea 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2378,7 +2378,7 @@ int atcommand_die(
const char* command, const char* message)
{
nullpo_retr(-1, sd);
- clif_specialeffect(&sd->bl,450,1);
+ clif_specialeffect(&sd->bl,450,SELF);
status_kill(&sd->bl);
clif_displaymessage(fd, msg_table[13]); // A pity! You've died.
@@ -4827,7 +4827,7 @@ int atcommand_doom(
struct map_session_data *pl_sd, **pl_allsd;
int i, users;
nullpo_retr(-1, sd);
- clif_specialeffect(&sd->bl,450,2);
+ clif_specialeffect(&sd->bl,450,ALL_SAMEMAP);
pl_allsd = map_getallusers(&users);
for(i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i]) && pl_sd->fd != fd && pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can doom only lower or same gm level
@@ -4851,7 +4851,7 @@ int atcommand_doommap(
struct map_session_data *pl_sd, **pl_allsd;
int i, users;
nullpo_retr(-1, sd);
- clif_specialeffect(&sd->bl,450,3);
+ clif_specialeffect(&sd->bl,450,ALL_CLIENT);
pl_allsd = map_getallusers(&users);
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i]) && pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m &&
@@ -6808,27 +6808,16 @@ int atcommand_effect(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
- struct map_session_data *pl_sd, **pl_allsd;
- int type = 0, flag = 0, i, users;
+ int type = 0, flag = 0;
nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%d %d", &type,&flag) < 2) {
clif_displaymessage(fd, "Please, enter at least a option (usage: @effect <type+>).");
return -1;
}
- if(flag <=0){
- clif_specialeffect(&sd->bl, type, flag);
- clif_displaymessage(fd, msg_table[229]); // Your effect has changed.
- }
- else{
- pl_allsd = map_getallusers(&users);
- for (i = 0; i < users; i++) {
- if ((pl_sd = pl_allsd[i])) {
- clif_specialeffect(&pl_sd->bl, type, flag);
- clif_displaymessage(pl_sd->fd, msg_table[229]); // Your effect has changed.
- }
- }
- }
+
+ clif_specialeffect(&sd->bl, type, flag);
+ clif_displaymessage(fd, msg_table[229]); // Your effect has changed.
return 0;
}
@@ -9796,10 +9785,10 @@ int atcommand_size(
if(size==1) {
sd->state.size=1;
- clif_specialeffect(&sd->bl,420,0);
+ clif_specialeffect(&sd->bl,420,AREA);
} else if(size==2) {
sd->state.size=2;
- clif_specialeffect(&sd->bl,422,0);
+ clif_specialeffect(&sd->bl,422,AREA);
}
return 0;
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index fc8c12820..610d7880a 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -890,7 +890,7 @@ charcommand_effect(const int fd, struct map_session_data* sd,
if((pl_sd=map_nick2sd((char *) target)) == NULL)
return -1;
- clif_specialeffect(&pl_sd->bl, type, 0);
+ clif_specialeffect(&pl_sd->bl, type, AREA);
clif_displaymessage(fd, msg_table[229]); // Your effect has changed.
return 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index 3f26df905..677bb3ddd 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -120,33 +120,6 @@ static const int packet_len_table[MAX_PACKET_DB] = {
3, 32, -1, 3, 3, 5, 5, 8, 2, 3, -1, -1, 4,-1, 4
};
-// local define
-enum {
- ALL_CLIENT,
- ALL_SAMEMAP,
- AREA,
- AREA_WOS,
- AREA_WOC,
- AREA_WOSC,
- AREA_CHAT_WOC,
- CHAT,
- CHAT_WOS,
- CHAT_MAINCHAT,
- PARTY,
- PARTY_WOS,
- PARTY_SAMEMAP,
- PARTY_SAMEMAP_WOS,
- PARTY_AREA,
- PARTY_AREA_WOS,
- GUILD,
- GUILD_WOS,
- GUILD_SAMEMAP, // [Valaris]
- GUILD_SAMEMAP_WOS,
- GUILD_AREA,
- GUILD_AREA_WOS, // end additions [Valaris]
- SELF
-};
-
//Converts item type in case of pet eggs.
#define itemtype(a) (a == 7)?4:a
@@ -1347,18 +1320,18 @@ int clif_spawn(struct block_list *bl)
if (sd->spiritball > 0)
clif_spiritball(sd);
if(sd->state.size==2) // tiny/big players [Valaris]
- clif_specialeffect(bl,423,0);
+ clif_specialeffect(bl,423,AREA);
else if(sd->state.size==1)
- clif_specialeffect(bl,421,0);
+ clif_specialeffect(bl,421,AREA);
}
break;
case BL_MOB:
{
TBL_MOB *md = ((TBL_MOB*)bl);
if(md->special_state.size==2) // tiny/big mobs [Valaris]
- clif_specialeffect(&md->bl,423,0);
+ clif_specialeffect(&md->bl,423,AREA);
else if(md->special_state.size==1)
- clif_specialeffect(&md->bl,421,0);
+ clif_specialeffect(&md->bl,421,AREA);
}
break;
}
@@ -1599,18 +1572,18 @@ int clif_move(struct block_list *bl) {
TBL_PC *sd = ((TBL_PC*)bl);
// clif_movepc(sd);
if(sd->state.size==2) // tiny/big players [Valaris]
- clif_specialeffect(&sd->bl,423,0);
+ clif_specialeffect(&sd->bl,423,AREA);
else if(sd->state.size==1)
- clif_specialeffect(&sd->bl,421,0);
+ clif_specialeffect(&sd->bl,421,AREA);
}
break;
case BL_MOB:
{
TBL_MOB *md = ((TBL_MOB*)bl);
if(md->special_state.size==2) // tiny/big mobs [Valaris]
- clif_specialeffect(&md->bl,423,0);
+ clif_specialeffect(&md->bl,423,AREA);
else if(md->special_state.size==1)
- clif_specialeffect(&md->bl,421,0);
+ clif_specialeffect(&md->bl,421,AREA);
}
break;
}
@@ -3864,9 +3837,9 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl)
TBL_PC* tsd = (TBL_PC*)bl;
clif_getareachar_pc(sd, tsd);
if(tsd->state.size==2) // tiny/big players [Valaris]
- clif_specialeffect(bl,423,0);
+ clif_specialeffect(bl,423,AREA);
else if(tsd->state.size==1)
- clif_specialeffect(bl,421,0);
+ clif_specialeffect(bl,421,AREA);
}
break;
case BL_NPC:
@@ -3879,9 +3852,9 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl)
{
TBL_MOB* md = (TBL_MOB*)bl;
if(md->special_state.size==2) // tiny/big mobs [Valaris]
- clif_specialeffect(bl,423,0);
+ clif_specialeffect(bl,423,AREA);
else if(md->special_state.size==1)
- clif_specialeffect(bl,421,0);
+ clif_specialeffect(bl,421,AREA);
}
break;
}
@@ -7753,22 +7726,8 @@ int clif_specialeffect(struct block_list *bl, int type, int flag)
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = type;
- switch (flag) {
- case 4:
- clif_send(buf, packet_len_table[0x1f3], bl, AREA_WOS);
- break;
- case 3:
- clif_send(buf, packet_len_table[0x1f3], bl, ALL_CLIENT);
- break;
- case 2:
- clif_send(buf, packet_len_table[0x1f3], bl, ALL_SAMEMAP);
- break;
- case 1:
- clif_send(buf, packet_len_table[0x1f3], bl, SELF);
- break;
- default:
- clif_send(buf, packet_len_table[0x1f3], bl, AREA);
- }
+ clif_send(buf, packet_len_table[0x1f3], bl, flag);
+
if (disguised(bl)) {
WBUFL(buf,2) = -bl->id;
clif_send(buf, packet_len_table[0x1f3], bl, SELF);
diff --git a/src/map/clif.h b/src/map/clif.h
index 5f1412569..da64c733a 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -28,6 +28,33 @@ struct packet_db {
short pos[20];
};
+// local define
+enum {
+ ALL_CLIENT,
+ ALL_SAMEMAP,
+ AREA,
+ AREA_WOS,
+ AREA_WOC,
+ AREA_WOSC,
+ AREA_CHAT_WOC,
+ CHAT,
+ CHAT_WOS,
+ CHAT_MAINCHAT,
+ PARTY,
+ PARTY_WOS,
+ PARTY_SAMEMAP,
+ PARTY_SAMEMAP_WOS,
+ PARTY_AREA,
+ PARTY_AREA_WOS,
+ GUILD,
+ GUILD_WOS,
+ GUILD_SAMEMAP, // [Valaris]
+ GUILD_SAMEMAP_WOS,
+ GUILD_AREA,
+ GUILD_AREA_WOS, // end additions [Valaris]
+ SELF
+};
+
extern struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB];
void clif_setip(char*);
diff --git a/src/map/script.c b/src/map/script.c
index 41d84a92a..1707b59eb 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -669,8 +669,8 @@ struct {
{buildin_petskillsupport,"petskillsupport","iiiii"}, // [Skotlex]
{buildin_skilleffect,"skilleffect","ii"}, // skill effect [Celest]
{buildin_npcskilleffect,"npcskilleffect","iiii"}, // npc skill effect [Valaris]
- {buildin_specialeffect,"specialeffect","i"}, // npc skill effect [Valaris]
- {buildin_specialeffect2,"specialeffect2","i"}, // skill effect on players[Valaris]
+ {buildin_specialeffect,"specialeffect","i*"}, // npc skill effect [Valaris]
+ {buildin_specialeffect2,"specialeffect2","i*"}, // skill effect on players[Valaris]
{buildin_nude,"nude",""}, // nude command [Valaris]
{buildin_mapwarp,"mapwarp","ssii"}, // Added by RoVeRT
{buildin_inittimer,"inittimer",""},
@@ -8646,7 +8646,7 @@ int buildin_specialeffect(struct script_state *st)
if(bl==NULL)
return 0;
- clif_specialeffect(bl,conv_num(st,& (st->stack->stack_data[st->start+2])), 0);
+ clif_specialeffect(bl,conv_num(st,& (st->stack->stack_data[st->start+2])), ((st->end > st->start+3)?conv_num(st,& (st->stack->stack_data[st->start+3])):AREA));
return 0;
}
@@ -8658,7 +8658,7 @@ int buildin_specialeffect2(struct script_state *st)
if(sd==NULL)
return 0;
- clif_specialeffect(&sd->bl,conv_num(st,& (st->stack->stack_data[st->start+2])), 0);
+ clif_specialeffect(&sd->bl,conv_num(st,& (st->stack->stack_data[st->start+2])), ((st->end > st->start+3)?conv_num(st,& (st->stack->stack_data[st->start+3])):AREA));
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 41ed65342..79c1e048c 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5206,7 +5206,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
do {
eff = rand() % 14;
- clif_specialeffect(bl, 523 + eff, 0);
+ clif_specialeffect(bl, 523 + eff, AREA);
switch (eff)
{
case 0: // heals SP to 0
@@ -10106,7 +10106,7 @@ int skill_produce_mix( struct map_session_data *sd, int skill_id,
break;
default: //Those that don't require a skill?
if (skill_produce_db[idx].itemlv==11) //Cooking items.
- clif_specialeffect(&sd->bl, 608, 0);
+ clif_specialeffect(&sd->bl, 608, AREA);
break;
}
}
@@ -10146,7 +10146,7 @@ int skill_produce_mix( struct map_session_data *sd, int skill_id,
break;
default:
if (skill_produce_db[idx].itemlv==11)
- clif_specialeffect(&sd->bl, 609, 0);
+ clif_specialeffect(&sd->bl, 609, AREA);
}
}
return 0;