From 5da49b87b5a2ae77852d1f697b62f5bfea7bcde8 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Fri, 29 Jul 2016 19:15:46 +0200 Subject: [PATCH] Added hat effect packet and script support --- db/const.txt | 52 +++++++++++++++++++++++++++++++++++++++++ db/packet_db.txt | 3 +++ doc/script_commands.txt | 10 ++++++++ src/map/clif.c | 33 ++++++++++++++++++++++++++ src/map/clif.h | 1 + src/map/script.c | 32 +++++++++++++++++++++++++ 6 files changed, 131 insertions(+) diff --git a/db/const.txt b/db/const.txt index cbecb5b980..2215287390 100644 --- a/db/const.txt +++ b/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 diff --git a/db/packet_db.txt b/db/packet_db.txt index 7d079c6699..0888cfb3a4 100644 --- a/db/packet_db.txt +++ b/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 diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 8a6b2c68f1..713bbe8e90 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -9161,5 +9161,15 @@ solution rather than sending the map and the monster_id. --------------------------------------- +*itemeffect(,{, 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. diff --git a/src/map/clif.c b/src/map/clif.c index fb39d8ab46..d4587d1ff6 100644 --- a/src/map/clif.c +++ b/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 .W .L .B { .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 *------------------------------------------*/ diff --git a/src/map/clif.h b/src/map/clif.h index 0bbce5f9d4..8151493f35 100644 --- a/src/map/clif.h +++ b/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); diff --git a/src/map/script.c b/src/map/script.c index d1b36ef025..be07c96fec 100644 --- a/src/map/script.c +++ b/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"