diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-06-11 22:14:50 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-06-11 22:14:50 +0000 |
commit | f24a3d43c43fc28c292cd7af10defae894aedc6d (patch) | |
tree | 3bdc85ce1e475a38440d155567587ee2ba59cfc0 /src | |
parent | 15d0d129834b212fa00285afa412cbb38f97ca6b (diff) | |
download | hercules-f24a3d43c43fc28c292cd7af10defae894aedc6d.tar.gz hercules-f24a3d43c43fc28c292cd7af10defae894aedc6d.tar.bz2 hercules-f24a3d43c43fc28c292cd7af10defae894aedc6d.tar.xz hercules-f24a3d43c43fc28c292cd7af10defae894aedc6d.zip |
- Fixed pet equip not displaying correctly at all (closes topic:153753)
- Removed old fixpos packet (the 'new' one is way smaller)
- Fixed some major logical typos in the code, cleaned up many places
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10746 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.c | 289 | ||||
-rw-r--r-- | src/map/clif.h | 12 | ||||
-rw-r--r-- | src/map/map.c | 3 | ||||
-rw-r--r-- | src/map/mob.c | 10 | ||||
-rw-r--r-- | src/map/pet.c | 16 | ||||
-rw-r--r-- | src/map/status.c | 35 | ||||
-rw-r--r-- | src/map/status.h | 1 |
7 files changed, 170 insertions, 196 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index d28f9fdf3..7cb9fc096 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -600,21 +600,22 @@ int clif_charselectok(int id) } /*========================================== - * + * Makes an item appear on the ground + * 009e <ID>.l <name ID>.w <identify flag>.B <X>.w <Y>.w <subX>.B <subY>.B <amount>.w *------------------------------------------*/ -static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf) +int clif_dropflooritem(struct flooritem_data* fitem) { + uint8 buf[17]; int view; nullpo_retr(0, fitem); - //009e <ID>.l <name ID>.w <identify flag>.B <X>.w <Y>.w <subX>.B <subY>.B <amount>.w + if (fitem->item_data.nameid <= 0) + return 0; + WBUFW(buf, 0) = 0x9e; WBUFL(buf, 2) = fitem->bl.id; - if ((view = itemdb_viewid(fitem->item_data.nameid)) > 0) - WBUFW(buf, 6) = view; - else - WBUFW(buf, 6) = fitem->item_data.nameid; + WBUFW(buf, 6) = ((view = itemdb_viewid(fitem->item_data.nameid)) > 0) ? view : fitem->item_data.nameid; WBUFB(buf, 8) = fitem->item_data.identify; WBUFW(buf, 9) = fitem->bl.x; WBUFW(buf,11) = fitem->bl.y; @@ -622,21 +623,6 @@ static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf) WBUFB(buf,14) = fitem->suby; WBUFW(buf,15) = fitem->item_data.amount; - return packet_len(0x9e); -} - -/*========================================== - * - *------------------------------------------*/ -int clif_dropflooritem(struct flooritem_data *fitem) -{ - unsigned char buf[64]; - - nullpo_retr(0, fitem); - - if (fitem->item_data.nameid <= 0) - return 0; - clif_set009e(fitem, buf); clif_send(buf, packet_len(0x9e), &fitem->bl, AREA); return 0; @@ -770,53 +756,29 @@ void clif_get_weapon_view(TBL_PC* sd, unsigned short *rhand, unsigned short *lha #endif } -static void clif_get_guild_data(struct block_list *bl, long *guild_id, short *emblem_id) -{ - //TODO: There has to be a way to clean this up. - switch (bl->type) { - case BL_PC: - *guild_id = ((TBL_PC*)bl)->status.guild_id; - *emblem_id = ((TBL_PC*)bl)->guild_emblem_id; - break; - case BL_MOB: - if (((TBL_MOB*)bl)->guardian_data) { - *guild_id =((TBL_MOB*)bl)->guardian_data->guild_id; - *emblem_id =((TBL_MOB*)bl)->guardian_data->emblem_id; - } - break; - case BL_NPC: - if (bl->subtype == SCRIPT && ((TBL_NPC*)bl)->u.scr.guild_id > 0) { - struct guild *g = guild_search(((TBL_NPC*)bl)->u.scr.guild_id); - if (g) { - *guild_id =g->guild_id; - *emblem_id =g->emblem_id; - } - } - break; - default: - *guild_id = status_get_guild_id(bl); - } - return; -} /*========================================== * *------------------------------------------*/ -static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned char *buf) +static int clif_set0078(struct block_list* bl, unsigned char* buf) { - struct status_change *sc; - struct map_session_data *sd; - long guild_id=0; - unsigned short emblem_id=0, lv; - unsigned short dir; + struct status_change* sc; + struct view_data* vd; + int guild_id, emblem_id, dir, lv; nullpo_retr(0, bl); - BL_CAST(BL_PC, bl, sd); sc = status_get_sc(bl); + vd = status_get_viewdata(bl); - clif_get_guild_data(bl, &guild_id, &emblem_id); + guild_id = status_get_guild_id(bl); + emblem_id = status_get_emblem_id(bl); dir = unit_getdir(bl); lv = status_get_lv(bl); - if(pcdb_checkid(vd->class_)) { + + if(pcdb_checkid(vd->class_)) + { + struct map_session_data* sd; + BL_CAST(BL_PC, bl, sd); + #if PACKETVER > 6 memset(buf,0,packet_len(0x22a)); @@ -955,9 +917,9 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch //44B: Karma //45B: Sex WBUFPOS(buf,46,bl->x,bl->y,dir); - WBUFB(buf,49)=5; - WBUFB(buf,50)=5; - //51BL Sit/Stand + //WBUFB(buf,49)=5; + //WBUFB(buf,50)=5; + //51B: Sit/Stand WBUFW(buf,52)=clif_setlevel(lv); return packet_len(0x78); } @@ -968,18 +930,20 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit_data *ud, unsigned char *buf) { struct status_change *sc; - struct map_session_data *sd; - long guild_id=0; - unsigned short emblem_id=0, lv; + int guild_id, emblem_id, lv; nullpo_retr(0, bl); - BL_CAST(BL_PC, bl, sd); sc = status_get_sc(bl); - clif_get_guild_data(bl, &guild_id, &emblem_id); + guild_id = status_get_guild_id(bl); + emblem_id = status_get_emblem_id(bl); lv = status_get_lv(bl); - if(pcdb_checkid(vd->class_)) { + if(pcdb_checkid(vd->class_)) + { + struct map_session_data* sd; + BL_CAST(BL_PC, bl, sd); + #if PACKETVER > 6 memset(buf,0,packet_len(0x22c)); @@ -1291,6 +1255,7 @@ int clif_spawn(struct block_list *bl) { unsigned char buf[128]; struct view_data *vd; + nullpo_retr(0, bl); vd = status_get_viewdata(bl); if (!vd || vd->class_ == INVISIBLE_CLASS) @@ -1298,8 +1263,9 @@ int clif_spawn(struct block_list *bl) if (pcdb_checkid(vd->class_)) { //Player spawn packet. - clif_set0078(bl, vd, buf); - switch(WBUFW(buf,0)) { + clif_set0078(bl, buf); + switch(WBUFW(buf,0)) + { case 0x78: //Convert to 0x79 WBUFW(buf, 0) = 0x79; WBUFW(buf,51) = WBUFW(buf,52); //Lv is placed on offset 52 @@ -1337,9 +1303,7 @@ int clif_spawn(struct block_list *bl) WBUFW(buf,10)=sc->opt2; WBUFW(buf,12)=sc->option; } - WBUFW(buf,14)=vd->hair_style; //Required for pets. WBUFW(buf,20)=vd->class_; - WBUFW(buf,24)=vd->head_bottom; //Pet armor WBUFPOS(buf,36,bl->x,bl->y,unit_getdir(bl)); clif_send(buf,packet_len(0x7c),bl,AREA_WOS); @@ -1374,6 +1338,13 @@ int clif_spawn(struct block_list *bl) clif_specialeffect(&md->bl,421,AREA); } break; + case BL_PET: + { + unsigned char buf[64]; + int len = clif_set0078(bl, buf); + clif_send(buf, len, bl, AREA_WOS); + } + break; } return 0; } @@ -2644,6 +2615,7 @@ int clif_updatestatus(struct map_session_data *sd,int type) return 0; } + int clif_changestatus(struct block_list *bl,int type,int val) { unsigned char buf[12]; @@ -2654,7 +2626,6 @@ int clif_changestatus(struct block_list *bl,int type,int val) if(bl->type == BL_PC) sd = (struct map_session_data *)bl; -//printf("clif_changestatus id:%d type:%d val:%d\n",bl->id,type,val); if(sd){ WBUFW(buf,0)=0x1ab; WBUFL(buf,2)=bl->id; @@ -3693,7 +3664,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds */ } -void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl) +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { struct unit_data *ud; struct view_data *vd; @@ -3724,7 +3695,7 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl) #else WFIFOHEAD(fd,packet_len(0x78)); #endif - len = clif_set0078(bl,vd,WFIFOP(fd,0)); + len = clif_set0078(bl,WFIFOP(fd,0)); WFIFOSET(fd,len); } @@ -3732,7 +3703,7 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl) clif_refreshlook(&sd->bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,SELF); switch (bl->type) - { + { // FIXME: 'AREA' causes unneccessary spam since this should be 1:1 communication case BL_PC: { TBL_PC* tsd = (TBL_PC*)bl; @@ -3758,39 +3729,16 @@ void clif_getareachar_char(struct map_session_data* sd,struct block_list *bl) clif_specialeffect(bl,421,AREA); } break; + case BL_PET: + { + unsigned char buf[64]; + int len = clif_set0078(bl, buf); + clif_send(buf, len, &sd->bl, SELF); + } + break; } } -/*========================================== - * Older fix pos packet. - *------------------------------------------*/ -int clif_fixpos2(struct block_list* bl) -{ - struct unit_data *ud; - struct view_data *vd; - unsigned char buf[256]; - int len; - - nullpo_retr(0, bl); - ud = unit_bl2ud(bl); - vd = status_get_viewdata(bl); - if (!vd || vd->class_ == INVISIBLE_CLASS) - return 0; - - if(ud && ud->walktimer != -1) - len = clif_set007b(bl,vd,ud,buf); - else - len = clif_set0078(bl,vd,buf); - - if (disguised(bl)) { - clif_send(buf,len,bl,AREA_WOS); - clif_setdisguise((TBL_PC*)bl, buf, len, 0); - clif_setdisguise((TBL_PC*)bl, buf, len, 1); - } else - clif_send(buf,len,bl,AREA); - return 0; -} - //Modifies the type of damage according to status changes [Skotlex] #define clif_calc_delay(type,delay) (type==1||type==4||type==0x0a)?type:(delay==0?9:type) @@ -4056,7 +4004,7 @@ int clif_01ac(struct block_list *bl) default: if(&sd->bl == bl) break; - clif_getareachar_char(sd,bl); + clif_getareachar_unit(sd,bl); break; } return 0; @@ -4134,13 +4082,13 @@ int clif_insight(struct block_list *bl,va_list ap) clif_getareachar_skillunit(tsd,(TBL_SKILL*)bl); break; default: - clif_getareachar_char(tsd,bl); + clif_getareachar_unit(tsd,bl); break; } } if (sd && sd->fd) { //Tell sd that tbl walked into his view - clif_getareachar_char(sd,tbl); + clif_getareachar_unit(sd,tbl); } return 0; } @@ -4187,7 +4135,7 @@ int clif_skillinfo(struct map_session_data *sd,int skillid,int type,int range) int clif_skillinfoblock(struct map_session_data *sd) { int fd; - int i,c,len=4,id; + int i,c,len,id; nullpo_retr(0, sd); @@ -4195,21 +4143,23 @@ int clif_skillinfoblock(struct map_session_data *sd) if (!fd) return 0; WFIFOHEAD(fd, MAX_SKILL * 37 + 4); - WFIFOW(fd,0)=0x10f; - for ( i = c = 0; i < MAX_SKILL; i++){ - if( (id=sd->status.skill[i].id)!=0 ){ - WFIFOW(fd,len ) = id; + WFIFOW(fd,0) = 0x10f; + for ( i = 0, c = 0, len = 4; i < MAX_SKILL; i++) + { + if( (id = sd->status.skill[i].id) != 0 ) + { + WFIFOW(fd,len) = id; WFIFOW(fd,len+2) = skill_get_inf(id); WFIFOW(fd,len+4) = 0; WFIFOW(fd,len+6) = sd->status.skill[i].lv; WFIFOW(fd,len+8) = skill_get_sp(id,sd->status.skill[i].lv); WFIFOW(fd,len+10)= skill_get_range2(&sd->bl, id,sd->status.skill[i].lv); strncpy((char*)WFIFOP(fd,len+12), skill_get_name(id), NAME_LENGTH); - if(sd->status.skill[i].flag ==0) - WFIFOB(fd,len+36)= (sd->status.skill[i].lv < skill_tree_get_max(id, sd->status.class_))? 1:0; + if(sd->status.skill[i].flag == 0) + WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill_tree_get_max(id, sd->status.class_))? 1:0; else WFIFOB(fd,len+36) = 0; - len+=37; + len += 37; c++; } } @@ -6051,7 +6001,7 @@ int clif_catch_process(struct map_session_data *sd) return 0; } -int clif_pet_rulet(struct map_session_data *sd,int data) +int clif_pet_roulette(struct map_session_data *sd,int data) { int fd; @@ -6102,24 +6052,48 @@ int clif_sendegg(struct map_session_data *sd) return 0; } -int clif_send_petdata(struct map_session_data *sd,int type,int param) +/*========================================== + * Sends a specific pet data update. + * type = 0 -> param = 0 (initial data) + * type = 1 -> param = intimacy value + * type = 2 -> param = hungry value + * type = 3 -> param = accessory id + * type = 4 -> param = performance number (1-3:normal, 4:special) + * type = 5 -> param = hairstyle number + *------------------------------------------*/ +int clif_send_petdata(struct map_session_data* sd, int type, int param) { int fd; nullpo_retr(0, sd); nullpo_retr(0, sd->pd); - fd=sd->fd; + fd = sd->fd; WFIFOHEAD(fd,packet_len(0x1a4)); - WFIFOW(fd,0)=0x1a4; - WFIFOB(fd,2)=type; - WFIFOL(fd,3)=sd->pd->bl.id; - WFIFOL(fd,7)=param; + WFIFOW(fd,0) = 0x1a4; + WFIFOB(fd,2) = type; + WFIFOL(fd,3) = sd->pd->bl.id; + WFIFOL(fd,7) = param; WFIFOSET(fd,packet_len(0x1a4)); return 0; } +int clif_send_petdata_area(struct pet_data* pd, int type, int param) +{ + uint8 buf[16]; + + nullpo_retr(0, pd); + + WBUFW(buf,0) = 0x1a4; + WBUFB(buf,2) = type; + WBUFL(buf,3) = pd->bl.id; + WBUFL(buf,7) = param; + clif_send(buf, packet_len(0x1a4), &pd->bl, AREA); + + return 0; +} + int clif_send_petstatus(struct map_session_data *sd) { int fd; @@ -6171,41 +6145,6 @@ int clif_pet_emotion(struct pet_data *pd,int param) return 0; } -int clif_pet_performance(struct block_list *bl,int param) -{ - unsigned char buf[16]; - - nullpo_retr(0, bl); - - memset(buf,0,packet_len(0x1a4)); - - WBUFW(buf,0)=0x1a4; - WBUFB(buf,2)=4; - WBUFL(buf,3)=bl->id; - WBUFL(buf,7)=param; - - clif_send(buf,packet_len(0x1a4),bl,AREA); - - return 0; -} - -int clif_pet_equip(struct pet_data *pd) -{ - unsigned char buf[16]; - - nullpo_retr(0, pd); - - memset(buf,0,packet_len(0x1a4)); - - WBUFW(buf,0)=0x1a4; - WBUFB(buf,2)=3; - WBUFL(buf,3)=pd->bl.id; - WBUFL(buf,7)=pd->vd.shield; - clif_send(buf,packet_len(0x1a4),&pd->bl,AREA); - - return 0; -} - int clif_pet_food(struct map_session_data *sd,int foodid,int fail) { int fd; @@ -6554,16 +6493,14 @@ int clif_guild_send_onlineinfo(struct map_session_data *sd) *------------------------------------------*/ int clif_guild_masterormember(struct map_session_data *sd) { - int type=0x57,fd; + int fd; nullpo_retr(0, sd); fd=sd->fd; - if(sd->state.gmaster_flag) - type=0xd7; WFIFOHEAD(fd,packet_len(0x14e)); - WFIFOW(fd,0)=0x14e; - WFIFOL(fd,2)=type; + WFIFOW(fd,0) = 0x14e; + WFIFOL(fd,2) = (sd->state.gmaster_flag) ? 0xd7 : 0x57; WFIFOSET(fd,packet_len(0x14e)); return 0; } @@ -6572,7 +6509,7 @@ int clif_guild_masterormember(struct map_session_data *sd) *------------------------------------------*/ int clif_guild_basicinfo(struct map_session_data *sd) { - int fd,i,t=0; + int fd,i,t; struct guild *g; struct guild_castle *gc=NULL; @@ -6599,15 +6536,13 @@ int clif_guild_basicinfo(struct map_session_data *sd) memcpy(WFIFOP(fd,46),g->name, NAME_LENGTH); memcpy(WFIFOP(fd,70),g->master, NAME_LENGTH); - for(i=0;i<MAX_GUILDCASTLE;i++){ - gc=guild_castle_search(i); - if(!gc) continue; - if(g->guild_id == gc->guild_id) t++; + for(i = 0, t = 0; i < MAX_GUILDCASTLE; i++) + { + gc = guild_castle_search(i); + if(gc && g->guild_id == gc->guild_id) + t++; } - if (t>=0 && t<=MAX_GUILDCASTLE) //(0=None, 1..24 = N of Casles) [Lupus] - strncpy((char*)WFIFOP(fd,94),msg_txt(300+t),20); - else - strncpy((char*)WFIFOP(fd,94),msg_txt(299),20); + strncpy((char*)WFIFOP(fd,94),msg_txt(300+t),20); // "'N' castles" WFIFOSET(fd,packet_len(WFIFOW(fd,0))); return 0; @@ -6838,8 +6773,10 @@ int clif_guild_skillinfo(struct map_session_data *sd) WFIFOSET(fd,WFIFOW(fd,2)); return 0; } + /*========================================== - * ギルド告知送信 + * Sends guild notice to client + * R 016f <str1z>.60B <str2z>.120B *------------------------------------------*/ int clif_guild_notice(struct map_session_data *sd,struct guild *g) { @@ -7455,7 +7392,7 @@ int clif_soundeffectall(struct block_list *bl, const char *name, int type, int c } // displaying special effects (npcs, weather, etc) [Valaris] -int clif_specialeffect(struct block_list *bl, int type, int flag) +int clif_specialeffect(struct block_list* bl, int type, enum send_target target) { unsigned char buf[24]; @@ -7467,7 +7404,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) WBUFL(buf,2) = bl->id; WBUFL(buf,6) = type; - clif_send(buf, packet_len(0x1f3), bl, flag); + clif_send(buf, packet_len(0x1f3), bl, target); if (disguised(bl)) { WBUFL(buf,2) = -bl->id; diff --git a/src/map/clif.h b/src/map/clif.h index 069e4f4c3..cba09da75 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -79,7 +79,6 @@ int clif_changemapserver(struct map_session_data* sd, const char* mapname, int x int clif_blown(struct block_list *); // area int clif_slide(struct block_list *,int,int); // area int clif_fixpos(struct block_list *); // area -int clif_fixpos2(struct block_list *); // area int clif_npcbuysell(struct map_session_data*,int); //self int clif_buylist(struct map_session_data*,struct npc_data*); //self int clif_selllist(struct map_session_data*); //self @@ -313,13 +312,14 @@ void clif_upgrademessage(int fd, int result, int item_id); //petsystem int clif_catch_process(struct map_session_data *sd); -int clif_pet_rulet(struct map_session_data *sd,int data); +int clif_pet_roulette(struct map_session_data *sd,int data); int clif_sendegg(struct map_session_data *sd); -int clif_send_petdata(struct map_session_data *sd,int type,int param); int clif_send_petstatus(struct map_session_data *sd); +int clif_send_petdata(struct map_session_data* sd, int type, int param); +int clif_send_petdata_area(struct pet_data* pd, int type, int param); +#define clif_pet_equip(pd) clif_send_petdata_area(pd, 3, (pd)->vd.head_bottom) +#define clif_pet_performance(pd, param) clif_send_petdata_area(pd, 4, param) int clif_pet_emotion(struct pet_data *pd,int param); -int clif_pet_performance(struct block_list *bl,int param); -int clif_pet_equip(struct pet_data *pd); int clif_pet_food(struct map_session_data *sd,int foodid,int fail); //friends list @@ -330,7 +330,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat // [Valaris] int clif_mob_hp(struct mob_data *md); int clif_weather(int m); // [Valaris] -int clif_specialeffect(struct block_list *bl,int type, int flag); // special effects [Valaris] +int clif_specialeffect(struct block_list* bl, int type, enum send_target target); // special effects [Valaris] int clif_message(struct block_list *bl, const char* msg); // messages (from mobs/npcs) [Valaris] int clif_GM_kickack(struct map_session_data *sd,int id); diff --git a/src/map/map.c b/src/map/map.c index ccf136040..51ff269b8 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -342,8 +342,9 @@ void map_delblcell(struct block_list *bl) /*========================================== * Adds a block to the map. - * If flag is 1, then the block was just added + * If flag is 1, then the block was just added, * otherwise it is part of a transition. + * Returns 0 on success, 1 on failure (illegal coordinates). *------------------------------------------*/ int map_addblock_sub (struct block_list *bl, int flag) { diff --git a/src/map/mob.c b/src/map/mob.c index 591bc55db..ca6d5e23c 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3631,7 +3631,7 @@ static int mob_readskilldb(void) } cond1[] = { { "always", MSC_ALWAYS }, { "myhpltmaxrate", MSC_MYHPLTMAXRATE }, - { "myhpinrate", MSC_MYHPINRATE }, + { "myhpinrate", MSC_MYHPINRATE }, { "friendhpltmaxrate",MSC_FRIENDHPLTMAXRATE }, { "friendhpinrate", MSC_FRIENDHPINRATE }, { "mystatuson", MSC_MYSTATUSON }, @@ -3651,7 +3651,7 @@ static int mob_readskilldb(void) { "masterhpltmaxrate",MSC_MASTERHPLTMAXRATE }, { "masterattacked", MSC_MASTERATTACKED }, { "alchemist", MSC_ALCHEMIST }, - { "onspawn", MSC_SPAWN}, + { "onspawn", MSC_SPAWN}, }, cond2[] ={ { "anybad", -1 }, { "stone", SC_STONE }, @@ -3666,14 +3666,14 @@ static int mob_readskilldb(void) { "hiding", SC_HIDING }, { "sight", SC_SIGHT }, }, state[] = { - { "any", MSS_ANY }, //All states except Dead + { "any", MSS_ANY }, //All states except Dead { "idle", MSS_IDLE }, { "walk", MSS_WALK }, { "loot", MSS_LOOT }, { "dead", MSS_DEAD }, { "attack", MSS_BERSERK }, //Retaliating attack - { "angry", MSS_ANGRY }, //Preemptive attack (aggressive mobs) - { "chase", MSS_RUSH }, //Chase escaping target + { "angry", MSS_ANGRY }, //Preemptive attack (aggressive mobs) + { "chase", MSS_RUSH }, //Chase escaping target { "follow", MSS_FOLLOW }, //Preemptive chase (aggressive mobs) { "anytarget",MSS_ANYTARGET }, //Berserk+Angry+Rush+Follow }, target[] = { diff --git a/src/map/pet.c b/src/map/pet.c index 866d8ca67..22237279e 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -325,13 +325,13 @@ static int pet_performance(struct map_session_data *sd, struct pet_data *pd) if (pd->pet.intimate > 900) val = (pd->petDB->s_perfor > 0)? 4:3; - else if(pd->pet.intimate > 750) + else if(pd->pet.intimate > 750) //TODO: this is way too high val = 2; else val = 1; pet_stop_walking(pd,2000<<8); - clif_pet_performance(&pd->bl,rand()%val + 1); + clif_pet_performance(pd, rand()%val + 1); pet_lootitem_drop(pd,NULL); return 1; } @@ -556,7 +556,7 @@ int pet_catch_process2(struct map_session_data *sd,int target_id) if (sd->menuskill_id != SA_TAMINGMONSTER) { //Exploit? - clif_pet_rulet(sd,0); + clif_pet_roulette(sd,0); sd->catch_target_class = -1; return 1; } @@ -566,7 +566,7 @@ int pet_catch_process2(struct map_session_data *sd,int target_id) i=pc_search_inventory(sd,sd->menuskill_lv); if (i < 0) { //they tried an exploit? - clif_pet_rulet(sd,0); + clif_pet_roulette(sd,0); sd->catch_target_class = -1; return 1; } @@ -584,7 +584,7 @@ int pet_catch_process2(struct map_session_data *sd,int target_id) sd->catch_target_class = md->class_; if(i < 0 || sd->catch_target_class != md->class_) { clif_emotion(&md->bl, 7); //mob will do /ag if wrong lure is used on them. - clif_pet_rulet(sd,0); + clif_pet_roulette(sd,0); sd->catch_target_class = -1; return 1; } @@ -597,16 +597,16 @@ int pet_catch_process2(struct map_session_data *sd,int target_id) if(rand()%10000 < pet_catch_rate) { unit_remove_map(&md->bl,0); status_kill(&md->bl); - clif_pet_rulet(sd,1); + clif_pet_roulette(sd,1); // if(battle_config.etc_log) -// printf("rulet success %d\n",target_id); +// printf("roulette success %d\n",target_id); intif_create_pet(sd->status.account_id,sd->status.char_id,pet_db[i].class_,mob_db(pet_db[i].class_)->lv, pet_db[i].EggID,0,pet_db[i].intimate,100,0,1,pet_db[i].jname); } else { sd->catch_target_class = -1; - clif_pet_rulet(sd,0); + clif_pet_roulette(sd,0); } return 0; diff --git a/src/map/status.c b/src/map/status.c index 2b3d91dd4..9b4e2cfd2 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4151,6 +4151,41 @@ int status_get_guild_id(struct block_list *bl) return 0; } +int status_get_emblem_id(struct block_list *bl) +{ + nullpo_retr(0, bl); + switch (bl->type) { + case BL_PC: + return ((TBL_PC*)bl)->guild_emblem_id; + case BL_PET: + if (((TBL_PET*)bl)->msd) + return ((TBL_PET*)bl)->msd->guild_emblem_id; + break; + case BL_MOB: + { + struct map_session_data *msd; + struct mob_data *md = (struct mob_data *)bl; + if (md->guardian_data) //Guardian's guild [Skotlex] + return md->guardian_data->emblem_id; + if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL) + return msd->guild_emblem_id; //Alchemist's mobs [Skotlex] + } + break; + case BL_HOM: + if (((TBL_HOM*)bl)->master) + return ((TBL_HOM*)bl)->master->guild_emblem_id; + break; + case BL_NPC: + if (bl->subtype == SCRIPT && ((TBL_NPC*)bl)->u.scr.guild_id > 0) { + struct guild *g = guild_search(((TBL_NPC*)bl)->u.scr.guild_id); + if (g) + return g->emblem_id; + } + break; + } + return 0; +} + int status_get_mexp(struct block_list *bl) { nullpo_retr(0, bl); diff --git a/src/map/status.h b/src/map/status.h index 380694eba..2e01a1e7c 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -614,6 +614,7 @@ unsigned char status_get_attack_lelement(struct block_list *bl); #define status_get_mode(bl) status_get_status_data(bl)->mode int status_get_party_id(struct block_list *bl); int status_get_guild_id(struct block_list *bl); +int status_get_emblem_id(struct block_list *bl); int status_get_mexp(struct block_list *bl); int status_get_race2(struct block_list *bl); |