Explorar o código

* 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://svn.code.sf.net/p/rathena/svn/trunk@14518 54d463be-8e91-2dee-dedb-b68131a5f0ec

ai4rei %!s(int64=14) %!d(string=hai) anos
pai
achega
93e376eac5
Modificáronse 9 ficheiros con 117 adicións e 33 borrados
  1. 2 0
      Changelog-Trunk.txt
  2. 3 8
      src/map/clif.c
  3. 87 0
      src/map/clif.h
  4. 15 15
      src/map/homunculus.c
  5. 2 2
      src/map/pet.c
  6. 1 1
      src/map/script.c
  7. 3 3
      src/map/skill.c
  8. 3 3
      src/map/status.c
  9. 1 1
      src/map/unit.c

+ 2 - 0
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.

+ 3 - 8
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);
 }

+ 87 - 0
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,

+ 15 - 15
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);
 	}
 

+ 2 - 2
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;

+ 1 - 1
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;
 }

+ 3 - 3
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);
 			}
 		}
 	}

+ 3 - 3
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;

+ 1 - 1
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);