From f5211cd347e39ea4c97c354006811cd251961687 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Sun, 28 Nov 2010 22:43:10 +0000 Subject: * Added emotion_type enumeration for clif_emotion constants. - Made clif_parse_Emotion use clif_emotion, rather than having it's code inlined. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14518 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/map/clif.c | 11 ++----- src/map/clif.h | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/map/homunculus.c | 30 +++++++++--------- src/map/pet.c | 4 +-- src/map/script.c | 2 +- src/map/skill.c | 6 ++-- src/map/status.c | 6 ++-- src/map/unit.c | 2 +- 9 files changed, 117 insertions(+), 33 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 9277b6267..2bad49567 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,6 +1,8 @@ Date Added 2010/11/28 + * Added emotion_type enumeration for clif_emotion constants. [Ai4rei] + - Made clif_parse_Emotion use clif_emotion, rather than having it's code inlined. * Added clr_type enumeration for vanish effect constants. [Ai4rei] * Resolved multiple issues with the party booking system (bugreport:4573, since r14412). [Ai4rei] - Fixed recruitments were limited to party leaders. diff --git a/src/map/clif.c b/src/map/clif.c index c99dab0b2..85b7d8667 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9063,10 +9063,8 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) *------------------------------------------*/ void clif_parse_Emotion(int fd, struct map_session_data *sd) { - unsigned char buf[64]; - if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 2) { - if (RFIFOB(fd,2) == 34) {// prevent use of the mute emote [Valaris] + if (RFIFOB(fd,2) == E_MUTE) {// prevent use of the mute emote [Valaris] clif_skill_fail(sd, 1, 0, 1); return; } @@ -9077,11 +9075,8 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) return; } sd->emotionlasttime = time(NULL) + 1; // not more than 1 per second (using /commands the client can spam it) - - WBUFW(buf,0) = 0xc0; - WBUFL(buf,2) = sd->bl.id; - WBUFB(buf,6) = RFIFOB(fd,2); - clif_send(buf, packet_len(0xc0), &sd->bl, AREA); + + clif_emotion(&sd->bl, RFIFOB(fd,2)); } else clif_skill_fail(sd, 1, 0, 1); } diff --git a/src/map/clif.h b/src/map/clif.h index e93291c9a..3f141e68d 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -78,6 +78,93 @@ typedef enum send_target { BG_AREA_WOS, } send_target; +typedef enum emotion_type +{ + E_GASP = 0, // /! + E_WHAT, // /? + E_HO, + E_LV, + E_SWT, + E_IC, + E_AN, + E_AG, + E_CASH, // /$ + E_DOTS, // /... + E_SCISSORS, // /gawi --- 10 + E_ROCK, // /bawi + E_PAPER, // /bo + E_KOREA, + E_LV2, + E_THX, + E_WAH, + E_SRY, + E_HEH, + E_SWT2, + E_HMM, // --- 20 + E_NO1, + E_NO, // /?? + E_OMG, + E_OH, + E_X, + E_HLP, + E_GO, + E_SOB, + E_GG, + E_KIS, // --- 30 + E_KIS2, + E_PIF, + E_OK, + E_MUTE, // red /... used for muted characters + E_INDONESIA, + E_BZZ, // /bzz, /stare + E_RICE, + E_AWSM, // /awsm, /cool + E_MEH, + E_SHY, // --- 40 + E_PAT, // /pat, /goodboy + E_MP, // /mp, /sptime + E_SLUR, + E_COM, // /com, /comeon + E_YAWN, // /yawn, /sleepy + E_GRAT, // /grat, /congrats + E_HP, // /hp, /hptime + E_PHILIPPINES, + E_MALAYSIA, + E_SINGAPORE, // --- 50 + E_BRAZIL, + E_FLASH, // /fsh + E_SPIN, // /spin + E_SIGH, + E_PROUD, // /dum + E_LOUD, // /crwd + E_OHNOES, // /desp, /otl + E_DICE1, + E_DICE2, + E_DICE3, // --- 60 + E_DICE4, + E_DICE5, + E_DICE6, + E_INDIA, + E_LOOSER, + E_RUSSIA, + E_VIRGIN, + E_PHONE, + E_MAIL, + E_CHINESE, // --- 70 + E_SIGNAL, + E_SIGNAL2, + E_SIGNAL3, + E_HUM, + E_ABS, + E_OOPS, + E_SPIT, + E_ENE, + E_PANIC, + E_WHISP, // --- 80 + // + E_MAX +} emotion_type; + typedef enum clr_type { CLR_OUTSIGHT = 0, diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 6b31e2b6b..2cdce9fb6 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -68,7 +68,7 @@ int merc_hom_dead(struct homun_data *hd, struct block_list *src) //There's no intimacy penalties on death (from Tharis) struct map_session_data *sd = hd->master; - clif_emotion(&hd->bl, 16) ; //wah + clif_emotion(&hd->bl, E_WAH); //Delete timers when dead. merc_hom_hungry_timer_delete(hd); @@ -77,7 +77,7 @@ int merc_hom_dead(struct homun_data *hd, struct block_list *src) if (!sd) //unit remove map will invoke unit free return 3; - clif_emotion(&sd->bl, 28) ; //sob + clif_emotion(&sd->bl, E_SOB); //Remove from map (if it has no intimacy, it is auto-removed from memory) return 3; } @@ -291,7 +291,7 @@ int merc_hom_evolution(struct homun_data *hd) if(!hd->homunculusDB->evo_class || hd->homunculus.class_ == hd->homunculusDB->evo_class) { - clif_emotion(&hd->bl, 4) ; //swt + clif_emotion(&hd->bl, E_SWT); return 0 ; } sd = hd->master; @@ -321,7 +321,7 @@ int merc_hom_evolution(struct homun_data *hd) map_addblock(&hd->bl); clif_spawn(&hd->bl); - clif_emotion(&sd->bl, 21); //no1 + clif_emotion(&sd->bl, E_NO1); clif_misceffect2(&hd->bl,568); //status_Calc flag&1 will make current HP/SP be reloaded from hom structure @@ -448,33 +448,33 @@ int merc_hom_food(struct map_session_data *sd, struct homun_data *hd) if ( hd->homunculus.hunger >= 91 ) { merc_hom_decrease_intimacy(hd, 50); - emotion = 16; + emotion = E_WAH; } else if ( hd->homunculus.hunger >= 76 ) { merc_hom_decrease_intimacy(hd, 5); - emotion = 19; + emotion = E_SWT2; } else if ( hd->homunculus.hunger >= 26 ) { merc_hom_increase_intimacy(hd, 75); - emotion = 2; + emotion = E_HO; } else if ( hd->homunculus.hunger >= 11 ) { merc_hom_increase_intimacy(hd, 100); - emotion = 2; + emotion = E_HO; } else { merc_hom_increase_intimacy(hd, 50); - emotion = 2; + emotion = E_HO; } hd->homunculus.hunger += 10; //dunno increase value for each food if(hd->homunculus.hunger > 100) hd->homunculus.hunger = 100; - clif_emotion(&hd->bl,emotion) ; + clif_emotion(&hd->bl,emotion); clif_send_homdata(sd,SP_HUNGRY,hd->homunculus.hunger); clif_send_homdata(sd,SP_INTIMATE,hd->homunculus.intimacy / 100); clif_hom_food(sd,foodID,1); // Too much food :/ if(hd->homunculus.intimacy == 0) - return merc_hom_delete(sd->hd, 23); //omg + return merc_hom_delete(sd->hd, E_OMG); return 0; } @@ -500,18 +500,18 @@ static int merc_hom_hungry(int tid, unsigned int tick, int id, intptr data) hd->homunculus.hunger-- ; if(hd->homunculus.hunger <= 10) { - clif_emotion(&hd->bl, 6) ; //an + clif_emotion(&hd->bl, E_AN); } else if(hd->homunculus.hunger == 25) { - clif_emotion(&hd->bl, 20) ; //hmm + clif_emotion(&hd->bl, E_HMM); } else if(hd->homunculus.hunger == 75) { - clif_emotion(&hd->bl, 33) ; //ok + clif_emotion(&hd->bl, E_OK); } if(hd->homunculus.hunger < 0) { hd->homunculus.hunger = 0; // Delete the homunculus if intimacy <= 100 if ( !merc_hom_decrease_intimacy(hd, 100) ) - return merc_hom_delete(hd, 23); //omg + return merc_hom_delete(hd, E_OMG); clif_send_homdata(sd,SP_INTIMATE,hd->homunculus.intimacy / 100); } diff --git a/src/map/pet.c b/src/map/pet.c index d3758b9e5..843f1cc11 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -509,7 +509,7 @@ int pet_catch_process2(struct map_session_data* sd, int target_id) if (sd->catch_target_class == 0 && !(md->status.mode&MD_BOSS)) 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_emotion(&md->bl, E_AG); //mob will do /ag if wrong lure is used on them. clif_pet_roulette(sd,0); sd->catch_target_class = -1; return 1; @@ -1100,7 +1100,7 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr data) //Detoxify is chosen for now. clif_skill_nodamage(&pd->bl,&sd->bl,TF_DETOXIFY,1,1); status_change_end(&sd->bl,pd->recovery->type,-1); - clif_emotion(&pd->bl, 33); + clif_emotion(&pd->bl, E_OK); } pd->recovery->timer = INVALID_TIMER; diff --git a/src/map/script.c b/src/map/script.c index c6c9c3591..abc183a6a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8693,7 +8693,7 @@ BUILDIN_FUNC(homunculus_evolution) if (sd->hd->homunculus.intimacy > 91000) merc_hom_evolution(sd->hd); else - clif_emotion(&sd->hd->bl, 4) ; //swt + clif_emotion(&sd->hd->bl, E_SWT); } return 0; } diff --git a/src/map/skill.c b/src/map/skill.c index 4db0b1e2b..6f34ae531 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -734,7 +734,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int case AM_ACIDTERROR: sc_start(bl,SC_BLEEDING,(skilllv*3),skilllv,skill_get_time2(skillid,skilllv)); if (skill_break_equip(bl, EQP_ARMOR, 100*skill_get_time(skillid,skilllv), BCT_ENEMY)) - clif_emotion(bl,23); + clif_emotion(bl,E_OMG); break; case AM_DEMONSTRATION: @@ -3002,7 +3002,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int break; case NPC_DARKBREATH: - clif_emotion(src,7); + clif_emotion(src,E_AG); case SN_FALCONASSAULT: case PA_PRESSURE: case CR_ACIDDEMONSTRATION: @@ -9408,7 +9408,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) clif_refine(sd->fd,1,idx,item->refine); pc_delitem(sd,idx,1,0,2); clif_misceffect(&sd->bl,2); - clif_emotion(&sd->bl, 23); + clif_emotion(&sd->bl, E_OMG); } } } diff --git a/src/map/status.c b/src/map/status.c index 3b9213ca5..ac034c1b6 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1083,7 +1083,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if (sc->data[SC_WINKCHARM] && target && !flag) { //Prevents skill usage - clif_emotion(src, 3); + clif_emotion(src, E_LV); return 0; } @@ -5266,7 +5266,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_SIGNUMCRUCIS: val2 = 10 + 4*val1; //Def reduction tick = -1; - clif_emotion(bl,4); + clif_emotion(bl,E_SWT); break; case SC_MAXIMIZEPOWER: val2 = tick>0?tick:60000; @@ -5483,7 +5483,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_CONFUSION: - clif_emotion(bl,1); + clif_emotion(bl,E_WHAT); break; case SC_BLEEDING: val4 = tick/10000; diff --git a/src/map/unit.c b/src/map/unit.c index a1e523fa1..d217177c4 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1973,7 +1973,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, ud->canact_tick = ud->canmove_tick; //It appears HOM do reset the can-act tick. if( !hd->homunculus.intimacy && !(hd->master && !hd->master->state.active) ) { //If logging out, this is deleted on unit_free - clif_emotion(bl, 28) ; //sob + clif_emotion(bl, E_SOB); clif_clearunit_area(bl,clrtype); map_delblock(bl); unit_free(bl,CLR_OUTSIGHT); -- cgit v1.2.3-60-g2f50