diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 323 |
1 files changed, 180 insertions, 143 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 7715e6c6a..9e105e4a9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2,56 +2,60 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#include "../common/cbasetypes.h" -#include "../common/socket.h" -#include "../common/timer.h" -#include "../common/grfio.h" -#include "../common/malloc.h" -#include "../common/nullpo.h" -#include "../common/random.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/utils.h" -#include "../common/ers.h" -#include "../common/conf.h" -#include "../common/HPM.h" +#define HERCULES_CORE + +#include "../config/core.h" // ANTI_MAYAP_CHEAT, RENEWAL, SECURE_NPCTIMEOUT +#include "clif.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <time.h> -#include "map.h" -#include "chrif.h" -#include "pc.h" -#include "status.h" -#include "npc.h" -#include "itemdb.h" -#include "chat.h" -#include "trade.h" -#include "storage.h" -#include "script.h" -#include "skill.h" #include "atcommand.h" -#include "intif.h" #include "battle.h" #include "battleground.h" -#include "mob.h" -#include "party.h" -#include "unit.h" +#include "chat.h" +#include "chrif.h" +#include "elemental.h" #include "guild.h" -#include "vending.h" -#include "pet.h" #include "homunculus.h" #include "instance.h" -#include "mercenary.h" -#include "elemental.h" +#include "intif.h" +#include "irc-bot.h" +#include "itemdb.h" #include "log.h" -#include "clif.h" #include "mail.h" +#include "map.h" +#include "mercenary.h" +#include "mob.h" +#include "npc.h" +#include "party.h" +#include "pc.h" +#include "pet.h" #include "quest.h" -#include "irc-bot.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <time.h> +#include "script.h" +#include "skill.h" +#include "status.h" +#include "storage.h" +#include "trade.h" +#include "unit.h" +#include "vending.h" +#include "../common/HPM.h" +#include "../common/cbasetypes.h" +#include "../common/conf.h" +#include "../common/ers.h" +#include "../common/grfio.h" +#include "../common/malloc.h" +#include "../common/mmo.h" // NEW_CARTS +#include "../common/nullpo.h" +#include "../common/random.h" +#include "../common/showmsg.h" +#include "../common/socket.h" +#include "../common/strlib.h" +#include "../common/timer.h" +#include "../common/utils.h" struct clif_interface clif_s; @@ -61,8 +65,10 @@ static struct packet_itemlist_equip itemlist_equip; static struct packet_storelist_normal storelist_normal; static struct packet_storelist_equip storelist_equip; static struct packet_viewequip_ack viewequip_list; +#if PACKETVER >= 20131223 static struct packet_npc_market_result_ack npcmarket_result; static struct packet_npc_market_open npcmarket_open; +#endif //#define DUMP_UNKNOWN_PACKET //#define DUMP_INVALID_PACKET @@ -1099,7 +1105,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); p.accessory3 = GetWord(g_id, 0); - } + } p.headpalette = vd->hair_color; p.bodypalette = vd->cloth_color; p.headDir = (sd)? sd->head_dir : 0; @@ -1219,7 +1225,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, p.GID = -bl->id; #else p.GID = -bl->id; -#endif +#endif clif->send(&p,sizeof(p),bl,SELF); } } @@ -2582,7 +2588,7 @@ void clif_cartlist(struct map_session_data *sd) { /// Removes cart (ZC_CARTOFF). /// 012b -/// Client behaviour: +/// Client behavior: /// Closes the cart storage and removes all it's items from memory. /// The Num & Weight values of the cart are left untouched and the cart is NOT removed. void clif_clearcart(int fd) @@ -4616,6 +4622,8 @@ void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send /// 099f <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.W <visible>.B (ZC_SKILL_ENTRY4) void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { struct packet_skill_entry p; + nullpo_retv(bl); + nullpo_retv(su); if( su->group->state.guildaura ) return; @@ -5041,7 +5049,7 @@ void clif_skillcastcancel(struct block_list* bl) /// 4 = "no party" MsgStringTable[163] /// 5 = "no shout" MsgStringTable[164] /// 6 = "no PKing" MsgStringTable[165] -/// 7 = "no alligning" MsgStringTable[383] +/// 7 = "no aligning" MsgStringTable[383] /// ? = ignored /// cause: /// 0 = "not enough skill level" MsgStringTable[214] (AL_WARP) @@ -5419,7 +5427,7 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { } -/// Presents a textual list of producable items (ZC_MAKABLEITEMLIST). +/// Presents a textual list of producible items (ZC_MAKABLEITEMLIST). /// 018d <packet len>.W { <name id>.W { <material id>.W }*3 }* /// material id: /// unused by the client @@ -5461,7 +5469,7 @@ void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int } -/// Present a list of producable items (ZC_MAKINGITEM_LIST). +/// Present a list of producible items (ZC_MAKINGITEM_LIST). /// 025a <packet len>.W <mk type>.W { <name id>.W }* /// mk type: /// 1 = cooking @@ -5597,7 +5605,7 @@ void clif_displaymessage(const int fd, const char* mes) { if ( ( len = strnlen(mes, 255) ) > 0 ) { // don't send a void message (it's not displaying on the client chat). @help can send void line. WFIFOHEAD(fd, 5 + len); WFIFOW(fd,0) = 0x8e; - WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate + WFIFOW(fd,2) = 5 + len; // 4 + len + NULL terminate safestrncpy((char *)WFIFOP(fd,4), mes, len + 1); WFIFOSET(fd, 5 + len); } @@ -5626,14 +5634,14 @@ void clif_displaymessage2(const int fd, const char* mes) { } else { WFIFOHEAD(fd, 5 + len); WFIFOW(fd,0) = 0x8e; - WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate + WFIFOW(fd,2) = 5 + len; // 4 + len + NULL terminate safestrncpy((char *)WFIFOP(fd,4), line, len + 1); WFIFOSET(fd, 5 + len); } } line = strtok(NULL, "\n"); } - aFree(message); + aFree(message); } } /* oh noo! another version of 0x8e! */ @@ -5643,7 +5651,7 @@ void clif_displaymessage_sprintf(const int fd, const char* mes, ...) { if( map->cpsd_active && fd == 0 ) { ShowInfo("HCP: "); va_start(ap,mes); - _vShowMessage(MSG_NONE,mes,ap); + vShowMessage_(MSG_NONE,mes,ap); va_end(ap); ShowMessage("\n"); } else if ( fd > 0 ) { @@ -5663,7 +5671,7 @@ void clif_displaymessage_sprintf(const int fd, const char* mes, ...) { /* */ WFIFOW(fd,0) = 0x8e; - WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate + WFIFOW(fd,2) = 5 + len; // 4 + len + NULL terminate WFIFOSET(fd, 5 + len); } @@ -5918,8 +5926,8 @@ void clif_wis_message(int fd, const char* nick, const char* mes, size_t mes_len) /// Inform the player about the result of his whisper action (ZC_ACK_WHISPER). /// 0098 <result>.B /// result: -/// 0 = success to send wisper -/// 1 = target character is not loged in +/// 0 = success to send whisper +/// 1 = target character is not logged in /// 2 = ignored by target /// 3 = everyone ignored by target void clif_wis_end(int fd, int flag) { @@ -6164,7 +6172,7 @@ void clif_item_refine_list(struct map_session_data *sd) WFIFOHEAD(fd, MAX_INVENTORY * 13 + 4); WFIFOW(fd,0)=0x221; for(i=c=0;i<MAX_INVENTORY;i++){ - if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify + if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify && (wlv=itemdb_wlv(sd->status.inventory[i].nameid)) >=1 && !sd->inventory_data[i]->flag.no_refine && !(sd->status.inventory[i].equip&EQP_ARMS)){ @@ -6185,7 +6193,7 @@ void clif_item_refine_list(struct map_session_data *sd) /// Notification of an auto-casted skill (ZC_AUTORUN_SKILL). -/// 0147 <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradable>.B +/// 0147 <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradeable>.B void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) { int fd; @@ -7270,7 +7278,7 @@ void clif_mvp_noitem(struct map_session_data* sd) /// 0 = "Guild has been created." /// 1 = "You are already in a Guild." /// 2 = "That Guild Name already exists." -/// 3 = "You need the neccessary item to create a Guild." +/// 3 = "You need the necessary item to create a Guild." void clif_guild_created(struct map_session_data *sd,int flag) { int fd; @@ -7663,7 +7671,7 @@ void clif_guild_emblem_area(struct block_list* bl) /// Sends guild skills (ZC_GUILD_SKILLINFO). -/// 0162 <packet len>.W <skill points>.W { <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradable>.B }* +/// 0162 <packet len>.W <skill points>.W { <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradeable>.B }* void clif_guild_skillinfo(struct map_session_data* sd) { int fd; @@ -8131,7 +8139,7 @@ void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum /// result: /// 0 = failure /// 1 = success -void clif_GM_kickack(struct map_session_data *sd, int id) +void clif_GM_kickack(struct map_session_data *sd, int result) { int fd; @@ -8140,7 +8148,7 @@ void clif_GM_kickack(struct map_session_data *sd, int id) fd = sd->fd; WFIFOHEAD(fd,packet_len(0xcd)); WFIFOW(fd,0) = 0xcd; - WFIFOB(fd,2) = id; // FIXME: this is not account id + WFIFOB(fd,2) = result; WFIFOSET(fd, packet_len(0xcd)); } @@ -8154,7 +8162,7 @@ void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { map->quit(tsd); if( sd ) - clif->GM_kickack(sd,tsd->status.account_id); + clif->GM_kickack(sd, 1); } @@ -8180,7 +8188,7 @@ void clif_manner_message(struct map_session_data* sd, uint32 type) } -/// Followup to 0x14a type 3/5, informs who did the manner adjustment action (ZC_NOTIFY_MANNER_POINT_GIVEN). +/// Follow-up to 0x14a type 3/5, informs who did the manner adjustment action (ZC_NOTIFY_MANNER_POINT_GIVEN). /// 014b <type>.B <GM name>.24B /// type: /// 0 = positive (unmute) @@ -8271,7 +8279,7 @@ void clif_playBGM(struct map_session_data* sd, const char* name) /// term: /// unknown purpose, only relevant to act = 1 /// npc id: -/// The accustic direction of the sound is determined by the +/// The acoustic direction of the sound is determined by the /// relative position of the NPC to the player (3D sound). void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) { @@ -8420,6 +8428,34 @@ void clif_message(struct block_list* bl, const char* msg) { clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); } +/** + * Notifies the client that the storage window is still open + * + * Should only be used in cases where the client closed the + * storage window without server's consent + **/ +void clif_refresh_storagewindow( struct map_session_data *sd ) { + // Notify the client that the storage is open + if( sd->state.storage_flag == 1 ) { + storage->sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); + clif->storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items)); + clif->updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE); + } + // Notify the client that the gstorage is open otherwise it will + // remain locked forever and nobody will be able to access it + if( sd->state.storage_flag == 2 ) { + struct guild_storage *gstor; + if( (gstor = gstorage->id2storage2(sd->status.guild_id)) == NULL) { + // Shouldn't happen... The information should already be at the map-server + intif->request_guild_storage(sd->status.account_id,sd->status.guild_id); + } else { + storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items)); + clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items)); + clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE); + } + } +} + // refresh the client's screen, getting rid of any effects void clif_refresh(struct map_session_data *sd) { @@ -8480,6 +8516,7 @@ void clif_refresh(struct map_session_data *sd) pc->disguise(sd, disguise); } + clif->refresh_storagewindow(sd); } @@ -8567,11 +8604,11 @@ void clif_charnameack (int fd, struct block_list *bl) nullpo_retv(md); memcpy(WBUFP(buf,6), md->name, NAME_LENGTH); - if( md->guardian_data && md->guardian_data->guild_id ) + if( md->guardian_data && md->guardian_data->g ) { WBUFW(buf, 0) = cmd = 0x195; WBUFB(buf,30) = 0; - memcpy(WBUFP(buf,54), md->guardian_data->guild_name, NAME_LENGTH); + memcpy(WBUFP(buf,54), md->guardian_data->g->name, NAME_LENGTH); memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, NAME_LENGTH); } else if( battle_config.show_mob_info ) @@ -8608,7 +8645,7 @@ void clif_charnameack (int fd, struct block_list *bl) return; } - // if no receipient specified just update nearby clients + // if no recipient specified just update nearby clients if (fd == 0) clif->send(buf, packet_len(cmd), bl, AREA); else { @@ -8703,7 +8740,7 @@ void clif_slide(struct block_list *bl, int x, int y) /// 008d <packet len>.W <id>.L <message>.?B void clif_disp_overhead(struct block_list *bl, const char* mes) { - unsigned char buf[256]; //This should be more than sufficient, the theorical max is CHAT_SIZE + 8 (pads and extra inserted crap) + unsigned char buf[256]; //This should be more than sufficient, the theoretical max is CHAT_SIZE + 8 (pads and extra inserted crap) size_t len_mes = strlen(mes)+1; //Account for \0 if (len_mes > sizeof(buf)-8) { @@ -8811,7 +8848,7 @@ void clif_starskill(struct map_session_data* sd, const char* mapname, int monste } /*========================================== - * Info about Star Glaldiator save map [Komurka] + * Info about Star Gladiator save map [Komurka] * type: 1: Information, 0: Map registered *------------------------------------------*/ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) @@ -8823,7 +8860,7 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig } /*========================================== - * Info about Star Glaldiator hate mob [Komurka] + * Info about Star Gladiator hate mob [Komurka] * type: 1: Register mob, 0: Information. *------------------------------------------*/ void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) @@ -9017,7 +9054,7 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, if( strncmp(name, sd->status.name, namelen) || // the text must start with the speaker's name name[namelen] != ' ' || name[namelen+1] != ':' || name[namelen+2] != ' ' ) // followed by ' : ' { - //Hacked message, or infamous "client desynch" issue where they pick one char while loading another. + //Hacked message, or infamous "client desynchronize" issue where they pick one char while loading another. ShowWarning("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n", sd->status.name); set_eof(fd); // Just kick them out to correct it. return false; @@ -9829,7 +9866,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) if( atcommand->exec(fd, sd, message, true) ) return; - if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) + if( !pc->can_talk(sd) ) return; if( battle_config.min_chat_delay ) { //[Skotlex] @@ -10076,14 +10113,14 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, return; } - if (sd->sc.count && - (sd->sc.data[SC_TRICKDEAD] || - sd->sc.data[SC_AUTOCOUNTER] || - sd->sc.data[SC_BLADESTOP] || - sd->sc.data[SC_DEEP_SLEEP] || - sd->sc.data[SC__MANHOLE] || - sd->sc.data[SC_CURSEDCIRCLE_ATKER] || - sd->sc.data[SC_CURSEDCIRCLE_TARGET] )) + // Statuses that don't let the player sit / attack / talk with NPCs(targeted) + // (not all are included in pc_can_attack) + if( sd->sc.count && ( + sd->sc.data[SC_TRICKDEAD] || + (sd->sc.data[SC_AUTOCOUNTER] && action_type != 0x07) || + sd->sc.data[SC_BLADESTOP] || + sd->sc.data[SC_DEEP_SLEEP] ) + ) return; pc_stop_walking(sd, 1); @@ -10107,10 +10144,6 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, if( sd->sc.option&OPTION_COSTUME ) return; - if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] || - (sd->sc.data[SC_SIREN] && sd->sc.data[SC_SIREN]->val2 == target_id) ) - return; - if (!battle_config.sdelay_attack_enable && pc->checkskill(sd, SA_FREECAST) <= 0) { if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) { clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); @@ -10277,7 +10310,7 @@ void clif_hercules_chsys_quit(struct map_session_data *sd) { sd->channel_count = 0; aFree(sd->channels); - sd->channels = NULL; + sd->channels = NULL; } /// Request for an action. @@ -10288,7 +10321,7 @@ void clif_hercules_chsys_quit(struct map_session_data *sd) { /// 1 = pick up item /// 2 = sit down /// 3 = stand up -/// 7 = continous attack +/// 7 = continuous attack /// 12 = (touch skill?) /// There are various variants of this packet, some of them have padding between fields. void clif_parse_ActionRequest(int fd, struct map_session_data *sd) @@ -10342,7 +10375,8 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) if ( atcommand->exec(fd, sd, message, true) ) return; - if (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)) + // Statuses that prevent the player from whispering + if( !pc->can_talk(sd) ) return; if (battle_config.min_chat_delay) { //[Skotlex] @@ -11002,7 +11036,7 @@ void clif_parse_ChatLeave(int fd, struct map_session_data* sd) } -//Handles notifying asker and rejecter of what has just ocurred. +//Handles notifying asker and rejecter of what has just occurred. //Type is used to determine the correct msg_txt to use: //0: void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { @@ -11128,8 +11162,8 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) /// 012a void clif_parse_RemoveOption(int fd,struct map_session_data *sd) { - if( !(sd->sc.option&(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)) -#ifdef NEW_CARTS + if( !(sd->sc.option&(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)) +#ifdef NEW_CARTS && sd->sc.data[SC_PUSH_CART] ){ pc->setcart(sd,0); #else @@ -11341,10 +11375,6 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) ) return; - // Some self skills need to close the storage to work properly - if( skill_id == AL_TELEPORT && sd->state.storage_flag ) - storage->close(sd); - if( pc_issit(sd) ) return; @@ -11545,7 +11575,8 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) if(skill_id != sd->menuskill_id) return; - if( pc_cant_act(sd) ) { + // It is possible to use teleport with the storage window open issue:8027 + if( pc_cant_act(sd) && (!sd->state.storage_flag && skill_id != AL_TELEPORT) ) { clif_menuskill_clear(sd); return; } @@ -12207,7 +12238,7 @@ void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { /// Party Booking in KRO [Spiria] /// -/// Request to register a party booking advertisment (CZ_PARTY_BOOKING_REQ_REGISTER). +/// Request to register a party booking advertisement (CZ_PARTY_BOOKING_REQ_REGISTER). /// 0802 <level>.W <map id>.W { <job>.W }*6 void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) { @@ -12227,7 +12258,7 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) } -/// Result of request to register a party booking advertisment (ZC_PARTY_BOOKING_ACK_REGISTER). +/// Result of request to register a party booking advertisement (ZC_PARTY_BOOKING_ACK_REGISTER). /// 0803 <result>.W /// result: /// 0 = success @@ -12248,7 +12279,7 @@ void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) } -/// Request to search for party booking advertisments (CZ_PARTY_BOOKING_REQ_SEARCH). +/// Request to search for party booking advertisement (CZ_PARTY_BOOKING_REQ_SEARCH). /// 0804 <level>.W <map id>.W <job>.W <last index>.L <result count>.W void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) { @@ -12299,7 +12330,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, } -/// Request to delete own party booking advertisment (CZ_PARTY_BOOKING_REQ_DELETE). +/// Request to delete own party booking advertisement (CZ_PARTY_BOOKING_REQ_DELETE). /// 0806 void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) { @@ -12312,7 +12343,7 @@ void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) } -/// Result of request to delete own party booking advertisment (ZC_PARTY_BOOKING_ACK_DELETE). +/// Result of request to delete own party booking advertisement (ZC_PARTY_BOOKING_ACK_DELETE). /// 0807 <result>.W /// result: /// 0 = success @@ -12334,7 +12365,7 @@ void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) } -/// Request to update party booking advertisment (CZ_PARTY_BOOKING_REQ_UPDATE). +/// Request to update party booking advertisement (CZ_PARTY_BOOKING_REQ_UPDATE). /// 0808 { <job>.W }*6 void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) { @@ -12352,7 +12383,7 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) } -/// Notification about new party booking advertisment (ZC_PARTY_BOOKING_NOTIFY_INSERT). +/// Notification about new party booking advertisement (ZC_PARTY_BOOKING_NOTIFY_INSERT). /// 0809 <index>.L <char name>.24B <expire time>.L <level>.W <map id>.W { <job>.W }*6 void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) { @@ -12378,7 +12409,7 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo } -/// Notification about updated party booking advertisment (ZC_PARTY_BOOKING_NOTIFY_UPDATE). +/// Notification about updated party booking advertisement (ZC_PARTY_BOOKING_NOTIFY_UPDATE). /// 080a <index>.L { <job>.W }*6 void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) { @@ -12399,7 +12430,7 @@ void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_boo } -/// Notification about deleted party booking advertisment (ZC_PARTY_BOOKING_NOTIFY_DELETE). +/// Notification about deleted party booking advertisement (ZC_PARTY_BOOKING_NOTIFY_DELETE). /// 080b <index>.L void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) { @@ -12418,7 +12449,7 @@ void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) /// Modified version of Party Booking System for 2012-04-10 or 2012-04-18 (RagexeRE). /// Code written by mkbu95, Spiria, Yommy and Ind -/// Request to register a party booking advertisment (CZ_PARTY_RECRUIT_REQ_REGISTER). +/// Request to register a party booking advertisement (CZ_PARTY_RECRUIT_REQ_REGISTER). /// 08e5 <level>.W <notice>.37B void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) { @@ -12465,7 +12496,7 @@ void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, #endif } -/// Result of request to register a party booking advertisment (ZC_PARTY_RECRUIT_ACK_REGISTER). +/// Result of request to register a party booking advertisement (ZC_PARTY_RECRUIT_ACK_REGISTER). /// 08e6 <result>.W /// result: /// 0 = success @@ -12485,7 +12516,7 @@ void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) #endif } -/// Request to search for party booking advertisments (CZ_PARTY_RECRUIT_REQ_SEARCH). +/// Request to search for party booking advertisement (CZ_PARTY_RECRUIT_REQ_SEARCH). /// 08e7 <level>.W <map id>.W <last index>.L <result count>.W void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) { @@ -12501,7 +12532,7 @@ void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) #endif } -/// Request to delete own party booking advertisment (CZ_PARTY_RECRUIT_REQ_DELETE). +/// Request to delete own party booking advertisement (CZ_PARTY_RECRUIT_REQ_DELETE). /// 08e9 void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) { @@ -12513,7 +12544,7 @@ void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) #endif } -/// Result of request to delete own party booking advertisment (ZC_PARTY_RECRUIT_ACK_DELETE). +/// Result of request to delete own party booking advertisement (ZC_PARTY_RECRUIT_ACK_DELETE). /// 08ea <result>.W /// result: /// 0 = success @@ -12534,7 +12565,7 @@ void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) #endif } -/// Request to update party booking advertisment (CZ_PARTY_RECRUIT_REQ_UPDATE). +/// Request to update party booking advertisement (CZ_PARTY_RECRUIT_REQ_UPDATE). /// 08eb <notice>.37B void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) { @@ -12549,7 +12580,7 @@ void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) #endif } -/// Notification about new party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_INSERT). +/// Notification about new party booking advertisement (ZC_PARTY_RECRUIT_NOTIFY_INSERT). /// 08ec <index>.L <expire time>.L <char name>.24B <level>.W <notice>.37B void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) { @@ -12571,7 +12602,7 @@ void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_boo #endif } -/// Notification about updated party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_UPDATE). +/// Notification about updated party booking advertisement (ZC_PARTY_RECRUIT_NOTIFY_UPDATE). /// 08ed <index>.L <notice>.37B void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) { @@ -12588,7 +12619,7 @@ void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_boo #endif } -/// Notification about deleted party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_DELETE). +/// Notification about deleted party booking advertisement (ZC_PARTY_RECRUIT_NOTIFY_DELETE). /// 08ee <index>.L void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) { @@ -13140,7 +13171,7 @@ void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) if(!sd->state.gmaster_flag) return; - // compensate for some client defects when using multilanguage mode + // compensate for some client defects when using multilingual mode if (msg1[0] == '|' && msg1[3] == '|') msg1+= 3; // skip duplicate marker if (msg2[0] == '|' && msg2[3] == '|') msg2+= 3; // skip duplicate marker if (msg2[0] == '|') msg2[strnlen(msg2, MAX_GUILDMES2)-1] = '\0'; // delete extra space at the end of string @@ -13580,7 +13611,7 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { /// Request to execute GM commands. /// usage: /// /item n - summon n monster or acquire n item/s -/// /item money - grants 2147483647 zenies +/// /item money - grants 2147483647 Zeny /// /item whereisboss - locate boss mob in current map.(not yet implemented) /// /item regenboss_n t - regenerate n boss monster by t millisecond.(not yet implemented) /// /item onekillmonster - toggle an ability to kill mobs in one hit.(not yet implemented) @@ -13684,7 +13715,7 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { return; value = battle_config.client_accept_chatdori; - dstsd = sd; + dstsd = sd; } else { dstsd = map->id2sd(id); if( dstsd == NULL ) @@ -13961,7 +13992,7 @@ void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int cha } -//Subfunction called from clif_foreachclient to toggle friends on/off [Skotlex] +//Sub-function called from clif_foreachclient to toggle friends on/off [Skotlex] int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) { int account_id, char_id, online; @@ -14310,7 +14341,7 @@ void clif_parse_ranklist(int fd, struct map_session_data *sd) { case RANKTYPE_BLACKSMITH: case RANKTYPE_ALCHEMIST: case RANKTYPE_TAEKWON: - clif->ranklist(sd, type); // pk_list unsuported atm + clif->ranklist(sd, type); // pk_list unsupported atm break; } } @@ -14581,18 +14612,27 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn] /// 0292 void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int hpsp = 100; - if (item_position < 0) - return; + if (item_position < 0){ + if (sd->sc.data[SC_LIGHT_OF_REGENE]) + hpsp = 20 * sd->sc.data[SC_LIGHT_OF_REGENE]->val1; + else + return; + } if (sd->sc.data[SC_HELLPOWER]) //Cannot res while under the effect of SC_HELLPOWER. return; - if (!status->revive(&sd->bl, 100, 100)) + if (!status->revive(&sd->bl, hpsp, hpsp)) return; + if ( item_position > 0) + pc->delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME); + else + status_change_end(&sd->bl,SC_LIGHT_OF_REGENE,INVALID_TIMER); + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); - pc->delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME); } @@ -14631,7 +14671,7 @@ void clif_check(int fd, struct map_session_data* pl_sd) { WFIFOW(fd,34) = pl_sd->battle_status.flee2/10; WFIFOW(fd,36) = pl_sd->battle_status.cri/10; WFIFOW(fd,38) = (2000-pl_sd->battle_status.amotion)/10; // aspd - WFIFOW(fd,40) = 0; // FIXME: What is 'plusASPD' supposed to be? Maybe adelay? + WFIFOW(fd,40) = 0; // FIXME: What is 'plusASPD' supposed to be? Maybe a delay? WFIFOSET(fd,packet_len(0x214)); } @@ -14696,7 +14736,7 @@ void clif_Mail_getattachment(int fd, uint8 flag) /// 0249 <result>.B /// result: /// 0 = success -/// 1 = recipinent does not exist +/// 1 = recipient does not exist void clif_Mail_send(int fd, bool fail) { WFIFOHEAD(fd,packet_len(0x249)); @@ -15521,20 +15561,10 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { WFIFOSET(fd,WFIFOW(fd,2)); } - /// Cashshop Buy Ack (ZC_PC_CASH_POINT_UPDATE). /// 0289 <cash point>.L <error>.W /// 0289 <cash point>.L <kafra point>.L <error>.W (PACKETVER >= 20070711) -/// error: -/// 0 = The deal has successfully completed. (ERROR_TYPE_NONE) -/// 1 = The Purchase has failed because the NPC does not exist. (ERROR_TYPE_NPC) -/// 2 = The Purchase has failed because the Kafra Shop System is not working correctly. (ERROR_TYPE_SYSTEM) -/// 3 = You are over your Weight Limit. (ERROR_TYPE_INVENTORY_WEIGHT) -/// 4 = You cannot purchase items while you are in a trade. (ERROR_TYPE_EXCHANGE) -/// 5 = The Purchase has failed because the Item Information was incorrect. (ERROR_TYPE_ITEM_ID) -/// 6 = You do not have enough Kafra Credit Points. (ERROR_TYPE_MONEY) -/// 7 = You can purchase up to 10 items. -/// 8 = Some items could not be purchased. +/// For error return codes see enum cashshop_error@clif.h void clif_cashshop_ack(struct map_session_data* sd, int error) { struct npc_data *nd; int fd = sd->fd; @@ -16037,7 +16067,7 @@ void clif_mercenary_info(struct map_session_data *sd) { /// Mercenary skill tree (ZC_MER_SKILLINFO_LIST). -/// 029d <packet len>.W { <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <skill name>.24B <upgradable>.B }* +/// 029d <packet len>.W { <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <skill name>.24B <upgradeable>.B }* void clif_mercenary_skillblock(struct map_session_data *sd) { struct mercenary_data *md; @@ -17111,7 +17141,7 @@ void clif_parse_debug(int fd,struct map_session_data *sd) { } /*========================================== * Server tells client to display a window similar to Magnifier (item) one - * Server populates the window with avilable elemental converter options according to player's inventory + * Server populates the window with available elemental converter options according to player's inventory *------------------------------------------*/ int clif_elementalconverter_list(struct map_session_data *sd) { int i,c,view,fd; @@ -17526,7 +17556,7 @@ void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { WFIFOW(fd, 0) = 0x845; WFIFOL(fd, 2) = sd->cashPoints; //[Ryuuzaki] - switched positions to reflect proper values WFIFOL(fd, 6) = sd->kafraPoints; - WFIFOSET(fd, 10); + WFIFOSET(fd, 10); } void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { @@ -17556,7 +17586,7 @@ void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { } void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { unsigned short limit = RFIFOW(fd, 4), i, j; - unsigned int kafra_pay = RFIFOL(fd, 6);// [Ryuuzaki] - These are free cash points (strangely #CASH = main cash curreny for us, confusing) + unsigned int kafra_pay = RFIFOL(fd, 6);// [Ryuuzaki] - These are free cash points (strangely #CASH = main cash currently for us, confusing) if( map->list[sd->bl.m].flag.nocashshop ) { clif->colormes(fd,COLOR_RED,msg_txt(1489)); //Cash Shop is disabled in this map @@ -17761,7 +17791,7 @@ void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK clif->send(&p,sizeof(p), &sd->bl, SELF); } break; - } + } } @@ -17793,7 +17823,7 @@ void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) { default: clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id); return; - } + } bg->queue_add(sd, arena, (enum bg_queue_types)p->type); } @@ -18153,6 +18183,7 @@ void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { } /* NPC Market (by Ind after an extensive debugging of the packet, only possible thanks to Yommy <3) */ void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { +#if PACKETVER >= 20131223 struct npc_item_list *shop = nd->u.scr.shop->item; unsigned short shop_size = nd->u.scr.shop->items, i, c; struct item_data *id = NULL; @@ -18173,12 +18204,14 @@ void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); +#endif } void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { /* TODO track the state <3~ */ sd->npc_shopid = 0; } void clif_npc_market_purchase_ack(struct map_session_data *sd, struct packet_npc_market_purchase *req, unsigned char response) { +#if PACKETVER >= 20131223 unsigned short c = 0; npcmarket_result.PacketType = npcmarketresultackType; @@ -18211,11 +18244,14 @@ void clif_npc_market_purchase_ack(struct map_session_data *sd, struct packet_npc npcmarket_result.PacketLength = 5 + ( sizeof(npcmarket_result.list[0]) * c );; clif->send(&npcmarket_result,npcmarket_result.PacketLength,&sd->bl,SELF); +#endif } void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) { +#if PACKETVER >= 20131223 struct packet_npc_market_purchase *p = P2PTR(fd); clif->npc_market_purchase_ack(sd,p,npc->market_buylist(sd,(p->PacketLength - 4) / sizeof(p->list[0]),p)); +#endif } /* */ unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { @@ -18646,6 +18682,7 @@ void clif_defaults(void) { clif->sitting = clif_sitting; clif->standing = clif_standing; clif->arrow_create_list = clif_arrow_create_list; + clif->refresh_storagewindow = clif_refresh_storagewindow; clif->refresh = clif_refresh; clif->fame_blacksmith = clif_fame_blacksmith; clif->fame_alchemist = clif_fame_alchemist; @@ -18986,7 +19023,7 @@ void clif_defaults(void) { clif->search_store_info_failed = clif_search_store_info_failed; clif->open_search_store_info = clif_open_search_store_info; clif->search_store_info_click_ack = clif_search_store_info_click_ack; - /* elemental-related */ + /* elemental-related */ clif->elemental_info = clif_elemental_info; clif->elemental_updatestatus = clif_elemental_updatestatus; /* bgqueue */ @@ -18996,7 +19033,7 @@ void clif_defaults(void) { clif->bgqueue_joined = clif_bgqueue_joined; clif->bgqueue_pcleft = clif_bgqueue_pcleft; clif->bgqueue_battlebegins = clif_bgqueue_battlebegins; - /* misc-handling */ + /* misc-handling */ clif->adopt_reply = clif_Adopt_reply; clif->adopt_request = clif_Adopt_request; clif->readbook = clif_readbook; @@ -19033,7 +19070,7 @@ void clif_defaults(void) { clif->npc_market_purchase_ack = clif_npc_market_purchase_ack; /*------------------------ *- Parse Incoming Packet - *------------------------*/ + *------------------------*/ clif->pWantToConnection = clif_parse_WantToConnection; clif->pLoadEndAck = clif_parse_LoadEndAck; clif->pTickSend = clif_parse_TickSend; @@ -19087,7 +19124,7 @@ void clif_defaults(void) { clif->pUseSkillToPos = clif_parse_UseSkillToPos; clif->pUseSkillToPosSub = clif_parse_UseSkillToPosSub; clif->pUseSkillToPos_homun = clif_parse_UseSkillToPos_homun; - clif->pUseSkillToPos_mercenary = clif_parse_UseSkillToPos_mercenary; + clif->pUseSkillToPos_mercenary = clif_parse_UseSkillToPos_mercenary; clif->pUseSkillToPosMoreInfo = clif_parse_UseSkillToPosMoreInfo; clif->pUseSkillMap = clif_parse_UseSkillMap; clif->pRequestMemo = clif_parse_RequestMemo; |