瀏覽代碼

Added hat effect packet and script support

Lemongrass3110 8 年之前
父節點
當前提交
5da49b87b5
共有 6 個文件被更改,包括 131 次插入0 次删除
  1. 52 0
      db/const.txt
  2. 3 0
      db/packet_db.txt
  3. 10 0
      doc/script_commands.txt
  4. 33 0
      src/map/clif.c
  5. 1 0
      src/map/clif.h
  6. 32 0
      src/map/script.c

+ 52 - 0
db/const.txt

@@ -1570,6 +1570,58 @@ EF_TIME_ACCESSORY	1095
 EF_SPRITEMABLE	1096
 EF_TUNAPARTY	1097
 
+HAT_EF_BLOSSOM_FLUTTERING	1
+HAT_EF_MERMAID_LONGING	2
+HAT_EF_RL_BANISHING_BUSTER	3
+HAT_EF_LJOSALFAR	4
+HAT_EF_CLOCKING	5
+HAT_EF_SNOW	6
+HAT_EF_MAKEBLUR	7
+HAT_EF_SLEEPATTACK	8
+HAT_EF_GUMGANG	9
+HAT_EF_TALK_FROSTJOKE	10
+HAT_EF_DEMONSTRATION	11
+HAT_EF_FLUTTER_BUTTERFLY	12
+HAT_EF_ANGEL_FLUTTERING	13
+HAT_EF_BLESSING_OF_ANGELS	14
+HAT_EF_ELECTRIC	15
+HAT_EF_GREEN_FLOOR	16
+HAT_EF_SHRINK	17
+HAT_EF_VALHALLA_IDOL	18
+HAT_EF_ANGEL_STAIRS	19
+HAT_EF_GLOW_OF_NEW_YEAR	20
+HAT_EF_BOTTOM_FORTUNEKISS	21
+HAT_EF_PINKBODY	22
+HAT_EF_DOUBLEGUMGANG	23
+HAT_EF_GIANTBODY	24
+HAT_EF_GREEN99_6	25
+HAT_EF_CIRCLEPOWER	26
+HAT_EF_BOTTOM_BLOODYLUST	27
+HAT_EF_WATER_BELOW	28
+HAT_EF_LEVEL99_150	29
+HAT_EF_YELLOWFLY3	30
+HAT_EF_KAGEMUSYA	31
+HAT_EF_CHERRYBLOSSOM	32
+HAT_EF_STRANGELIGHTS	33
+HAT_EF_WL_TELEKINESIS_INTENSE	34
+HAT_EF_AB_OFFERTORIUM_RING	35
+HAT_EF_WHITEBODY	36
+HAT_EF_SAKURA	37
+HAT_EF_CLOUD2	38
+HAT_EF_FEATHER_FLUTTERING	39
+HAT_EF_CAMELLIA_HAIR_PIN	40
+HAT_EF_JP_EV_EFFECT01	41
+HAT_EF_JP_EV_EFFECT02	42
+HAT_EF_JP_EV_EFFECT03	43
+HAT_EF_FLORAL_WALTZ	44
+HAT_EF_MAGICAL_FEATHER	45
+HAT_EF_HAT_EFFECT	46
+HAT_EF_BAKURETSU_HADOU	47
+HAT_EF_GOLD_SHOWER	48
+// Those are redefined clientside
+//HAT_EF_WHITEBODY	49
+//HAT_EF_WATER_BELOW	50
+
 WARPNPC	45
 1_ETC_01	46
 1_M_01	47

+ 3 - 0
db/packet_db.txt

@@ -2468,6 +2468,9 @@ packet_keys: 0x62C86D09,0x75944F17,0x112C133D // [YomRawr]
 0x0817,5,hommenu,2:4
 0x0923,36,storagepassword,2:4:20
 
+// New Packets
+0xA3B,-1		// ZC_HAT_EFFECT
+
 // RODEX Mail system
 0x09E7,3		// ZC_NOTIFY_UNREADMAIL
 0x09E8,11,dull,0	// CZ_OPEN_MAILBOX

