diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-11-07 16:17:01 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-11-07 16:17:01 +0000 |
commit | 1b73b82ea629ff1e69fc2d6094c27e9e32229a84 (patch) | |
tree | ae09928b655e5e706a9560eefdde38372beb366f /src/map | |
parent | e60b722daee5105cf5ba2ef58d6de827def30126 (diff) | |
download | hercules-1b73b82ea629ff1e69fc2d6094c27e9e32229a84.tar.gz hercules-1b73b82ea629ff1e69fc2d6094c27e9e32229a84.tar.bz2 hercules-1b73b82ea629ff1e69fc2d6094c27e9e32229a84.tar.xz hercules-1b73b82ea629ff1e69fc2d6094c27e9e32229a84.zip |
- Fixed map_foreachiddb and map_foreachpc so they don't encapsulate the variable arguments into a double va_arg list. Thanks to the Ultra Mage for the tip.
- Cleaned up the clif_hate/mob_info functions with the correct fields/usage as explained by Rayce.
- Implemented clif_feel_hate_reset packet to properly display the Angel of the Sun/Moon/Stars, thanks again to Rayce for the relevant information.
- LP will again block all land-stuff from being placed down on top of it for the exception of Song/Dance/Encores.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9162 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 53 | ||||
-rw-r--r-- | src/map/clif.h | 7 | ||||
-rw-r--r-- | src/map/map.c | 4 | ||||
-rw-r--r-- | src/map/mob.c | 9 | ||||
-rw-r--r-- | src/map/npc.c | 6 | ||||
-rw-r--r-- | src/map/pc.c | 6 | ||||
-rw-r--r-- | src/map/script.c | 7 | ||||
-rw-r--r-- | src/map/skill.c | 11 | ||||
-rw-r--r-- | src/map/status.c | 5 |
9 files changed, 58 insertions, 50 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index f5ba4101f..710d7a06e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8020,36 +8020,40 @@ int clif_party_xy_remove(struct map_session_data *sd) /*==========================================
* Info about Star Glaldiator save map [Komurka]
+ * type: 1: Information, 0: Map registered
*------------------------------------------
*/
-void clif_feel_info(struct map_session_data *sd, int feel_level)
+void clif_feel_info(struct map_session_data *sd, unsigned char feel_level, unsigned char type)
{
int fd=sd->fd;
WFIFOHEAD(fd,packet_len_table[0x20e]);
WFIFOW(fd,0)=0x20e;
memcpy(WFIFOP(fd,2),mapindex_id2name(sd->feel_map[feel_level].index), MAP_NAME_LENGTH);
WFIFOL(fd,26)=sd->bl.id;
- WFIFOW(fd,30)=0x100+feel_level;
+ WFIFOB(fd,30)=feel_level;
+ WFIFOB(fd,31)=type?1:0;
WFIFOSET(fd, packet_len_table[0x20e]);
}
/*==========================================
* Info about Star Glaldiator hate mob [Komurka]
+ * type: 1: Register mob, 0: Information.
*------------------------------------------
*/
-void clif_hate_mob(struct map_session_data *sd, int type,int mob_id)
+void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type)
{
int fd=sd->fd;
WFIFOHEAD(fd,packet_len_table[0x20e]);
WFIFOW(fd,0)=0x20e;
- if (pcdb_checkid(mob_id))
- strncpy(WFIFOP(fd,2),job_name(mob_id), NAME_LENGTH);
- else if (mobdb_checkid(mob_id))
- strncpy(WFIFOP(fd,2),mob_db(mob_id)->jname, NAME_LENGTH);
+ if (pcdb_checkid(class_))
+ strncpy(WFIFOP(fd,2),job_name(class_), NAME_LENGTH);
+ else if (mobdb_checkid(class_))
+ strncpy(WFIFOP(fd,2),mob_db(class_)->jname, NAME_LENGTH);
else //Really shouldn't happen...
malloc_tsetdword(WFIFOP(fd,2), 0, NAME_LENGTH);
WFIFOL(fd,26)=sd->bl.id;
- WFIFOW(fd,30)=0xa00+type;
+ WFIFOB(fd,30)=hate_level;
+ WFIFOB(fd,31)=type?10:11; //Register/Info
WFIFOSET(fd, packet_len_table[0x20e]);
}
@@ -8057,14 +8061,31 @@ void clif_hate_mob(struct map_session_data *sd, int type,int mob_id) * Info about TaeKwon Do TK_MISSION mob [Skotlex]
*------------------------------------------
*/
-void clif_mission_mob(struct map_session_data *sd, unsigned short mob_id, unsigned short progress)
+void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress)
{
int fd=sd->fd;
WFIFOHEAD(fd,packet_len_table[0x20e]);
WFIFOW(fd,0)=0x20e;
strncpy(WFIFOP(fd,2),mob_db(mob_id)->jname, NAME_LENGTH);
WFIFOL(fd,26)=mob_id;
- WFIFOW(fd,30)=0x1400+progress; //Message to display
+ WFIFOB(fd,30)=progress; //Message to display
+ WFIFOB(fd,31)=20;
+ WFIFOSET(fd, packet_len_table[0x20e]);
+}
+
+/*==========================================
+ * Feel/Hate reset (thanks to Rayce) [Skotlex]
+ *------------------------------------------
+ */
+void clif_feel_hate_reset(struct map_session_data *sd)
+{
+ int fd=sd->fd;
+ WFIFOHEAD(fd,packet_len_table[0x20e]);
+ WFIFOW(fd,0)=0x20e;
+ malloc_tsetdword(WFIFOP(fd,2), 0, NAME_LENGTH); //Blank name as all was reset.
+ WFIFOL(fd,26)=sd->bl.id;
+ WFIFOB(fd,30)=0; //Feel/hate level: irrelevant
+ WFIFOB(fd,31)=30;
WFIFOSET(fd, packet_len_table[0x20e]);
}
@@ -11491,14 +11512,10 @@ void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) sd->feel_map[i].m = sd->bl.m;
pc_setglobalreg(sd,feel_var[i],map[sd->bl.m].index);
- clif_misceffect2(&sd->bl, 0x1b0);
- clif_misceffect2(&sd->bl, 0x21f);
- WFIFOHEAD(fd,packet_len_table[0x20e]);
- WFIFOW(fd,0)=0x20e;
- memcpy(WFIFOP(fd,2),map[sd->bl.m].name, MAP_NAME_LENGTH);
- WFIFOL(fd,26)=sd->bl.id;
- WFIFOW(fd,30)=i;
- WFIFOSET(fd, packet_len_table[0x20e]);
+//Are these really needed? Shouldn't they show up automatically from the feel save packet?
+// clif_misceffect2(&sd->bl, 0x1b0);
+// clif_misceffect2(&sd->bl, 0x21f);
+ clif_feel_info(sd, i, 0);
sd->menuskill_lv = sd->menuskill_id = 0;
}
diff --git a/src/map/clif.h b/src/map/clif.h index 067be9dc5..01e9445b3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -346,9 +346,10 @@ void clif_get_weapon_view(TBL_PC* sd, unsigned short *rhand, unsigned short *lha int clif_party_xy_remove(struct map_session_data *sd); //Fix for minimap [Kevin]
void clif_parse_ReqFeel(int fd, struct map_session_data *sd, int skilllv);
-void clif_feel_info(struct map_session_data *sd, int feel_level);
-void clif_hate_mob(struct map_session_data *sd, int type,int mob_id);
-void clif_mission_mob(struct map_session_data *sd, unsigned short mob_id, unsigned short progress);
+void clif_feel_info(struct map_session_data *sd, unsigned char feel_level, unsigned char type);
+void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type);
+void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress);
+void clif_feel_hate_reset(struct map_session_data *sd);
// [blackhole89]
int clif_spawnhomun(struct homun_data *hd);
diff --git a/src/map/map.c b/src/map/map.c index 2c609bc74..52035d3bd 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1894,7 +1894,7 @@ struct map_session_data** map_getallusers(int *users) { void map_foreachpc(int (*func)(DBKey,void*,va_list),...) { va_list ap; va_start(ap,func); - pc_db->foreach(pc_db,func,ap); + pc_db->vforeach(pc_db,func,ap); va_end(ap); } @@ -1906,7 +1906,7 @@ int map_foreachiddb(int (*func)(DBKey,void*,va_list),...) { va_list ap; va_start(ap,func); - id_db->foreach(id_db,func,ap); + id_db->vforeach(id_db,func,ap); va_end(ap); return 0; } diff --git a/src/map/mob.c b/src/map/mob.c index daf71b348..f19bd292b 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1333,21 +1333,17 @@ static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) * Negligent mode MOB AI (PC is not in near) *------------------------------------------ */ -static int mob_ai_sub_lazy(DBKey key,void * data,va_list app) +static int mob_ai_sub_lazy(DBKey key,void * data,va_list ap) { struct mob_data *md = (struct mob_data *)data; - va_list ap; unsigned int tick; int mode; nullpo_retr(0, md); - nullpo_retr(0, app); if(md->bl.type!=BL_MOB || md->bl.prev == NULL) return 0; - ap = va_arg(app, va_list); - if (md->nd || (battle_config.mob_ai&32 && map[md->bl.m].users>0)) return mob_ai_sub_hard(&md->bl, ap); @@ -1407,7 +1403,6 @@ static int mob_ai_sub_lazy(DBKey key,void * data,va_list app) static int mob_ai_lazy(int tid,unsigned int tick,int id,int data) { map_foreachiddb(mob_ai_sub_lazy,tick); - return 0; } @@ -1762,7 +1757,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) sd->mission_mobid = temp; pc_setglobalreg(sd,"TK_MISSION_ID", temp); sd->mission_count = 0; - clif_mission_mob(sd, temp, 0); + clif_mission_info(sd, temp, 0); } pc_setglobalreg(sd,"TK_MISSION_COUNT", sd->mission_count); } diff --git a/src/map/npc.c b/src/map/npc.c index 7784be6ec..a5cc3ac09 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1399,16 +1399,14 @@ static int npc_unload_ev(DBKey key,void *data,va_list ap) { return 0;
}
-static int npc_unload_dup_sub(DBKey key,void * data,va_list app)
+static int npc_unload_dup_sub(DBKey key,void * data,va_list ap)
{
struct npc_data *nd = (struct npc_data *)data;
- va_list ap;
int src_id;
if(nd->bl.type!=BL_NPC || nd->bl.subtype != SCRIPT)
return 0;
- ap = va_arg(app, va_list);
src_id=va_arg(ap,int);
if (nd->u.scr.src_id == src_id)
npc_unload(nd);
@@ -2834,7 +2832,7 @@ static int npc_cleanup_sub (struct block_list *bl, va_list ap) { return 0;
}
-static int npc_cleanup_dbsub(DBKey key,void * data,va_list app) {
+static int npc_cleanup_dbsub(DBKey key,void * data,va_list ap) {
return npc_cleanup_sub((struct block_list*)data, 0);
}
diff --git a/src/map/pc.c b/src/map/pc.c index 818bd1b42..07b387d1f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -775,7 +775,7 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) return 0; if (sd->hate_mob[pos] != -1) { //Can't change hate targets. - clif_hate_mob(sd,pos,sd->hate_mob[pos]); //Display current + clif_hate_info(sd, pos, sd->hate_mob[pos], 0); //Display current return 0; } @@ -789,7 +789,7 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) } sd->hate_mob[pos] = class_; pc_setglobalreg(sd,hate_var[pos],class_+1); - clif_hate_mob(sd,pos,class_); + clif_hate_info(sd, pos, class_, 1); return 1; } @@ -6870,7 +6870,7 @@ int pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y) *------------------------------------------ */ static int last_save_id=0,save_flag=0; -static int pc_autosave_sub(DBKey key,void * data,va_list app) +static int pc_autosave_sub(DBKey key,void * data,va_list ap) { struct map_session_data *sd = (TBL_PC*)data; diff --git a/src/map/script.c b/src/map/script.c index 9c9a5fc21..767402512 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8652,10 +8652,9 @@ int buildin_emotion(struct script_state *st) static int buildin_maprespawnguildid_sub_pc(DBKey key, void *data, va_list ap) { - va_list ap2 = va_arg(ap, va_list); // double decode -_- - int m=va_arg(ap2,int); - int g_id=va_arg(ap2,int); - int flag=va_arg(ap2,int); + int m=va_arg(ap,int); + int g_id=va_arg(ap,int); + int flag=va_arg(ap,int); struct map_session_data *sd = (TBL_PC*)data; if(!sd || sd->bl.m != m) diff --git a/src/map/skill.c b/src/map/skill.c index a90e179ce..ea9f44c4f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3789,7 +3789,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if (sd) { int id; if (sd->mission_mobid && (sd->mission_count || rand()%100)) { //Cannot change target when already have one - clif_mission_mob(sd, sd->mission_mobid, sd->mission_count); + clif_mission_info(sd, sd->mission_mobid, sd->mission_count); clif_skill_fail(sd,skillid,0,0); break; } @@ -3801,7 +3801,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in sd->mission_mobid = id; sd->mission_count = 0; pc_setglobalreg(sd,"TK_MISSION_ID", id); - clif_mission_mob(sd, id, 0); + clif_mission_info(sd, id, 0); clif_skill_nodamage(src,bl,skillid,skilllv,1); } break; @@ -5411,7 +5411,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if(!sd->feel_map[skilllv-1].index) clif_parse_ReqFeel(sd->fd,sd, skilllv); else - clif_feel_info(sd, skilllv-1); + clif_feel_info(sd, skilllv-1, 1); } break; @@ -9333,9 +9333,8 @@ int skill_landprotector (struct block_list *bl, va_list ap) break; } if (unit->group->skill_id == SA_LANDPROTECTOR && - skill_get_type(skillid) == BF_MAGIC) -// !(skill_get_unit_flag(skillid)&(UF_DANCE|UF_SONG|UF_ENSEMBLE))) - { //When LP is already placed, all it does it prevent magic spells from being placed. + !(skill_get_unit_flag(skillid)&(UF_DANCE|UF_SONG|UF_ENSEMBLE))) + { //Block stuff from being placed on an LP except for song/dances (*alive) = 0; return 1; } diff --git a/src/map/status.c b/src/map/status.c index 8820fa505..6426eced3 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6882,7 +6882,7 @@ int status_change_clear_buffs (struct block_list *bl, int type) //Natural regen related stuff.
static unsigned int natural_heal_prev_tick,natural_heal_diff_tick;
-static int status_natural_heal(DBKey key,void * data,va_list app)
+static int status_natural_heal(DBKey key,void * data,va_list ap)
{
struct block_list *bl = (struct block_list*)data;
struct regen_data *regen;
@@ -7054,10 +7054,9 @@ static int status_natural_heal(DBKey key,void * data,va_list app) (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR &&
rand()%10000 < battle_config.sg_angel_skill_ratio
) { //Angel of the Sun/Moon/Star
+ clif_feel_hate_reset(sd);
pc_resethate(sd);
pc_resetfeel(sd);
- //TODO: Figure out how to make the client-side msg show up.
- clif_displaymessage(sd->fd,"[Angel of the Sun, Moon and Stars]");
}
}
sregen->tick.sp -= battle_config.natural_heal_skill_interval;
|