+ 10 - 0
doc/script_commands.txt

@@ -9161,5 +9161,15 @@ solution rather than sending the map and the monster_id.
 
 ---------------------------------------
 
+*itemeffect(<State>,<Hat Effect ID>{, Hat Effect ID2, ... });
+
+This will set a Hat Effect onto the player. The state field allows you to
+enable (true) or disable (false) the effect on the player.
+The Hat Effect constants can be found in db/const.txt starting with HAT_EF_*.
+
+Requires client 2015-05-13aRagEXE or newer. 
+
+---------------------------------------
+
 Whew.
 That's about all of them.

+ 33 - 0
src/map/clif.c

@@ -18708,6 +18708,39 @@ void clif_navigateTo(struct map_session_data *sd, const char* mapname, uint16 x,
 #endif
 }
 
+/// Send hat effects to the client (ZC_HAT_EFFECT).
+/// 0A3B <Length>.W <AID>.L <Status>.B { <HatEffectId>.W }
+void clif_item_effects( struct block_list* bl, bool enable, short effects[], int count ){
+#if PACKETVER >= 20150513
+	unsigned char* buf;
+	int len,i;
+
+	nullpo_retv(bl);
+
+	len = 9 + count * 2;
+
+	buf = (unsigned char*)aMalloc( len );
+
+	WBUFW(buf,0) = 0xa3b;
+	WBUFW(buf,2) = len;
+	WBUFL(buf,4) = bl->id;
+	WBUFB(buf,8) = enable;
+
+	for( i = 0; i < count; i++ ){
+		WBUFW(buf,9+i*2) = effects[i];
+	}
+
+	clif_send(buf, len,bl,SELF);
+
+	if( disguised(bl) ){
+		WBUFL(buf,4) = -bl->id;
+		clif_send(buf, len,bl,SELF);
+	}
+
+	aFree(buf);
+#endif
+}
+
 /*==========================================
  * Main client packet processing function
  *------------------------------------------*/

+ 1 - 0
src/map/clif.h

@@ -672,6 +672,7 @@ void clif_item_repair_list(struct map_session_data *sd, struct map_session_data
 void clif_item_repaireffect(struct map_session_data *sd, int idx, int flag);
 void clif_item_damaged(struct map_session_data* sd, unsigned short position);
 void clif_item_refine_list(struct map_session_data *sd);
+void clif_item_effects( struct block_list* bl, bool enable, short effects[], int count );
 
 void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv);
 

+ 32 - 0
src/map/script.c

@@ -21480,6 +21480,37 @@ BUILDIN_FUNC(recalculatestat) {
 	status_calc_pc(sd, SCO_FORCE);
 	return SCRIPT_CMD_SUCCESS;
 }
+
+BUILDIN_FUNC(itemeffect){
+#if PACKETVER >= 20150513
+	struct map_session_data* sd = script_rid2sd(st);
+	bool enable;
+	short *effects;
+	int i, count;
+
+	if( sd == NULL )
+		return SCRIPT_CMD_FAILURE;
+
+	enable = script_getnum(st,2) ? true : false;
+
+	if( !script_hasdata(st,3) ){
+		ShowError( "buildin_itemeffect: You need to specify a hat effect id.\n" );
+		return SCRIPT_CMD_FAILURE;
+	}
+
+	count = st->end - 3;
+	effects = (short*)aMalloc(count*sizeof(short));
+
+	for( i = 0; i < count; i++ ){
+		effects[i] = script_getnum(st,3+i);
+	}
+
+	clif_item_effects( &sd->bl, enable, effects, count );
+
+#endif
+	return SCRIPT_CMD_SUCCESS;
+}
+
 #include "../custom/script.inc"
 
 // declarations that were supposed to be exported from npc_chat.c
@@ -22058,6 +22089,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(adopt,"vv"),
 	BUILDIN_DEF(getexp2,"ii?"),
 	BUILDIN_DEF(recalculatestat,""),
+	BUILDIN_DEF(itemeffect,"ii*"),
 
 #include "../custom/script_def.inc"