diff options
author | shennetsind <ind@henn.et> | 2013-03-30 23:08:08 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-03-30 23:08:08 -0300 |
commit | 7ec1e8fdff6adad1979d750774f9003f223bf3ef (patch) | |
tree | 65553e83135c5f5f983c106914d0a35ea2f62588 | |
parent | 87373047cd4aaf8b0c2425133b9b907e3ea4d122 (diff) | |
download | hercules-7ec1e8fdff6adad1979d750774f9003f223bf3ef.tar.gz hercules-7ec1e8fdff6adad1979d750774f9003f223bf3ef.tar.bz2 hercules-7ec1e8fdff6adad1979d750774f9003f223bf3ef.tar.xz hercules-7ec1e8fdff6adad1979d750774f9003f223bf3ef.zip |
Hercules Renewal: clif.c complete
Added the last missing functions into the interface, all functions in clif.c are now wired to the interface.
http://hercules.ws/board/topic/237-hercules-renewal/
Also shortened clif->displaymessage to clif->message, removed the old clif->message and merged its functionality with clif->disp_overhead (both use the same packet and do the same thing :P)
-
and a gazillion other stuff:
http://hercules.ws/board/topic/316-introducing-hercules-channel-system/
Signed-off-by: shennetsind <ind@henn.et>
35 files changed, 3668 insertions, 2618 deletions
diff --git a/conf/atcommand.conf b/conf/atcommand.conf index 5a0a5b289..67af3b91f 100644 --- a/conf/atcommand.conf +++ b/conf/atcommand.conf @@ -56,6 +56,7 @@ aliases: { guildstorage: ["gstorage"] accinfo: ["accountinfo"] itemreset: ["clearinventory"] + channel: ["main"] } /* Commands help file */ diff --git a/conf/battle/items.conf b/conf/battle/items.conf index 4401072d5..05aadfecd 100644 --- a/conf/battle/items.conf +++ b/conf/battle/items.conf @@ -76,7 +76,7 @@ gtb_sc_immunity: 50 // always work independently of each other regardless of setting. autospell_stacking: no -// Will disabled consumables (disabled by item_noequip.txt) be consumed when trying to use them? +// Will disabled consumables (disabled by map_zone_db.conf) be consumed when trying to use them? // 1 (official): yes // 0: no item_restricted_consumption_type:1 diff --git a/conf/channels.conf b/conf/channels.conf new file mode 100644 index 000000000..b12d2da8b --- /dev/null +++ b/conf/channels.conf @@ -0,0 +1,39 @@ +chsys: ( +{ + /* default channels (available on boot) */ + default_channels: { + /* channel_name : channel_messages_color */ + main: "Orange" /* available as #main */ + support: "Blue" /* available as #support */ + trade: "Red" /* available as #trade */ + offtopic: "Cyan" /* available as #offtopic */ + /* as many channels as you like */ + } + /* colors available */ + colors: { + Default: "0xffffff" /* custom channels will use the first in the list unless a font is selected thru @channel */ + Red: "0xff0000" + Blue: "0x83cfe9" + Orange: "0xe57c00" + Cyan: "0x00b89d" + Yellow: "0xffff90" + Green: "0x28bf00" + Normal: "0x00ff00" + /* as many colors as you like */ + } + /* allow users to create their own (private) channels through @channels command? */ + /* (must also allow players to use @channels in groups.conf) */ + allow_user_channel_creation: true + /* "map_local_channel" is a instanced channel unique to each map */ + map_local_channel: true + map_local_channel_name: "map" /* available as #map */ + map_local_channel_color: "Yellow" + map_local_channel_autojoin: true /* can disable autojoin in specific maps through a mapflag or zone */ + /* "ally_channel" is a channel shared by all your guild allies */ + ally_channel_enabled: true + ally_channel_name: "ally" /* available as #ally */ + ally_channel_color: "Green" + ally_channel_autojoin: true +} +) + diff --git a/conf/groups.conf b/conf/groups.conf index a243716e6..879361387 100644 --- a/conf/groups.conf +++ b/conf/groups.conf @@ -123,13 +123,13 @@ groups: ( refresh: true noask: true noks: true - main: true autoloot: true alootid: true autotrade: true request: true go: true breakguild: true + channel: true } permissions: { } @@ -272,6 +272,7 @@ groups: ( use_check: true use_changemaptype: true all_commands: true + hchsys_admin: true } } ) diff --git a/conf/help.txt b/conf/help.txt index 105371e9f..6f202091e 100644 --- a/conf/help.txt +++ b/conf/help.txt @@ -6,7 +6,6 @@ // This file uses libconfig syntax. help: "Params: <command>\n" "Shows help for specified command." -main: "Params: [on|off|<message>]\n" "Turns on or off main (server-wide) chat. Sends message to main chat." noask: "Auto rejects deals/invites." gmotd: "Broadcasts the Message of The Day to all players." me: "Params: <message>\n" "Displays normal text as a message in this format: *name message* (like /me in mIRC)." diff --git a/conf/inter-server.conf b/conf/inter-server.conf index 523437007..bf8d9e7a3 100644 --- a/conf/inter-server.conf +++ b/conf/inter-server.conf @@ -119,8 +119,4 @@ mapreg_db: mapreg //Use SQL item_db, mob_db and mob_skill_db for the map server use_sql_db: no -// Nick for sending mainchat -// messages like whisper -main_chat_nick: Main - import: conf/import/inter_conf.txt diff --git a/conf/messages.conf b/conf/messages.conf index 6025ecd81..7666badf3 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -1409,5 +1409,48 @@ // @skillid (extension) 1398: -- Displaying first %d partial matches +// @join +1399: Unknown Channel (usage: %s <#channel_name>) +1400: Unknown Channel '%s' (usage: %s <#channel_name>) +1401: '%s' Channel is password protected (usage: %s <#channel_name> <password>) +1403: You're now in the '%s' channel + +// Hercules Chat Feature +1402: You're not in that channel, type '@join <#channel_name>' +1434: You're already in the '%s' channel +1435: You're now in the '#%s' channel for '%s' + +// @channel +1404: %s failed +1405: Channel name must start with a '#' +1406: Channel length must be between 3 and %d +1407: Channel '%s' is not available +1408: Channel password may not contain spaces +1409: - #%s ( %d users ) +1410: -- Public Channels +1411: Unknown color '%s' +1412: You're not the owner of channel '%s' +1413: '%s' channel color updated to '%s' +1414: --- Available options: +1415: -- %s create <channel name> <channel password> +1416: - creates a new channel +1417: -- %s list +1418: - lists public channels +1419: -- %s list colors +1420: - lists colors available to select for custom channels +1421: -- %s setcolor <channel name> <color name> +1422: - changes <channel name> color to <color name> +1423: -- %s leave <channel name> +1424: - leaves <channel name> +1425: You're not part of the '%s' channel +1426: You've left the '%s' channel +1427: -- %s bindto <channel name> +1428: - binds your global chat to <channel name>, making anything you type in global be sent to the channel +1429: -- %s unbind +1430: - unbinds your global chat from its attached channel (if binded) +1431: Your global chat is now binded to the '%s' channel +1432: Your global chat is not binded to any channel +1433: Your global chat is now unbinded from the '#%s' channel + //Custom translations import: conf/import/msg_conf.txt diff --git a/doc/permissions.txt b/doc/permissions.txt index 619282c94..1dbfd0056 100644 --- a/doc/permissions.txt +++ b/doc/permissions.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20120606 +//= 20130330 //===== Description: ========================================= //= Player group permissions, configured in /conf/groups.conf. //============================================================ @@ -30,4 +30,5 @@ receive_requests : Ability to receive @requests. show_bossmobs : Ability to see boss mobs with @showmobs. disable_pvm : Ability to disable Player vs. Monster. disable_pvp : Ability to disable Player vs. Player. -disable_commands_when_dead : Ability to disable @command usage when dead.
\ No newline at end of file +disable_commands_when_dead : Ability to disable @command usage when dead. +hchsys_admin : Hercules Chat System Admin (can modify channels settings regardless of ownership and join password-protected channels without password)
\ No newline at end of file diff --git a/src/char/char.c b/src/char/char.c index 1745c061f..9e2400ddf 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1465,7 +1465,7 @@ int check_char_name(char * name, char * esc_name) return -2; // control chars in name // check for reserved names - if( strcmpi(name, main_chat_nick) == 0 || strcmpi(name, wisp_server_name) == 0 ) + if( strcmpi(name, wisp_server_name) == 0 ) return -1; // nick reserved for internal server messages // Check Authorised letters/symbols in the name of the character diff --git a/src/char/inter.c b/src/char/inter.c index da790e200..dec217d02 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -43,7 +43,6 @@ char default_codepage[32] = ""; //Feature by irmin. static struct accreg *accreg_pt; unsigned int party_share_level = 10; -char main_chat_nick[16] = "Main"; // recv. packet list int inter_recv_packet_length[] = { @@ -731,8 +730,6 @@ static int inter_config_read(const char* cfgName) party_share_level = atoi(w2); else if(!strcmpi(w1,"log_inter")) log_inter = atoi(w2); - else if(!strcmpi(w1,"main_chat_nick")) - safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick)); else if(!strcmpi(w1,"import")) inter_config_read(w2); } diff --git a/src/char/inter.h b/src/char/inter.h index 9f99197eb..e34c54c16 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -23,8 +23,6 @@ extern unsigned int party_share_level; extern Sql* sql_handle; extern Sql* lsql_handle; -extern char main_chat_nick[16]; - int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type); uint64 inter_chk_lastuid(int8 flag, uint64 value); diff --git a/src/common/mmo.h b/src/common/mmo.h index 56770fe02..7d1928201 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -5,6 +5,7 @@ #define _MMO_H_ #include "cbasetypes.h" +#include "../common/db.h" #include <time.h> // server->client protocol version @@ -510,8 +511,10 @@ struct guild { struct guild_alliance alliance[MAX_GUILDALLIANCE]; struct guild_expulsion expulsion[MAX_GUILDEXPULSION]; struct guild_skill skill[MAX_GUILDSKILL]; - + + /* TODO: still used for something?|: */ unsigned short save_flag; // for TXT saving + void *channel; }; struct guild_castle { diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a585e6cc8..94838f699 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -219,21 +219,21 @@ ACMD_FUNC(send) { int i; for (i = 900; i <= 903; ++i) - clif->displaymessage(fd, msg_txt(i)); + clif->message(fd, msg_txt(i)); return -1; } #define PARSE_ERROR(error,p) \ {\ - clif->displaymessage(fd, (error));\ + clif->message(fd, (error));\ sprintf(atcmd_output, ">%s", (p));\ - clif->displaymessage(fd, atcmd_output);\ + clif->message(fd, atcmd_output);\ } //define PARSE_ERROR #define CHECK_EOS(p) \ if(*(p) == 0){\ - clif->displaymessage(fd, "Unexpected end of string");\ + clif->message(fd, "Unexpected end of string");\ return -1;\ } //define CHECK_EOS @@ -259,7 +259,7 @@ ACMD_FUNC(send) if(len) {// show packet length sprintf(atcmd_output, msg_txt(904), type, packet_db[sd->packet_ver][type].len); // Packet 0x%x length: %d - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -268,7 +268,7 @@ ACMD_FUNC(send) if(len == 0) {// unknown packet - ERROR sprintf(atcmd_output, msg_txt(905), type); // Unknown packet: 0x%x - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } else if(len == -1) {// dynamic packet @@ -425,11 +425,11 @@ ACMD_FUNC(send) WFIFOSET(fd,len); } } else { - clif->displaymessage(fd, msg_txt(259)); // Invalid packet + clif->message(fd, msg_txt(259)); // Invalid packet return -1; } sprintf (atcmd_output, msg_txt(258), type, type); // Sent packet 0x%x (%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; #undef PARSE_ERROR #undef CHECK_EOS @@ -455,7 +455,7 @@ ACMD_FUNC(mapmove) (sscanf(message, "%15s %hd %hd", map_name, &x, &y) < 3 && sscanf(message, "%15[^,],%hd,%hd", map_name, &x, &y) < 1)) { - clif->displaymessage(fd, msg_txt(909)); // Please enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>). + clif->message(fd, msg_txt(909)); // Please enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>). return -1; } @@ -464,30 +464,30 @@ ACMD_FUNC(mapmove) m = map_mapindex2mapid(mapindex); if (!mapindex) { // m < 0 means on different server! [Kevin] - clif->displaymessage(fd, msg_txt(1)); // Map not found. + clif->message(fd, msg_txt(1)); // Map not found. return -1; } if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS)) { //This is to prevent the pc_setpos call from printing an error. - clif->displaymessage(fd, msg_txt(2)); + clif->message(fd, msg_txt(2)); if (!map_search_freecell(NULL, m, &x, &y, 10, 10, 1)) x = y = 0; //Invalid cell, use random spot. } if (map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(247)); + clif->message(fd, msg_txt(247)); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(248)); + clif->message(fd, msg_txt(248)); return -1; } if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) { - clif->displaymessage(fd, msg_txt(1)); // Map not found. + clif->message(fd, msg_txt(1)); // Map not found. return -1; } - clif->displaymessage(fd, msg_txt(0)); // Warped. + clif->message(fd, msg_txt(0)); // Warped. return 0; } @@ -502,7 +502,7 @@ ACMD_FUNC(where) memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(910)); // Please enter a player name (usage: @where <char name>). + clif->message(fd, msg_txt(910)); // Please enter a player name (usage: @where <char name>). return -1; } @@ -511,12 +511,12 @@ ACMD_FUNC(where) strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 || (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc_get_group_level(pl_sd) > pc_get_group_level(sd) && !pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID)) ) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } snprintf(atcmd_output, sizeof atcmd_output, "%s %s %d %d", pl_sd->status.name, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -531,37 +531,37 @@ ACMD_FUNC(jumpto) nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(911)); // Please enter a player name (usage: @jumpto/@warpto/@goto <char name/ID>). + clif->message(fd, msg_txt(911)); // Please enter a player name (usage: @jumpto/@warpto/@goto <char name/ID>). return -1; } if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(247)); // You are not authorized to warp to this map. + clif->message(fd, msg_txt(247)); // You are not authorized to warp to this map. return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map. + clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map. return -1; } if( pc_isdead(sd) ) { - clif->displaymessage(fd, msg_txt(664)); + clif->message(fd, msg_txt(664)); return -1; } pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT); sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jumped to %s - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -580,26 +580,26 @@ ACMD_FUNC(jump) sscanf(message, "%hd %hd", &x, &y); if (map[sd->bl.m].flag.noteleport && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map. + clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map. return -1; } if( pc_isdead(sd) ) { - clif->displaymessage(fd, msg_txt(664)); + clif->message(fd, msg_txt(664)); return -1; } if ((x || y) && map_getcell(sd->bl.m, x, y, CELL_CHKNOPASS)) { //This is to prevent the pc_setpos call from printing an error. - clif->displaymessage(fd, msg_txt(2)); + clif->message(fd, msg_txt(2)); if (!map_search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1)) x = y = 0; //Invalid cell, use random spot. } pc_setpos(sd, sd->mapindex, x, y, CLR_TELEPORT); sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -667,7 +667,7 @@ ACMD_FUNC(who) } default: { struct party_data *p = party_search(pl_sd->status.party_id); - struct guild *g = guild_search(pl_sd->status.guild_id); + struct guild *g = pl_sd->guild; StringBuf_Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s " if (pc_get_group_id(pl_sd) > 0) // Player title, if exists @@ -679,7 +679,7 @@ ACMD_FUNC(who) break; } } - clif->displaymessage(fd, StringBuf_Value(&buf)); + clif->message(fd, StringBuf_Value(&buf)); StringBuf_Clear(&buf); count++; } @@ -701,7 +701,7 @@ ACMD_FUNC(who) else StringBuf_Printf(&buf, msg_txt(56), count, map[map_id].name); // %d players found in map '%s'. } - clif->displaymessage(fd, StringBuf_Value(&buf)); + clif->message(fd, StringBuf_Value(&buf)); StringBuf_Destroy(&buf); return 0; } @@ -754,7 +754,7 @@ ACMD_FUNC(whogm) if (pl_sd->sc.option & OPTION_INVISIBLE) continue; sprintf(atcmd_output, msg_txt(913), pl_sd->status.name); // Name: %s (GM) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); count++; continue; } @@ -762,31 +762,31 @@ ACMD_FUNC(whogm) sprintf(atcmd_output, msg_txt(914), // Name: %s (GM:%d) | Location: %s %d %d pl_sd->status.name, pl_level, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(915), // BLvl: %d | Job: %s (Lvl: %d) pl_sd->status.base_level, job_name(pl_sd->status.class_), pl_sd->status.job_level); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); p = party_search(pl_sd->status.party_id); - g = guild_search(pl_sd->status.guild_id); + g = pl_sd->guild; sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s' p?p->party.name:msg_txt(917), g?g->name:msg_txt(917)); // None. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); count++; } mapit_free(iter); if (count == 0) - clif->displaymessage(fd, msg_txt(150)); // No GM found. + clif->message(fd, msg_txt(150)); // No GM found. else if (count == 1) - clif->displaymessage(fd, msg_txt(151)); // 1 GM found. + clif->message(fd, msg_txt(151)); // 1 GM found. else { sprintf(atcmd_output, msg_txt(152), count); // %d GMs found. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -805,7 +805,7 @@ ACMD_FUNC(save) chrif_save(sd,0); - clif->displaymessage(fd, msg_txt(6)); // Your save point has been changed. + clif->message(fd, msg_txt(6)); // Your save point has been changed. return 0; } @@ -821,16 +821,16 @@ ACMD_FUNC(load) m = map_mapindex2mapid(sd->status.save_point.map); if (m >= 0 && map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(249)); // You are not authorized to warp to your save map. + clif->message(fd, msg_txt(249)); // You are not authorized to warp to your save map. return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map. + clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map. return -1; } pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT); - clif->displaymessage(fd, msg_txt(7)); // Warping to save point.. + clif->message(fd, msg_txt(7)); // Warping to save point.. return 0; } @@ -848,13 +848,13 @@ ACMD_FUNC(speed) if (!message || !*message || sscanf(message, "%d", &speed) < 1) { sprintf(atcmd_output, msg_txt(918), MIN_WALK_SPEED, MAX_WALK_SPEED); // Please enter a speed value (usage: @speed <%d-%d>). - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); status_calc_bl(&sd->bl, SCB_SPEED); - clif->displaymessage(fd, msg_txt(8)); // Speed changed. + clif->message(fd, msg_txt(8)); // Speed changed. return 0; } @@ -870,11 +870,11 @@ ACMD_FUNC(storage) if (storage_storageopen(sd) == 1) { //Already open. - clif->displaymessage(fd, msg_txt(250)); + clif->message(fd, msg_txt(250)); return -1; } - clif->displaymessage(fd, msg_txt(919)); // Storage opened. + clif->message(fd, msg_txt(919)); // Storage opened. return 0; } @@ -888,7 +888,7 @@ ACMD_FUNC(guildstorage) nullpo_retr(-1, sd); if (!sd->status.guild_id) { - clif->displaymessage(fd, msg_txt(252)); + clif->message(fd, msg_txt(252)); return -1; } @@ -896,17 +896,17 @@ ACMD_FUNC(guildstorage) return -1; if (sd->state.storage_flag == 1) { - clif->displaymessage(fd, msg_txt(250)); + clif->message(fd, msg_txt(250)); return -1; } if (sd->state.storage_flag == 2) { - clif->displaymessage(fd, msg_txt(251)); + clif->message(fd, msg_txt(251)); return -1; } storage_guild_storageopen(sd); - clif->displaymessage(fd, msg_txt(920)); // Guild storage opened. + clif->message(fd, msg_txt(920)); // Guild storage opened. return 0; } @@ -926,11 +926,11 @@ ACMD_FUNC(option) text = atcommand_help_string( command ); // notify the user of the requirement to enter an option - clif->displaymessage(fd, msg_txt(921)); // Please enter at least one option. + clif->message(fd, msg_txt(921)); // Please enter at least one option. if( text ) {// send the help text associated with this command - clif->displaymessage( fd, text ); + clif->message( fd, text ); } return -1; @@ -940,7 +940,7 @@ ACMD_FUNC(option) sd->sc.opt2 = param2; pc_setoption(sd, param3); - clif->displaymessage(fd, msg_txt(9)); // Options changed. + clif->message(fd, msg_txt(9)); // Options changed. return 0; } @@ -957,7 +957,7 @@ ACMD_FUNC(hide) status_set_viewdata(&sd->bl, sd->disguise); else status_set_viewdata(&sd->bl, sd->status.class_); - clif->displaymessage(fd, msg_txt(10)); // Invisible: Off + clif->message(fd, msg_txt(10)); // Invisible: Off // increment the number of pvp players on the map map[sd->bl.m].users_pvp++; @@ -971,7 +971,7 @@ ACMD_FUNC(hide) } else { sd->sc.option |= OPTION_INVISIBLE; sd->vd.class_ = INVISIBLE_CLASS; - clif->displaymessage(fd, msg_txt(11)); // Invisible: On + clif->message(fd, msg_txt(11)); // Invisible: On // decrement the number of pvp players on the map map[sd->bl.m].users_pvp--; @@ -1011,7 +1011,7 @@ ACMD_FUNC(jobchange) if (!found) { text = atcommand_help_string(command); if (text) - clif->displaymessage(fd, text); + clif->message(fd, text); return -1; } } @@ -1020,21 +1020,21 @@ ACMD_FUNC(jobchange) || job == JOB_LORD_KNIGHT2 || job == JOB_PALADIN2 || job == JOB_BABY_KNIGHT2 || job == JOB_BABY_CRUSADER2 || job == JOB_STAR_GLADIATOR2 || (job >= JOB_RUNE_KNIGHT2 && job <= JOB_MECHANIC_T2) || (job >= JOB_BABY_RUNE2 && job <= JOB_BABY_MECHANIC2) ) // Deny direct transformation into dummy jobs - {clif->displaymessage(fd, msg_txt(923)); //"You can not change to this job by command." + {clif->message(fd, msg_txt(923)); //"You can not change to this job by command." return 0;} if (pcdb_checkid(job)) { if (pc_jobchange(sd, job, upper) == 0) - clif->displaymessage(fd, msg_txt(12)); // Your job has been changed. + clif->message(fd, msg_txt(12)); // Your job has been changed. else { - clif->displaymessage(fd, msg_txt(155)); // You are unable to change your job. + clif->message(fd, msg_txt(155)); // You are unable to change your job. return -1; } } else { text = atcommand_help_string(command); if (text) - clif->displaymessage(fd, text); + clif->message(fd, text); return -1; } @@ -1048,9 +1048,9 @@ ACMD_FUNC(kill) { nullpo_retr(-1, sd); status_kill(&sd->bl); - clif->displaymessage(sd->fd, msg_txt(13)); // A pity! You've died. + clif->message(sd->fd, msg_txt(13)); // A pity! You've died. if (fd != sd->fd) - clif->displaymessage(fd, msg_txt(14)); // Character killed. + clif->message(fd, msg_txt(14)); // Character killed. return 0; } @@ -1062,11 +1062,11 @@ ACMD_FUNC(alive) nullpo_retr(-1, sd); if (!status_revive(&sd->bl, 100, 100)) { - clif->displaymessage(fd, msg_txt(667)); + clif->message(fd, msg_txt(667)); return -1; } clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); - clif->displaymessage(fd, msg_txt(16)); // You've been revived! It's a miracle! + clif->message(fd, msg_txt(16)); // You've been revived! It's a miracle! return 0; } @@ -1082,7 +1082,7 @@ ACMD_FUNC(kami) if(*(command + 5) != 'c' && *(command + 5) != 'C') { if (!message || !*message) { - clif->displaymessage(fd, msg_txt(980)); // Please enter a message (usage: @kami <message>). + clif->message(fd, msg_txt(980)); // Please enter a message (usage: @kami <message>). return -1; } @@ -1093,12 +1093,12 @@ ACMD_FUNC(kami) intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, (*(command + 5) == 'b' || *(command + 5) == 'B') ? 0x10 : 0); } else { if(!message || !*message || (sscanf(message, "%lx %199[^\n]", &color, atcmd_output) < 2)) { - clif->displaymessage(fd, msg_txt(981)); // Please enter color and message (usage: @kamic <color> <message>). + clif->message(fd, msg_txt(981)); // Please enter color and message (usage: @kamic <color> <message>). return -1; } if(color > 0xFFFFFF) { - clif->displaymessage(fd, msg_txt(982)); // Invalid color. + clif->message(fd, msg_txt(982)); // Invalid color. return -1; } intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0); @@ -1113,33 +1113,40 @@ ACMD_FUNC(heal) { int hp = 0, sp = 0; // [Valaris] thanks to fov nullpo_retr(-1, sd); - + sscanf(message, "%d %d", &hp, &sp); + WFIFOHEAD(fd, 4); + WFIFOW(fd, 0) = 0x23e; + WFIFOW(fd, 2) = hp; + WFIFOSET(fd, 4); + ShowDebug("Sending~! %d\n",hp); + + // some overflow checks if( hp == INT_MIN ) hp++; if( sp == INT_MIN ) sp++; if ( hp == 0 && sp == 0 ) { if (!status_percent_heal(&sd->bl, 100, 100)) - clif->displaymessage(fd, msg_txt(157)); // HP and SP have already been recovered. + clif->message(fd, msg_txt(157)); // HP and SP have already been recovered. else - clif->displaymessage(fd, msg_txt(17)); // HP, SP recovered. + clif->message(fd, msg_txt(17)); // HP, SP recovered. return 0; } if ( hp > 0 && sp >= 0 ) { if(!status_heal(&sd->bl, hp, sp, 0)) - clif->displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value. + clif->message(fd, msg_txt(157)); // HP and SP are already with the good value. else - clif->displaymessage(fd, msg_txt(17)); // HP, SP recovered. + clif->message(fd, msg_txt(17)); // HP, SP recovered. return 0; } if ( hp < 0 && sp <= 0 ) { status_damage(NULL, &sd->bl, -hp, -sp, 0, 0); clif->damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0, 4, 0); - clif->displaymessage(fd, msg_txt(156)); // HP or/and SP modified. + clif->message(fd, msg_txt(156)); // HP or/and SP modified. return 0; } @@ -1160,7 +1167,7 @@ ACMD_FUNC(heal) status_damage(NULL, &sd->bl, 0, -sp, 0, 0); } - clif->displaymessage(fd, msg_txt(156)); // HP or/and SP modified. + clif->message(fd, msg_txt(156)); // HP or/and SP modified. return 0; } @@ -1182,7 +1189,7 @@ ACMD_FUNC(item) sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 && sscanf(message, "%99s %d", item_name, &number) < 1 )) { - clif->displaymessage(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>). + clif->message(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>). return -1; } @@ -1192,7 +1199,7 @@ ACMD_FUNC(item) if ((item_data = itemdb_searchname(item_name)) == NULL && (item_data = itemdb_exists(atoi(item_name))) == NULL) { - clif->displaymessage(fd, msg_txt(19)); // Invalid item ID or name. + clif->message(fd, msg_txt(19)); // Invalid item ID or name. return -1; } @@ -1215,7 +1222,7 @@ ACMD_FUNC(item) } if (flag == 0) - clif->displaymessage(fd, msg_txt(18)); // Item created. + clif->message(fd, msg_txt(18)); // Item created. return 0; } @@ -1238,8 +1245,8 @@ ACMD_FUNC(item2) sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 && sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 )) { - clif->displaymessage(fd, msg_txt(984)); // Please enter all parameters (usage: @item2 <item name/ID> <quantity> - clif->displaymessage(fd, msg_txt(985)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4>). + clif->message(fd, msg_txt(984)); // Please enter all parameters (usage: @item2 <item name/ID> <quantity> + clif->message(fd, msg_txt(985)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4>). return -1; } @@ -1287,9 +1294,9 @@ ACMD_FUNC(item2) } if (flag == 0) - clif->displaymessage(fd, msg_txt(18)); // Item created. + clif->message(fd, msg_txt(18)); // Item created. } else { - clif->displaymessage(fd, msg_txt(19)); // Invalid item ID or name. + clif->message(fd, msg_txt(19)); // Invalid item ID or name. return -1; } @@ -1309,7 +1316,7 @@ ACMD_FUNC(itemreset) pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND); } } - clif->displaymessage(fd, msg_txt(20)); // All of your items have been removed. + clif->message(fd, msg_txt(20)); // All of your items have been removed. return 0; } @@ -1324,13 +1331,13 @@ ACMD_FUNC(baselevelup) level = atoi(message); if (!message || !*message || !level) { - clif->displaymessage(fd, msg_txt(986)); // Please enter a level adjustment (usage: @lvup/@blevel/@baselvlup <number of levels>). + clif->message(fd, msg_txt(986)); // Please enter a level adjustment (usage: @lvup/@blevel/@baselvlup <number of levels>). return -1; } if (level > 0) { if (sd->status.base_level >= pc_maxbaselv(sd)) { // check for max level by Valaris - clif->displaymessage(fd, msg_txt(47)); // Base level can't go any higher. + clif->message(fd, msg_txt(47)); // Base level can't go any higher. return -1; } // End Addition if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow @@ -1342,10 +1349,10 @@ ACMD_FUNC(baselevelup) sd->status.base_level += (unsigned int)level; status_percent_heal(&sd->bl, 100, 100); clif->misceffect(&sd->bl, 0); - clif->displaymessage(fd, msg_txt(21)); // Base level raised. + clif->message(fd, msg_txt(21)); // Base level raised. } else { if (sd->status.base_level == 1) { - clif->displaymessage(fd, msg_txt(158)); // Base level can't go any lower. + clif->message(fd, msg_txt(158)); // Base level can't go any lower. return -1; } level*=-1; @@ -1360,7 +1367,7 @@ ACMD_FUNC(baselevelup) else sd->status.status_point -= status_point; sd->status.base_level -= (unsigned int)level; - clif->displaymessage(fd, msg_txt(22)); // Base level lowered. + clif->message(fd, msg_txt(22)); // Base level lowered. } sd->status.base_exp = 0; clif->updatestatus(sd, SP_STATUSPOINT); @@ -1385,12 +1392,12 @@ ACMD_FUNC(joblevelup) level = atoi(message); if (!message || !*message || !level) { - clif->displaymessage(fd, msg_txt(987)); // Please enter a level adjustment (usage: @joblvup/@jlevel/@joblvlup <number of levels>). + clif->message(fd, msg_txt(987)); // Please enter a level adjustment (usage: @joblvup/@jlevel/@joblvlup <number of levels>). return -1; } if (level > 0) { if (sd->status.job_level >= pc_maxjoblv(sd)) { - clif->displaymessage(fd, msg_txt(23)); // Job level can't go any higher. + clif->message(fd, msg_txt(23)); // Job level can't go any higher. return -1; } if ((unsigned int)level > pc_maxjoblv(sd) || (unsigned int)level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow @@ -1398,10 +1405,10 @@ ACMD_FUNC(joblevelup) sd->status.job_level += (unsigned int)level; sd->status.skill_point += level; clif->misceffect(&sd->bl, 1); - clif->displaymessage(fd, msg_txt(24)); // Job level raised. + clif->message(fd, msg_txt(24)); // Job level raised. } else { if (sd->status.job_level == 1) { - clif->displaymessage(fd, msg_txt(159)); // Job level can't go any lower. + clif->message(fd, msg_txt(159)); // Job level can't go any lower. return -1; } level *=-1; @@ -1414,7 +1421,7 @@ ACMD_FUNC(joblevelup) sd->status.skill_point = 0; else sd->status.skill_point -= level; - clif->displaymessage(fd, msg_txt(25)); // Job level lowered. + clif->message(fd, msg_txt(25)); // Job level lowered. } sd->status.job_exp = 0; clif->updatestatus(sd, SP_JOBLEVEL); @@ -1440,7 +1447,7 @@ ACMD_FUNC(help) help = config_lookup(&atcommand_config, "help"); if (help == NULL) { - clif->displaymessage(fd, msg_txt(27)); // "Commands help is not available." + clif->message(fd, msg_txt(27)); // "Commands help is not available." return -1; } @@ -1454,20 +1461,20 @@ ACMD_FUNC(help) if (!pc_can_use_command(sd, command_name, COMMAND_ATCOMMAND)) { sprintf(atcmd_output, msg_txt(153), message); // "%s is Unknown Command" - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); atcommand_get_suggestions(sd, command_name, true); return -1; } if (!config_setting_lookup_string(help, command_name, &text)) { sprintf(atcmd_output, msg_txt(988), atcommand_symbol, command_name); // There is no help for %c%s. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); atcommand_get_suggestions(sd, command_name, true); return -1; } sprintf(atcmd_output, msg_txt(989), atcommand_symbol, command_name); // Help for command %c%s: - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); { // Display aliases DBIterator* iter; @@ -1488,12 +1495,12 @@ ACMD_FUNC(help) } dbi_destroy(iter); if (has_aliases) - clif->displaymessage(fd, StringBuf_Value(&buf)); + clif->message(fd, StringBuf_Value(&buf)); StringBuf_Destroy(&buf); } // Display help contents - clif->displaymessage(fd, text); + clif->message(fd, text); return 0; } @@ -1529,7 +1536,7 @@ ACMD_FUNC(pvpoff) nullpo_retr(-1, sd); if (!map[sd->bl.m].flag.pvp) { - clif->displaymessage(fd, msg_txt(160)); // PvP is already Off. + clif->message(fd, msg_txt(160)); // PvP is already Off. return -1; } @@ -1539,7 +1546,7 @@ ACMD_FUNC(pvpoff) clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); map_foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC); map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0); - clif->displaymessage(fd, msg_txt(31)); // PvP: Off. + clif->message(fd, msg_txt(31)); // PvP: Off. return 0; } @@ -1565,7 +1572,7 @@ ACMD_FUNC(pvpon) nullpo_retr(-1, sd); if (map[sd->bl.m].flag.pvp) { - clif->displaymessage(fd, msg_txt(161)); // PvP is already On. + clif->message(fd, msg_txt(161)); // PvP is already On. return -1; } @@ -1577,7 +1584,7 @@ ACMD_FUNC(pvpon) map_foreachinmap(atcommand_pvpon_sub,sd->bl.m, BL_PC); } - clif->displaymessage(fd, msg_txt(32)); // PvP: On. + clif->message(fd, msg_txt(32)); // PvP: On. return 0; } @@ -1590,14 +1597,14 @@ ACMD_FUNC(gvgoff) nullpo_retr(-1, sd); if (!map[sd->bl.m].flag.gvg) { - clif->displaymessage(fd, msg_txt(162)); // GvG is already Off. + clif->message(fd, msg_txt(162)); // GvG is already Off. return -1; } map[sd->bl.m].flag.gvg = 0; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0); - clif->displaymessage(fd, msg_txt(33)); // GvG: Off. + clif->message(fd, msg_txt(33)); // GvG: Off. return 0; } @@ -1610,13 +1617,13 @@ ACMD_FUNC(gvgon) nullpo_retr(-1, sd); if (map[sd->bl.m].flag.gvg) { - clif->displaymessage(fd, msg_txt(163)); // GvG is already On. + clif->message(fd, msg_txt(163)); // GvG is already On. return -1; } map[sd->bl.m].flag.gvg = 1; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE); - clif->displaymessage(fd, msg_txt(34)); // GvG: On. + clif->message(fd, msg_txt(34)); // GvG: On. return 0; } @@ -1634,7 +1641,7 @@ ACMD_FUNC(model) if (!message || !*message || sscanf(message, "%d %d %d", &hair_style, &hair_color, &cloth_color) < 1) { sprintf(atcmd_output, msg_txt(991), // Please enter at least one value (usage: @model <hair ID: %d-%d> <hair color: %d-%d> <clothes color: %d-%d>). MIN_HAIR_STYLE, MAX_HAIR_STYLE, MIN_HAIR_COLOR, MAX_HAIR_COLOR, MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } @@ -1644,9 +1651,9 @@ ACMD_FUNC(model) pc_changelook(sd, LOOK_HAIR, hair_style); pc_changelook(sd, LOOK_HAIR_COLOR, hair_color); pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color); - clif->displaymessage(fd, msg_txt(36)); // Appearence changed. + clif->message(fd, msg_txt(36)); // Appearence changed. } else { - clif->displaymessage(fd, msg_txt(37)); // An invalid number was specified. + clif->message(fd, msg_txt(37)); // An invalid number was specified. return -1; } @@ -1665,15 +1672,15 @@ ACMD_FUNC(dye) if (!message || !*message || sscanf(message, "%d", &cloth_color) < 1) { sprintf(atcmd_output, msg_txt(992), MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); // Please enter a clothes color (usage: @dye/@ccolor <clothes color: %d-%d>). - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color); - clif->displaymessage(fd, msg_txt(36)); // Appearence changed. + clif->message(fd, msg_txt(36)); // Appearence changed. } else { - clif->displaymessage(fd, msg_txt(37)); // An invalid number was specified. + clif->message(fd, msg_txt(37)); // An invalid number was specified. return -1; } @@ -1692,15 +1699,15 @@ ACMD_FUNC(hair_style) if (!message || !*message || sscanf(message, "%d", &hair_style) < 1) { sprintf(atcmd_output, msg_txt(993), MIN_HAIR_STYLE, MAX_HAIR_STYLE); // Please enter a hair style (usage: @hairstyle/@hstyle <hair ID: %d-%d>). - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) { pc_changelook(sd, LOOK_HAIR, hair_style); - clif->displaymessage(fd, msg_txt(36)); // Appearence changed. + clif->message(fd, msg_txt(36)); // Appearence changed. } else { - clif->displaymessage(fd, msg_txt(37)); // An invalid number was specified. + clif->message(fd, msg_txt(37)); // An invalid number was specified. return -1; } @@ -1719,15 +1726,15 @@ ACMD_FUNC(hair_color) if (!message || !*message || sscanf(message, "%d", &hair_color) < 1) { sprintf(atcmd_output, msg_txt(994), MIN_HAIR_COLOR, MAX_HAIR_COLOR); // Please enter a hair color (usage: @haircolor/@hcolor <hair color: %d-%d>). - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) { pc_changelook(sd, LOOK_HAIR_COLOR, hair_color); - clif->displaymessage(fd, msg_txt(36)); // Appearence changed. + clif->message(fd, msg_txt(36)); // Appearence changed. } else { - clif->displaymessage(fd, msg_txt(37)); // An invalid number was specified. + clif->message(fd, msg_txt(37)); // An invalid number was specified. return -1; } @@ -1793,7 +1800,7 @@ ACMD_FUNC(go) nullpo_retr(-1, sd); if( map[sd->bl.m].flag.nogo && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE) ) { - clif->displaymessage(sd->fd,msg_txt(995)); // You cannot use @go on this map. + clif->message(sd->fd,msg_txt(995)); // You cannot use @go on this map. return 0; } @@ -1810,11 +1817,11 @@ ACMD_FUNC(go) // attempt to find the text help string text = atcommand_help_string( command ); - clif->displaymessage(fd, msg_txt(38)); // Invalid location number, or name. + clif->message(fd, msg_txt(38)); // Invalid location number, or name. if( text ) {// send the text to the client - clif->displaymessage( fd, text ); + clif->message( fd, text ); } return -1; @@ -1913,21 +1920,21 @@ ACMD_FUNC(go) { m = map_mapname2mapid(data[town].map); if (m >= 0 && map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(247)); + clif->message(fd, msg_txt(247)); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(248)); + clif->message(fd, msg_txt(248)); return -1; } if (pc_setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) { - clif->displaymessage(fd, msg_txt(0)); // Warped. + clif->message(fd, msg_txt(0)); // Warped. } else { - clif->displaymessage(fd, msg_txt(1)); // Map not found. + clif->message(fd, msg_txt(1)); // Map not found. return -1; } } else { // if you arrive here, you have an error in town variable when reading of names - clif->displaymessage(fd, msg_txt(38)); // Invalid location number or name. + clif->message(fd, msg_txt(38)); // Invalid location number or name. return -1; } @@ -1955,7 +1962,7 @@ ACMD_FUNC(monster) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(80)); // Give the display name or monster name/id please. + clif->message(fd, msg_txt(80)); // Give the display name or monster name/id please. return -1; } if (sscanf(message, "\"%23[^\"]\" %23s %d", name, monster, &number) > 1 || @@ -1971,7 +1978,7 @@ ACMD_FUNC(monster) //As before, name may be already filled. name[0] = '\0'; } else { - clif->displaymessage(fd, msg_txt(80)); // Give a display name and monster name/id please. + clif->message(fd, msg_txt(80)); // Give a display name and monster name/id please. return -1; } @@ -1979,12 +1986,12 @@ ACMD_FUNC(monster) mob_id = mobdb_checkid(atoi(monster)); if (mob_id == 0) { - clif->displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. + clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return -1; } if (mob_id == MOBID_EMPERIUM) { - clif->displaymessage(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned. + clif->message(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned. return -1; } @@ -2018,13 +2025,13 @@ ACMD_FUNC(monster) if (count != 0) if (number == count) - clif->displaymessage(fd, msg_txt(39)); // All monster summoned! + clif->message(fd, msg_txt(39)); // All monster summoned! else { sprintf(atcmd_output, msg_txt(240), count); // %d monster(s) summoned! - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } else { - clif->displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. + clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return -1; } @@ -2071,7 +2078,7 @@ ACMD_FUNC(killmonster) map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, -drop_flag); - clif->displaymessage(fd, msg_txt(165)); // All monsters killed! + clif->message(fd, msg_txt(165)); // All monsters killed! return 0; } @@ -2088,27 +2095,27 @@ ACMD_FUNC(refine) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) { - clif->displaymessage(fd, msg_txt(996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>). + clif->message(fd, msg_txt(996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>). sprintf(atcmd_output, msg_txt(997), EQP_HEAD_LOW); // %d: Lower Headgear - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(998), EQP_HAND_R); // %d: Right Hand - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(999), EQP_GARMENT); // %d: Garment - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1000), EQP_ACC_L); // %d: Left Accessory - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1001), EQP_ARMOR); // %d: Body Armor - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1002), EQP_HAND_L); // %d: Left Hand - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1003), EQP_SHOES); // %d: Shoes - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1004), EQP_ACC_R); // %d: Right Accessory - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1005), EQP_HEAD_TOP); // %d: Top Headgear - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1006), EQP_HEAD_MID); // %d: Mid Headgear - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } @@ -2143,12 +2150,12 @@ ACMD_FUNC(refine) } if (count == 0) - clif->displaymessage(fd, msg_txt(166)); // No item has been refined. + clif->message(fd, msg_txt(166)); // No item has been refined. else if (count == 1) - clif->displaymessage(fd, msg_txt(167)); // 1 item has been refined. + clif->message(fd, msg_txt(167)); // 1 item has been refined. else { sprintf(atcmd_output, msg_txt(168), count); // %d items have been refined. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -2172,13 +2179,13 @@ ACMD_FUNC(produce) sscanf(message, "\"%99[^\"]\" %d %d", item_name, &attribute, &star) < 1 && sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1 )) { - clif->displaymessage(fd, msg_txt(1007)); // Please enter at least one item name/ID (usage: @produce <equip name/ID> <element> <# of very's>). + clif->message(fd, msg_txt(1007)); // Please enter at least one item name/ID (usage: @produce <equip name/ID> <element> <# of very's>). return -1; } if ( (item_data = itemdb_searchname(item_name)) == NULL && (item_data = itemdb_exists(atoi(item_name))) == NULL ) { - clif->displaymessage(fd, msg_txt(170)); //This item is not an equipment. + clif->message(fd, msg_txt(170)); //This item is not an equipment. return -1; } @@ -2206,7 +2213,7 @@ ACMD_FUNC(produce) clif->additem(sd, 0, 0, flag); } else { sprintf(atcmd_output, msg_txt(169), item_id, item_data->name); // The item (%d: '%s') is not equipable. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } @@ -2226,14 +2233,14 @@ ACMD_FUNC(memo) if( !message || !*message || sscanf(message, "%d", &position) < 1 ) { int i; - clif->displaymessage(sd->fd, msg_txt(668)); + clif->message(sd->fd, msg_txt(668)); for( i = 0; i < MAX_MEMOPOINTS; i++ ) { if( sd->status.memo_point[i].map ) sprintf(atcmd_output, "%d - %s (%d,%d)", i, mapindex_id2name(sd->status.memo_point[i].map), sd->status.memo_point[i].x, sd->status.memo_point[i].y); else sprintf(atcmd_output, msg_txt(171), i); // %d - void - clif->displaymessage(sd->fd, atcmd_output); + clif->message(sd->fd, atcmd_output); } return 0; } @@ -2241,7 +2248,7 @@ ACMD_FUNC(memo) if( position < 0 || position >= MAX_MEMOPOINTS ) { sprintf(atcmd_output, msg_txt(1008), 0, MAX_MEMOPOINTS-1); // Please enter a valid position (usage: @memo <memo_position:%d-%d>). - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } @@ -2268,7 +2275,7 @@ ACMD_FUNC(gat) map_getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE), map_getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE)); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -2283,7 +2290,7 @@ ACMD_FUNC(displaystatus) nullpo_retr(-1, sd); if (!message || !*message || (i = sscanf(message, "%d %d %d %d %d %d", &type, &flag, &tick, &val1, &val2, &val3)) < 1) { - clif->displaymessage(fd, msg_txt(1009)); // Please enter a status type/flag (usage: @displaystatus <status type> <flag> <tick> {<val1> {<val2> {<val3>}}}). + clif->message(fd, msg_txt(1009)); // Please enter a status type/flag (usage: @displaystatus <status type> <flag> <tick> {<val1> {<val2> {<val3>}}}). return -1; } if (i < 2) flag = 1; @@ -2303,7 +2310,7 @@ ACMD_FUNC(statuspoint) unsigned int new_status_point; if (!message || !*message || (point = atoi(message)) == 0) { - clif->displaymessage(fd, msg_txt(1010)); // Please enter a number (usage: @stpoint <number of points>). + clif->message(fd, msg_txt(1010)); // Please enter a number (usage: @stpoint <number of points>). return -1; } @@ -2330,12 +2337,12 @@ ACMD_FUNC(statuspoint) if (new_status_point != sd->status.status_point) { sd->status.status_point = new_status_point; clif->updatestatus(sd, SP_STATUSPOINT); - clif->displaymessage(fd, msg_txt(174)); // Number of status points changed. + clif->message(fd, msg_txt(174)); // Number of status points changed. } else { if (point < 0) - clif->displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value. + clif->message(fd, msg_txt(41)); // Unable to decrease the number/value. else - clif->displaymessage(fd, msg_txt(149)); // Unable to increase the number/value. + clif->message(fd, msg_txt(149)); // Unable to increase the number/value. return -1; } @@ -2352,7 +2359,7 @@ ACMD_FUNC(skillpoint) nullpo_retr(-1, sd); if (!message || !*message || (point = atoi(message)) == 0) { - clif->displaymessage(fd, msg_txt(1011)); // Please enter a number (usage: @skpoint <number of points>). + clif->message(fd, msg_txt(1011)); // Please enter a number (usage: @skpoint <number of points>). return -1; } @@ -2379,12 +2386,12 @@ ACMD_FUNC(skillpoint) if (new_skill_point != sd->status.skill_point) { sd->status.skill_point = new_skill_point; clif->updatestatus(sd, SP_SKILLPOINT); - clif->displaymessage(fd, msg_txt(175)); // Number of skill points changed. + clif->message(fd, msg_txt(175)); // Number of skill points changed. } else { if (point < 0) - clif->displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value. + clif->message(fd, msg_txt(41)); // Unable to decrease the number/value. else - clif->displaymessage(fd, msg_txt(149)); // Unable to increase the number/value. + clif->message(fd, msg_txt(149)); // Unable to increase the number/value. return -1; } @@ -2400,20 +2407,20 @@ ACMD_FUNC(zeny) nullpo_retr(-1, sd); if (!message || !*message || (zeny = atoi(message)) == 0) { - clif->displaymessage(fd, msg_txt(1012)); // Please enter an amount (usage: @zeny <amount>). + clif->message(fd, msg_txt(1012)); // Please enter an amount (usage: @zeny <amount>). return -1; } if(zeny > 0){ if((ret=pc_getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1) - clif->displaymessage(fd, msg_txt(149)); // Unable to increase the number/value. + clif->message(fd, msg_txt(149)); // Unable to increase the number/value. } else { if( sd->status.zeny < -zeny ) zeny = -sd->status.zeny; if((ret=pc_payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1) - clif->displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value. + clif->message(fd, msg_txt(41)); // Unable to decrease the number/value. } - if(!ret) clif->displaymessage(fd, msg_txt(176)); //ret=0 mean cmd success + if(!ret) clif->message(fd, msg_txt(176)); //ret=0 mean cmd success return 0; } @@ -2431,14 +2438,14 @@ ACMD_FUNC(param) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { - clif->displaymessage(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>). + clif->message(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>). return -1; } ARR_FIND( 0, ARRAYLENGTH(param), i, strcmpi(command+1, param[i]) == 0 ); if( i == ARRAYLENGTH(param) || i > MAX_STATUS_TYPE) { // normally impossible... - clif->displaymessage(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>). + clif->message(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>). return -1; } @@ -2467,12 +2474,12 @@ ACMD_FUNC(param) clif->updatestatus(sd, SP_STR + i); clif->updatestatus(sd, SP_USTR + i); status_calc_pc(sd, 0); - clif->displaymessage(fd, msg_txt(42)); // Stat changed. + clif->message(fd, msg_txt(42)); // Stat changed. } else { if (value < 0) - clif->displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value. + clif->message(fd, msg_txt(41)); // Unable to decrease the number/value. else - clif->displaymessage(fd, msg_txt(149)); // Unable to increase the number/value. + clif->message(fd, msg_txt(149)); // Unable to increase the number/value. return -1; } @@ -2526,12 +2533,12 @@ ACMD_FUNC(stat_all) if (count > 0) { // if at least 1 stat modified status_calc_pc(sd, 0); - clif->displaymessage(fd, msg_txt(84)); // All stats changed! + clif->message(fd, msg_txt(84)); // All stats changed! } else { if (value < 0) - clif->displaymessage(fd, msg_txt(177)); // You cannot decrease that stat anymore. + clif->message(fd, msg_txt(177)); // You cannot decrease that stat anymore. else - clif->displaymessage(fd, msg_txt(178)); // You cannot increase that stat anymore. + clif->message(fd, msg_txt(178)); // You cannot increase that stat anymore. return -1; } @@ -2549,16 +2556,16 @@ ACMD_FUNC(guildlevelup) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d", &level) < 1 || level == 0) { - clif->displaymessage(fd, msg_txt(1014)); // Please enter a valid level (usage: @guildlvup/@guildlvlup <# of levels>). + clif->message(fd, msg_txt(1014)); // Please enter a valid level (usage: @guildlvup/@guildlvlup <# of levels>). return -1; } - if (sd->status.guild_id <= 0 || (guild_info = guild_search(sd->status.guild_id)) == NULL) { - clif->displaymessage(fd, msg_txt(43)); // You're not in a guild. + if (sd->status.guild_id <= 0 || (guild_info = sd->guild) == NULL) { + clif->message(fd, msg_txt(43)); // You're not in a guild. return -1; } //if (strcmp(sd->status.name, guild_info->master) != 0) { - // clif->displaymessage(fd, msg_txt(44)); // You're not the master of your guild. + // clif->message(fd, msg_txt(44)); // You're not the master of your guild. // return -1; //} @@ -2570,9 +2577,9 @@ ACMD_FUNC(guildlevelup) if (added_level != 0) { intif_guild_change_basicinfo(guild_info->guild_id, GBI_GUILDLV, &added_level, sizeof(added_level)); - clif->displaymessage(fd, msg_txt(179)); // Guild level changed. + clif->message(fd, msg_txt(179)); // Guild level changed. } else { - clif->displaymessage(fd, msg_txt(45)); // Guild level change failed. + clif->message(fd, msg_txt(45)); // Guild level change failed. return -1; } @@ -2589,7 +2596,7 @@ ACMD_FUNC(makeegg) nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1015)); // Please enter a monster/egg name/ID (usage: @makeegg <pet>). + clif->message(fd, msg_txt(1015)); // Please enter a monster/egg name/ID (usage: @makeegg <pet>). return -1; } @@ -2612,7 +2619,7 @@ ACMD_FUNC(makeegg) (short)pet_db[pet_id].EggID, 0, (short)pet_db[pet_id].intimate, 100, 0, 1, pet_db[pet_id].jname); } else { - clif->displaymessage(fd, msg_txt(180)); // The monster/egg name/id doesn't exist. + clif->message(fd, msg_txt(180)); // The monster/egg name/id doesn't exist. return -1; } @@ -2628,7 +2635,7 @@ ACMD_FUNC(hatch) if (sd->status.pet_id <= 0) clif->sendegg(sd); else { - clif->displaymessage(fd, msg_txt(181)); // You already have a pet. + clif->message(fd, msg_txt(181)); // You already have a pet. return -1; } @@ -2645,30 +2652,30 @@ ACMD_FUNC(petfriendly) nullpo_retr(-1, sd); if (!message || !*message || (friendly = atoi(message)) < 0) { - clif->displaymessage(fd, msg_txt(1016)); // Please enter a valid value (usage: @petfriendly <0-1000>). + clif->message(fd, msg_txt(1016)); // Please enter a valid value (usage: @petfriendly <0-1000>). return -1; } pd = sd->pd; if (!pd) { - clif->displaymessage(fd, msg_txt(184)); // Sorry, but you have no pet. + clif->message(fd, msg_txt(184)); // Sorry, but you have no pet. return -1; } if (friendly < 0 || friendly > 1000) { - clif->displaymessage(fd, msg_txt(37)); // An invalid number was specified. + clif->message(fd, msg_txt(37)); // An invalid number was specified. return -1; } if (friendly == pd->pet.intimate) { - clif->displaymessage(fd, msg_txt(183)); // Pet intimacy is already at maximum. + clif->message(fd, msg_txt(183)); // Pet intimacy is already at maximum. return -1; } pet_set_intimate(pd, friendly); clif->send_petstatus(sd); - clif->displaymessage(fd, msg_txt(182)); // Pet intimacy changed. + clif->message(fd, msg_txt(182)); // Pet intimacy changed. return 0; } @@ -2682,27 +2689,27 @@ ACMD_FUNC(pethungry) nullpo_retr(-1, sd); if (!message || !*message || (hungry = atoi(message)) < 0) { - clif->displaymessage(fd, msg_txt(1017)); // Please enter a valid number (usage: @pethungry <0-100>). + clif->message(fd, msg_txt(1017)); // Please enter a valid number (usage: @pethungry <0-100>). return -1; } pd = sd->pd; if (!sd->status.pet_id || !pd) { - clif->displaymessage(fd, msg_txt(184)); // Sorry, but you have no pet. + clif->message(fd, msg_txt(184)); // Sorry, but you have no pet. return -1; } if (hungry < 0 || hungry > 100) { - clif->displaymessage(fd, msg_txt(37)); // An invalid number was specified. + clif->message(fd, msg_txt(37)); // An invalid number was specified. return -1; } if (hungry == pd->pet.hungry) { - clif->displaymessage(fd, msg_txt(186)); // Pet hunger is already at maximum. + clif->message(fd, msg_txt(186)); // Pet hunger is already at maximum. return -1; } pd->pet.hungry = hungry; clif->send_petstatus(sd); - clif->displaymessage(fd, msg_txt(185)); // Pet hunger changed. + clif->message(fd, msg_txt(185)); // Pet hunger changed. return 0; } @@ -2715,19 +2722,19 @@ ACMD_FUNC(petrename) struct pet_data *pd; nullpo_retr(-1, sd); if (!sd->status.pet_id || !sd->pd) { - clif->displaymessage(fd, msg_txt(184)); // Sorry, but you have no pet. + clif->message(fd, msg_txt(184)); // Sorry, but you have no pet. return -1; } pd = sd->pd; if (!pd->pet.rename_flag) { - clif->displaymessage(fd, msg_txt(188)); // You can already rename your pet. + clif->message(fd, msg_txt(188)); // You can already rename your pet. return -1; } pd->pet.rename_flag = 0; intif_save_petdata(sd->status.account_id, &pd->pet); clif->send_petstatus(sd); - clif->displaymessage(fd, msg_txt(187)); // You can now rename your pet. + clif->message(fd, msg_txt(187)); // You can now rename your pet. return 0; } @@ -2741,28 +2748,28 @@ ACMD_FUNC(recall) { nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1018)); // Please enter a player name (usage: @recall <char name/ID>). + clif->message(fd, msg_txt(1018)); // Please enter a player name (usage: @recall <char name/ID>). return -1; } if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { - clif->displaymessage(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player. + clif->message(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player. return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(1019)); // You are not authorized to warp someone to this map. + clif->message(fd, msg_txt(1019)); // You are not authorized to warp someone to this map. return -1; } if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(1020)); // You are not authorized to warp this player from their map. + clif->message(fd, msg_txt(1020)); // You are not authorized to warp this player from their map. return -1; } if (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y) { @@ -2770,7 +2777,7 @@ ACMD_FUNC(recall) { } pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN); sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled! - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -2786,12 +2793,12 @@ ACMD_FUNC(char_block) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(1021)); // Please enter a player name (usage: @charblock/@block <char name>). + clif->message(fd, msg_txt(1021)); // Please enter a player name (usage: @charblock/@block <char name>). return -1; } chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block - clif->displaymessage(fd, msg_txt(88)); // Character name sent to char-server to ask it. + clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return 0; } @@ -2823,7 +2830,7 @@ ACMD_FUNC(char_ban) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%255s %23[^\n]", atcmd_output, atcmd_player_name) < 2) { - clif->displaymessage(fd, msg_txt(1022)); // Please enter ban time and a player name (usage: @charban/@ban/@banish/@charbanish <time> <char name>). + clif->message(fd, msg_txt(1022)); // Please enter ban time and a player name (usage: @charban/@ban/@banish/@charbanish <time> <char name>). return -1; } @@ -2867,7 +2874,7 @@ ACMD_FUNC(char_ban) } } if (year == 0 && month == 0 && day == 0 && hour == 0 && minute == 0 && second == 0) { - clif->displaymessage(fd, msg_txt(85)); // Invalid time for ban command. + clif->message(fd, msg_txt(85)); // Invalid time for ban command. return -1; } /** @@ -2883,12 +2890,12 @@ ACMD_FUNC(char_ban) tmtime->tm_sec = tmtime->tm_sec + second; timestamp = mktime(tmtime); if( timestamp <= time(NULL) && !pc_can_use_command(sd, "unban", COMMAND_ATCOMMAND) ) { - clif->displaymessage(fd,msg_txt(1023)); // You are not allowed to reduce the length of a ban. + clif->message(fd,msg_txt(1023)); // You are not allowed to reduce the length of a ban. return -1; } chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 2, year, month, day, hour, minute, second); // type: 2 - ban - clif->displaymessage(fd, msg_txt(88)); // Character name sent to char-server to ask it. + clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return 0; } @@ -2903,13 +2910,13 @@ ACMD_FUNC(char_unblock) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(1024)); // Please enter a player name (usage: @charunblock <char name>). + clif->message(fd, msg_txt(1024)); // Please enter a player name (usage: @charunblock <char name>). return -1; } // send answer to login server via char-server chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0, 0, 0, 0); // type: 3 - unblock - clif->displaymessage(fd, msg_txt(88)); // Character name sent to char-server to ask it. + clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return 0; } @@ -2924,13 +2931,13 @@ ACMD_FUNC(char_unban) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(1025)); // Please enter a player name (usage: @charunban <char name>). + clif->message(fd, msg_txt(1025)); // Please enter a player name (usage: @charunban <char name>). return -1; } // send answer to login server via char-server chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 4, 0, 0, 0, 0, 0, 0); // type: 4 - unban - clif->displaymessage(fd, msg_txt(88)); // Character name sent to char-server to ask it. + clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return 0; } @@ -2945,7 +2952,7 @@ ACMD_FUNC(night) if (night_flag != 1) { map_night_timer(night_timer_tid, 0, 0, 1); } else { - clif->displaymessage(fd, msg_txt(89)); // Night mode is already enabled. + clif->message(fd, msg_txt(89)); // Night mode is already enabled. return -1; } @@ -2962,7 +2969,7 @@ ACMD_FUNC(day) if (night_flag != 0) { map_day_timer(day_timer_tid, 0, 0, 1); } else { - clif->displaymessage(fd, msg_txt(90)); // Day mode is already enabled. + clif->message(fd, msg_txt(90)); // Day mode is already enabled. return -1; } @@ -2986,12 +2993,12 @@ ACMD_FUNC(doom) { status_kill(&pl_sd->bl); clif->specialeffect(&pl_sd->bl,450,AREA); - clif->displaymessage(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgement. + clif->message(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgement. } } mapit_free(iter); - clif->displaymessage(fd, msg_txt(62)); // Judgement was made. + clif->message(fd, msg_txt(62)); // Judgement was made. return 0; } @@ -3013,12 +3020,12 @@ ACMD_FUNC(doommap) { status_kill(&pl_sd->bl); clif->specialeffect(&pl_sd->bl,450,AREA); - clif->displaymessage(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgement. + clif->message(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgement. } } mapit_free(iter); - clif->displaymessage(fd, msg_txt(62)); // Judgement was made. + clif->message(fd, msg_txt(62)); // Judgement was made. return 0; } @@ -3031,7 +3038,7 @@ static void atcommand_raise_sub(struct map_session_data* sd) { status_revive(&sd->bl, 100, 100); clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); - clif->displaymessage(sd->fd, msg_txt(63)); // Mercy has been shown. + clif->message(sd->fd, msg_txt(63)); // Mercy has been shown. } /*========================================== @@ -3050,7 +3057,7 @@ ACMD_FUNC(raise) atcommand_raise_sub(pl_sd); mapit_free(iter); - clif->displaymessage(fd, msg_txt(64)); // Mercy has been granted. + clif->message(fd, msg_txt(64)); // Mercy has been granted. return 0; } @@ -3071,7 +3078,7 @@ ACMD_FUNC(raisemap) atcommand_raise_sub(pl_sd); mapit_free(iter); - clif->displaymessage(fd, msg_txt(64)); // Mercy has been granted. + clif->message(fd, msg_txt(64)); // Mercy has been granted. return 0; } @@ -3087,19 +3094,19 @@ ACMD_FUNC(kick) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1026)); // Please enter a player name (usage: @kick <char name/ID>). + clif->message(fd, msg_txt(1026)); // Please enter a player name (usage: @kick <char name/ID>). return -1; } if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { - clif->displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } @@ -3127,7 +3134,7 @@ ACMD_FUNC(kickall) } mapit_free(iter); - clif->displaymessage(fd, msg_txt(195)); // All players have been kicked! + clif->message(fd, msg_txt(195)); // All players have been kicked! return 0; } @@ -3141,7 +3148,7 @@ ACMD_FUNC(allskill) pc_allskillup(sd); // all skills sd->status.skill_point = 0; // 0 skill points clif->updatestatus(sd, SP_SKILLPOINT); // update - clif->displaymessage(fd, msg_txt(76)); // All skills have been added to your skill tree. + clif->message(fd, msg_txt(76)); // All skills have been added to your skill tree. return 0; } @@ -3162,30 +3169,30 @@ ACMD_FUNC(questskill) text = atcommand_help_string( command ); // send the error message as always - clif->displaymessage(fd, msg_txt(1027)); // Please enter a quest skill number. + clif->message(fd, msg_txt(1027)); // Please enter a quest skill number. if( text ) {// send the skill ID list associated with this command - clif->displaymessage( fd, text ); + clif->message( fd, text ); } return -1; } if (skill_id >= MAX_SKILL_DB) { - clif->displaymessage(fd, msg_txt(198)); // This skill number doesn't exist. + clif->message(fd, msg_txt(198)); // This skill number doesn't exist. return -1; } if (!(skill->get_inf2(skill_id) & INF2_QUEST_SKILL)) { - clif->displaymessage(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. + clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. return -1; } if (pc_checkskill(sd, skill_id) > 0) { - clif->displaymessage(fd, msg_txt(196)); // You already have this quest skill. + clif->message(fd, msg_txt(196)); // You already have this quest skill. return -1; } pc_skill(sd, skill_id, 1, 0); - clif->displaymessage(fd, msg_txt(70)); // You have learned the skill. + clif->message(fd, msg_txt(70)); // You have learned the skill. return 0; } @@ -3206,32 +3213,32 @@ ACMD_FUNC(lostskill) text = atcommand_help_string( command ); // send the error message as always - clif->displaymessage(fd, msg_txt(1027)); // Please enter a quest skill number. + clif->message(fd, msg_txt(1027)); // Please enter a quest skill number. if( text ) {// send the skill ID list associated with this command - clif->displaymessage( fd, text ); + clif->message( fd, text ); } return -1; } if (skill_id >= MAX_SKILL) { - clif->displaymessage(fd, msg_txt(198)); // This skill number doesn't exist. + clif->message(fd, msg_txt(198)); // This skill number doesn't exist. return -1; } if (!(skill->get_inf2(skill_id) & INF2_QUEST_SKILL)) { - clif->displaymessage(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. + clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. return -1; } if (pc_checkskill(sd, skill_id) == 0) { - clif->displaymessage(fd, msg_txt(201)); // You don't have this quest skill. + clif->message(fd, msg_txt(201)); // You don't have this quest skill. return -1; } sd->status.skill[skill_id].lv = 0; sd->status.skill[skill_id].flag = 0; clif->deleteskill(sd,skill_id); - clif->displaymessage(fd, msg_txt(71)); // You have forgotten the skill. + clif->message(fd, msg_txt(71)); // You have forgotten the skill. return 0; } @@ -3251,7 +3258,7 @@ ACMD_FUNC(spiritball) { char msg[CHAT_SIZE_MAX]; safesnprintf(msg, sizeof(msg), msg_txt(1028), max_spiritballs); // Please enter a party name (usage: @party <party_name>). - clif->displaymessage(fd, msg); + clif->message(fd, msg); return -1; } @@ -3275,7 +3282,7 @@ ACMD_FUNC(party) memset(party, '\0', sizeof(party)); if (!message || !*message || sscanf(message, "%23[^\n]", party) < 1) { - clif->displaymessage(fd, msg_txt(1029)); // Please enter a party name (usage: @party <party_name>). + clif->message(fd, msg_txt(1029)); // Please enter a party name (usage: @party <party_name>). return -1; } @@ -3296,7 +3303,7 @@ ACMD_FUNC(guild) memset(guild, '\0', sizeof(guild)); if (!message || !*message || sscanf(message, "%23[^\n]", guild) < 1) { - clif->displaymessage(fd, msg_txt(1030)); // Please enter a guild name (usage: @guild <guild_name>). + clif->message(fd, msg_txt(1030)); // Please enter a guild name (usage: @guild <guild_name>). return -1; } @@ -3314,7 +3321,7 @@ ACMD_FUNC(breakguild) if (sd->status.guild_id) { // Check if the player has a guild struct guild *g; - g = guild_search(sd->status.guild_id); // Search the guild + g = sd->guild; // Search the guild if (g) { // Check if guild was found if (sd->state.gmaster_flag) { // Check if player is guild master int ret = 0; @@ -3325,15 +3332,15 @@ ACMD_FUNC(breakguild) return -1; // Something went wrong } } else { // Not guild master - clif->displaymessage(fd, msg_txt(1181)); // You need to be a Guild Master to use this command. + clif->message(fd, msg_txt(1181)); // You need to be a Guild Master to use this command. return -1; } } else { // Guild was not found. HOW? - clif->displaymessage(fd, msg_txt(252)); // You are not in a guild. + clif->message(fd, msg_txt(252)); // You are not in a guild. return -1; } } else { // Player does not have a guild - clif->displaymessage(fd, msg_txt(252)); // You are not in a guild. + clif->message(fd, msg_txt(252)); // You are not in a guild. return -1; } return 0; @@ -3346,13 +3353,13 @@ ACMD_FUNC(agitstart) { nullpo_retr(-1, sd); if (agit_flag == 1) { - clif->displaymessage(fd, msg_txt(73)); // War of Emperium is currently in progress. + clif->message(fd, msg_txt(73)); // War of Emperium is currently in progress. return -1; } agit_flag = 1; guild_agit_start(); - clif->displaymessage(fd, msg_txt(72)); // War of Emperium has been initiated. + clif->message(fd, msg_txt(72)); // War of Emperium has been initiated. return 0; } @@ -3364,13 +3371,13 @@ ACMD_FUNC(agitstart2) { nullpo_retr(-1, sd); if (agit2_flag == 1) { - clif->displaymessage(fd, msg_txt(404)); // "War of Emperium SE is currently in progress." + clif->message(fd, msg_txt(404)); // "War of Emperium SE is currently in progress." return -1; } agit2_flag = 1; guild_agit2_start(); - clif->displaymessage(fd, msg_txt(403)); // "War of Emperium SE has been initiated." + clif->message(fd, msg_txt(403)); // "War of Emperium SE has been initiated." return 0; } @@ -3382,13 +3389,13 @@ ACMD_FUNC(agitend) { nullpo_retr(-1, sd); if (agit_flag == 0) { - clif->displaymessage(fd, msg_txt(75)); // War of Emperium is currently not in progress. + clif->message(fd, msg_txt(75)); // War of Emperium is currently not in progress. return -1; } agit_flag = 0; guild_agit_end(); - clif->displaymessage(fd, msg_txt(74)); // War of Emperium has been ended. + clif->message(fd, msg_txt(74)); // War of Emperium has been ended. return 0; } @@ -3400,13 +3407,13 @@ ACMD_FUNC(agitend2) { nullpo_retr(-1, sd); if (agit2_flag == 0) { - clif->displaymessage(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress." + clif->message(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress." return -1; } agit2_flag = 0; guild_agit2_end(); - clif->displaymessage(fd, msg_txt(405)); // "War of Emperium SE has been ended." + clif->message(fd, msg_txt(405)); // "War of Emperium SE has been ended." return 0; } @@ -3436,24 +3443,24 @@ ACMD_FUNC(idsearch) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%99s", item_name) < 0) { - clif->displaymessage(fd, msg_txt(1031)); // Please enter part of an item name (usage: @idsearch <part_of_item_name>). + clif->message(fd, msg_txt(1031)); // Please enter part of an item name (usage: @idsearch <part_of_item_name>). return -1; } sprintf(atcmd_output, msg_txt(77), item_name); // The reference result of '%s' (name: id): - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); match = itemdb_searchname_array(item_array, MAX_SEARCH, item_name); if (match > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, match); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); match = MAX_SEARCH; } for(i = 0; i < match; i++) { sprintf(atcmd_output, msg_txt(78), item_array[i]->jname, item_array[i]->nameid); // %s: %d - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } sprintf(atcmd_output, msg_txt(79), match); // It is %d affair above. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -3471,7 +3478,7 @@ ACMD_FUNC(recallall) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map. + clif->message(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map. return -1; } @@ -3496,10 +3503,10 @@ ACMD_FUNC(recallall) } mapit_free(iter); - clif->displaymessage(fd, msg_txt(92)); // All characters recalled! + clif->message(fd, msg_txt(92)); // All characters recalled! if (count) { sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -3521,19 +3528,19 @@ ACMD_FUNC(guildrecall) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { - clif->displaymessage(fd, msg_txt(1034)); // Please enter a guild name/ID (usage: @guildrecall <guild_name/ID>). + clif->message(fd, msg_txt(1034)); // Please enter a guild name/ID (usage: @guildrecall <guild_name/ID>). return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map. + clif->message(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map. return -1; } if ((g = guild_searchname(guild_name)) == NULL && // name first to avoid error when name begin with a number (g = guild_search(atoi(message))) == NULL) { - clif->displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. + clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return -1; } @@ -3555,10 +3562,10 @@ ACMD_FUNC(guildrecall) mapit_free(iter); sprintf(atcmd_output, msg_txt(93), g->name); // All online characters of the %s guild have been recalled to your position. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); if (count) { sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -3580,19 +3587,19 @@ ACMD_FUNC(partyrecall) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) { - clif->displaymessage(fd, msg_txt(1035)); // Please enter a party name/ID (usage: @partyrecall <party_name/ID>). + clif->message(fd, msg_txt(1035)); // Please enter a party name/ID (usage: @partyrecall <party_name/ID>). return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { - clif->displaymessage(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map. + clif->message(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map. return -1; } if ((p = party_searchname(party_name)) == NULL && // name first to avoid error when name begin with a number (p = party_search(atoi(message))) == NULL) { - clif->displaymessage(fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online. + clif->message(fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online. return -1; } @@ -3614,10 +3621,10 @@ ACMD_FUNC(partyrecall) mapit_free(iter); sprintf(atcmd_output, msg_txt(95), p->party.name); // All online characters of the %s party have been recalled to your position. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); if (count) { sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -3630,7 +3637,7 @@ ACMD_FUNC(reloaditemdb) { nullpo_retr(-1, sd); itemdb_reload(); - clif->displaymessage(fd, msg_txt(97)); // Item database has been reloaded. + clif->message(fd, msg_txt(97)); // Item database has been reloaded. return 0; } @@ -3647,7 +3654,7 @@ ACMD_FUNC(reloadmobdb) read_mercenarydb(); read_mercenary_skilldb(); reload_elementaldb(); - clif->displaymessage(fd, msg_txt(98)); // Monster database has been reloaded. + clif->message(fd, msg_txt(98)); // Monster database has been reloaded. return 0; } @@ -3662,7 +3669,7 @@ ACMD_FUNC(reloadskilldb) merc_skill_reload(); reload_elemental_skilldb(); read_mercenary_skilldb(); - clif->displaymessage(fd, msg_txt(99)); // Skill database has been reloaded. + clif->message(fd, msg_txt(99)); // Skill database has been reloaded. return 0; } @@ -3675,14 +3682,14 @@ ACMD_FUNC(reloadatcommand) { config_t run_test; if (conf_read_file(&run_test, "conf/groups.conf")) { - clif->displaymessage(fd, msg_txt(1036)); // Error reading groups.conf, reload failed. + clif->message(fd, msg_txt(1036)); // Error reading groups.conf, reload failed. return -1; } config_destroy(&run_test); if (conf_read_file(&run_test, ATCOMMAND_CONF_FILENAME)) { - clif->displaymessage(fd, msg_txt(1037)); // Error reading atcommand.conf, reload failed. + clif->message(fd, msg_txt(1037)); // Error reading atcommand.conf, reload failed. return -1; } @@ -3690,7 +3697,7 @@ ACMD_FUNC(reloadatcommand) { atcommand_doload(); pc_groups_reload(); - clif->displaymessage(fd, msg_txt(254)); + clif->message(fd, msg_txt(254)); return 0; } /*========================================== @@ -3738,7 +3745,7 @@ ACMD_FUNC(reloadbattleconf) mob_reload(); //Needed as well so rate changes take effect. chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common); } - clif->displaymessage(fd, msg_txt(255)); + clif->message(fd, msg_txt(255)); return 0; } /*========================================== @@ -3747,7 +3754,7 @@ ACMD_FUNC(reloadbattleconf) ACMD_FUNC(reloadstatusdb) { status_readdb(); - clif->displaymessage(fd, msg_txt(256)); + clif->message(fd, msg_txt(256)); return 0; } /*========================================== @@ -3756,7 +3763,7 @@ ACMD_FUNC(reloadstatusdb) ACMD_FUNC(reloadpcdb) { pc_readdb(); - clif->displaymessage(fd, msg_txt(257)); + clif->message(fd, msg_txt(257)); return 0; } @@ -3766,7 +3773,7 @@ ACMD_FUNC(reloadpcdb) ACMD_FUNC(reloadmotd) { pc_read_motd(); - clif->displaymessage(fd, msg_txt(268)); + clif->message(fd, msg_txt(268)); return 0; } @@ -3784,7 +3791,7 @@ ACMD_FUNC(reloadscript) script_reload(); npc_reload(); - clif->displaymessage(fd, msg_txt(100)); // Scripts have been reloaded. + clif->message(fd, msg_txt(100)); // Scripts have been reloaded. return 0; } @@ -3817,7 +3824,7 @@ ACMD_FUNC(mapinfo) { sscanf(message, "%d %23[^\n]", &list, mapname); if (list < 0 || list > 3) { - clif->displaymessage(fd, msg_txt(1038)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>). + clif->message(fd, msg_txt(1038)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>). return -1; } @@ -3829,12 +3836,12 @@ ACMD_FUNC(mapinfo) { } if (m_id < 0) { - clif->displaymessage(fd, msg_txt(1)); // Map not found. + clif->message(fd, msg_txt(1)); // Map not found. return -1; } m_index = mapindex_name2id(mapname); //This one shouldn't fail since the previous seek did not. - clif->displaymessage(fd, msg_txt(1039)); // ------ Map Info ------ + clif->message(fd, msg_txt(1039)); // ------ Map Info ------ // count chats (for initial message) chat_num = 0; @@ -3850,18 +3857,18 @@ ACMD_FUNC(mapinfo) { mapit_free(iter); sprintf(atcmd_output, msg_txt(1040), mapname, map[m_id].zone->name, map[m_id].users, map[m_id].npc_num, chat_num, vend_num); // Map: %s (Zone:%s) | Players: %d | NPCs: %d | Chats: %d | Vendings: %d - clif->displaymessage(fd, atcmd_output); - clif->displaymessage(fd, msg_txt(1041)); // ------ Map Flags ------ + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1041)); // ------ Map Flags ------ if (map[m_id].flag.town) - clif->displaymessage(fd, msg_txt(1042)); // Town Map + clif->message(fd, msg_txt(1042)); // Town Map if (battle_config.autotrade_mapflag == map[m_id].flag.autotrade) - clif->displaymessage(fd, msg_txt(1043)); // Autotrade Enabled + clif->message(fd, msg_txt(1043)); // Autotrade Enabled else - clif->displaymessage(fd, msg_txt(1044)); // Autotrade Disabled + clif->message(fd, msg_txt(1044)); // Autotrade Disabled if (map[m_id].flag.battleground) - clif->displaymessage(fd, msg_txt(1045)); // Battlegrounds ON + clif->message(fd, msg_txt(1045)); // Battlegrounds ON strcpy(atcmd_output,msg_txt(1046)); // PvP Flags: if (map[m_id].flag.pvp) @@ -3874,7 +3881,7 @@ ACMD_FUNC(mapinfo) { strcat(atcmd_output, msg_txt(1050)); // NightmareDrop | if (map[m_id].flag.pvp_nocalcrank) strcat(atcmd_output, msg_txt(1051)); // NoCalcRank | - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); strcpy(atcmd_output,msg_txt(1052)); // GvG Flags: if (map[m_id].flag.gvg) @@ -3885,7 +3892,7 @@ ACMD_FUNC(mapinfo) { strcat(atcmd_output, msg_txt(1055)); // GvG Castle | if (map[m_id].flag.gvg_noparty) strcat(atcmd_output, msg_txt(1056)); // NoParty | - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); strcpy(atcmd_output,msg_txt(1057)); // Teleport Flags: if (map[m_id].flag.noteleport) @@ -3902,23 +3909,23 @@ ACMD_FUNC(mapinfo) { strcat(atcmd_output, msg_txt(1063)); // NoGo | if (map[m_id].flag.nomemo) strcat(atcmd_output, msg_txt(1064)); // NoMemo | - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1065), // No Exp Penalty: %s | No Zeny Penalty: %s (map[m_id].flag.noexppenalty) ? msg_txt(1066) : msg_txt(1067), (map[m_id].flag.nozenypenalty) ? msg_txt(1066) : msg_txt(1067)); // On / Off - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); if (map[m_id].flag.nosave) { if (!map[m_id].save.map) - clif->displaymessage(fd, msg_txt(1068)); // No Save (Return to last Save Point) + clif->message(fd, msg_txt(1068)); // No Save (Return to last Save Point) else if (map[m_id].save.x == -1 || map[m_id].save.y == -1 ) { sprintf(atcmd_output, msg_txt(1069), mapindex_id2name(map[m_id].save.map)); // No Save, Save Point: %s,Random - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } else { sprintf(atcmd_output, msg_txt(1070), // No Save, Save Point: %s,%d,%d mapindex_id2name(map[m_id].save.map),map[m_id].save.x,map[m_id].save.y); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } @@ -3939,7 +3946,7 @@ ACMD_FUNC(mapinfo) { strcat(atcmd_output, msg_txt(1078)); // Leaves | if (map[m_id].flag.nightenabled) strcat(atcmd_output, msg_txt(1080)); // Displays Night | - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); strcpy(atcmd_output,msg_txt(1081)); // Other Flags: if (map[m_id].flag.nobranch) @@ -3958,7 +3965,7 @@ ACMD_FUNC(mapinfo) { strcat(atcmd_output, msg_txt(1088)); // AllowKS | if (map[m_id].flag.reset) strcat(atcmd_output, msg_txt(1089)); // Reset | - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); strcpy(atcmd_output,msg_txt(1090)); // Other Flags: if (map[m_id].nocommand) @@ -3975,27 +3982,27 @@ ACMD_FUNC(mapinfo) { strcat(atcmd_output, msg_txt(1096)); // PartyLock | if (map[m_id].flag.guildlock) strcat(atcmd_output, msg_txt(1097)); // GuildLock | - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); switch (list) { case 0: // Do nothing. It's list 0, no additional display. break; case 1: - clif->displaymessage(fd, msg_txt(1098)); // ----- Players in Map ----- + clif->message(fd, msg_txt(1098)); // ----- Players in Map ----- iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ) { if (pl_sd->mapindex == m_index) { sprintf(atcmd_output, msg_txt(1099), // Player '%s' (session #%d) | Location: %d,%d pl_sd->status.name, pl_sd->fd, pl_sd->bl.x, pl_sd->bl.y); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } mapit_free(iter); break; case 2: - clif->displaymessage(fd, msg_txt(1100)); // ----- NPCs in Map ----- + clif->message(fd, msg_txt(1100)); // ----- NPCs in Map ----- for (i = 0; i < map[m_id].npc_num;) { nd = map[m_id].npc[i]; @@ -4017,11 +4024,11 @@ ACMD_FUNC(mapinfo) { else sprintf(atcmd_output, msg_txt(1112), // NPC %d: %s::%s | Direction: %s | Sprite: %d | Location: %d %d ++i, nd->name, nd->exname, direction, nd->class_, nd->bl.x, nd->bl.y); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } break; case 3: - clif->displaymessage(fd, msg_txt(1113)); // ----- Chats in Map ----- + clif->message(fd, msg_txt(1113)); // ----- Chats in Map ----- iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ) { @@ -4031,16 +4038,16 @@ ACMD_FUNC(mapinfo) { { sprintf(atcmd_output, msg_txt(1114), // Chat: %s | Player: %s | Location: %d %d cd->title, pl_sd->status.name, cd->bl.x, cd->bl.y); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1115), // Users: %d/%d | Password: %s | Public: %s cd->users, cd->limit, cd->pass, (cd->pub) ? msg_txt(1116) : msg_txt(1117)); // Yes / No - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } mapit_free(iter); break; default: // normally impossible to arrive here - clif->displaymessage(fd, msg_txt(1118)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>). + clif->message(fd, msg_txt(1118)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>). return -1; break; } @@ -4056,36 +4063,36 @@ ACMD_FUNC(mount_peco) nullpo_retr(-1, sd); if (sd->disguise) { - clif->displaymessage(fd, msg_txt(212)); // Cannot mount while in disguise. + clif->message(fd, msg_txt(212)); // Cannot mount while in disguise. return -1; } if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && pc_checkskill(sd,RK_DRAGONTRAINING) > 0 ) { if( !(sd->sc.option&OPTION_DRAGON1) ) { - clif->displaymessage(sd->fd,msg_txt(1119)); // You have mounted your Dragon. + clif->message(sd->fd,msg_txt(1119)); // You have mounted your Dragon. pc_setoption(sd, sd->sc.option|OPTION_DRAGON1); } else { - clif->displaymessage(sd->fd,msg_txt(1120)); // You have released your Dragon. + clif->message(sd->fd,msg_txt(1120)); // You have released your Dragon. pc_setoption(sd, sd->sc.option&~OPTION_DRAGON1); } return 0; } if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && pc_checkskill(sd,RA_WUGRIDER) > 0 ) { if( !pc_isridingwug(sd) ) { - clif->displaymessage(sd->fd,msg_txt(1121)); // You have mounted your Warg. + clif->message(sd->fd,msg_txt(1121)); // You have mounted your Warg. pc_setoption(sd, sd->sc.option|OPTION_WUGRIDER); } else { - clif->displaymessage(sd->fd,msg_txt(1122)); // You have released your Warg. + clif->message(sd->fd,msg_txt(1122)); // You have released your Warg. pc_setoption(sd, sd->sc.option&~OPTION_WUGRIDER); } return 0; } if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) { if( !pc_ismadogear(sd) ) { - clif->displaymessage(sd->fd,msg_txt(1123)); // You have mounted your Mado Gear. + clif->message(sd->fd,msg_txt(1123)); // You have mounted your Mado Gear. pc_setoption(sd, sd->sc.option|OPTION_MADOGEAR); } else { - clif->displaymessage(sd->fd,msg_txt(1124)); // You have released your Mado Gear. + clif->message(sd->fd,msg_txt(1124)); // You have released your Mado Gear. pc_setoption(sd, sd->sc.option&~OPTION_MADOGEAR); } return 0; @@ -4093,15 +4100,15 @@ ACMD_FUNC(mount_peco) if (!pc_isriding(sd)) { // if actually no peco if (!pc_checkskill(sd, KN_RIDING)) { - clif->displaymessage(fd, msg_txt(213)); // You can not mount a Peco Peco with your current job. + clif->message(fd, msg_txt(213)); // You can not mount a Peco Peco with your current job. return -1; } pc_setoption(sd, sd->sc.option | OPTION_RIDING); - clif->displaymessage(fd, msg_txt(102)); // You have mounted a Peco Peco. + clif->message(fd, msg_txt(102)); // You have mounted a Peco Peco. } else {//Dismount pc_setoption(sd, sd->sc.option & ~OPTION_RIDING); - clif->displaymessage(fd, msg_txt(214)); // You have released your Peco Peco. + clif->message(fd, msg_txt(214)); // You have released your Peco Peco. } return 0; @@ -4121,11 +4128,11 @@ ACMD_FUNC(guildspy) if (!enable_spy) { - clif->displaymessage(fd, msg_txt(1125)); // The mapserver has spy command support disabled. + clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled. return -1; } if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { - clif->displaymessage(fd, msg_txt(1126)); // Please enter a guild name/ID (usage: @guildspy <guild_name/ID>). + clif->message(fd, msg_txt(1126)); // Please enter a guild name/ID (usage: @guildspy <guild_name/ID>). return -1; } @@ -4134,14 +4141,14 @@ ACMD_FUNC(guildspy) if (sd->guildspy == g->guild_id) { sd->guildspy = 0; sprintf(atcmd_output, msg_txt(103), g->name); // No longer spying on the %s guild. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } else { sd->guildspy = g->guild_id; sprintf(atcmd_output, msg_txt(104), g->name); // Spying on the %s guild. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } else { - clif->displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the specified guild is online. + clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the specified guild is online. return -1; } @@ -4162,12 +4169,12 @@ ACMD_FUNC(partyspy) if (!enable_spy) { - clif->displaymessage(fd, msg_txt(1125)); // The mapserver has spy command support disabled. + clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled. return -1; } if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) { - clif->displaymessage(fd, msg_txt(1127)); // Please enter a party name/ID (usage: @partyspy <party_name/ID>). + clif->message(fd, msg_txt(1127)); // Please enter a party name/ID (usage: @partyspy <party_name/ID>). return -1; } @@ -4176,14 +4183,14 @@ ACMD_FUNC(partyspy) if (sd->partyspy == p->party.party_id) { sd->partyspy = 0; sprintf(atcmd_output, msg_txt(105), p->party.name); // No longer spying on the %s party. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } else { sd->partyspy = p->party.party_id; sprintf(atcmd_output, msg_txt(106), p->party.name); // Spying on the %s party. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } else { - clif->displaymessage(fd, msg_txt(96)); // Incorrect name/ID, or no one from the specified party is online. + clif->message(fd, msg_txt(96)); // Incorrect name/ID, or no one from the specified party is online. return -1; } @@ -4210,9 +4217,9 @@ ACMD_FUNC(repairall) if (count > 0) { clif->misceffect(&sd->bl, 3); clif->equiplist(sd); - clif->displaymessage(fd, msg_txt(107)); // All items have been repaired. + clif->message(fd, msg_txt(107)); // All items have been repaired. } else { - clif->displaymessage(fd, msg_txt(108)); // No item need to be repaired. + clif->message(fd, msg_txt(108)); // No item need to be repaired. return -1; } @@ -4230,20 +4237,20 @@ ACMD_FUNC(nuke) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(1128)); // Please enter a player name (usage: @nuke <char name>). + clif->message(fd, msg_txt(1128)); // Please enter a player name (usage: @nuke <char name>). return -1; } if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kill only lower or same GM level skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0); - clif->displaymessage(fd, msg_txt(109)); // Player has been nuked! + clif->message(fd, msg_txt(109)); // Player has been nuked! } else { - clif->displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } } else { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } @@ -4263,17 +4270,17 @@ ACMD_FUNC(tonpc) memset(npcname, 0, sizeof(npcname)); if (!message || !*message || sscanf(message, "%23[^\n]", npcname) < 1) { - clif->displaymessage(fd, msg_txt(1129)); // Please enter a NPC name (usage: @tonpc <NPC_name>). + clif->message(fd, msg_txt(1129)); // Please enter a NPC name (usage: @tonpc <NPC_name>). return -1; } if ((nd = npc_name2id(npcname)) != NULL) { if (pc_setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0) - clif->displaymessage(fd, msg_txt(0)); // Warped. + clif->message(fd, msg_txt(0)); // Warped. else return -1; } else { - clif->displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. + clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return -1; } @@ -4291,15 +4298,15 @@ ACMD_FUNC(shownpc) memset(NPCname, '\0', sizeof(NPCname)); if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) { - clif->displaymessage(fd, msg_txt(1130)); // Please enter a NPC name (usage: @enablenpc <NPC_name>). + clif->message(fd, msg_txt(1130)); // Please enter a NPC name (usage: @enablenpc <NPC_name>). return -1; } if (npc_name2id(NPCname) != NULL) { npc_enable(NPCname, 1); - clif->displaymessage(fd, msg_txt(110)); // Npc Enabled. + clif->message(fd, msg_txt(110)); // Npc Enabled. } else { - clif->displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. + clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return -1; } @@ -4317,17 +4324,17 @@ ACMD_FUNC(hidenpc) memset(NPCname, '\0', sizeof(NPCname)); if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) { - clif->displaymessage(fd, msg_txt(1131)); // Please enter a NPC name (usage: @hidenpc <NPC_name>). + clif->message(fd, msg_txt(1131)); // Please enter a NPC name (usage: @hidenpc <NPC_name>). return -1; } if (npc_name2id(NPCname) == NULL) { - clif->displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. + clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return -1; } npc_enable(NPCname, 0); - clif->displaymessage(fd, msg_txt(112)); // Npc Disabled. + clif->message(fd, msg_txt(112)); // Npc Disabled. return 0; } @@ -4336,13 +4343,13 @@ ACMD_FUNC(loadnpc) FILE *fp; if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1132)); // Please enter a script file name (usage: @loadnpc <file name>). + clif->message(fd, msg_txt(1132)); // Please enter a script file name (usage: @loadnpc <file name>). return -1; } // check if script file exists if ((fp = fopen(message, "r")) == NULL) { - clif->displaymessage(fd, msg_txt(261)); + clif->message(fd, msg_txt(261)); return -1; } fclose(fp); @@ -4352,7 +4359,7 @@ ACMD_FUNC(loadnpc) npc_parsesrcfile(message,true); npc_read_event_script(); - clif->displaymessage(fd, msg_txt(262)); + clif->message(fd, msg_txt(262)); return 0; } @@ -4366,19 +4373,19 @@ ACMD_FUNC(unloadnpc) memset(NPCname, '\0', sizeof(NPCname)); if (!message || !*message || sscanf(message, "%24[^\n]", NPCname) < 1) { - clif->displaymessage(fd, msg_txt(1133)); // Please enter a NPC name (usage: @npcoff <NPC_name>). + clif->message(fd, msg_txt(1133)); // Please enter a NPC name (usage: @npcoff <NPC_name>). return -1; } if ((nd = npc_name2id(NPCname)) == NULL) { - clif->displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. + clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return -1; } npc_unload_duplicates(nd); npc_unload(nd,true); npc_read_event_script(); - clif->displaymessage(fd, msg_txt(112)); // Npc Disabled. + clif->message(fd, msg_txt(112)); // Npc Disabled. return 0; } @@ -4440,54 +4447,54 @@ ACMD_FUNC(servertime) datetime = localtime(&time_server); // convert seconds in structure // like sprintf, but only for date/time (Sunday, November 02 2003 15:12:52) strftime(temp, sizeof(temp)-1, msg_txt(230), datetime); // Server time (normal time): %A, %B %d %Y %X. - clif->displaymessage(fd, temp); + clif->message(fd, temp); if (battle_config.night_duration == 0 && battle_config.day_duration == 0) { if (night_flag == 0) - clif->displaymessage(fd, msg_txt(231)); // Game time: The game is in permanent daylight. + clif->message(fd, msg_txt(231)); // Game time: The game is in permanent daylight. else - clif->displaymessage(fd, msg_txt(232)); // Game time: The game is in permanent night. + clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night. } else if (battle_config.night_duration == 0) if (night_flag == 1) { // we start with night timer_data = get_timer(day_timer_tid); sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in night for %s. - clif->displaymessage(fd, temp); - clif->displaymessage(fd, msg_txt(234)); // Game time: After, the game will be in permanent daylight. + clif->message(fd, temp); + clif->message(fd, msg_txt(234)); // Game time: After, the game will be in permanent daylight. } else - clif->displaymessage(fd, msg_txt(231)); // Game time: The game is in permanent daylight. + clif->message(fd, msg_txt(231)); // Game time: The game is in permanent daylight. else if (battle_config.day_duration == 0) if (night_flag == 0) { // we start with day timer_data = get_timer(night_timer_tid); sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s. - clif->displaymessage(fd, temp); - clif->displaymessage(fd, msg_txt(236)); // Game time: After, the game will be in permanent night. + clif->message(fd, temp); + clif->message(fd, msg_txt(236)); // Game time: After, the game will be in permanent night. } else - clif->displaymessage(fd, msg_txt(232)); // Game time: The game is in permanent night. + clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night. else { if (night_flag == 0) { timer_data = get_timer(night_timer_tid); timer_data2 = get_timer(day_timer_tid); sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s. - clif->displaymessage(fd, temp); + clif->message(fd, temp); if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0) sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)); // Game time: After, the game will be in night for %s. else sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)); // Game time: After, the game will be in night for %s. - clif->displaymessage(fd, temp); + clif->message(fd, temp); sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s. - clif->displaymessage(fd, temp); + clif->message(fd, temp); } else { timer_data = get_timer(day_timer_tid); timer_data2 = get_timer(night_timer_tid); sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,gettick()) / 1000)); // Game time: The game is actualy in night for %s. - clif->displaymessage(fd, temp); + clif->message(fd, temp); if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0) sprintf(temp, msg_txt(239), txt_time((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)); // Game time: After, the game will be in daylight for %s. else sprintf(temp, msg_txt(239), txt_time(DIFF_TICK(timer_data2->tick, timer_data->tick) / 1000)); // Game time: After, the game will be in daylight for %s. - clif->displaymessage(fd, temp); + clif->message(fd, temp); sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s. - clif->displaymessage(fd, temp); + clif->message(fd, temp); } } @@ -4536,24 +4543,24 @@ ACMD_FUNC(jail) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(1134)); // Please enter a player name (usage: @jail <char_name>). + clif->message(fd, msg_txt(1134)); // Please enter a player name (usage: @jail <char_name>). return -1; } if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) { // you can jail only lower or same GM - clif->displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } if (pl_sd->sc.data[SC_JAILED]) { - clif->displaymessage(fd, msg_txt(118)); // Player warped in jails. + clif->message(fd, msg_txt(118)); // Player warped in jails. return -1; } @@ -4572,8 +4579,8 @@ ACMD_FUNC(jail) //Duration of INT_MAX to specify infinity. sc_start4(&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000); - clif->displaymessage(pl_sd->fd, msg_txt(117)); // GM has send you in jails. - clif->displaymessage(fd, msg_txt(118)); // Player warped in jails. + clif->message(pl_sd->fd, msg_txt(117)); // GM has send you in jails. + clif->message(fd, msg_txt(118)); // Player warped in jails. return 0; } @@ -4588,31 +4595,31 @@ ACMD_FUNC(unjail) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(1135)); // Please enter a player name (usage: @unjail/@discharge <char_name>). + clif->message(fd, msg_txt(1135)); // Please enter a player name (usage: @unjail/@discharge <char_name>). return -1; } if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) { // you can jail only lower or same GM - clif->displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } if (!pl_sd->sc.data[SC_JAILED]) { - clif->displaymessage(fd, msg_txt(119)); // This player is not in jails. + clif->message(fd, msg_txt(119)); // This player is not in jails. return -1; } //Reset jail time to 1 sec. sc_start(&pl_sd->bl,SC_JAILED,100,1,1000); - clif->displaymessage(pl_sd->fd, msg_txt(120)); // A GM has discharged you from jail. - clif->displaymessage(fd, msg_txt(121)); // Player unjailed. + clif->message(pl_sd->fd, msg_txt(120)); // A GM has discharged you from jail. + clif->message(fd, msg_txt(121)); // Player unjailed. return 0; } @@ -4626,7 +4633,7 @@ ACMD_FUNC(jailfor) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%255s %23[^\n]",atcmd_output,atcmd_player_name) < 2) { - clif->displaymessage(fd, msg_txt(400)); //Usage: @jailfor <time> <character name> + clif->message(fd, msg_txt(400)); //Usage: @jailfor <time> <character name> return -1; } @@ -4668,24 +4675,24 @@ ACMD_FUNC(jailfor) } if (year == 0 && month == 0 && day == 0 && hour == 0 && minute == 0) { - clif->displaymessage(fd, msg_txt(1136)); // Invalid time for jail command. + clif->message(fd, msg_txt(1136)); // Invalid time for jail command. return -1; } if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if (pc_get_group_level(pl_sd) > pc_get_group_level(sd)) { - clif->displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } jailtime = year*12*30*24*60 + month*30*24*60 + day*24*60 + hour*60 + minute; //In minutes if(jailtime==0) { - clif->displaymessage(fd, msg_txt(1136)); // Invalid time for jail command. + clif->message(fd, msg_txt(1136)); // Invalid time for jail command. return -1; } @@ -4696,17 +4703,17 @@ ACMD_FUNC(jailfor) jailtime += pl_sd->sc.data[SC_JAILED]->val1; if (jailtime <= 0) { jailtime = 0; - clif->displaymessage(pl_sd->fd, msg_txt(120)); // GM has discharge you. - clif->displaymessage(fd, msg_txt(121)); // Player unjailed + clif->message(pl_sd->fd, msg_txt(120)); // GM has discharge you. + clif->message(fd, msg_txt(121)); // Player unjailed } else { get_jail_time(jailtime,&year,&month,&day,&hour,&minute); sprintf(atcmd_output,msg_txt(402),msg_txt(1137),year,month,day,hour,minute); //%s in jail for %d years, %d months, %d days, %d hours and %d minutes - clif->displaymessage(pl_sd->fd, atcmd_output); + clif->message(pl_sd->fd, atcmd_output); sprintf(atcmd_output,msg_txt(402),msg_txt(1138),year,month,day,hour,minute); //This player is now in jail for %d years, %d months, %d days, %d hours and %d minutes - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } else if (jailtime < 0) { - clif->displaymessage(fd, msg_txt(1136)); + clif->message(fd, msg_txt(1136)); return -1; } @@ -4736,17 +4743,17 @@ ACMD_FUNC(jailtime) nullpo_retr(-1, sd); if (!sd->sc.data[SC_JAILED]) { - clif->displaymessage(fd, msg_txt(1139)); // You are not in jail. + clif->message(fd, msg_txt(1139)); // You are not in jail. return -1; } if (sd->sc.data[SC_JAILED]->val1 == INT_MAX) { - clif->displaymessage(fd, msg_txt(1140)); // You have been jailed indefinitely. + clif->message(fd, msg_txt(1140)); // You have been jailed indefinitely. return 0; } if (sd->sc.data[SC_JAILED]->val1 <= 0) { // Was not jailed with @jailfor (maybe @jail? or warped there? or got recalled?) - clif->displaymessage(fd, msg_txt(1141)); // You have been jailed for an unknown amount of time. + clif->message(fd, msg_txt(1141)); // You have been jailed for an unknown amount of time. return -1; } @@ -4754,7 +4761,7 @@ ACMD_FUNC(jailtime) get_jail_time(sd->sc.data[SC_JAILED]->val1,&year,&month,&day,&hour,&minute); sprintf(atcmd_output,msg_txt(402),msg_txt(1142),year,month,day,hour,minute); // You will remain in jail for %d years, %d months, %d days, %d hours and %d minutes - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -4768,7 +4775,7 @@ ACMD_FUNC(disguise) nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1143)); // Please enter a Monster/NPC name/ID (usage: @disguise <name/ID>). + clif->message(fd, msg_txt(1143)); // Please enter a Monster/NPC name/ID (usage: @disguise <name/ID>). return -1; } @@ -4787,18 +4794,18 @@ ACMD_FUNC(disguise) if (id == 0) { - clif->displaymessage(fd, msg_txt(123)); // Invalid Monster/NPC name/ID specified. + clif->message(fd, msg_txt(123)); // Invalid Monster/NPC name/ID specified. return -1; } if(pc_isriding(sd)) { - clif->displaymessage(fd, msg_txt(1144)); // Character cannot be disguised while mounted. + clif->message(fd, msg_txt(1144)); // Character cannot be disguised while mounted. return -1; } pc_disguise(sd, id); - clif->displaymessage(fd, msg_txt(122)); // Disguise applied. + clif->message(fd, msg_txt(122)); // Disguise applied. return 0; } @@ -4814,7 +4821,7 @@ ACMD_FUNC(disguiseall) nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1145)); // Please enter a Monster/NPC name/ID (usage: @disguiseall <name/ID>). + clif->message(fd, msg_txt(1145)); // Please enter a Monster/NPC name/ID (usage: @disguiseall <name/ID>). return -1; } @@ -4822,7 +4829,7 @@ ACMD_FUNC(disguiseall) mob_id = atoi(message); if (!mobdb_checkid(mob_id) && !npcdb_checkid(mob_id)) { //if mob or npc... - clif->displaymessage(fd, msg_txt(123)); // Monster/NPC name/id not found. + clif->message(fd, msg_txt(123)); // Monster/NPC name/id not found. return -1; } @@ -4831,7 +4838,7 @@ ACMD_FUNC(disguiseall) pc_disguise(pl_sd, mob_id); mapit_free(iter); - clif->displaymessage(fd, msg_txt(122)); // Disguise applied. + clif->message(fd, msg_txt(122)); // Disguise applied. return 0; } @@ -4849,7 +4856,7 @@ ACMD_FUNC(disguiseguild) memset(guild, '\0', sizeof(guild)); if( !message || !*message || sscanf(message, "%23[^,], %23[^\r\n]", monster, guild) < 2 ) { - clif->displaymessage(fd, msg_txt(1146)); // Please enter a mob name/ID and guild name/ID (usage: @disguiseguild <mob name/ID>, <guild name/ID>). + clif->message(fd, msg_txt(1146)); // Please enter a mob name/ID and guild name/ID (usage: @disguiseguild <mob name/ID>, <guild name/ID>). return -1; } @@ -4865,12 +4872,12 @@ ACMD_FUNC(disguiseguild) } if( id == 0 ) { - clif->displaymessage(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. + clif->message(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. return -1; } if( (g = guild_searchname(guild)) == NULL && (g = guild_search(atoi(guild))) == NULL ) { - clif->displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. + clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return -1; } @@ -4878,7 +4885,7 @@ ACMD_FUNC(disguiseguild) if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) ) pc_disguise(pl_sd, id); - clif->displaymessage(fd, msg_txt(122)); // Disguise applied. + clif->message(fd, msg_txt(122)); // Disguise applied. return 0; } @@ -4891,9 +4898,9 @@ ACMD_FUNC(undisguise) nullpo_retr(-1, sd); if (sd->disguise) { pc_disguise(sd, 0); - clif->displaymessage(fd, msg_txt(124)); // Undisguise applied. + clif->message(fd, msg_txt(124)); // Undisguise applied. } else { - clif->displaymessage(fd, msg_txt(125)); // You're not disguised. + clif->message(fd, msg_txt(125)); // You're not disguised. return -1; } @@ -4915,7 +4922,7 @@ ACMD_FUNC(undisguiseall) pc_disguise(pl_sd, 0); mapit_free(iter); - clif->displaymessage(fd, msg_txt(124)); // Undisguise applied. + clif->message(fd, msg_txt(124)); // Undisguise applied. return 0; } @@ -4934,12 +4941,12 @@ ACMD_FUNC(undisguiseguild) memset(guild_name, '\0', sizeof(guild_name)); if(!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { - clif->displaymessage(fd, msg_txt(1147)); // Please enter guild name/ID (usage: @undisguiseguild <guild name/ID>). + clif->message(fd, msg_txt(1147)); // Please enter guild name/ID (usage: @undisguiseguild <guild name/ID>). return -1; } if( (g = guild_searchname(guild_name)) == NULL && (g = guild_search(atoi(message))) == NULL ) { - clif->displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. + clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return -1; } @@ -4947,7 +4954,7 @@ ACMD_FUNC(undisguiseguild) if( (pl_sd = g->member[i].sd) && pl_sd->disguise ) pc_disguise(pl_sd, 0); - clif->displaymessage(fd, msg_txt(124)); // Undisguise applied. + clif->message(fd, msg_txt(124)); // Undisguise applied. return 0; } @@ -4971,7 +4978,7 @@ ACMD_FUNC(exp) nextj = sd->status.job_exp*100.0/nextj; sprintf(output, msg_txt(1148), sd->status.base_level, nextb, sd->status.job_level, nextj); // Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%) - clif->displaymessage(fd, output); + clif->message(fd, output); return 0; } @@ -4986,7 +4993,7 @@ ACMD_FUNC(broadcast) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1149)); // Please enter a message (usage: @broadcast <message>). + clif->message(fd, msg_txt(1149)); // Please enter a message (usage: @broadcast <message>). return -1; } @@ -5006,7 +5013,7 @@ ACMD_FUNC(localbroadcast) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1150)); // Please enter a message (usage: @localbroadcast <message>). + clif->message(fd, msg_txt(1150)); // Please enter a message (usage: @localbroadcast <message>). return -1; } @@ -5030,26 +5037,26 @@ ACMD_FUNC(email) memset(new_email, '\0', sizeof(new_email)); if (!message || !*message || sscanf(message, "%99s %99s", actual_email, new_email) < 2) { - clif->displaymessage(fd, msg_txt(1151)); // Please enter 2 emails (usage: @email <actual@email> <new@email>). + clif->message(fd, msg_txt(1151)); // Please enter 2 emails (usage: @email <actual@email> <new@email>). return -1; } if (e_mail_check(actual_email) == 0) { - clif->displaymessage(fd, msg_txt(144)); // Invalid actual email. If you have default e-mail, give a@a.com. + clif->message(fd, msg_txt(144)); // Invalid actual email. If you have default e-mail, give a@a.com. return -1; } else if (e_mail_check(new_email) == 0) { - clif->displaymessage(fd, msg_txt(145)); // Invalid new email. Please enter a real e-mail. + clif->message(fd, msg_txt(145)); // Invalid new email. Please enter a real e-mail. return -1; } else if (strcmpi(new_email, "a@a.com") == 0) { - clif->displaymessage(fd, msg_txt(146)); // New email must be a real e-mail. + clif->message(fd, msg_txt(146)); // New email must be a real e-mail. return -1; } else if (strcmpi(actual_email, new_email) == 0) { - clif->displaymessage(fd, msg_txt(147)); // New email must be different of the actual e-mail. + clif->message(fd, msg_txt(147)); // New email must be different of the actual e-mail. return -1; } chrif_changeemail(sd->status.account_id, actual_email, new_email); - clif->displaymessage(fd, msg_txt(148)); // Information sended to login-server via char-server. + clif->message(fd, msg_txt(148)); // Information sended to login-server via char-server. return 0; } @@ -5062,12 +5069,12 @@ ACMD_FUNC(effect) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d", &type) < 1) { - clif->displaymessage(fd, msg_txt(1152)); // Please enter an effect number (usage: @effect <effect number>). + clif->message(fd, msg_txt(1152)); // Please enter an effect number (usage: @effect <effect number>). return -1; } clif->specialeffect(&sd->bl, type, (send_target)flag); - clif->displaymessage(fd, msg_txt(229)); // Your effect has changed. + clif->message(fd, msg_txt(229)); // Your effect has changed. return 0; } @@ -5081,9 +5088,9 @@ ACMD_FUNC(killer) sd->state.killer = !sd->state.killer; if(sd->state.killer) - clif->displaymessage(fd, msg_txt(241)); + clif->message(fd, msg_txt(241)); else { - clif->displaymessage(fd, msg_txt(292)); + clif->message(fd, msg_txt(292)); pc_stop_attack(sd); } return 0; @@ -5099,9 +5106,9 @@ ACMD_FUNC(killable) sd->state.killable = !sd->state.killable; if(sd->state.killable) - clif->displaymessage(fd, msg_txt(242)); + clif->message(fd, msg_txt(242)); else { - clif->displaymessage(fd, msg_txt(288)); + clif->message(fd, msg_txt(288)); map_foreachinrange(atcommand_stopattack,&sd->bl, AREA_SIZE, BL_CHAR, sd->bl.id); } return 0; @@ -5115,7 +5122,7 @@ ACMD_FUNC(skillon) { nullpo_retr(-1, sd); map[sd->bl.m].flag.noskill = 0; - clif->displaymessage(fd, msg_txt(244)); + clif->message(fd, msg_txt(244)); return 0; } @@ -5127,7 +5134,7 @@ ACMD_FUNC(skilloff) { nullpo_retr(-1, sd); map[sd->bl.m].flag.noskill = 1; - clif->displaymessage(fd, msg_txt(243)); + clif->message(fd, msg_txt(243)); return 0; } @@ -5143,19 +5150,19 @@ ACMD_FUNC(npcmove) memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &x, &y, atcmd_player_name) < 3) { - clif->displaymessage(fd, msg_txt(1153)); // Usage: @npcmove <X> <Y> <npc_name> + clif->message(fd, msg_txt(1153)); // Usage: @npcmove <X> <Y> <npc_name> return -1; } if ((nd = npc_name2id(atcmd_player_name)) == NULL) { - clif->displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. + clif->message(fd, msg_txt(111)); // This NPC doesn't exist. return -1; } if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL) { - clif->displaymessage(fd, msg_txt(1154)); // NPC is not on this map. + clif->message(fd, msg_txt(1154)); // NPC is not on this map. return -1; //Not on a map. } @@ -5164,7 +5171,7 @@ ACMD_FUNC(npcmove) map_foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); map_moveblock(&nd->bl, x, y, gettick()); map_foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); - clif->displaymessage(fd, msg_txt(1155)); // NPC moved. + clif->message(fd, msg_txt(1155)); // NPC moved. return 0; } @@ -5184,7 +5191,7 @@ ACMD_FUNC(addwarp) memset(warpname, '\0', sizeof(warpname)); if (!message || !*message || sscanf(message, "%31s %d %d %23[^\n]", mapname, &x, &y, warpname) < 4) { - clif->displaymessage(fd, msg_txt(1156)); // Usage: @addwarp <mapname> <X> <Y> <npc name> + clif->message(fd, msg_txt(1156)); // Usage: @addwarp <mapname> <X> <Y> <npc name> return -1; } @@ -5192,7 +5199,7 @@ ACMD_FUNC(addwarp) if( m == 0 ) { sprintf(atcmd_output, msg_txt(1157), mapname); // Unknown map '%s'. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } @@ -5201,7 +5208,7 @@ ACMD_FUNC(addwarp) return -1; sprintf(atcmd_output, msg_txt(1158), nd->exname); // New warp NPC '%s' created. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -5219,22 +5226,22 @@ ACMD_FUNC(follow) return -1; pc_stop_following (sd); - clif->displaymessage(fd, msg_txt(1159)); // Follow mode OFF. + clif->message(fd, msg_txt(1159)); // Follow mode OFF. return 0; } if ( (pl_sd = map_nick2sd((char *)message)) == NULL ) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if (sd->followtarget == pl_sd->bl.id) { pc_stop_following (sd); - clif->displaymessage(fd, msg_txt(1159)); // Follow mode OFF. + clif->message(fd, msg_txt(1159)); // Follow mode OFF. } else { pc_follow(sd, pl_sd->bl.id); - clif->displaymessage(fd, msg_txt(1160)); // Follow mode ON. + clif->message(fd, msg_txt(1160)); // Follow mode ON. } return 0; @@ -5271,7 +5278,7 @@ ACMD_FUNC(storeall) if (sd->state.storage_flag != 1) { //Open storage. if( storage_storageopen(sd) == 1 ) { - clif->displaymessage(fd, msg_txt(1161)); // You currently cannot open your storage. + clif->message(fd, msg_txt(1161)); // You currently cannot open your storage. return -1; } } @@ -5285,7 +5292,7 @@ ACMD_FUNC(storeall) } storage_storageclose(sd); - clif->displaymessage(fd, msg_txt(1162)); // All items stored. + clif->message(fd, msg_txt(1162)); // All items stored. return 0; } @@ -5295,7 +5302,7 @@ ACMD_FUNC(clearstorage) nullpo_retr(-1, sd); if (sd->state.storage_flag == 1) { - clif->displaymessage(fd, msg_txt(250)); + clif->message(fd, msg_txt(250)); return -1; } @@ -5305,7 +5312,7 @@ ACMD_FUNC(clearstorage) } storage_storageclose(sd); - clif->displaymessage(fd, msg_txt(1394)); // Your storage was cleaned. + clif->message(fd, msg_txt(1394)); // Your storage was cleaned. return 0; } @@ -5316,20 +5323,20 @@ ACMD_FUNC(cleargstorage) struct guild_storage *gstorage; nullpo_retr(-1, sd); - g = guild_search(sd->status.guild_id); + g = sd->guild; if (g == NULL) { - clif->displaymessage(fd, msg_txt(43)); + clif->message(fd, msg_txt(43)); return -1; } if (sd->state.storage_flag == 1) { - clif->displaymessage(fd, msg_txt(250)); + clif->message(fd, msg_txt(250)); return -1; } if (sd->state.storage_flag == 2) { - clif->displaymessage(fd, msg_txt(251)); + clif->message(fd, msg_txt(251)); return -1; } @@ -5346,7 +5353,7 @@ ACMD_FUNC(cleargstorage) storage_guild_storageclose(sd); gstorage->lock = 0; // Cleaning done, release lock - clif->displaymessage(fd, msg_txt(1395)); // Your guild storage was cleaned. + clif->message(fd, msg_txt(1395)); // Your guild storage was cleaned. return 0; } @@ -5356,7 +5363,7 @@ ACMD_FUNC(clearcart) nullpo_retr(-1, sd); if (pc_iscarton(sd) == 0) { - clif->displaymessage(fd, msg_txt(1396)); // You do not have a cart to be cleaned. + clif->message(fd, msg_txt(1396)); // You do not have a cart to be cleaned. return -1; } @@ -5371,7 +5378,7 @@ ACMD_FUNC(clearcart) clif->clearcart(fd); clif->updatestatus(sd,SP_CARTINFO); - clif->displaymessage(fd, msg_txt(1397)); // Your cart was cleaned. + clif->message(fd, msg_txt(1397)); // Your cart was cleaned. return 0; } @@ -5391,7 +5398,7 @@ ACMD_FUNC(skillid) { nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1163)); // Please enter a skill name to look up (usage: @skillid <skill name>). + clif->message(fd, msg_txt(1163)); // Please enter a skill name to look up (usage: @skillid <skill name>). return -1; } @@ -5403,7 +5410,7 @@ ACMD_FUNC(skillid) { idx = skill->get_index(db_data2i(data)); if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_db[idx].desc, message, skillen) == 0) { sprintf(atcmd_output, msg_txt(1164), db_data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } else if ( found < MAX_SKILLID_PARTIAL_RESULTS && ( stristr(key.str,message) || stristr(skill_db[idx].desc,message) ) ) { snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), db_data2i(data), skill_db[idx].desc, key.str); } @@ -5413,11 +5420,11 @@ ACMD_FUNC(skillid) { if( found ) { sprintf(atcmd_output, msg_txt(1398), found); // -- Displaying first %d partial matches - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } for(i = 0; i < found; i++) { /* partials */ - clif->displaymessage(fd, partials[i]); + clif->message(fd, partials[i]); } return 0; @@ -5437,19 +5444,19 @@ ACMD_FUNC(useskill) nullpo_retr(-1, sd); if(!message || !*message || sscanf(message, "%hu %hu %23[^\n]", &skill_id, &skill_lv, target) != 3) { - clif->displaymessage(fd, msg_txt(1165)); // Usage: @useskill <skill ID> <skill level> <target> + clif->message(fd, msg_txt(1165)); // Usage: @useskill <skill ID> <skill level> <target> return -1; } if(!strcmp(target,"self")) pl_sd = sd; //quick keyword else if ( (pl_sd = map_nick2sd(target)) == NULL ){ - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { - clif->displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } @@ -5482,7 +5489,7 @@ ACMD_FUNC(displayskill) if (!message || !*message || sscanf(message, "%hu %hu", &skill_id, &skill_lv) < 1) { - clif->displaymessage(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>} + clif->message(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>} return -1; } status = status_get_status_data(&sd->bl); @@ -5507,13 +5514,13 @@ ACMD_FUNC(skilltree) nullpo_retr(-1, sd); if(!message || !*message || sscanf(message, "%hu %23[^\r\n]", &skill_id, target) != 2) { - clif->displaymessage(fd, msg_txt(1167)); // Usage: @skilltree <skill ID> <target> + clif->message(fd, msg_txt(1167)); // Usage: @skilltree <skill ID> <target> return -1; } if ( (pl_sd = map_nick2sd(target)) == NULL ) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } @@ -5521,12 +5528,12 @@ ACMD_FUNC(skilltree) c = pc_mapid2jobid(c, pl_sd->status.sex); sprintf(atcmd_output, msg_txt(1168), job_name(c), pc_checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points). - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); ARR_FIND( 0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skill_id ); if( j == MAX_SKILL_TREE || skill_tree[c][j].id == 0 ) { - clif->displaymessage(fd, msg_txt(1169)); // The player cannot use that skill. + clif->message(fd, msg_txt(1169)); // The player cannot use that skill. return 0; } @@ -5538,12 +5545,12 @@ ACMD_FUNC(skilltree) if( ent->need[j].id && pc_checkskill(sd,ent->need[j].id) < ent->need[j].lv) { sprintf(atcmd_output, msg_txt(1170), ent->need[j].lv, skill_db[ent->need[j].id].desc); // Player requires level %d of skill %s. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); meets = 0; } } if (meets == 1) { - clif->displaymessage(fd, msg_txt(1171)); // The player meets all the requirements for that skill. + clif->message(fd, msg_txt(1171)); // The player meets all the requirements for that skill. } return 0; @@ -5581,24 +5588,24 @@ ACMD_FUNC(marry) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%23s", player_name) != 1) { - clif->displaymessage(fd, msg_txt(1172)); // Usage: @marry <char name> + clif->message(fd, msg_txt(1172)); // Usage: @marry <char name> return -1; } if ((pl_sd = map_nick2sd(player_name)) == NULL) { - clif->displaymessage(fd, msg_txt(3)); + clif->message(fd, msg_txt(3)); return -1; } if (pc_marriage(sd, pl_sd) == 0) { - clif->displaymessage(fd, msg_txt(1173)); // They are married... wish them well. + clif->message(fd, msg_txt(1173)); // They are married... wish them well. clif->wedding_effect(&pl_sd->bl); //wedding effect and music [Lupus] getring(sd); // Auto-give named rings (Aru) getring(pl_sd); return 0; } - clif->displaymessage(fd, msg_txt(1174)); // The two cannot wed because one is either a baby or already married. + clif->message(fd, msg_txt(1174)); // The two cannot wed because one is either a baby or already married. return -1; } @@ -5612,12 +5619,12 @@ ACMD_FUNC(divorce) if (pc_divorce(sd) != 0) { sprintf(atcmd_output, msg_txt(1175), sd->status.name); // '%s' is not married. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } sprintf(atcmd_output, msg_txt(1176), sd->status.name); // '%s' and his/her partner are now divorced. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -5630,8 +5637,8 @@ ACMD_FUNC(changelook) int pos[7] = { LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HEAD_BOTTOM,LOOK_WEAPON,LOOK_SHIELD,LOOK_SHOES,LOOK_ROBE }; if((i = sscanf(message, "%d %d", &j, &k)) < 1) { - clif->displaymessage(fd, msg_txt(1177)); // Usage: @changelook {<position>} <view id> - clif->displaymessage(fd, msg_txt(1178)); // Position: 1-Top 2-Middle 3-Bottom 4-Weapon 5-Shield 6-Shoes 7-Robe + clif->message(fd, msg_txt(1177)); // Usage: @changelook {<position>} <view id> + clif->message(fd, msg_txt(1178)); // Position: 1-Top 2-Middle 3-Bottom 4-Weapon 5-Shield 6-Shoes 7-Robe return -1; } else if ( i == 2 ) { if (j < 1 || j > 7) @@ -5656,17 +5663,17 @@ ACMD_FUNC(autotrade) nullpo_retr(-1, sd); if( map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) { - clif->displaymessage(fd, msg_txt(1179)); // Autotrade is not allowed on this map. + clif->message(fd, msg_txt(1179)); // Autotrade is not allowed on this map. return -1; } if( pc_isdead(sd) ) { - clif->displaymessage(fd, msg_txt(1180)); // You cannot autotrade when dead. + clif->message(fd, msg_txt(1180)); // You cannot autotrade when dead. return -1; } if( !sd->state.vending && !sd->state.buyingstore ) { //check if player is vending or buying - clif->displaymessage(fd, msg_txt(549)); // "You should have a shop open to use @autotrade." + clif->message(fd, msg_txt(549)); // "You should have a shop open to use @autotrade." return -1; } @@ -5690,23 +5697,23 @@ ACMD_FUNC(changegm) struct map_session_data *pl_sd; nullpo_retr(-1, sd); - if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL || strcmp(g->master,sd->status.name)) { - clif->displaymessage(fd, msg_txt(1181)); // You need to be a Guild Master to use this command. + if (sd->status.guild_id == 0 || (g = sd->guild) == NULL || strcmp(g->master,sd->status.name)) { + clif->message(fd, msg_txt(1181)); // You need to be a Guild Master to use this command. return -1; } if( map[sd->bl.m].flag.guildlock || map[sd->bl.m].flag.gvg_castle ) { - clif->displaymessage(fd, msg_txt(1182)); // You cannot change guild leaders on this map. + clif->message(fd, msg_txt(1182)); // You cannot change guild leaders on this map. return -1; } if( !message[0] ) { - clif->displaymessage(fd, msg_txt(1183)); // Usage: @changegm <guild_member_name> + clif->message(fd, msg_txt(1183)); // Usage: @changegm <guild_member_name> return -1; } if((pl_sd=map_nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) { - clif->displaymessage(fd, msg_txt(1184)); // Target character must be online and be a guild member. + clif->message(fd, msg_txt(1184)); // Target character must be online and be a guild member. return -1; } @@ -5724,7 +5731,7 @@ ACMD_FUNC(changeleader) if( !message[0] ) { - clif->displaymessage(fd, msg_txt(1185)); // Usage: @changeleader <party_member_name> + clif->message(fd, msg_txt(1185)); // Usage: @changeleader <party_member_name> return -1; } @@ -5746,7 +5753,7 @@ ACMD_FUNC(partyoption) if (sd->status.party_id == 0 || (p = party_search(sd->status.party_id)) == NULL) { - clif->displaymessage(fd, msg_txt(282)); + clif->message(fd, msg_txt(282)); return -1; } @@ -5756,13 +5763,13 @@ ACMD_FUNC(partyoption) if (!p->party.member[mi].leader) { - clif->displaymessage(fd, msg_txt(282)); + clif->message(fd, msg_txt(282)); return -1; } if(!message || !*message || sscanf(message, "%15s %15s", w1, w2) < 2) { - clif->displaymessage(fd, msg_txt(1186)); // Usage: @partyoption <pickup share: yes/no> <item distribution: yes/no> + clif->message(fd, msg_txt(1186)); // Usage: @partyoption <pickup share: yes/no> <item distribution: yes/no> return -1; } @@ -5772,7 +5779,7 @@ ACMD_FUNC(partyoption) if (option != p->party.item) party_changeoption(sd, p->party.exp, option); else - clif->displaymessage(fd, msg_txt(286)); + clif->message(fd, msg_txt(286)); return 0; } @@ -5803,9 +5810,9 @@ ACMD_FUNC(autoloot) sd->state.autoloot = rate; if (sd->state.autoloot) { snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1187),((double)sd->state.autoloot)/100.); // Autolooting items with drop rates of %0.02f%% and below. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); }else - clif->displaymessage(fd, msg_txt(1188)); // Autoloot is now off. + clif->message(fd, msg_txt(1188)); // Autoloot is now off. return 0; } @@ -5838,7 +5845,7 @@ ACMD_FUNC(autolootitem) item_data = itemdb_searchname(message); if (!item_data) { // No items founds in the DB with Id or Name - clif->displaymessage(fd, msg_txt(1189)); // Item not found. + clif->message(fd, msg_txt(1189)); // Item not found. return -1; } } @@ -5847,28 +5854,28 @@ ACMD_FUNC(autolootitem) case 1: ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid); if (i != AUTOLOOTITEM_SIZE) { - clif->displaymessage(fd, msg_txt(1190)); // You're already autolooting this item. + clif->message(fd, msg_txt(1190)); // You're already autolooting this item. return -1; } ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == 0); if (i == AUTOLOOTITEM_SIZE) { - clif->displaymessage(fd, msg_txt(1191)); // Your autolootitem list is full. Remove some items first with @autolootid -<item name or ID>. + clif->message(fd, msg_txt(1191)); // Your autolootitem list is full. Remove some items first with @autolootid -<item name or ID>. return -1; } sd->state.autolootid[i] = item_data->nameid; // Autoloot Activated sprintf(atcmd_output, msg_txt(1192), item_data->name, item_data->jname, item_data->nameid); // Autolooting item: '%s'/'%s' {%d} - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sd->state.autolooting = 1; break; case 2: ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid); if (i == AUTOLOOTITEM_SIZE) { - clif->displaymessage(fd, msg_txt(1193)); // You're currently not autolooting this item. + clif->message(fd, msg_txt(1193)); // You're currently not autolooting this item. return -1; } sd->state.autolootid[i] = 0; sprintf(atcmd_output, msg_txt(1194), item_data->name, item_data->jname, item_data->nameid); // Removed item: '%s'/'%s' {%d} from your autolootitem list. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] != 0); if (i == AUTOLOOTITEM_SIZE) { sd->state.autolooting = 0; @@ -5876,14 +5883,14 @@ ACMD_FUNC(autolootitem) break; case 3: sprintf(atcmd_output, msg_txt(1195), AUTOLOOTITEM_SIZE); // You can have %d items on your autolootitem list. - clif->displaymessage(fd, atcmd_output); - clif->displaymessage(fd, msg_txt(1196)); // To add an item to the list, use "@alootid +<item name or ID>". To remove an item, use "@alootid -<item name or ID>". - clif->displaymessage(fd, msg_txt(1197)); // "@alootid reset" will clear your autolootitem list. + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1196)); // To add an item to the list, use "@alootid +<item name or ID>". To remove an item, use "@alootid -<item name or ID>". + clif->message(fd, msg_txt(1197)); // "@alootid reset" will clear your autolootitem list. ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] != 0); if (i == AUTOLOOTITEM_SIZE) { - clif->displaymessage(fd, msg_txt(1198)); // Your autolootitem list is empty. + clif->message(fd, msg_txt(1198)); // Your autolootitem list is empty. } else { - clif->displaymessage(fd, msg_txt(1199)); // Items on your autolootitem list: + clif->message(fd, msg_txt(1199)); // Items on your autolootitem list: for(i = 0; i < AUTOLOOTITEM_SIZE; i++) { if (sd->state.autolootid[i] == 0) @@ -5893,13 +5900,13 @@ ACMD_FUNC(autolootitem) continue; } sprintf(atcmd_output, "'%s'/'%s' {%d}", item_data->name, item_data->jname, item_data->nameid); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } break; case 4: memset(sd->state.autolootid, 0, sizeof(sd->state.autolootid)); - clif->displaymessage(fd, msg_txt(1200)); // Your autolootitem list has been reset. + clif->message(fd, msg_txt(1200)); // Your autolootitem list has been reset. sd->state.autolooting = 0; break; } @@ -5917,11 +5924,11 @@ ACMD_FUNC(autolootitem) // if (map[sd->bl.m].flag.rain) { // map[sd->bl.m].flag.rain=0; // clif->weather(sd->bl.m); -// clif->displaymessage(fd, msg_txt(1201)); // The rain has stopped. +// clif->message(fd, msg_txt(1201)); // The rain has stopped. // } else { // map[sd->bl.m].flag.rain=1; // clif->weather(sd->bl.m); -// clif->displaymessage(fd, msg_txt(1202)); // It has started to rain. +// clif->message(fd, msg_txt(1202)); // It has started to rain. // } // return 0; //} @@ -5935,11 +5942,11 @@ ACMD_FUNC(snow) if (map[sd->bl.m].flag.snow) { map[sd->bl.m].flag.snow=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1203)); // Snow has stopped falling. + clif->message(fd, msg_txt(1203)); // Snow has stopped falling. } else { map[sd->bl.m].flag.snow=1; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1204)); // It has started to snow. + clif->message(fd, msg_txt(1204)); // It has started to snow. } return 0; @@ -5954,11 +5961,11 @@ ACMD_FUNC(sakura) if (map[sd->bl.m].flag.sakura) { map[sd->bl.m].flag.sakura=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1205)); // Cherry tree leaves no longer fall. + clif->message(fd, msg_txt(1205)); // Cherry tree leaves no longer fall. } else { map[sd->bl.m].flag.sakura=1; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1206)); // Cherry tree leaves have begun to fall. + clif->message(fd, msg_txt(1206)); // Cherry tree leaves have begun to fall. } return 0; } @@ -5972,11 +5979,11 @@ ACMD_FUNC(clouds) if (map[sd->bl.m].flag.clouds) { map[sd->bl.m].flag.clouds=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1207)); // The clouds has disappear. + clif->message(fd, msg_txt(1207)); // The clouds has disappear. } else { map[sd->bl.m].flag.clouds=1; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1208)); // Clouds appear. + clif->message(fd, msg_txt(1208)); // Clouds appear. } return 0; @@ -5991,11 +5998,11 @@ ACMD_FUNC(clouds2) if (map[sd->bl.m].flag.clouds2) { map[sd->bl.m].flag.clouds2=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1209)); // The alternative clouds disappear. + clif->message(fd, msg_txt(1209)); // The alternative clouds disappear. } else { map[sd->bl.m].flag.clouds2=1; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1210)); // Alternative clouds appear. + clif->message(fd, msg_txt(1210)); // Alternative clouds appear. } return 0; @@ -6010,11 +6017,11 @@ ACMD_FUNC(fog) if (map[sd->bl.m].flag.fog) { map[sd->bl.m].flag.fog=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1211)); // The fog has gone. + clif->message(fd, msg_txt(1211)); // The fog has gone. } else { map[sd->bl.m].flag.fog=1; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1212)); // Fog hangs over. + clif->message(fd, msg_txt(1212)); // Fog hangs over. } return 0; } @@ -6028,11 +6035,11 @@ ACMD_FUNC(leaves) if (map[sd->bl.m].flag.leaves) { map[sd->bl.m].flag.leaves=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1213)); // Leaves no longer fall. + clif->message(fd, msg_txt(1213)); // Leaves no longer fall. } else { map[sd->bl.m].flag.leaves=1; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1214)); // Fallen leaves fall. + clif->message(fd, msg_txt(1214)); // Fallen leaves fall. } return 0; @@ -6047,11 +6054,11 @@ ACMD_FUNC(fireworks) if (map[sd->bl.m].flag.fireworks) { map[sd->bl.m].flag.fireworks=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1215)); // Fireworks have ended. + clif->message(fd, msg_txt(1215)); // Fireworks have ended. } else { map[sd->bl.m].flag.fireworks=1; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(1216)); // Fireworks have launched. + clif->message(fd, msg_txt(1216)); // Fireworks have launched. } return 0; @@ -6075,7 +6082,7 @@ ACMD_FUNC(clearweather) map[sd->bl.m].flag.fireworks=0; map[sd->bl.m].flag.leaves=0; clif->weather(sd->bl.m); - clif->displaymessage(fd, msg_txt(291)); + clif->message(fd, msg_txt(291)); return 0; } @@ -6090,7 +6097,7 @@ ACMD_FUNC(sound) memset(sound_file, '\0', sizeof(sound_file)); if(!message || !*message || sscanf(message, "%99[^\n]", sound_file) < 1) { - clif->displaymessage(fd, msg_txt(1217)); // Please enter a sound filename (usage: @sound <filename>). + clif->message(fd, msg_txt(1217)); // Please enter a sound filename (usage: @sound <filename>). return -1; } @@ -6115,7 +6122,7 @@ ACMD_FUNC(mobsearch) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%99[^\n]", mob_name) < 1) { - clif->displaymessage(fd, msg_txt(1218)); // Please enter a monster name (usage: @mobsearch <monster name>). + clif->message(fd, msg_txt(1218)); // Please enter a monster name (usage: @mobsearch <monster name>). return -1; } @@ -6123,7 +6130,7 @@ ACMD_FUNC(mobsearch) mob_id = mobdb_searchname(mob_name); if(mob_id > 0 && mobdb_checkid(mob_id) == 0){ snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1219),mob_name); // Invalid mob ID %s! - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } if(mob_id == atoi(mob_name) && mob_db(mob_id)->jname) @@ -6131,7 +6138,7 @@ ACMD_FUNC(mobsearch) // strcpy(mob_name,mob_db(mob_id)->name); // --en-- snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1220), mob_name, mapindex_id2name(sd->mapindex)); // Mob Search... %s %s - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); it = mapit_geteachmob(); for(;;) @@ -6150,7 +6157,7 @@ ACMD_FUNC(mobsearch) snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%3d:%3d] %s", number, md->bl.x, md->bl.y, md->name); else snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%s] %s", number, "dead", md->name); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } mapit_free(it); @@ -6172,7 +6179,7 @@ static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) ACMD_FUNC(cleanmap) { map_foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM); - clif->displaymessage(fd, msg_txt(1221)); // All dropped items have been cleaned up. + clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up. return 0; } @@ -6190,7 +6197,7 @@ ACMD_FUNC(cleanarea) map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM); } - clif->displaymessage(fd, msg_txt(1221)); // All dropped items have been cleaned up. + clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up. return 0; } @@ -6212,19 +6219,19 @@ ACMD_FUNC(npctalk) if(!ifcolor) { if (!message || !*message || sscanf(message, "%23[^,], %99[^\n]", name, mes) < 2) { - clif->displaymessage(fd, msg_txt(1222)); // Please enter the correct parameters (usage: @npctalk <npc name>, <message>). + clif->message(fd, msg_txt(1222)); // Please enter the correct parameters (usage: @npctalk <npc name>, <message>). return -1; } } else { if (!message || !*message || sscanf(message, "%lx %23[^,], %99[^\n]", &color, name, mes) < 3) { - clif->displaymessage(fd, msg_txt(1223)); // Please enter the correct parameters (usage: @npctalkc <color> <npc name>, <message>). + clif->message(fd, msg_txt(1223)); // Please enter the correct parameters (usage: @npctalkc <color> <npc name>, <message>). return -1; } } if (!(nd = npc_name2id(name))) { - clif->displaymessage(fd, msg_txt(111)); // This NPC doesn't exist + clif->message(fd, msg_txt(111)); // This NPC doesn't exist return -1; } @@ -6232,7 +6239,7 @@ ACMD_FUNC(npctalk) snprintf(temp, sizeof(temp), "%s : %s", name, mes); if(ifcolor) clif->messagecolor(&nd->bl,color,temp); - else clif->message(&nd->bl, temp); + else clif->disp_overhead(&nd->bl, temp); return 0; } @@ -6252,7 +6259,7 @@ ACMD_FUNC(pettalk) if(!sd->status.pet_id || !(pd=sd->pd)) { - clif->displaymessage(fd, msg_txt(184)); + clif->message(fd, msg_txt(184)); return -1; } @@ -6262,7 +6269,7 @@ ACMD_FUNC(pettalk) return -1; if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) { - clif->displaymessage(fd, msg_txt(1224)); // Please enter a message (usage: @pettalk <message>). + clif->message(fd, msg_txt(1224)); // Please enter a message (usage: @pettalk <message>). return -1; } @@ -6296,7 +6303,7 @@ ACMD_FUNC(pettalk) } snprintf(temp, sizeof temp ,"%s : %s", pd->pet.name, mes); - clif->message(&pd->bl, temp); + clif->disp_overhead(&pd->bl, temp); return 0; } @@ -6337,12 +6344,12 @@ ACMD_FUNC(users) continue;// empty safesnprintf(buf, sizeof(buf), "%s: %d (%.2f%%)", mapindex_id2name(i), users[i], (float)(100.0f*users[i]/users_all)); - clif->displaymessage(sd->fd, buf); + clif->message(sd->fd, buf); } // display overall count safesnprintf(buf, sizeof(buf), "all: %d", users_all); - clif->displaymessage(sd->fd, buf); + clif->message(sd->fd, buf); return 0; } @@ -6355,7 +6362,7 @@ ACMD_FUNC(reset) pc_resetstate(sd); pc_resetskill(sd,1); sprintf(atcmd_output, msg_txt(208), sd->status.name); // '%s' skill and stats points reseted! - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -6374,7 +6381,7 @@ ACMD_FUNC(summon) if (!message || !*message || sscanf(message, "%23s %d", name, &duration) < 1) { - clif->displaymessage(fd, msg_txt(1225)); // Please enter a monster name (usage: @summon <monster name> {duration}). + clif->message(fd, msg_txt(1225)); // Please enter a monster name (usage: @summon <monster name> {duration}). return -1; } @@ -6387,7 +6394,7 @@ ACMD_FUNC(summon) mob_id = mobdb_searchname(name); if(mob_id == 0 || mobdb_checkid(mob_id) == 0) { - clif->displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. + clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return -1; } @@ -6403,7 +6410,7 @@ ACMD_FUNC(summon) mob_spawn(md); sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); clif->skill_poseffect(&sd->bl,AM_CALLHOMUN,1,md->bl.x,md->bl.y,tick); - clif->displaymessage(fd, msg_txt(39)); // All monster summoned! + clif->message(fd, msg_txt(39)); // All monster summoned! return 0; } @@ -6419,19 +6426,19 @@ ACMD_FUNC(adjgroup) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d", &new_group) != 1) { - clif->displaymessage(fd, msg_txt(1226)); // Usage: @adjgroup <group_id> + clif->message(fd, msg_txt(1226)); // Usage: @adjgroup <group_id> return -1; } if (!pc_group_exists(new_group)) { - clif->displaymessage(fd, msg_txt(1227)); // Specified group does not exist. + clif->message(fd, msg_txt(1227)); // Specified group does not exist. return -1; } sd->group_id = new_group; pc_group_pc_load(sd);/* update cache */ - clif->displaymessage(fd, msg_txt(1228)); // Group changed successfully. - clif->displaymessage(sd->fd, msg_txt(1229)); // Your group has changed. + clif->message(fd, msg_txt(1228)); // Group changed successfully. + clif->message(sd->fd, msg_txt(1229)); // Your group has changed. return 0; } @@ -6445,13 +6452,13 @@ ACMD_FUNC(trade) nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1230)); // Please enter a player name (usage: @trade <char name>). + clif->message(fd, msg_txt(1230)); // Please enter a player name (usage: @trade <char name>). return -1; } if ( (pl_sd = map_nick2sd((char *)message)) == NULL ) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } @@ -6469,16 +6476,16 @@ ACMD_FUNC(setbattleflag) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%127s %127s", flag, value) != 2) { - clif->displaymessage(fd, msg_txt(1231)); // Usage: @setbattleflag <flag> <value> + clif->message(fd, msg_txt(1231)); // Usage: @setbattleflag <flag> <value> return -1; } if (battle->config_set_value(flag, value) == 0) { - clif->displaymessage(fd, msg_txt(1232)); // Unknown battle_config flag. + clif->message(fd, msg_txt(1232)); // Unknown battle_config flag. return -1; } - clif->displaymessage(fd, msg_txt(1233)); // Set battle_config as requested. + clif->message(fd, msg_txt(1233)); // Set battle_config as requested. return 0; } @@ -6492,24 +6499,24 @@ ACMD_FUNC(unmute) nullpo_retr(-1, sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1234)); // Please enter a player name (usage: @unmute <char name>). + clif->message(fd, msg_txt(1234)); // Please enter a player name (usage: @unmute <char name>). return -1; } if ( (pl_sd = map_nick2sd((char *)message)) == NULL ) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if(!pl_sd->sc.data[SC_NOCHAT]) { - clif->displaymessage(sd->fd,msg_txt(1235)); // Player is not muted. + clif->message(sd->fd,msg_txt(1235)); // Player is not muted. return -1; } pl_sd->status.manner = 0; status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER); - clif->displaymessage(sd->fd,msg_txt(1236)); // Player unmuted. + clif->message(sd->fd,msg_txt(1236)); // Player unmuted. return 0; } @@ -6532,7 +6539,7 @@ ACMD_FUNC(uptime) seconds -= (seconds/minute>0)?(seconds/minute)*minute:0; snprintf(atcmd_output, sizeof(atcmd_output), msg_txt(245), days, hours, minutes, seconds); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -6563,19 +6570,19 @@ ACMD_FUNC(mute) nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d %23[^\n]", &manner, atcmd_player_name) < 1) { - clif->displaymessage(fd, msg_txt(1237)); // Usage: @mute <time> <char name> + clif->message(fd, msg_txt(1237)); // Usage: @mute <time> <char name> return -1; } if ( (pl_sd = map_nick2sd(atcmd_player_name)) == NULL ) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return -1; } if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { - clif->displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } @@ -6636,7 +6643,7 @@ ACMD_FUNC(identify) if (num > 0) { clif->item_identify_list(sd); } else { - clif->displaymessage(fd,msg_txt(1238)); // There are no items to appraise. + clif->message(fd,msg_txt(1238)); // There are no items to appraise. } return 0; } @@ -6722,7 +6729,7 @@ ACMD_FUNC(mobinfo) memset(atcmd_output2, '\0', sizeof(atcmd_output2)); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1239)); // Please enter a monster name/ID (usage: @mobinfo <monster_name_or_monster_ID>). + clif->message(fd, msg_txt(1239)); // Please enter a monster name/ID (usage: @mobinfo <monster_name_or_monster_ID>). return -1; } @@ -6735,13 +6742,13 @@ ACMD_FUNC(mobinfo) count = mobdb_searchname_array(mob_array, MAX_SEARCH, message); if (!count) { - clif->displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. + clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return -1; } if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); count = MAX_SEARCH; } for (k = 0; k < count; k++) { @@ -6752,21 +6759,21 @@ ACMD_FUNC(mobinfo) sprintf(atcmd_output, msg_txt(1240), mob->name, mob->jname, mob->sprite, mob->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d) else sprintf(atcmd_output, msg_txt(1241), mob->name, mob->jname, mob->sprite, mob->vd.class_); // Monster: '%s'/'%s'/'%s' (%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1242), mob->lv, mob->status.max_hp, mob->base_exp, mob->job_exp,MOB_HIT(mob), MOB_FLEE(mob)); // Lv:%d HP:%d Base EXP:%u Job EXP:%u HIT:%d FLEE:%d - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1243), // DEF:%d MDEF:%d STR:%d AGI:%d VIT:%d INT:%d DEX:%d LUK:%d mob->status.def, mob->status.mdef,mob->status.str, mob->status.agi, mob->status.vit, mob->status.int_, mob->status.dex, mob->status.luk); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1244), // ATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Element: %s (Lv:%d) mob->status.rhw.atk, mob->status.rhw.atk2, mob->status.rhw.range, mob->range2 , mob->range3, msize[mob->status.size], mrace[mob->status.race], melement[mob->status.def_ele], mob->status.ele_lv); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); // drops - clif->displaymessage(fd, msg_txt(1245)); // Drops: + clif->message(fd, msg_txt(1245)); // Drops: strcpy(atcmd_output, " "); j = 0; for (i = 0; i < MAX_MOB_DROP; i++) { @@ -6781,18 +6788,18 @@ ACMD_FUNC(mobinfo) sprintf(atcmd_output2, " - %s %02.02f%%", item_data->jname, (float)droprate / 100); strcat(atcmd_output, atcmd_output2); if (++j % 3 == 0) { - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); strcpy(atcmd_output, " "); } } if (j == 0) - clif->displaymessage(fd, msg_txt(1246)); // This monster has no drops. + clif->message(fd, msg_txt(1246)); // This monster has no drops. else if (j % 3 != 0) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); // mvp if (mob->mexp) { sprintf(atcmd_output, msg_txt(1247), mob->mexp); // MVP Bonus EXP:%u - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); strcpy(atcmd_output, msg_txt(1248)); // MVP Items: j = 0; for (i = 0; i < MAX_MVP_DROP; i++) { @@ -6808,9 +6815,9 @@ ACMD_FUNC(mobinfo) } } if (j == 0) - clif->displaymessage(fd, msg_txt(1249)); // This monster has no MVP prizes. + clif->message(fd, msg_txt(1249)); // This monster has no MVP prizes. else - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } return 0; @@ -6836,12 +6843,12 @@ ACMD_FUNC(showmobs) mob_id = mobdb_searchname(mob_name); if(mob_id > 0 && mobdb_checkid(mob_id) == 0){ snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1250),mob_name); // Invalid mob id %s! - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } if(mob_db(mob_id)->status.mode&MD_BOSS && !pc_has_permission(sd, PC_PERM_SHOW_BOSS)){ // If player group does not have access to boss mobs. - clif->displaymessage(fd, msg_txt(1251)); // Can't show boss mobs! + clif->message(fd, msg_txt(1251)); // Can't show boss mobs! return 0; } @@ -6851,7 +6858,7 @@ ACMD_FUNC(showmobs) snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1252), // Mob Search... %s %s mob_name, mapindex_id2name(sd->mapindex)); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); it = mapit_geteachmob(); for(;;) @@ -6888,12 +6895,12 @@ ACMD_FUNC(homlevel) nullpo_retr(-1, sd); if ( !message || !*message || ( level = atoi(message) ) < 1 ) { - clif->displaymessage(fd, msg_txt(1253)); // Please enter a level adjustment (usage: @homlevel <number of levels>). + clif->message(fd, msg_txt(1253)); // Please enter a level adjustment (usage: @homlevel <number of levels>). return -1; } if ( !merc_is_hom_active(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } @@ -6920,12 +6927,12 @@ ACMD_FUNC(homevolution) nullpo_retr(-1, sd); if ( !merc_is_hom_active(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } if ( !merc_hom_evolution(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1255)); // Your homunculus doesn't evolve. + clif->message(fd, msg_txt(1255)); // Your homunculus doesn't evolve. return -1; } clif->homskillinfoblock(sd); @@ -6938,7 +6945,7 @@ ACMD_FUNC(hommutate) nullpo_retr(-1, sd); if (!merc_is_hom_active(sd->hd)) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } @@ -6968,19 +6975,19 @@ ACMD_FUNC(makehomun) nullpo_retr(-1, sd); if ( sd->status.hom_id ) { - clif->displaymessage(fd, msg_txt(450)); + clif->message(fd, msg_txt(450)); return -1; } if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1256)); // Please enter a homunculus ID (usage: @makehomun <homunculus id>). + clif->message(fd, msg_txt(1256)); // Please enter a homunculus ID (usage: @makehomun <homunculus id>). return -1; } homunid = atoi(message); if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 ) { - clif->displaymessage(fd, msg_txt(1257)); // Invalid Homunculus ID. + clif->message(fd, msg_txt(1257)); // Invalid Homunculus ID. return -1; } @@ -6998,12 +7005,12 @@ ACMD_FUNC(homfriendly) nullpo_retr(-1, sd); if ( !merc_is_hom_active(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1258)); // Please enter a friendly value (usage: @homfriendly <friendly value [0-1000]>). + clif->message(fd, msg_txt(1258)); // Please enter a friendly value (usage: @homfriendly <friendly value [0-1000]>). return -1; } @@ -7025,12 +7032,12 @@ ACMD_FUNC(homhungry) nullpo_retr(-1, sd); if ( !merc_is_hom_active(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1259)); // Please enter a hunger value (usage: @homhungry <hunger value [0-100]>). + clif->message(fd, msg_txt(1259)); // Please enter a hunger value (usage: @homhungry <hunger value [0-100]>). return -1; } @@ -7063,17 +7070,17 @@ ACMD_FUNC(homtalk) return -1; if ( !merc_is_hom_active(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) { - clif->displaymessage(fd, msg_txt(1260)); // Please enter a message (usage: @homtalk <message>). + clif->message(fd, msg_txt(1260)); // Please enter a message (usage: @homtalk <message>). return -1; } snprintf(temp, sizeof temp ,"%s : %s", sd->hd->homunculus.name, mes); - clif->message(&sd->hd->bl, temp); + clif->disp_overhead(&sd->hd->bl, temp); return 0; } @@ -7088,31 +7095,31 @@ ACMD_FUNC(hominfo) nullpo_retr(-1, sd); if ( !merc_is_hom_active(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } hd = sd->hd; status = status_get_status_data(&hd->bl); - clif->displaymessage(fd, msg_txt(1261)); // Homunculus stats: + clif->message(fd, msg_txt(1261)); // Homunculus stats: snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1262), // HP: %d/%d - SP: %d/%d status->hp, status->max_hp, status->sp, status->max_sp); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1263), // ATK: %d - MATK: %d~%d status->rhw.atk2 +status->batk, status->matk_min, status->matk_max); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1264), // Hungry: %d - Intimacy: %u hd->homunculus.hunger, hd->homunculus.intimacy/100); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); snprintf(atcmd_output, sizeof(atcmd_output) , msg_txt(1265), // Stats: Str %d / Agi %d / Vit %d / Int %d / Dex %d / Luk %d status->str, status->agi, status->vit, status->int_, status->dex, status->luk); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -7127,7 +7134,7 @@ ACMD_FUNC(homstats) nullpo_retr(-1, sd); if ( !merc_is_hom_active(sd->hd) ) { - clif->displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + clif->message(fd, msg_txt(1254)); // You do not have a homunculus. return -1; } @@ -7139,49 +7146,49 @@ ACMD_FUNC(homstats) snprintf(atcmd_output, sizeof(atcmd_output) , msg_txt(1266), lv, db->name); // Homunculus growth stats (Lv %d %s): - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); lv--; //Since the first increase is at level 2. evo = (hom->class_ == db->evo_class); min = db->base.HP +lv*db->gmin.HP +(evo?db->emin.HP:0); max = db->base.HP +lv*db->gmax.HP +(evo?db->emax.HP:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1267), hom->max_hp, min, max); // Max HP: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); min = db->base.SP +lv*db->gmin.SP +(evo?db->emin.SP:0); max = db->base.SP +lv*db->gmax.SP +(evo?db->emax.SP:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1268), hom->max_sp, min, max); // Max SP: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); min = db->base.str +lv*(db->gmin.str/10) +(evo?db->emin.str:0); max = db->base.str +lv*(db->gmax.str/10) +(evo?db->emax.str:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1269), hom->str/10, min, max); // Str: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); min = db->base.agi +lv*(db->gmin.agi/10) +(evo?db->emin.agi:0); max = db->base.agi +lv*(db->gmax.agi/10) +(evo?db->emax.agi:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1270), hom->agi/10, min, max); // Agi: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); min = db->base.vit +lv*(db->gmin.vit/10) +(evo?db->emin.vit:0); max = db->base.vit +lv*(db->gmax.vit/10) +(evo?db->emax.vit:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1271), hom->vit/10, min, max); // Vit: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); min = db->base.int_ +lv*(db->gmin.int_/10) +(evo?db->emin.int_:0); max = db->base.int_ +lv*(db->gmax.int_/10) +(evo?db->emax.int_:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1272), hom->int_/10, min, max); // Int: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); min = db->base.dex +lv*(db->gmin.dex/10) +(evo?db->emin.dex:0); max = db->base.dex +lv*(db->gmax.dex/10) +(evo?db->emax.dex:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1273), hom->dex/10, min, max); // Dex: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); min = db->base.luk +lv*(db->gmin.luk/10) +(evo?db->emin.luk:0); max = db->base.luk +lv*(db->gmax.luk/10) +(evo?db->emax.luk:0);; snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1274), hom->luk/10, min, max); // Luk: %d (%d~%d) - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -7196,7 +7203,7 @@ ACMD_FUNC(homshuffle) if(!merc_hom_shuffle(sd->hd)) return -1; - clif->displaymessage(sd->fd, msg_txt(1275)); // Homunculus stats altered. + clif->message(sd->fd, msg_txt(1275)); // Homunculus stats altered. atcommand_homstats(fd, sd, command, message); //Print out the new stats return 0; } @@ -7211,20 +7218,20 @@ ACMD_FUNC(iteminfo) int i, count = 1; if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1276)); // Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>). + clif->message(fd, msg_txt(1276)); // Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>). return -1; } if ((item_array[0] = itemdb_exists(atoi(message))) == NULL) count = itemdb_searchname_array(item_array, MAX_SEARCH, message); if (!count) { - clif->displaymessage(fd, msg_txt(19)); // Invalid item ID or name. + clif->message(fd, msg_txt(19)); // Invalid item ID or name. return -1; } if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); count = MAX_SEARCH; } for (i = 0; i < count; i++) { @@ -7234,10 +7241,10 @@ ACMD_FUNC(iteminfo) itemdb_typename(item_data->type), (item_data->script==NULL)? msg_txt(1278) : msg_txt(1279) // None / With script ); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1280), item_data->value_buy, item_data->value_sell, item_data->weight/10. ); // NPC Buy:%dz, Sell:%dz | Weight: %.1f - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); if (item_data->maxchance == -1) strcpy(atcmd_output, msg_txt(1281)); // - Available in the shops only. @@ -7245,7 +7252,7 @@ ACMD_FUNC(iteminfo) sprintf(atcmd_output, msg_txt(1282), (float)item_data->maxchance / 100 ); // - Maximal monsters drop chance: %02.02f%% else strcpy(atcmd_output, msg_txt(1283)); // - Monsters don't drop this item. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -7260,38 +7267,38 @@ ACMD_FUNC(whodrops) int i,j, count = 1; if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>). + clif->message(fd, msg_txt(1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>). return -1; } if ((item_array[0] = itemdb_exists(atoi(message))) == NULL) count = itemdb_searchname_array(item_array, MAX_SEARCH, message); if (!count) { - clif->displaymessage(fd, msg_txt(19)); // Invalid item ID or name. + clif->message(fd, msg_txt(19)); // Invalid item ID or name. return -1; } if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); count = MAX_SEARCH; } for (i = 0; i < count; i++) { item_data = item_array[i]; sprintf(atcmd_output, msg_txt(1285), item_data->jname,item_data->slot); // Item: '%s'[%d] - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); if (item_data->mob[0].chance == 0) { strcpy(atcmd_output, msg_txt(1286)); // - Item is not dropped by mobs. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } else { sprintf(atcmd_output, msg_txt(1287), MAX_SEARCH); // - Common mobs with highest drop chance (only max %d are listed): - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++) { sprintf(atcmd_output, "- %s (%02.02f%%)", mob_db(item_data->mob[j].id)->jname, item_data->mob[j].chance/100.); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } } @@ -7305,7 +7312,7 @@ ACMD_FUNC(whereis) int i, j, k; if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1288)); // Please enter a monster name/ID (usage: @whereis <monster_name_or_monster_ID>). + clif->message(fd, msg_txt(1288)); // Please enter a monster name/ID (usage: @whereis <monster_name_or_monster_ID>). return -1; } @@ -7318,29 +7325,29 @@ ACMD_FUNC(whereis) count = mobdb_searchname_array(mob_array, MAX_SEARCH, message); if (!count) { - clif->displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. + clif->message(fd, msg_txt(40)); // Invalid monster ID or name. return -1; } if (count > MAX_SEARCH) { sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); count = MAX_SEARCH; } for (k = 0; k < count; k++) { mob = mob_array[k]; snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1289), mob->jname); // %s spawns in: - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); for (i = 0; i < ARRAYLENGTH(mob->spawn) && mob->spawn[i].qty; i++) { j = map_mapindex2mapid(mob->spawn[i].mapindex); if (j < 0) continue; snprintf(atcmd_output, sizeof atcmd_output, "%s (%d)", map[j].name, mob->spawn[i].qty); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } if (i == 0) - clif->displaymessage(fd, msg_txt(1290)); // This monster does not spawn normally. + clif->message(fd, msg_txt(1290)); // This monster does not spawn normally. } return 0; @@ -7352,9 +7359,9 @@ ACMD_FUNC(version) if ((revision = get_svn_revision()) != 0) { sprintf(atcmd_output,msg_txt(1295),revision); // rAthena Version SVN r%s - clif->displaymessage(fd,atcmd_output); + clif->message(fd,atcmd_output); } else - clif->displaymessage(fd,msg_txt(1296)); // Cannot determine SVN revision. + clif->message(fd,msg_txt(1296)); // Cannot determine SVN revision. return 0; } @@ -7389,7 +7396,7 @@ ACMD_FUNC(mutearea) nullpo_ret(sd); if (!message || !*message) { - clif->displaymessage(fd, msg_txt(1297)); // Please enter a time in minutes (usage: @mutearea/@stfu <time in minutes>). + clif->message(fd, msg_txt(1297)); // Please enter a time in minutes (usage: @mutearea/@stfu <time in minutes>). return -1; } @@ -7412,16 +7419,16 @@ ACMD_FUNC(rates) snprintf(buf, CHAT_SIZE_MAX, msg_txt(1298), // Experience rates: Base %.2fx / Job %.2fx battle_config.base_exp_rate/100., battle_config.job_exp_rate/100.); - clif->displaymessage(fd, buf); + clif->message(fd, buf); snprintf(buf, CHAT_SIZE_MAX, msg_txt(1299), // Normal Drop Rates: Common %.2fx / Healing %.2fx / Usable %.2fx / Equipment %.2fx / Card %.2fx battle_config.item_rate_common/100., battle_config.item_rate_heal/100., battle_config.item_rate_use/100., battle_config.item_rate_equip/100., battle_config.item_rate_card/100.); - clif->displaymessage(fd, buf); + clif->message(fd, buf); snprintf(buf, CHAT_SIZE_MAX, msg_txt(1300), // Boss Drop Rates: Common %.2fx / Healing %.2fx / Usable %.2fx / Equipment %.2fx / Card %.2fx battle_config.item_rate_common_boss/100., battle_config.item_rate_heal_boss/100., battle_config.item_rate_use_boss/100., battle_config.item_rate_equip_boss/100., battle_config.item_rate_card_boss/100.); - clif->displaymessage(fd, buf); + clif->message(fd, buf); snprintf(buf, CHAT_SIZE_MAX, msg_txt(1301), // Other Drop Rates: MvP %.2fx / Card-Based %.2fx / Treasure %.2fx battle_config.item_rate_mvp/100., battle_config.item_rate_adddrop/100., battle_config.item_rate_treasure/100.); - clif->displaymessage(fd, buf); + clif->message(fd, buf); return 0; } @@ -7444,12 +7451,12 @@ ACMD_FUNC(me) return -1; if (!message || !*message || sscanf(message, "%199[^\n]", tempmes) < 0) { - clif->displaymessage(fd, msg_txt(1302)); // Please enter a message (usage: @me <message>). + clif->message(fd, msg_txt(1302)); // Please enter a message (usage: @me <message>). return -1; } sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); // *%s %s* - clif->disp_overhead(sd, atcmd_output); + clif->disp_overhead(&sd->bl, atcmd_output); return 0; @@ -7477,7 +7484,7 @@ ACMD_FUNC(size) else if( size == SZ_BIG ) clif->specialeffect(&sd->bl,422,AREA); - clif->displaymessage(fd, msg_txt(1303)); // Size change applied. + clif->message(fd, msg_txt(1303)); // Size change applied. return 0; } @@ -7507,7 +7514,7 @@ ACMD_FUNC(sizeall) } mapit_free(iter); - clif->displaymessage(fd, msg_txt(1303)); // Size change applied. + clif->message(fd, msg_txt(1303)); // Size change applied. return 0; } @@ -7522,12 +7529,12 @@ ACMD_FUNC(sizeguild) memset(guild, '\0', sizeof(guild)); if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild) < 2 ) { - clif->displaymessage(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>). + clif->message(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>). return -1; } if( (g = guild_searchname(guild)) == NULL && (g = guild_search(atoi(guild))) == NULL ) { - clif->displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. + clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return -1; } @@ -7548,7 +7555,7 @@ ACMD_FUNC(sizeguild) } } - clif->displaymessage(fd, msg_txt(1303)); // Size change applied. + clif->message(fd, msg_txt(1303)); // Size change applied. return 0; } @@ -7562,10 +7569,10 @@ ACMD_FUNC(monsterignore) if (!sd->state.monster_ignore) { sd->state.monster_ignore = 1; - clif->displaymessage(sd->fd, msg_txt(1305)); // You are now immune to attacks. + clif->message(sd->fd, msg_txt(1305)); // You are now immune to attacks. } else { sd->state.monster_ignore = 0; - clif->displaymessage(sd->fd, msg_txt(1306)); // Returned to normal state. + clif->message(sd->fd, msg_txt(1306)); // Returned to normal state. } return 0; @@ -7584,23 +7591,23 @@ ACMD_FUNC(fakename) { sd->fakename[0] = '\0'; clif->charnameack(0, &sd->bl); - clif->displaymessage(sd->fd, msg_txt(1307)); // Returned to real name. + clif->message(sd->fd, msg_txt(1307)); // Returned to real name. return 0; } - clif->displaymessage(sd->fd, msg_txt(1308)); // You must enter a name. + clif->message(sd->fd, msg_txt(1308)); // You must enter a name. return -1; } if( strlen(message) < 2 ) { - clif->displaymessage(sd->fd, msg_txt(1309)); // Fake name must be at least two characters. + clif->message(sd->fd, msg_txt(1309)); // Fake name must be at least two characters. return -1; } safestrncpy(sd->fakename, message, sizeof(sd->fakename)); clif->charnameack(0, &sd->bl); - clif->displaymessage(sd->fd, msg_txt(1310)); // Fake name enabled. + clif->message(sd->fd, msg_txt(1310)); // Fake name enabled. return 0; } @@ -7609,12 +7616,12 @@ ACMD_FUNC(fakename) * Ragnarok Resources *------------------------------------------*/ ACMD_FUNC(mapflag) { -#define checkflag( cmd ) if ( map[ sd->bl.m ].flag.cmd ) clif->displaymessage(sd->fd,#cmd) +#define checkflag( cmd ) if ( map[ sd->bl.m ].flag.cmd ) clif->message(sd->fd,#cmd) #define setflag( cmd ) \ if ( strcmp( flag_name , #cmd ) == 0 ){\ map[ sd->bl.m ].flag.cmd = flag;\ sprintf(atcmd_output,"[ @mapflag ] %s flag has been set to %s value = %hd",#cmd,flag?"On":"Off",flag);\ - clif->displaymessage(sd->fd,atcmd_output);\ + clif->message(sd->fd,atcmd_output);\ return 0;\ } char flag_name[100]; @@ -7623,8 +7630,8 @@ ACMD_FUNC(mapflag) { memset(flag_name, '\0', sizeof(flag_name)); if (!message || !*message || (sscanf(message, "%99s %hd", flag_name, &flag) < 1)) { - clif->displaymessage(sd->fd,msg_txt(1311)); // Enabled Mapflags in this map: - clif->displaymessage(sd->fd,"----------------------------------"); + clif->message(sd->fd,msg_txt(1311)); // Enabled Mapflags in this map: + clif->message(sd->fd,"----------------------------------"); checkflag(autotrade); checkflag(allowks); checkflag(nomemo); checkflag(noteleport); checkflag(noreturn); checkflag(monster_noteleport); checkflag(nosave); checkflag(nobranch); checkflag(noexppenalty); checkflag(pvp); checkflag(pvp_noparty); checkflag(pvp_noguild); @@ -7637,9 +7644,9 @@ ACMD_FUNC(mapflag) { checkflag(nojobexp); checkflag(nomobloot); checkflag(nomvploot); checkflag(nightenabled); checkflag(nodrop); checkflag(novending); checkflag(loadevent); checkflag(nochat); checkflag(partylock); checkflag(guildlock); checkflag(src4instance); - clif->displaymessage(sd->fd," "); - clif->displaymessage(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) - clif->displaymessage(sd->fd,msg_txt(1313)); // Type "@mapflag available" to list the available mapflags. + clif->message(sd->fd," "); + clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) + clif->message(sd->fd,msg_txt(1313)); // Type "@mapflag available" to list the available mapflags. return 1; } for (i = 0; flag_name[i]; i++) flag_name[i] = (char)tolower(flag_name[i]); //lowercase @@ -7657,17 +7664,17 @@ ACMD_FUNC(mapflag) { setflag(nodrop); setflag(novending); setflag(loadevent); setflag(nochat); setflag(partylock); setflag(guildlock); setflag(src4instance); - clif->displaymessage(sd->fd,msg_txt(1314)); // Invalid flag name or flag. - clif->displaymessage(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) - clif->displaymessage(sd->fd,msg_txt(1315)); // Available Flags: - clif->displaymessage(sd->fd,"----------------------------------"); - clif->displaymessage(sd->fd,"town, autotrade, allowks, nomemo, noteleport, noreturn, monster_noteleport, nosave,"); - clif->displaymessage(sd->fd,"nobranch, noexppenalty, pvp, pvp_noparty, pvp_noguild, pvp_nightmaredrop,"); - clif->displaymessage(sd->fd,"pvp_nocalcrank, gvg_castle, gvg, gvg_dungeon, gvg_noparty, battleground,"); - clif->displaymessage(sd->fd,"nozenypenalty, notrade, noskill, nowarp, nowarpto, noicewall, snow, clouds, clouds2,"); - clif->displaymessage(sd->fd,"fog, fireworks, sakura, leaves, nogo, nobaseexp, nojobexp, nomobloot,"); - clif->displaymessage(sd->fd,"nomvploot, nightenabled, nodrop, novending, loadevent, nochat, partylock,"); - clif->displaymessage(sd->fd,"guildlock, src4instance"); + clif->message(sd->fd,msg_txt(1314)); // Invalid flag name or flag. + clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) + clif->message(sd->fd,msg_txt(1315)); // Available Flags: + clif->message(sd->fd,"----------------------------------"); + clif->message(sd->fd,"town, autotrade, allowks, nomemo, noteleport, noreturn, monster_noteleport, nosave,"); + clif->message(sd->fd,"nobranch, noexppenalty, pvp, pvp_noparty, pvp_noguild, pvp_nightmaredrop,"); + clif->message(sd->fd,"pvp_nocalcrank, gvg_castle, gvg, gvg_dungeon, gvg_noparty, battleground,"); + clif->message(sd->fd,"nozenypenalty, notrade, noskill, nowarp, nowarpto, noicewall, snow, clouds, clouds2,"); + clif->message(sd->fd,"fog, fireworks, sakura, leaves, nogo, nobaseexp, nojobexp, nomobloot,"); + clif->message(sd->fd,"nomvploot, nightenabled, nodrop, novending, loadevent, nochat, partylock,"); + clif->message(sd->fd,"guildlock, src4instance"); #undef checkflag #undef setflag @@ -7682,12 +7689,12 @@ ACMD_FUNC(showexp) { if (sd->state.showexp) { sd->state.showexp = 0; - clif->displaymessage(fd, msg_txt(1316)); // Gained exp will not be shown. + clif->message(fd, msg_txt(1316)); // Gained exp will not be shown. return 0; } sd->state.showexp = 1; - clif->displaymessage(fd, msg_txt(1317)); // Gained exp is now shown. + clif->message(fd, msg_txt(1317)); // Gained exp is now shown. return 0; } @@ -7695,12 +7702,12 @@ ACMD_FUNC(showzeny) { if (sd->state.showzeny) { sd->state.showzeny = 0; - clif->displaymessage(fd, msg_txt(1318)); // Gained zeny will not be shown. + clif->message(fd, msg_txt(1318)); // Gained zeny will not be shown. return 0; } sd->state.showzeny = 1; - clif->displaymessage(fd, msg_txt(1319)); // Gained zeny is now shown. + clif->message(fd, msg_txt(1319)); // Gained zeny is now shown. return 0; } @@ -7708,12 +7715,12 @@ ACMD_FUNC(showdelay) { if (sd->state.showdelay) { sd->state.showdelay = 0; - clif->displaymessage(fd, msg_txt(1320)); // Skill delay failures will not be shown. + clif->message(fd, msg_txt(1320)); // Skill delay failures will not be shown. return 0; } sd->state.showdelay = 1; - clif->displaymessage(fd, msg_txt(1321)); // Skill delay failures are now shown. + clif->message(fd, msg_txt(1321)); // Skill delay failures are now shown. return 0; } @@ -7733,7 +7740,7 @@ ACMD_FUNC(invite) if(did == 0) { // "Duel: @invite without @duel." - clif->displaymessage(fd, msg_txt(350)); + clif->message(fd, msg_txt(350)); return 0; } @@ -7741,32 +7748,32 @@ ACMD_FUNC(invite) duel_list[did].members_count >= duel_list[did].max_players_limit) { // "Duel: Limit of players is reached." - clif->displaymessage(fd, msg_txt(351)); + clif->message(fd, msg_txt(351)); return 0; } if(target_sd == NULL) { // "Duel: Player not found." - clif->displaymessage(fd, msg_txt(352)); + clif->message(fd, msg_txt(352)); return 0; } if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) { // "Duel: Player already in duel." - clif->displaymessage(fd, msg_txt(353)); + clif->message(fd, msg_txt(353)); return 0; } if(battle_config.duel_only_on_same_map && target_sd->bl.m != sd->bl.m) { sprintf(atcmd_output, msg_txt(364), message); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } duel_invite(did, sd, target_sd); // "Duel: Invitation has been sent." - clif->displaymessage(fd, msg_txt(354)); + clif->message(fd, msg_txt(354)); return 0; } @@ -7781,7 +7788,7 @@ ACMD_FUNC(duel) if(sd->duel_invite > 0) { // "Duel: @duel without @reject." - clif->displaymessage(fd, msg_txt(355)); + clif->message(fd, msg_txt(355)); return 0; } @@ -7789,14 +7796,14 @@ ACMD_FUNC(duel) char output[CHAT_SIZE_MAX]; // "Duel: You can take part in duel only one time per %d minutes." sprintf(output, msg_txt(356), battle_config.duel_time_interval); - clif->displaymessage(fd, output); + clif->message(fd, output); return 0; } if( message[0] ) { if(sscanf(message, "%d", &maxpl) >= 1) { if(maxpl < 2 || maxpl > 65535) { - clif->displaymessage(fd, msg_txt(357)); // "Duel: Invalid value." + clif->message(fd, msg_txt(357)); // "Duel: Invalid value." return 0; } duel_create(sd, maxpl); @@ -7807,15 +7814,15 @@ ACMD_FUNC(duel) unsigned int newduel; if((newduel = duel_create(sd, 2)) != -1) { if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) { - clif->displaymessage(fd, msg_txt(353)); // "Duel: Player already in duel." + clif->message(fd, msg_txt(353)); // "Duel: Player already in duel." return 0; } duel_invite(newduel, sd, target_sd); - clif->displaymessage(fd, msg_txt(354)); // "Duel: Invitation has been sent." + clif->message(fd, msg_txt(354)); // "Duel: Invitation has been sent." } } else { // "Duel: Player not found." - clif->displaymessage(fd, msg_txt(352)); + clif->message(fd, msg_txt(352)); return 0; } } @@ -7830,12 +7837,12 @@ ACMD_FUNC(leave) { if(sd->duel_group <= 0) { // "Duel: @leave without @duel." - clif->displaymessage(fd, msg_txt(358)); + clif->message(fd, msg_txt(358)); return 0; } duel_leave(sd->duel_group, sd); - clif->displaymessage(fd, msg_txt(359)); // "Duel: You left the duel." + clif->message(fd, msg_txt(359)); // "Duel: You left the duel." return 0; } @@ -7845,26 +7852,26 @@ ACMD_FUNC(accept) char output[CHAT_SIZE_MAX]; // "Duel: You can take part in duel only one time per %d minutes." sprintf(output, msg_txt(356), battle_config.duel_time_interval); - clif->displaymessage(fd, output); + clif->message(fd, output); return 0; } if(sd->duel_invite <= 0) { // "Duel: @accept without invititation." - clif->displaymessage(fd, msg_txt(360)); + clif->message(fd, msg_txt(360)); return 0; } if( duel_list[sd->duel_invite].max_players_limit > 0 && duel_list[sd->duel_invite].members_count >= duel_list[sd->duel_invite].max_players_limit ) { // "Duel: Limit of players is reached." - clif->displaymessage(fd, msg_txt(351)); + clif->message(fd, msg_txt(351)); return 0; } duel_accept(sd->duel_invite, sd); // "Duel: Invitation has been accepted." - clif->displaymessage(fd, msg_txt(361)); + clif->message(fd, msg_txt(361)); return 0; } @@ -7872,13 +7879,13 @@ ACMD_FUNC(reject) { if(sd->duel_invite <= 0) { // "Duel: @reject without invititation." - clif->displaymessage(fd, msg_txt(362)); + clif->message(fd, msg_txt(362)); return 0; } duel_reject(sd->duel_invite, sd); // "Duel: Invitation has been rejected." - clif->displaymessage(fd, msg_txt(363)); + clif->message(fd, msg_txt(363)); return 0; } @@ -7893,7 +7900,7 @@ ACMD_FUNC(cash) nullpo_retr(-1, sd); if( !message || !*message || (value = atoi(message)) == 0 ) { - clif->displaymessage(fd, msg_txt(1322)); // Please enter an amount. + clif->message(fd, msg_txt(1322)); // Please enter an amount. return -1; } @@ -7904,13 +7911,13 @@ ACMD_FUNC(cash) sprintf(output, msg_txt(505), ret, sd->cashPoints); clif->disp_onlyself(sd, output, strlen(output)); } - else clif->displaymessage(fd, msg_txt(149)); // Unable to decrease the number/value. + else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value. } else { if( (ret=pc_paycash(sd, -value, 0)) >= 0){ sprintf(output, msg_txt(410), ret, sd->cashPoints); clif->disp_onlyself(sd, output, strlen(output)); } - else clif->displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value. + else clif->message(fd, msg_txt(41)); // Unable to decrease the number/value. } } else @@ -7920,13 +7927,13 @@ ACMD_FUNC(cash) sprintf(output, msg_txt(506), ret, sd->kafraPoints); clif->disp_onlyself(sd, output, strlen(output)); } - else clif->displaymessage(fd, msg_txt(149)); // Unable to decrease the number/value. + else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value. } else { if( (ret=pc_paycash(sd, -value, -value)) >= 0){ sprintf(output, msg_txt(411), ret, sd->kafraPoints); clif->disp_onlyself(sd, output, strlen(output)); } - else clif->displaymessage(fd, msg_txt(41)); // Unable to decrease the number/value. + else clif->message(fd, msg_txt(41)); // Unable to decrease the number/value. } } @@ -7940,17 +7947,17 @@ ACMD_FUNC(clone) struct map_session_data *pl_sd=NULL; if (!message || !*message) { - clif->displaymessage(sd->fd,msg_txt(1323)); // You must enter a player name or ID. + clif->message(sd->fd,msg_txt(1323)); // You must enter a player name or ID. return 0; } if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) { - clif->displaymessage(fd, msg_txt(3)); // Character not found. + clif->message(fd, msg_txt(3)); // Character not found. return 0; } if(pc_get_group_level(pl_sd) > pc_get_group_level(sd)) { - clif->displaymessage(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself. + clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself. return 0; } @@ -7959,13 +7966,13 @@ ACMD_FUNC(clone) else if (strcmpi(command+1, "slaveclone") == 0) { flag = 2; if(pc_isdead(sd)){ - clif->displaymessage(fd, msg_txt(129+flag*2)); + clif->message(fd, msg_txt(129+flag*2)); return 0; } master = sd->bl.id; if (battle_config.atc_slave_clone_limit && mob_countslave(&sd->bl) >= battle_config.atc_slave_clone_limit) { - clif->displaymessage(fd, msg_txt(127)); // You've reached your slave clones limit. + clif->message(fd, msg_txt(127)); // You've reached your slave clones limit. return 0; } } @@ -7981,62 +7988,10 @@ ACMD_FUNC(clone) } if((x = mob_clone_spawn(pl_sd, sd->bl.m, x, y, "", master, 0, flag?1:0, 0)) > 0) { - clif->displaymessage(fd, msg_txt(128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned. + clif->message(fd, msg_txt(128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned. return 0; } - clif->displaymessage(fd, msg_txt(129+flag*2)); // Unable to spawn evil clone. Unable to spawn clone. Unable to spawn slave clone. - return 0; -} - -/*=================================== - * Main chat [LuzZza] - * Usage: @main <on|off|message> - *-----------------------------------*/ -ACMD_FUNC(main) -{ - if( message[0] ) { - - if(strcmpi(message, "on") == 0) { - if(!sd->state.mainchat) { - sd->state.mainchat = 1; - clif->displaymessage(fd, msg_txt(380)); // Main chat has been activated. - } else { - clif->displaymessage(fd, msg_txt(381)); // Main chat already activated. - } - } else if(strcmpi(message, "off") == 0) { - if(sd->state.mainchat) { - sd->state.mainchat = 0; - clif->displaymessage(fd, msg_txt(382)); // Main chat has been disabled. - } else { - clif->displaymessage(fd, msg_txt(383)); // Main chat already disabled. - } - } else { - if(!sd->state.mainchat) { - sd->state.mainchat = 1; - clif->displaymessage(fd, msg_txt(380)); // Main chat has been activated. - } - if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) { - clif->displaymessage(fd, msg_txt(387)); - return -1; - } - - if ( battle_config.min_chat_delay ) { - if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 ) - return 0; - sd->cantalk_tick = gettick() + battle_config.min_chat_delay; - } - - // send the message using inter-server system - intif_main_message( sd, message ); - } - - } else { - - if(sd->state.mainchat) - clif->displaymessage(fd, msg_txt(384)); // Main chat currently enabled. Usage: @main <on|off>, @main <message>. - else - clif->displaymessage(fd, msg_txt(385)); // Main chat currently disabled. Usage: @main <on|off>, @main <message>. - } + clif->message(fd, msg_txt(129+flag*2)); // Unable to spawn evil clone. Unable to spawn clone. Unable to spawn slave clone. return 0; } @@ -8047,10 +8002,10 @@ ACMD_FUNC(main) ACMD_FUNC(noask) { if(sd->state.noask) { - clif->displaymessage(fd, msg_txt(391)); // Autorejecting is deactivated. + clif->message(fd, msg_txt(391)); // Autorejecting is deactivated. sd->state.noask = 0; } else { - clif->displaymessage(fd, msg_txt(390)); // Autorejecting is activated. + clif->message(fd, msg_txt(390)); // Autorejecting is activated. sd->state.noask = 1; } @@ -8064,14 +8019,14 @@ ACMD_FUNC(noask) ACMD_FUNC(request) { if (!message || !*message) { - clif->displaymessage(sd->fd,msg_txt(277)); // Usage: @request <petition/message to online GMs>. + clif->message(sd->fd,msg_txt(277)); // Usage: @request <petition/message to online GMs>. return -1; } sprintf(atcmd_output, msg_txt(278), message); // (@request): %s intif_wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output); clif->disp_onlyself(sd, atcmd_output, strlen(atcmd_output)); - clif->displaymessage(sd->fd,msg_txt(279)); // @request sent. + clif->message(sd->fd,msg_txt(279)); // @request sent. return 0; } @@ -8081,7 +8036,7 @@ ACMD_FUNC(request) ACMD_FUNC(feelreset) { pc_resetfeel(sd); - clif->displaymessage(fd, msg_txt(1324)); // Reset 'Feeling' maps. + clif->message(fd, msg_txt(1324)); // Reset 'Feeling' maps. return 0; } @@ -8107,27 +8062,27 @@ ACMD_FUNC(ksprotection) if( sd->state.noks ) { sd->state.noks = 0; - clif->displaymessage(fd, msg_txt(1325)); // [ K.S Protection Inactive ] + clif->message(fd, msg_txt(1325)); // [ K.S Protection Inactive ] } else { if( !message || !*message || !strcmpi(message, "party") ) { // Default is Party sd->state.noks = 2; - clif->displaymessage(fd, msg_txt(1326)); // [ K.S Protection Active - Option: Party ] + clif->message(fd, msg_txt(1326)); // [ K.S Protection Active - Option: Party ] } else if( !strcmpi(message, "self") ) { sd->state.noks = 1; - clif->displaymessage(fd, msg_txt(1327)); // [ K.S Protection Active - Option: Self ] + clif->message(fd, msg_txt(1327)); // [ K.S Protection Active - Option: Self ] } else if( !strcmpi(message, "guild") ) { sd->state.noks = 3; - clif->displaymessage(fd, msg_txt(1328)); // [ K.S Protection Active - Option: Guild ] + clif->message(fd, msg_txt(1328)); // [ K.S Protection Active - Option: Guild ] } else - clif->displaymessage(fd, msg_txt(1329)); // Usage: @noks <self|party|guild> + clif->message(fd, msg_txt(1329)); // Usage: @noks <self|party|guild> } return 0; } @@ -8140,10 +8095,10 @@ ACMD_FUNC(allowks) if( map[sd->bl.m].flag.allowks ) { map[sd->bl.m].flag.allowks = 0; - clif->displaymessage(fd, msg_txt(1330)); // [ Map K.S Protection Active ] + clif->message(fd, msg_txt(1330)); // [ Map K.S Protection Active ] } else { map[sd->bl.m].flag.allowks = 1; - clif->displaymessage(fd, msg_txt(1331)); // [ Map K.S Protection Inactive ] + clif->message(fd, msg_txt(1331)); // [ Map K.S Protection Inactive ] } return 0; } @@ -8154,7 +8109,7 @@ ACMD_FUNC(resetstat) pc_resetstate(sd); sprintf(atcmd_output, msg_txt(207), sd->status.name); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -8164,7 +8119,7 @@ ACMD_FUNC(resetskill) pc_resetskill(sd,1); sprintf(atcmd_output, msg_txt(206), sd->status.name); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } @@ -8224,7 +8179,7 @@ ACMD_FUNC(itemlist) if( count == 1 ) { StringBuf_Printf(&buf, msg_txt(1332), location, sd->status.name); // ------ %s items list of '%s' ------ - clif->displaymessage(fd, StringBuf_Value(&buf)); + clif->message(fd, StringBuf_Value(&buf)); StringBuf_Clear(&buf); } @@ -8270,7 +8225,7 @@ ACMD_FUNC(itemlist) StringBuf_AppendStr(&buf, equipstr); } - clif->displaymessage(fd, StringBuf_Value(&buf)); + clif->message(fd, StringBuf_Value(&buf)); StringBuf_Clear(&buf); if( it->card[0] == CARD0_PET ) @@ -8317,7 +8272,7 @@ ACMD_FUNC(itemlist) } if( StringBuf_Length(&buf) > 0 ) - clif->displaymessage(fd, StringBuf_Value(&buf)); + clif->message(fd, StringBuf_Value(&buf)); StringBuf_Clear(&buf); } @@ -8327,7 +8282,7 @@ ACMD_FUNC(itemlist) else StringBuf_Printf(&buf, msg_txt(1354), counter, count, location); // %d item(s) found in %d %s slots. - clif->displaymessage(fd, StringBuf_Value(&buf)); + clif->message(fd, StringBuf_Value(&buf)); StringBuf_Destroy(&buf); @@ -8387,11 +8342,11 @@ ACMD_FUNC(stats) sprintf(job_jobname, "Job - %s %s", job_name(sd->status.class_), "(level %d)"); sprintf(output, msg_txt(53), sd->status.name); // '%s' stats: - clif->displaymessage(fd, output); + clif->message(fd, output); for (i = 0; output_table[i].format != NULL; i++) { sprintf(output, output_table[i].format, output_table[i].value); - clif->displaymessage(fd, output); + clif->message(fd, output); } return 0; @@ -8407,7 +8362,7 @@ ACMD_FUNC(delitem) if( !message || !*message || ( sscanf(message, "\"%99[^\"]\" %d", item_name, &amount) < 2 && sscanf(message, "%99s %d", item_name, &amount) < 2 ) || amount < 1 ) { - clif->displaymessage(fd, msg_txt(1355)); // Please enter an item name/ID, a quantity, and a player name (usage: #delitem <player> <item_name_or_ID> <quantity>). + clif->message(fd, msg_txt(1355)); // Please enter an item name/ID, a quantity, and a player name (usage: #delitem <player> <item_name_or_ID> <quantity>). return -1; } @@ -8417,7 +8372,7 @@ ACMD_FUNC(delitem) } else { - clif->displaymessage(fd, msg_txt(19)); // Invalid item ID or name. + clif->message(fd, msg_txt(19)); // Invalid item ID or name. return -1; } @@ -8439,22 +8394,22 @@ ACMD_FUNC(delitem) // notify target sprintf(atcmd_output, msg_txt(113), total-amount); // %d item(s) removed by a GM. - clif->displaymessage(sd->fd, atcmd_output); + clif->message(sd->fd, atcmd_output); // notify source if( amount == total ) { - clif->displaymessage(fd, msg_txt(116)); // Character does not have the item. + clif->message(fd, msg_txt(116)); // Character does not have the item. } else if( amount ) { sprintf(atcmd_output, msg_txt(115), total-amount, total-amount, total); // %d item(s) removed. Player had only %d on %d items. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } else { sprintf(atcmd_output, msg_txt(114), total); // %d item(s) removed from the player. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return 0; @@ -8474,25 +8429,25 @@ ACMD_FUNC(font) if( sd->user_font ) { sd->user_font = 0; - clif->displaymessage(fd, msg_txt(1356)); // Returning to normal font. + clif->message(fd, msg_txt(1356)); // Returning to normal font. clif->font(sd); } else { - clif->displaymessage(fd, msg_txt(1357)); // Use @font <1-9> to change your message font. - clif->displaymessage(fd, msg_txt(1358)); // Use 0 or no parameter to return to normal font. + clif->message(fd, msg_txt(1357)); // Use @font <1-9> to change your message font. + clif->message(fd, msg_txt(1358)); // Use 0 or no parameter to return to normal font. } } else if( font_id < 0 || font_id > 9 ) - clif->displaymessage(fd, msg_txt(1359)); // Invalid font. Use a value from 0 to 9. + clif->message(fd, msg_txt(1359)); // Invalid font. Use a value from 0 to 9. else if( font_id != sd->user_font ) { sd->user_font = font_id; clif->font(sd); - clif->displaymessage(fd, msg_txt(1360)); // Font changed. + clif->message(fd, msg_txt(1360)); // Font changed. } else - clif->displaymessage(fd, msg_txt(1361)); // Already using this font. + clif->message(fd, msg_txt(1361)); // Already using this font. return 0; } @@ -8511,7 +8466,7 @@ static void atcommand_commands_sub(struct map_session_data* sd, const int fd, At memset(line_buff,' ',CHATBOX_SIZE); line_buff[CHATBOX_SIZE-1] = 0; - clif->displaymessage(fd, msg_txt(273)); // "Commands available:" + clif->message(fd, msg_txt(273)); // "Commands available:" for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) { unsigned int slen = 0; @@ -8535,7 +8490,7 @@ static void atcommand_commands_sub(struct map_session_data* sd, const int fd, At // flush the text buffer if this command won't fit into it if ( slen + cur - line_buff >= CHATBOX_SIZE ) { - clif->displaymessage(fd,line_buff); + clif->message(fd,line_buff); cur = line_buff; memset(line_buff,' ',CHATBOX_SIZE); line_buff[CHATBOX_SIZE-1] = 0; @@ -8547,10 +8502,10 @@ static void atcommand_commands_sub(struct map_session_data* sd, const int fd, At count++; } dbi_destroy(iter); - clif->displaymessage(fd,line_buff); + clif->message(fd,line_buff); sprintf(atcmd_output, msg_txt(274), count); // "%d commands found." - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return; } @@ -8575,12 +8530,12 @@ ACMD_FUNC(charcommands) /* for new mounts */ ACMD_FUNC(mount2) { - clif->displaymessage(sd->fd,msg_txt(1362)); // NOTICE: If you crash with mount your LUA is outdated. + clif->message(sd->fd,msg_txt(1362)); // NOTICE: If you crash with mount your LUA is outdated. if( !(sd->sc.option&OPTION_MOUNTING) ) { - clif->displaymessage(sd->fd,msg_txt(1363)); // You have mounted. + clif->message(sd->fd,msg_txt(1363)); // You have mounted. pc_setoption(sd, sd->sc.option|OPTION_MOUNTING); } else { - clif->displaymessage(sd->fd,msg_txt(1364)); // You have released your mount. + clif->message(sd->fd,msg_txt(1364)); // You have released your mount. pc_setoption(sd, sd->sc.option&~OPTION_MOUNTING); } return 0; @@ -8590,8 +8545,8 @@ ACMD_FUNC(accinfo) { char query[NAME_LENGTH]; if (!message || !*message || strlen(message) > NAME_LENGTH ) { - clif->displaymessage(fd, msg_txt(1365)); // Usage: @accinfo/@accountinfo <account_id/char name> - clif->displaymessage(fd, msg_txt(1366)); // You may search partial name by making use of '%' in the search, ex. "@accinfo %Mario%" lists all characters whose name contains "Mario". + clif->message(fd, msg_txt(1365)); // Usage: @accinfo/@accountinfo <account_id/char name> + clif->message(fd, msg_txt(1366)); // You may search partial name by making use of '%' in the search, ex. "@accinfo %Mario%" lists all characters whose name contains "Mario". return -1; } @@ -8611,19 +8566,19 @@ ACMD_FUNC(set) { bool is_str = false; if( !message || !*message || (toset = sscanf(message, "%31s %128[^\n]s", reg, val)) < 1 ) { - clif->displaymessage(fd, msg_txt(1367)); // Usage: @set <variable name> <value> - clif->displaymessage(fd, msg_txt(1368)); // Usage: ex. "@set PoringCharVar 50" - clif->displaymessage(fd, msg_txt(1369)); // Usage: ex. "@set PoringCharVarSTR$ Super Duper String" - clif->displaymessage(fd, msg_txt(1370)); // Usage: ex. "@set PoringCharVarSTR$" outputs its value, Super Duper String. + clif->message(fd, msg_txt(1367)); // Usage: @set <variable name> <value> + clif->message(fd, msg_txt(1368)); // Usage: ex. "@set PoringCharVar 50" + clif->message(fd, msg_txt(1369)); // Usage: ex. "@set PoringCharVarSTR$ Super Duper String" + clif->message(fd, msg_txt(1370)); // Usage: ex. "@set PoringCharVarSTR$" outputs its value, Super Duper String. return -1; } /* disabled variable types (they require a proper script state to function, so allowing them would crash the server) */ if( reg[0] == '.' ) { - clif->displaymessage(fd, msg_txt(1371)); // NPC variables may not be used with @set. + clif->message(fd, msg_txt(1371)); // NPC variables may not be used with @set. return -1; } else if( reg[0] == '\'' ) { - clif->displaymessage(fd, msg_txt(1372)); // Instance variables may not be used with @set. + clif->message(fd, msg_txt(1372)); // Instance variables may not be used with @set. return -1; } @@ -8714,7 +8669,7 @@ ACMD_FUNC(set) { break; } - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); aFree(data); @@ -8722,7 +8677,7 @@ ACMD_FUNC(set) { } ACMD_FUNC(reloadquestdb) { do_reload_quest(); - clif->displaymessage(fd, msg_txt(1377)); // Quest database has been reloaded. + clif->message(fd, msg_txt(1377)); // Quest database has been reloaded. return 0; } ACMD_FUNC(addperm) { @@ -8732,11 +8687,11 @@ ACMD_FUNC(addperm) { if( !message || !*message ) { sprintf(atcmd_output, msg_txt(1378),command); // Usage: %s <permission_name> - clif->displaymessage(fd, atcmd_output); - clif->displaymessage(fd, msg_txt(1379)); // -- Permission List + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1379)); // -- Permission List for( i = 0; i < perm_size; i++ ) { sprintf(atcmd_output,"- %s",pc_g_permission_name[i].name); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return -1; } @@ -8745,28 +8700,28 @@ ACMD_FUNC(addperm) { if( i == perm_size ) { sprintf(atcmd_output,msg_txt(1380),message); // '%s' is not a known permission. - clif->displaymessage(fd, atcmd_output); - clif->displaymessage(fd, msg_txt(1379)); // -- Permission List + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1379)); // -- Permission List for( i = 0; i < perm_size; i++ ) { sprintf(atcmd_output,"- %s",pc_g_permission_name[i].name); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } return -1; } if( add && (sd->permissions&pc_g_permission_name[i].permission) ) { sprintf(atcmd_output, msg_txt(1381),sd->status.name,pc_g_permission_name[i].name); // User '%s' already possesses the '%s' permission. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } else if ( !add && !(sd->permissions&pc_g_permission_name[i].permission) ) { sprintf(atcmd_output, msg_txt(1382),sd->status.name,pc_g_permission_name[i].name); // User '%s' doesn't possess the '%s' permission. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); sprintf(atcmd_output,msg_txt(1383),sd->status.name); // -- User '%s' Permissions - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); for( i = 0; i < perm_size; i++ ) { if( sd->permissions&pc_g_permission_name[i].permission ) { sprintf(atcmd_output,"- %s",pc_g_permission_name[i].name); - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); } } @@ -8780,21 +8735,21 @@ ACMD_FUNC(addperm) { sprintf(atcmd_output, msg_txt(1384),sd->status.name); // User '%s' permissions updated successfully. The changes are temporary. - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return 0; } ACMD_FUNC(unloadnpcfile) { if( !message || !*message ) { - clif->displaymessage(fd, msg_txt(1385)); // Usage: @unloadnpcfile <file name> + clif->message(fd, msg_txt(1385)); // Usage: @unloadnpcfile <file name> return -1; } if( npc_unloadfile(message) ) - clif->displaymessage(fd, msg_txt(1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed. + clif->message(fd, msg_txt(1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed. else { - clif->displaymessage(fd, msg_txt(1387)); // File not found. + clif->message(fd, msg_txt(1387)); // File not found. return -1; } return 0; @@ -8810,12 +8765,12 @@ ACMD_FUNC(cart) { if( !message || !*message || val < 0 || val > MAX_CARTS ) { sprintf(atcmd_output, msg_txt(1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>). - clif->displaymessage(fd, atcmd_output); + clif->message(fd, atcmd_output); return -1; } if( val == 0 && !pc_iscarton(sd) ) { - clif->displaymessage(fd, msg_txt(1391)); // You do not possess a cart to be removed + clif->message(fd, msg_txt(1391)); // You do not possess a cart to be removed return -1; } @@ -8834,12 +8789,302 @@ ACMD_FUNC(cart) { MC_CART_MDFY(0); } - clif->displaymessage(fd, msg_txt(1392)); // Cart Added + clif->message(fd, msg_txt(1392)); // Cart Added return 0; #undef MC_CART_MDFY } +/* [Ind/Hercules] */ +ACMD_FUNC(join) { + struct hChSysCh *channel; + char name[HCHSYS_NAME_LENGTH], pass[HCHSYS_NAME_LENGTH]; + + if( !message || !*message || sscanf(message, "%s %s", name, pass) < 1 ) { + sprintf(atcmd_output, msg_txt(1399),command); // Unknown Channel (usage: %s <#channel_name>) + clif->message(fd, atcmd_output); + return -1; + } + if( hChSys.local && strcmpi(name + 1, hChSys.local_name) == 0 ) { + if( !map[sd->bl.m].channel ) { + clif->chsys_mjoin(sd); + return 0; + } else + channel = map[sd->bl.m].channel; + } else if( hChSys.ally && sd->status.guild_id && strcmpi(name + 1, hChSys.ally_name) == 0 ) { + struct guild *g = sd->guild; + if( !g ) return -1;/* unlikely, but we wont let it crash anyway. */ + channel = (struct hChSysCh *)g->channel; + } else if( !( channel = strdb_get(clif->channel_db, name + 1) ) ) { + sprintf(atcmd_output, msg_txt(1400),name,command); // Unknown Channel '%s' (usage: %s <#channel_name>) + clif->message(fd, atcmd_output); + return -1; + } + + if( idb_exists(channel->users, sd->status.char_id) ) { + sprintf(atcmd_output, msg_txt(1434),name); // You're already in the '%s' channel + clif->message(fd, atcmd_output); + return -1; + } + if( channel->pass[0] != '\0' && strcmp(channel->pass,pass) != 0 ) { + if( pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) { + sd->stealth = true; + } else { + sprintf(atcmd_output, msg_txt(1401),name,command); // '%s' Channel is password protected (usage: %s <#channel_name> <password>) + clif->message(fd, atcmd_output); + return -1; + } + } + + if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) { + sprintf(atcmd_output, msg_txt(1403),name); // You're now in the '%s' channel + clif->message(fd, atcmd_output); + } + + clif->chsys_join(channel,sd); + + return 0; +} +/* [Ind/Hercules] */ +inline void atcmd_channel_help(int fd, const char *command, bool can_create) { + sprintf(atcmd_output, msg_txt(1404),command); // %s failed. + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1414));// --- Available options: + if( can_create ) { + sprintf(atcmd_output, msg_txt(1415),command);// -- %s create <channel name> <channel password> + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1416));// - creates a new channel + } + sprintf(atcmd_output, msg_txt(1417),command);// -- %s list + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1418));// - lists public channels + if( can_create ) { + sprintf(atcmd_output, msg_txt(1419),command);// -- %s list colors + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1420));// - lists colors available to select for custom channels + sprintf(atcmd_output, msg_txt(1421),command);// -- %s setcolor <channel name> <color name> + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1422));// - changes <channel name> color to <color name> + } + sprintf(atcmd_output, msg_txt(1423),command);// -- %s leave <channel name> + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1424));// - leaves <channel name> + sprintf(atcmd_output, msg_txt(1427),command);// -- %s bindto <channel name> + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1428));// - binds global chat to <channel name>, making anything you type in global be sent to the channel + sprintf(atcmd_output, msg_txt(1429),command);// -- %s unbind + clif->message(fd, atcmd_output); + clif->message(fd, msg_txt(1430));// - unbinds your global chat from its attached channel (if binded) + +} +/* [Ind/Hercules] */ +ACMD_FUNC(channel) { + struct hChSysCh *channel; + char key[HCHSYS_NAME_LENGTH], sub1[HCHSYS_NAME_LENGTH], sub2[HCHSYS_NAME_LENGTH], sub3[HCHSYS_NAME_LENGTH]; + unsigned char k = 0; + sub1[0] = sub2[0] = sub3[0] = '\0'; + + if( !message || !*message || sscanf(message, "%s %s %s %s", key, sub1, sub2, sub3) < 1 ) { + atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) )); + return 0; + } + + if( strcmpi(key,"create") == 0 && ( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) ) { + if( sub1[0] != '#' ) { + clif->message(fd, msg_txt(1405));// Channel name must start with a '#' + return -1; + } else if ( strlen(sub1) < 3 || strlen(sub1) > HCHSYS_NAME_LENGTH ) { + sprintf(atcmd_output, msg_txt(1406), HCHSYS_NAME_LENGTH);// Channel length must be between 3 and %d + clif->message(fd, atcmd_output); + return -1; + } else if ( sub3[0] != '\0' ) { + clif->message(fd, msg_txt(1408)); // Channel password may not contain spaces + return -1; + } + if( strcmpi(sub1 + 1,hChSys.local_name) == 0 || strcmpi(sub1 + 1,hChSys.ally_name) == 0 || strdb_exists(clif->channel_db, sub1 + 1) ) { + sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available + clif->message(fd, atcmd_output); + return -1; + } + + CREATE( channel, struct hChSysCh, 1 ); + + clif->chsys_create(channel,sub1 + 1,sub2,0); + + channel->owner = sd->status.char_id; + + if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) { + sprintf(atcmd_output, msg_txt(1403),sub1); // You're now in the '%s' channel + clif->message(fd, atcmd_output); + } + + clif->chsys_join(channel,sd); + + } else if ( strcmpi(key,"list") == 0 ) { + if( sub1[0] != '\0' && strcmpi(sub1,"colors") == 0 ) { + char mout[40]; + for( k = 0; k < hChSys.colors_count; k++ ) { + unsigned short msg_len = 1; + msg_len += sprintf(mout, "[ %s list colors ] : %s",command,hChSys.colors_name[k]); + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = hChSys.colors[k]; + safestrncpy((char*)WFIFOP(fd,12), mout, msg_len); + WFIFOSET(fd, msg_len + 12); + } + } else { + DBIterator *iter = db_iterator(clif->channel_db); + bool show_all = pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ? true : false; + clif->message(fd, msg_txt(1410)); // -- Public Channels + if( hChSys.local ) { + sprintf(atcmd_output, msg_txt(1409), hChSys.local_name, map[sd->bl.m].channel ? db_size(map[sd->bl.m].channel->users) : 0);// - #%s ( %d users ) + clif->message(fd, atcmd_output); + } + if( hChSys.ally && sd->status.guild_id ) { + struct guild *g = sd->guild; + if( !g ) return -1; + sprintf(atcmd_output, msg_txt(1409), hChSys.ally_name, db_size(((struct hChSysCh *)g->channel)->users));// - #%s ( %d users ) + clif->message(fd, atcmd_output); + } + for(channel = dbi_first(iter); dbi_exists(iter); channel = dbi_next(iter)) { + if( show_all || channel->type == hChSys_PUBLIC ) { + sprintf(atcmd_output, msg_txt(1409), channel->name, db_size(channel->users));// - #%s ( %d users ) + clif->message(fd, atcmd_output); + } + } + dbi_destroy(iter); + } + } else if ( strcmpi(key,"setcolor") == 0 ) { + + if( sub1[0] != '#' ) { + clif->message(fd, msg_txt(1405));// Channel name must start with a '#' + return -1; + } + + if( !(channel = strdb_get(clif->channel_db, sub1 + 1)) ) { + sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available + clif->message(fd, atcmd_output); + return -1; + } + + if( channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) { + sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s' + clif->message(fd, atcmd_output); + return -1; + } + + for( k = 0; k < hChSys.colors_count; k++ ) { + if( strcmpi(sub2,hChSys.colors_name[k]) == 0 ) + break; + } + if( k == hChSys.colors_count ) { + sprintf(atcmd_output, msg_txt(1411), sub2);// Unknown color '%s' + clif->message(fd, atcmd_output); + return -1; + } + channel->color = k; + sprintf(atcmd_output, msg_txt(1413),sub1,hChSys.colors_name[k]);// '%s' channel color updated to '%s' + clif->message(fd, atcmd_output); + } else if ( strcmpi(key,"leave") == 0 ) { + + if( sub1[0] != '#' ) { + clif->message(fd, msg_txt(1405));// Channel name must start with a '#' + return -1; + } + + for(k = 0; k < sd->channel_count; k++) { + if( strcmpi(sub1+1,sd->channels[k]->name) == 0 ) + break; + } + if( k == sd->channel_count ) { + sprintf(atcmd_output, msg_txt(1425),sub1);// You're not part of the '%s' channel + clif->message(fd, atcmd_output); + return -1; + } + clif->chsys_left(sd->channels[k],sd); + sprintf(atcmd_output, msg_txt(1425),sub1); // You've left the '%s' channel + clif->message(fd, atcmd_output); + } else if ( strcmpi(key,"bindto") == 0 ) { + + if( sub1[0] != '#' ) { + clif->message(fd, msg_txt(1405));// Channel name must start with a '#' + return -1; + } + + for(k = 0; k < sd->channel_count; k++) { + if( strcmpi(sub1+1,sd->channels[k]->name) == 0 ) + break; + } + if( k == sd->channel_count ) { + sprintf(atcmd_output, msg_txt(1425),sub1);// You're not part of the '%s' channel + clif->message(fd, atcmd_output); + return -1; + } + + sd->gcbind = sd->channels[k]; + sprintf(atcmd_output, msg_txt(1431),sub1); // Your global chat is now binded to the '%s' channel + clif->message(fd, atcmd_output); + } else if ( strcmpi(key,"unbind") == 0 ) { + + if( sd->gcbind == NULL ) { + clif->message(fd, msg_txt(1432));// Your global chat is not binded to any channel + return -1; + } + + sprintf(atcmd_output, msg_txt(1433),sd->gcbind->name); // Your global chat is now unbinded from the '#%s' channel + clif->message(fd, atcmd_output); + + sd->gcbind = NULL; + } else { + atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) )); + } + + return 0; +} +/* debug only, delete after */ +ACMD_FUNC(fontcolor) { + unsigned char k; + + if( !message || !*message ) { + char mout[40]; + for( k = 0; k < hChSys.colors_count; k++ ) { + unsigned short msg_len = 1; + msg_len += sprintf(mout, "[ %s ] : %s",command,hChSys.colors_name[k]); + + WFIFOHEAD(fd,msg_len + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = msg_len + 12; + WFIFOL(fd,4) = 0; + WFIFOL(fd,8) = hChSys.colors[k]; + safestrncpy((char*)WFIFOP(fd,12), mout, msg_len); + WFIFOSET(fd, msg_len + 12); + } + return -1; + } + + if( message[0] == '0' ) { + sd->fontcolor = 0; + pc_disguise(sd,0); + return 0; + } + + for( k = 0; k < hChSys.colors_count; k++ ) { + if( strcmpi(message,hChSys.colors_name[k]) == 0 ) + break; + } + if( k == hChSys.colors_count ) { + sprintf(atcmd_output, msg_txt(1411), message);// Unknown color '%s' + clif->message(fd, atcmd_output); + return -1; + } + + sd->fontcolor = k + 1; + pc_disguise(sd,sd->status.class_); + return 0; +} /** * Fills the reference of available commands in atcommand DBMap **/ @@ -9052,7 +9297,6 @@ void atcommand_basecommands(void) { ACMD_DEF(leave), ACMD_DEF(accept), ACMD_DEF(reject), - ACMD_DEF(main), ACMD_DEF(clone), ACMD_DEF2("slaveclone", clone), ACMD_DEF2("evilclone", clone), @@ -9100,7 +9344,10 @@ void atcommand_basecommands(void) { ACMD_DEF2("rmvperm", addperm), ACMD_DEF(unloadnpcfile), ACMD_DEF(cart), - ACMD_DEF(mount2) + ACMD_DEF(mount2), + ACMD_DEF(join), + ACMD_DEF(channel), + ACMD_DEF(fontcolor) }; AtCommandInfo* atcommand; int i; @@ -9206,7 +9453,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n strcat(buffer," "); } - clif->displaymessage(sd->fd, buffer); + clif->message(sd->fd, buffer); } dbi_destroy(atcommand_iter); @@ -9250,7 +9497,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message if ( type == 1) { //Commands are disabled on maps flagged as 'nocommand' if ( map[sd->bl.m].nocommand && pc_get_group_level(sd) < map[sd->bl.m].nocommand ) { - clif->displaymessage(fd, msg_txt(143)); + clif->message(fd, msg_txt(143)); return false; } } @@ -9294,7 +9541,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message } sprintf(output, msg_txt(1388), charcommand_symbol); // Charcommand failed (usage: %c<command> <char name> <parameters>). - clif->displaymessage(fd, output); + clif->message(fd, output); return true; } while(0); } @@ -9321,7 +9568,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message if (*message == charcommand_symbol && (ssd = map_nick2sd(charname)) == NULL && (ssd = map_nick2sd(charname2)) == NULL ) { sprintf(output, msg_txt(1389), command); // %s failed. Player not found. - clif->displaymessage(fd, output); + clif->message(fd, output); return true; } @@ -9345,7 +9592,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message if (info == NULL) { if( pc_get_group_level(sd) ) { // TODO: remove or replace with proper permission sprintf(output, msg_txt(153), command); // "%s is Unknown Command." - clif->displaymessage(fd, output); + clif->message(fd, output); atcommand_get_suggestions(sd, command + 1, *message == atcommand_symbol); return true; } else @@ -9359,7 +9606,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message return false; } if( pc_isdead(sd) && pc_has_permission(sd,PC_PERM_DISABLE_CMD_DEAD) ) { - clif->displaymessage(fd, msg_txt(1393)); // You can't use commands while dead + clif->message(fd, msg_txt(1393)); // You can't use commands while dead return true; } } @@ -9368,7 +9615,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message if (*message == charcommand_symbol && (ssd = map_nick2sd(charname)) == NULL && (ssd = map_nick2sd(charname2)) == NULL ) { sprintf(output, msg_txt(1389), command); // %s failed. Player not found. - clif->displaymessage(fd, output); + clif->message(fd, output); return true; } @@ -9376,7 +9623,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message if ( (info->func(fd, (*atcmd_msg == atcommand_symbol) ? sd : ssd, command, params) != 0) ) { sprintf(output,msg_txt(154), command); // %s failed. - clif->displaymessage(fd, output); + clif->message(fd, output); return true; } diff --git a/src/map/battle.c b/src/map/battle.c index 8f97ca58d..692750bdb 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1324,7 +1324,7 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama } } if(src->type != BL_MOB) { - struct guild *g = guild_search(status_get_guild_id(src)); + struct guild *g = src->type == BL_PC ? ((TBL_PC *)src)->guild : guild_search(status_get_guild_id(src)); if (class_ == MOBID_EMPERIUM && (!g || guild_checkskill(g,GD_APPROVAL) <= 0 )) return 0; @@ -1335,32 +1335,32 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama } switch (skill_id) { - //Skills with no damage reduction. - case PA_PRESSURE: - case HW_GRAVITATION: - case NJ_ZENYNAGE: - case KO_MUCHANAGE: - break; - default: - /* Uncomment if you want god-mode Emperiums at 100 defense. [Kisuka] - if (md && md->guardian_data) { - damage -= damage * (md->guardian_data->castle->defense/100) * battle_config.castle_defense_rate/100; - } - */ - if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex] - if (flag&BF_WEAPON) - damage = damage * battle_config.gvg_weapon_damage_rate / 100; - if (flag&BF_MAGIC) - damage = damage * battle_config.gvg_magic_damage_rate / 100; - if (flag&BF_MISC) - damage = damage * battle_config.gvg_misc_damage_rate / 100; - } else { //Normal attacks get reductions based on range. - if (flag & BF_SHORT) - damage = damage * battle_config.gvg_short_damage_rate / 100; - if (flag & BF_LONG) - damage = damage * battle_config.gvg_long_damage_rate / 100; - } - if(!damage) damage = 1; + //Skills with no damage reduction. + case PA_PRESSURE: + case HW_GRAVITATION: + case NJ_ZENYNAGE: + case KO_MUCHANAGE: + break; + default: + /* Uncomment if you want god-mode Emperiums at 100 defense. [Kisuka] + if (md && md->guardian_data) { + damage -= damage * (md->guardian_data->castle->defense/100) * battle_config.castle_defense_rate/100; + } + */ + if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex] + if (flag&BF_WEAPON) + damage = damage * battle_config.gvg_weapon_damage_rate / 100; + if (flag&BF_MAGIC) + damage = damage * battle_config.gvg_magic_damage_rate / 100; + if (flag&BF_MISC) + damage = damage * battle_config.gvg_misc_damage_rate / 100; + } else { //Normal attacks get reductions based on range. + if (flag & BF_SHORT) + damage = damage * battle_config.gvg_short_damage_rate / 100; + if (flag & BF_LONG) + damage = damage * battle_config.gvg_long_damage_rate / 100; + } + if(!damage) damage = 1; } return damage; } diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index bd7d92727..fb186917b 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -58,13 +58,13 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots) if( map[sd->bl.m].flag.novending ) {// custom: no vending maps - clif->displaymessage(sd->fd, msg_txt(276)); // "You can't open a shop on this map" + clif->message(sd->fd, msg_txt(276)); // "You can't open a shop on this map" return false; } if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) ) {// custom: no vending cells - clif->displaymessage(sd->fd, msg_txt(204)); // "You can't open a shop on this cell." + clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell." return false; } @@ -101,7 +101,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha if( !pc_can_give_items(sd) ) {// custom: GM is not allowed to buy (give zeny) sd->buyingstore.slots = 0; - clif->displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); clif->buyingstore_open_failed(sd, BUYINGSTORE_CREATE, 0); return; } @@ -113,13 +113,13 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha if( map[sd->bl.m].flag.novending ) {// custom: no vending maps - clif->displaymessage(sd->fd, msg_txt(276)); // "You can't open a shop on this map" + clif->message(sd->fd, msg_txt(276)); // "You can't open a shop on this map" return; } if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) ) {// custom: no vending cells - clif->displaymessage(sd->fd, msg_txt(204)); // "You can't open a shop on this cell." + clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell." return; } @@ -221,7 +221,7 @@ void buyingstore_open(struct map_session_data* sd, int account_id) if( !pc_can_give_items(sd) ) {// custom: GM is not allowed to sell - clif->displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); return; } @@ -259,7 +259,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int if( !pc_can_give_items(sd) ) {// custom: GM is not allowed to sell - clif->displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0); return; } diff --git a/src/map/chat.c b/src/map/chat.c index 98f866133..f908e94ef 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -83,13 +83,13 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char if( map[sd->bl.m].flag.nochat ) { - clif->displaymessage(sd->fd, msg_txt(281)); + clif->message(sd->fd, msg_txt(281)); return 0; //Can't create chatrooms on this map. } if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) ) { - clif->displaymessage (sd->fd, msg_txt(665)); + clif->message (sd->fd, msg_txt(665)); return 0; } diff --git a/src/map/chrif.c b/src/map/chrif.c index d3abb8680..3672aa52f 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -811,7 +811,7 @@ int chrif_changesex(struct map_session_data *sd) { WFIFOW(char_fd,30) = 5; WFIFOSET(char_fd,44); - clif->displaymessage(sd->fd, msg_txt(408)); //"Need disconnection to perform change-sex request..." + clif->message(sd->fd, msg_txt(408)); //"Need disconnection to perform change-sex request..." if (sd->fd) clif->authfail_fd(sd->fd, 15); @@ -856,7 +856,7 @@ static void chrif_char_ask_name_answer(int acc, const char* player_name, uint16 default: output[0] = '\0'; break; } - clif->displaymessage(sd->fd, output); + clif->message(sd->fd, output); } /*========================================== @@ -908,7 +908,7 @@ int chrif_changedsex(int fd) { // save character sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters // do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it) - clif->displaymessage(sd->fd, msg_txt(409)); //"Your sex has been changed (need disconnection by the server)..." + clif->message(sd->fd, msg_txt(409)); //"Your sex has been changed (need disconnection by the server)..." set_eof(sd->fd); // forced to disconnect for the change map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X] } @@ -1004,18 +1004,18 @@ int chrif_accountban(int fd) { if (RFIFOB(fd,6) == 0) { // 0: change of statut, 1: ban int ret_status = RFIFOL(fd,7); // status or final date of a banishment if(0<ret_status && ret_status<=9) - clif->displaymessage(sd->fd, msg_txt(411+ret_status)); + clif->message(sd->fd, msg_txt(411+ret_status)); else if(ret_status==100) - clif->displaymessage(sd->fd, msg_txt(421)); + clif->message(sd->fd, msg_txt(421)); else - clif->displaymessage(sd->fd, msg_txt(420)); //"Your account has not more authorised." + clif->message(sd->fd, msg_txt(420)); //"Your account has not more authorised." } else if (RFIFOB(fd,6) == 1) { // 0: change of statut, 1: ban time_t timestamp; char tmpstr[2048]; timestamp = (time_t)RFIFOL(fd,7); // status or final date of a banishment strcpy(tmpstr, msg_txt(423)); //"Your account has been banished until " strftime(tmpstr + strlen(tmpstr), 24, "%d-%m-%Y %H:%M:%S", localtime(×tamp)); - clif->displaymessage(sd->fd, tmpstr); + clif->message(sd->fd, tmpstr); } set_eof(sd->fd); // forced to disconnect for the change diff --git a/src/map/clif.c b/src/map/clif.c index 120de98c2..51320dd56 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -13,6 +13,7 @@ #include "../common/strlib.h" #include "../common/utils.h" #include "../common/ers.h" +#include "../common/conf.h" #include "map.h" #include "chrif.h" @@ -50,9 +51,6 @@ #include <stdarg.h> #include <time.h> -/* for clif_clearunit_delayed */ -static struct eri *delay_clearunit_ers; - //#define DUMP_UNKNOWN_PACKET //#define DUMP_INVALID_PACKET @@ -61,17 +59,13 @@ struct Clif_Config { int connect_cmd[MAX_PACKET_VER + 1]; //Store the connect command for all versions. [Skotlex] } clif_config; -struct s_packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB + 1]; - //Converts item type in case of pet eggs. -static inline int itemtype(int type) -{ +static inline int itemtype(int type) { return ( type == IT_PETEGG ) ? IT_WEAPON : type; } -static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsigned char dir) -{ +static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsigned char dir) { p += pos; p[0] = (uint8)(x>>2); p[1] = (uint8)((x<<6) | ((y>>4)&0x3f)); @@ -80,8 +74,7 @@ static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsig // client-side: x0+=sx0*0.0625-0.5 and y0+=sy0*0.0625-0.5 -static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) -{ +static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) { p += pos; p[0] = (uint8)(x0>>2); p[1] = (uint8)((x0<<6) | ((y0>>4)&0x3f)); @@ -92,20 +85,17 @@ static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, sh } -static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsigned char dir) -{ +static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsigned char dir) { WBUFPOS(WFIFOP(fd,pos), 0, x, y, dir); } -static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) -{ +static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) { WBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); } -static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* y, unsigned char* dir) -{ +static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* y, unsigned char* dir) { p += pos; if( x ) { @@ -122,8 +112,7 @@ static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* } -static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) -{ +static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) { p += pos; if( x0 ) { @@ -152,28 +141,24 @@ static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short } -static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) -{ +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); } -static inline void RFIFOPOS2(int fd, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) -{ +static inline void RFIFOPOS2(int fd, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) { RBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); } //To idenfity disguised characters. -static inline bool disguised(struct block_list* bl) -{ +static inline bool disguised(struct block_list* bl) { return (bool)( bl->type == BL_PC && ((TBL_PC*)bl)->disguise ); } //Guarantees that the given string does not exceeds the allowed size, as well as making sure it's null terminated. [Skotlex] -static inline unsigned int mes_len_check(char* mes, unsigned int len, unsigned int max) -{ +static inline unsigned int mes_len_check(char* mes, unsigned int len, unsigned int max) { if( len > max ) len = max; @@ -182,14 +167,10 @@ static inline unsigned int mes_len_check(char* mes, unsigned int len, unsigned i return len; } - -static int clif_parse (int fd); - /*========================================== * Ip setting of map-server *------------------------------------------*/ -int clif_setip(const char* ip) -{ +int clif_setip(const char* ip) { char ip_str[16]; clif->map_ip = host2ip(ip); if (!clif->map_ip) { @@ -202,8 +183,7 @@ int clif_setip(const char* ip) return 1; } -void clif_setbindip(const char* ip) -{ +void clif_setbindip(const char* ip) { clif->bind_ip = host2ip(ip); if (clif->bind_ip) { char ip_str[16]; @@ -253,7 +233,7 @@ uint32 clif_refresh_ip(void) { #if PACKETVER >= 20071106 static inline unsigned char clif_bl_type(struct block_list *bl) { switch (bl->type) { - case BL_PC: return disguised(bl)?0x1:0x0; //PC_TYPE + case BL_PC: return disguised(bl) && pcdb_checkid(status_get_viewdata(bl)->class_)? 0x1:0x0; //PC_TYPE case BL_ITEM: return 0x2; //ITEM_TYPE case BL_SKILL: return 0x3; //SKILL_TYPE case BL_CHAT: return 0x4; //UNKNOWN_TYPE @@ -278,8 +258,7 @@ static inline unsigned char clif_bl_type(struct block_list *bl) { * - AREA_WOS (AREA WITHOUT SELF) : Not run for self * - AREA_CHAT_WOC : Everyone in the area of your chat without a chat *------------------------------------------*/ -static int clif_send_sub(struct block_list *bl, va_list ap) -{ +int clif_send_sub(struct block_list *bl, va_list ap) { struct block_list *src_bl; struct map_session_data *sd; unsigned char *buf; @@ -356,7 +335,7 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; struct s_mapiterator* iter; - if( type != ALL_CLIENT && type != CHAT_MAINCHAT ) + if( type != ALL_CLIENT ) nullpo_ret(bl); sd = BL_CAST(BL_PC, bl); @@ -393,11 +372,11 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target clif->send (buf, len, bl, SELF); case AREA_WOC: case AREA_WOS: - map_foreachinarea(clif_send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, + map_foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, BL_PC, buf, len, bl, type); break; case AREA_CHAT_WOC: - map_foreachinarea(clif_send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), + map_foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC); break; @@ -427,20 +406,6 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target } break; - case CHAT_MAINCHAT: //[LuzZza] - iter = mapit_getallusers(); - while( (tsd = (TBL_PC*)mapit_next(iter)) != NULL ) - { - if( tsd->state.mainchat && tsd->chatID == 0 && packet_db[tsd->packet_ver][RBUFW(buf,0)].len ) - { // packet must exist for the client version - WFIFOHEAD(tsd->fd, len); - memcpy(WFIFOP(tsd->fd,0), buf, len); - WFIFOSET(tsd->fd,len); - } - } - mapit_free(iter); - break; - case PARTY_AREA: case PARTY_AREA_WOS: x0 = bl->x - AREA_SIZE; @@ -535,7 +500,7 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target case GUILD_WOS: case GUILD_NOBG: if (sd && sd->status.guild_id) - g = guild_search(sd->status.guild_id); + g = sd->guild; if (g) { for(i = 0; i < g->max_member; i++) { @@ -698,7 +663,7 @@ void clif_authrefuse(int fd, uint8 error_code) /// ? = disconnected -> MsgStringTable[3] void clif_authfail_fd(int fd, int type) { - if (!fd || !session[fd] || session[fd]->func_parse != clif_parse) //clif_authfail should only be invoked on players! + if (!fd || !session[fd] || session[fd]->func_parse != clif->parse) //clif_authfail should only be invoked on players! return; WFIFOHEAD(fd, packet_len(0x81)); @@ -825,18 +790,17 @@ void clif_clearunit_area(struct block_list* bl, clr_type type) /// Used to make monsters with player-sprites disappear after dying /// like normal monsters, because the client does not remove those /// automatically. -static int clif_clearunit_delayed_sub(int tid, unsigned int tick, int id, intptr_t data) -{ +int clif_clearunit_delayed_sub(int tid, unsigned int tick, int id, intptr_t data) { struct block_list *bl = (struct block_list *)data; - clif_clearunit_area(bl, (clr_type) id); - ers_free(delay_clearunit_ers,bl); + clif->clearunit_area(bl, (clr_type) id); + ers_free(clif->delay_clearunit_ers,bl); return 0; } void clif_clearunit_delayed(struct block_list* bl, clr_type type, unsigned int tick) { - struct block_list *tbl = ers_alloc(delay_clearunit_ers, struct block_list); + struct block_list *tbl = ers_alloc(clif->delay_clearunit_ers, struct block_list); memcpy (tbl, bl, sizeof (struct block_list)); - add_timer(tick, clif_clearunit_delayed_sub, (int)type, (intptr_t)tbl); + add_timer(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)tbl); } void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand) @@ -877,31 +841,23 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un } //To make the assignation of the level based on limits clearer/easier. [Skotlex] -static int clif_setlevel_sub(int lv) -{ - if( lv < battle_config.max_lv ) - { +static int clif_setlevel_sub(int lv) { + if( lv < battle_config.max_lv ) { ; - } - else if( lv < battle_config.aura_lv ) - { + } else if( lv < battle_config.aura_lv ) { lv = battle_config.max_lv - 1; - } - else - { + } else { lv = battle_config.max_lv; } return lv; } -static int clif_setlevel(struct block_list* bl) -{ +static int clif_setlevel(struct block_list* bl) { int lv = status_get_lv(bl); if( battle_config.client_limit_unit_lv&bl->type ) return clif_setlevel_sub(lv); - switch( bl->type ) - { + switch( bl->type ) { case BL_NPC: case BL_PET: // npcs and pets do not have level @@ -913,8 +869,7 @@ static int clif_setlevel(struct block_list* bl) /*========================================== * Prepares 'unit standing/spawning' packet *------------------------------------------*/ -static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool spawn) -{ +int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool spawn) { struct map_session_data* sd; struct status_change* sc = status_get_sc(bl); struct view_data* vd = status_get_viewdata(bl); @@ -1079,8 +1034,7 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool /*========================================== * Prepares 'unit walking' packet *------------------------------------------*/ -static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, unsigned char* buffer) -{ +int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, unsigned char* buffer) { struct map_session_data* sd; struct status_change* sc = status_get_sc(bl); struct view_data* vd = status_get_viewdata(bl); @@ -1185,8 +1139,7 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un //Modifies the buffer for disguise characters and sends it to self. //Used for spawn/walk packets, where the ID offset changes for packetver >=9 -static void clif_setdisguise(struct block_list *bl, unsigned char *buf,int len) -{ +void clif_setdisguise(struct block_list *bl, unsigned char *buf,int len) { #if PACKETVER >= 20091103 WBUFB(buf,4)= pcdb_checkid(status_get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE WBUFL(buf,5)=-bl->id; @@ -1223,8 +1176,7 @@ void clif_class_change(struct block_list *bl,int class_,int type) /// Notifies the client of an object's spirits. /// 01d0 <id>.L <amount>.W (ZC_SPIRITS) /// 01e1 <id>.L <amount>.W (ZC_SPIRITS2) -static void clif_spiritball_single(int fd, struct map_session_data *sd) -{ +void clif_spiritball_single(int fd, struct map_session_data *sd) { WFIFOHEAD(fd, packet_len(0x1e1)); WFIFOW(fd,0)=0x1e1; WFIFOL(fd,2)=sd->bl.id; @@ -1235,8 +1187,7 @@ static void clif_spiritball_single(int fd, struct map_session_data *sd) /*========================================== * Kagerou/Oboro amulet spirit *------------------------------------------*/ -static void clif_talisman_single(int fd, struct map_session_data *sd, short type) -{ +void clif_talisman_single(int fd, struct map_session_data *sd, short type) { WFIFOHEAD(fd, packet_len(0x08cf)); WFIFOW(fd,0)=0x08cf; WFIFOL(fd,2)=sd->bl.id; @@ -1249,8 +1200,7 @@ static void clif_talisman_single(int fd, struct map_session_data *sd, short type * Run when player changes map / refreshes * Tells its client to display all weather settings being used by this map *------------------------------------------*/ -static void clif_weather_check(struct map_session_data *sd) -{ +void clif_weather_check(struct map_session_data *sd) { int16 m = sd->bl.m; int fd = sd->fd; @@ -1260,12 +1210,7 @@ static void clif_weather_check(struct map_session_data *sd) || map[m].flag.fireworks || map[m].flag.sakura || map[m].flag.leaves - /** - * No longer available, keeping here just in case it's back someday. [Ind] - **/ - //|| map[m].flag.rain - || map[m].flag.clouds2) - { + || map[m].flag.clouds2) { if (map[m].flag.snow) clif->specialeffect_single(&sd->bl, 162, fd); if (map[m].flag.clouds) @@ -1320,10 +1265,10 @@ int clif_spawn(struct block_list *bl) if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE)) return 0; - len = clif_set_unit_idle(bl, buf,true); + len = clif->set_unit_idle(bl, buf,true); clif->send(buf, len, bl, AREA_WOS); if (disguised(bl)) - clif_setdisguise(bl, buf, len); + clif->setdisguise(bl, buf, len); if (vd->cloth_color) clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); @@ -1549,44 +1494,42 @@ void clif_walkok(struct map_session_data *sd) } -static void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) -{ +void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { uint8 buf[128]; int len; - len = clif_set_unit_walking(bl,ud,buf); + len = clif->set_unit_walking(bl,ud,buf); clif->send(buf,len,bl,AREA_WOS); if (disguised(bl)) - clif_setdisguise(bl, buf, len); + clif->setdisguise(bl, buf, len); if(vd->cloth_color) clif->refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); - switch(bl->type) - { - case BL_PC: - { - TBL_PC *sd = ((TBL_PC*)bl); -// clif_movepc(sd); - if(sd->state.size==SZ_BIG) // tiny/big players [Valaris] - clif->specialeffect(&sd->bl,423,AREA); - else if(sd->state.size==SZ_MEDIUM) - clif->specialeffect(&sd->bl,421,AREA); - } - break; - case BL_MOB: - { - TBL_MOB *md = ((TBL_MOB*)bl); - if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris] - clif->specialeffect(&md->bl,423,AREA); - else if(md->special_state.size==SZ_MEDIUM) - clif->specialeffect(&md->bl,421,AREA); - } - break; - case BL_PET: - if( vd->head_bottom ) // needed to display pet equip properly - clif->send_petdata(NULL, (TBL_PET*)bl, 3, vd->head_bottom); - break; + switch(bl->type) { + case BL_PC: + { + TBL_PC *sd = ((TBL_PC*)bl); + // clif_movepc(sd); + if(sd->state.size==SZ_BIG) // tiny/big players [Valaris] + clif->specialeffect(&sd->bl,423,AREA); + else if(sd->state.size==SZ_MEDIUM) + clif->specialeffect(&sd->bl,421,AREA); + } + break; + case BL_MOB: + { + TBL_MOB *md = ((TBL_MOB*)bl); + if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris] + clif->specialeffect(&md->bl,423,AREA); + else if(md->special_state.size==SZ_MEDIUM) + clif->specialeffect(&md->bl,421,AREA); + } + break; + case BL_PET: + if( vd->head_bottom ) // needed to display pet equip properly + clif->send_petdata(NULL, (TBL_PET*)bl, 3, vd->head_bottom); + break; } } @@ -1614,7 +1557,7 @@ void clif_move(struct unit_data *ud) // Since we don't know how to update the speed of other objects, // use the old walk packet to update the data. ud->state.speed_changed = 0; - clif_move2(bl, vd, ud); + clif->move2(bl, vd, ud); return; } @@ -1634,8 +1577,7 @@ void clif_move(struct unit_data *ud) /*========================================== * Delays the map_quit of a player after they are disconnected. [Skotlex] *------------------------------------------*/ -static int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) -{ +int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data *sd = NULL; //Remove player from map server @@ -1647,17 +1589,16 @@ static int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) /*========================================== * *------------------------------------------*/ -void clif_quitsave(int fd,struct map_session_data *sd) -{ +void clif_quitsave(int fd,struct map_session_data *sd) { if (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) map_quit(sd); - else if (sd->fd) - { //Disassociate session from player (session is deleted after this function was called) + else if (sd->fd) { + //Disassociate session from player (session is deleted after this function was called) //And set a timer to make him quit later. session[sd->fd]->session_data = NULL; sd->fd = 0; - add_timer(gettick() + 10000, clif_delayquit, sd->bl.id, 0); + add_timer(gettick() + 10000, clif->delayquit, sd->bl.id, 0); } } @@ -1773,7 +1714,21 @@ void clif_buylist(struct map_session_data *sd, struct npc_data *nd) WFIFOW(fd,2) = 4 + c*11; WFIFOSET(fd,WFIFOW(fd,2)); } - +void clif_hercules_chsys_create(struct hChSysCh *channel, char *name, char *pass, unsigned char color) { + channel->users = idb_alloc(DB_OPT_BASE); + if( name ) + safestrncpy(channel->name, name, HCHSYS_NAME_LENGTH); + channel->color = color; + if( !pass ) + channel->pass[0] = '\0'; + else + safestrncpy(channel->pass, pass, HCHSYS_NAME_LENGTH); + + channel->opt = hChSys_OPT_BASE; + + if( channel->type != hChSys_MAP && channel->type != hChSys_ALLY ) + strdb_put(clif->channel_db, channel->name, channel); +} /// Presents list of items, that can be sold to an NPC shop (ZC_PC_SELL_ITEMLIST). /// 00c7 <packet len>.W { <index>.W <price>.L <overcharge price>.L }* @@ -2038,8 +1993,25 @@ void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, in WFIFOL(fd,19)=color; WFIFOSET(fd,packet_len(0x144)); } - - +void clif_hercules_chsys_join(struct hChSysCh *channel, struct map_session_data *sd) { + RECREATE(sd->channels, struct hChSysCh *, ++sd->channel_count); + sd->channels[ sd->channel_count - 1 ] = channel; + idb_put(channel->users, sd->status.char_id, sd); + + if( sd->stealth ) { + sd->stealth = false; + } else if( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) { + char message[60]; + sprintf(message, "#%s '%s' joined",channel->name,sd->status.name); + clif->chsys_msg(channel,sd,message); + } + + /* someone is cheating, we kindly disconnect the bastard */ + if( sd->channel_count > 200 ) { + set_eof(sd->fd); + } + +} /// Displays an illustration image. /// 0145 <image name>.16B <type>.B (ZC_SHOW_IMAGE) /// 01b3 <image name>.64B <type>.B (ZC_SHOW_IMAGE2) @@ -2067,8 +2039,7 @@ void clif_cutin(struct map_session_data* sd, const char* image, int type) /*========================================== * Fills in card data from the given item and into the buffer. [Skotlex] *------------------------------------------*/ -static void clif_addcards(unsigned char* buf, struct item* item) -{ +void clif_addcards(unsigned char* buf, struct item* item) { int i=0,j; if( item == NULL ) { //Blank data WBUFW(buf,0) = 0; @@ -2177,7 +2148,7 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail) WFIFOB(fd,8)=sd->status.inventory[n].identify; WFIFOB(fd,9)=sd->status.inventory[n].attribute; WFIFOB(fd,10)=sd->status.inventory[n].refine; - clif_addcards(WFIFOP(fd,11), &sd->status.inventory[n]); + clif->addcards(WFIFOP(fd,11), &sd->status.inventory[n]); WFIFOW(fd,19)=pc_equippoint(sd,n); WFIFOB(fd,21)=itemtype(sd->inventory_data[n]->type); WFIFOB(fd,22)=fail; @@ -2224,7 +2195,7 @@ void clif_dropitem(struct map_session_data *sd,int n,int amount) void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) { #if PACKETVER < 20091117 - clif_dropitem(sd,n,amount); + clif->dropitem(sd,n,amount); #else int fd; @@ -2245,8 +2216,7 @@ void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) // Simplifies inventory/cart/storage packets by handling the packet section relevant to items. [Skotlex] // Equip is >= 0 for equippable items (holds the equip-point, is 0 for pet // armor/egg) -1 for stackable items, -2 for stackable items where arrows must send in the equip-point. -void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *id, int equip) -{ +void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *id, int equip) { if (id->view_id > 0) WBUFW(buf,n)=id->view_id; else @@ -2267,10 +2237,8 @@ void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data * } } -void clif_favorite_item(struct map_session_data* sd, unsigned short index); //Unified inventory function which sends all of the inventory (requires two packets, one for equipable items and one for stackable ones. [Skotlex] -void clif_inventorylist(struct map_session_data *sd) -{ +void clif_inventorylist(struct map_session_data *sd) { int i,n,ne,arrow=-1; unsigned char *buf; unsigned char *bufe; @@ -2301,8 +2269,8 @@ void clif_inventorylist(struct map_session_data *sd) if( !itemdb_isstackable2(sd->inventory_data[i]) ) { //Non-stackable (Equippable) WBUFW(bufe,ne*se+4)=i+2; - clif_item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i)); - clif_addcards(WBUFP(bufe, ne*se+16), &sd->status.inventory[i]); + clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i)); + clif->addcards(WBUFP(bufe, ne*se+16), &sd->status.inventory[i]); #if PACKETVER >= 20071002 WBUFL(bufe,ne*se+24)=sd->status.inventory[i].expire_time; WBUFW(bufe,ne*se+28)=0; //Unknown @@ -2318,11 +2286,11 @@ void clif_inventorylist(struct map_session_data *sd) else { //Stackable. WBUFW(buf,n*s+4)=i+2; - clif_item_sub(buf, n*s+6, &sd->status.inventory[i], sd->inventory_data[i], -2); + clif->item_sub(buf, n*s+6, &sd->status.inventory[i], sd->inventory_data[i], -2); if( sd->inventory_data[i]->equip == EQP_AMMO && sd->status.inventory[i].equip ) arrow=i; #if PACKETVER >= 5 - clif_addcards(WBUFP(buf, n*s+14), &sd->status.inventory[i]); + clif->addcards(WBUFP(buf, n*s+14), &sd->status.inventory[i]); #endif #if PACKETVER >= 20080102 WBUFL(buf,n*s+22)=sd->status.inventory[i].expire_time; @@ -2359,7 +2327,7 @@ void clif_inventorylist(struct map_session_data *sd) continue; if ( sd->status.inventory[i].favorite ) - clif_favorite_item(sd, i); + clif->favorite_item(sd, i); } #endif @@ -2391,8 +2359,8 @@ void clif_equiplist(struct map_session_data *sd) continue; //Equippable WBUFW(buf,n*cmd+4)=i+2; - clif_item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i)); - clif_addcards(WBUFP(buf, n*cmd+16), &sd->status.inventory[i]); + clif->item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i)); + clif->addcards(WBUFP(buf, n*cmd+16), &sd->status.inventory[i]); #if PACKETVER >= 20071002 WBUFL(buf,n*cmd+24)=sd->status.inventory[i].expire_time; WBUFW(buf,n*cmd+28)=0; //Unknown @@ -2448,8 +2416,8 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items if( !itemdb_isstackable2(id) ) { //Equippable WBUFW(bufe,ne*cmd+4)=i+1; - clif_item_sub(bufe, ne*cmd+6, &items[i], id, id->equip); - clif_addcards(WBUFP(bufe, ne*cmd+16), &items[i]); + clif->item_sub(bufe, ne*cmd+6, &items[i], id, id->equip); + clif->addcards(WBUFP(bufe, ne*cmd+16), &items[i]); #if PACKETVER >= 20071002 WBUFL(bufe,ne*cmd+24)=items[i].expire_time; WBUFW(bufe,ne*cmd+28)=0; //Unknown @@ -2459,9 +2427,9 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items else { //Stackable WBUFW(buf,n*s+4)=i+1; - clif_item_sub(buf, n*s+6, &items[i], id,-1); + clif->item_sub(buf, n*s+6, &items[i], id,-1); #if PACKETVER >= 5 - clif_addcards(WBUFP(buf,n*s+14), &items[i]); + clif->addcards(WBUFP(buf,n*s+14), &items[i]); #endif #if PACKETVER >= 20080102 WBUFL(buf,n*s+22)=items[i].expire_time; @@ -2528,8 +2496,8 @@ void clif_cartlist(struct map_session_data *sd) if( !itemdb_isstackable2(id) ) { //Equippable WBUFW(bufe,ne*cmd+4)=i+2; - clif_item_sub(bufe, ne*cmd+6, &sd->status.cart[i], id, id->equip); - clif_addcards(WBUFP(bufe, ne*cmd+16), &sd->status.cart[i]); + clif->item_sub(bufe, ne*cmd+6, &sd->status.cart[i], id, id->equip); + clif->addcards(WBUFP(bufe, ne*cmd+16), &sd->status.cart[i]); #if PACKETVER >= 20071002 WBUFL(bufe,ne*cmd+24)=sd->status.cart[i].expire_time; WBUFW(bufe,ne*cmd+28)=0; //Unknown @@ -2539,9 +2507,9 @@ void clif_cartlist(struct map_session_data *sd) else { //Stackable WBUFW(buf,n*s+4)=i+2; - clif_item_sub(buf, n*s+6, &sd->status.cart[i], id,-1); + clif->item_sub(buf, n*s+6, &sd->status.cart[i], id,-1); #if PACKETVER >= 5 - clif_addcards(WBUFP(buf,n*s+14), &sd->status.cart[i]); + clif->addcards(WBUFP(buf,n*s+14), &sd->status.cart[i]); #endif #if PACKETVER >= 20080102 WBUFL(buf,n*s+22)=sd->status.cart[i].expire_time; @@ -2635,12 +2603,142 @@ void clif_guild_xy_remove(struct map_session_data *sd) WBUFW(buf,8)=-1; clif->send(buf,packet_len(0x1eb),&sd->bl,GUILD_SAMEMAP_WOS); } +void read_channels_config(void) { + config_t channels_conf; + config_setting_t *chsys = NULL; + const char *config_filename = "conf/channels.conf"; // FIXME hardcoded name + + if (conf_read_file(&channels_conf, config_filename)) + return; + + chsys = config_lookup(&channels_conf, "chsys"); + + if (chsys != NULL) { + config_setting_t *settings = config_setting_get_elem(chsys, 0); + config_setting_t *channels; + config_setting_t *colors; + int i,k; + const char *local_name, *ally_name, + *local_color, *ally_color; + int ally_enabled = 0, local_enabled = 0, + local_autojoin = 0, ally_autojoin = 0, + allow_user_channel_creation = 0; + + if( !config_setting_lookup_string(settings, "map_local_channel_name", &local_name) ) + local_name = "map"; + safestrncpy(hChSys.local_name, local_name, HCHSYS_NAME_LENGTH); + + if( !config_setting_lookup_string(settings, "ally_channel_name", &ally_name) ) + ally_name = "ally"; + safestrncpy(hChSys.ally_name, ally_name, HCHSYS_NAME_LENGTH); + + config_setting_lookup_bool(settings, "map_local_channel", &local_enabled); + config_setting_lookup_bool(settings, "ally_channel_enabled", &ally_enabled); + + if( local_enabled ) + hChSys.local = true; + if( ally_enabled ) + hChSys.ally = true; + + config_setting_lookup_bool(settings, "map_local_channel_autojoin", &local_autojoin); + config_setting_lookup_bool(settings, "ally_channel_autojoin", &ally_autojoin); + + if( local_autojoin ) + hChSys.local_autojoin = true; + if( ally_autojoin ) + hChSys.ally_autojoin = true; + + config_setting_lookup_bool(settings, "allow_user_channel_creation", &allow_user_channel_creation); + + if( allow_user_channel_creation ) + hChSys.allow_user_channel_creation = true; + + if( (colors = config_setting_get_member(settings, "colors")) != NULL ) { + int color_count = config_setting_length(colors); + CREATE( hChSys.colors, unsigned long, color_count ); + CREATE( hChSys.colors_name, char *, color_count ); + for(i = 0; i < color_count; i++) { + config_setting_t *color = config_setting_get_elem(colors, i); + + CREATE( hChSys.colors_name[i], char, HCHSYS_NAME_LENGTH ); + + safestrncpy(hChSys.colors_name[i], config_setting_name(color), HCHSYS_NAME_LENGTH); + + hChSys.colors[i] = strtoul(config_setting_get_string_elem(colors,i),NULL,0); + hChSys.colors[i] = (hChSys.colors[i] & 0x0000FF) << 16 | (hChSys.colors[i] & 0x00FF00) | (hChSys.colors[i] & 0xFF0000) >> 16;//RGB to BGR + } + hChSys.colors_count = color_count; + } + + config_setting_lookup_string(settings, "map_local_channel_color", &local_color); + + for (k = 0; k < hChSys.colors_count; k++) { + if( strcmpi(hChSys.colors_name[k],local_color) == 0 ) + break; + } + + if( k < hChSys.colors_count ) { + hChSys.local_color = k; + } else { + ShowError("channels.conf: unknown color '%s' for channel 'map_local_channel_color', disabling '#%s'...\n",local_color,local_name); + hChSys.local = false; + } + + config_setting_lookup_string(settings, "ally_channel_color", &ally_color); + + for (k = 0; k < hChSys.colors_count; k++) { + if( strcmpi(hChSys.colors_name[k],ally_color) == 0 ) + break; + } + + if( k < hChSys.colors_count ) { + hChSys.ally_color = k; + } else { + ShowError("channels.conf: unknown color '%s' for channel 'ally_channel_color', disabling '#%s'...\n",local_color,ally_name); + hChSys.ally = false; + } + + if( (channels = config_setting_get_member(settings, "default_channels")) != NULL ) { + int channel_count = config_setting_length(channels); + + for(i = 0; i < channel_count; i++) { + config_setting_t *channel = config_setting_get_elem(channels, i); + const char *name = config_setting_name(channel); + const char *color = config_setting_get_string_elem(channels,i); + struct hChSysCh *chd; + + for (k = 0; k < hChSys.colors_count; k++) { + if( strcmpi(hChSys.colors_name[k],color) == 0 ) + break; + } + if( k == hChSys.colors_count ) { + ShowError("channels.conf: unknown color '%s' for channel '%s', skipping channel...\n",color,name); + continue; + } + if( strcmpi(name,hChSys.local_name) == 0 || strcmpi(name,hChSys.ally_name) == 0 || strdb_exists(clif->channel_db, name) ) { + ShowError("channels.conf: duplicate channel '%s', skipping channel...\n",name); + continue; + + } + CREATE( chd, struct hChSysCh, 1 ); + + safestrncpy(chd->name, name, HCHSYS_NAME_LENGTH); + chd->type = hChSys_PUBLIC; + + clif->chsys_create(chd,NULL,NULL,k); + } + } + + ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(clif->channel_db), config_filename); + config_destroy(&channels_conf); + } +} + /*========================================== * *------------------------------------------*/ -static int clif_hpmeter_sub(struct block_list *bl, va_list ap) -{ +int clif_hpmeter_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd, *tsd; #if PACKETVER < 20100126 const int cmd = 0x106; @@ -2683,10 +2781,9 @@ static int clif_hpmeter_sub(struct block_list *bl, va_list ap) * Server tells all players that are allowed to view HP bars * and are nearby 'sd' that 'sd' hp bar was updated. *------------------------------------------*/ -static int clif_hpmeter(struct map_session_data *sd) -{ +int clif_hpmeter(struct map_session_data *sd) { nullpo_ret(sd); - map_foreachinarea(clif_hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd); + map_foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd); return 0; } @@ -2714,205 +2811,205 @@ void clif_updatestatus(struct map_session_data *sd,int type) WFIFOW(fd,0)=0xb0; WFIFOW(fd,2)=type; switch(type){ - // 00b0 - case SP_WEIGHT: - pc_updateweightstatus(sd); - WFIFOHEAD(fd,14); - WFIFOW(fd,0)=0xb0; //Need to re-set as pc_updateweightstatus can alter the buffer. [Skotlex] - WFIFOW(fd,2)=type; - WFIFOL(fd,4)=sd->weight; - break; - case SP_MAXWEIGHT: - WFIFOL(fd,4)=sd->max_weight; - break; - case SP_SPEED: - WFIFOL(fd,4)=sd->battle_status.speed; - break; - case SP_BASELEVEL: - WFIFOL(fd,4)=sd->status.base_level; - break; - case SP_JOBLEVEL: - WFIFOL(fd,4)=sd->status.job_level; - break; - case SP_KARMA: // Adding this back, I wonder if the client intercepts this - [Lance] - WFIFOL(fd,4)=sd->status.karma; - break; - case SP_MANNER: - WFIFOL(fd,4)=sd->status.manner; - break; - case SP_STATUSPOINT: - WFIFOL(fd,4)=sd->status.status_point; - break; - case SP_SKILLPOINT: - WFIFOL(fd,4)=sd->status.skill_point; - break; - case SP_HIT: - WFIFOL(fd,4)=sd->battle_status.hit; - break; - case SP_FLEE1: - WFIFOL(fd,4)=sd->battle_status.flee; - break; - case SP_FLEE2: - WFIFOL(fd,4)=sd->battle_status.flee2/10; - break; - case SP_MAXHP: - WFIFOL(fd,4)=sd->battle_status.max_hp; - break; - case SP_MAXSP: - WFIFOL(fd,4)=sd->battle_status.max_sp; - break; - case SP_HP: - WFIFOL(fd,4)=sd->battle_status.hp; - // TODO: Won't these overwrite the current packet? - clif_hpmeter(sd); - if( !battle_config.party_hp_mode && sd->status.party_id ) - clif->party_hp(sd); - if( sd->bg_id ) - clif->bg_hp(sd); - break; - case SP_SP: - WFIFOL(fd,4)=sd->battle_status.sp; - break; - case SP_ASPD: - WFIFOL(fd,4)=sd->battle_status.amotion; - break; - case SP_ATK1: - WFIFOL(fd,4)=pc_leftside_atk(sd); - break; - case SP_DEF1: - WFIFOL(fd,4)=pc_leftside_def(sd); - break; - case SP_MDEF1: - WFIFOL(fd,4)=pc_leftside_mdef(sd); - break; - case SP_ATK2: - WFIFOL(fd,4)=pc_rightside_atk(sd); - break; - case SP_DEF2: - WFIFOL(fd,4)=pc_rightside_def(sd); - break; - case SP_MDEF2: { - //negative check (in case you have something like Berserk active) - int mdef2 = pc_rightside_mdef(sd); + // 00b0 + case SP_WEIGHT: + pc_updateweightstatus(sd); + WFIFOHEAD(fd,14); + WFIFOW(fd,0)=0xb0; //Need to re-set as pc_updateweightstatus can alter the buffer. [Skotlex] + WFIFOW(fd,2)=type; + WFIFOL(fd,4)=sd->weight; + break; + case SP_MAXWEIGHT: + WFIFOL(fd,4)=sd->max_weight; + break; + case SP_SPEED: + WFIFOL(fd,4)=sd->battle_status.speed; + break; + case SP_BASELEVEL: + WFIFOL(fd,4)=sd->status.base_level; + break; + case SP_JOBLEVEL: + WFIFOL(fd,4)=sd->status.job_level; + break; + case SP_KARMA: // Adding this back, I wonder if the client intercepts this - [Lance] + WFIFOL(fd,4)=sd->status.karma; + break; + case SP_MANNER: + WFIFOL(fd,4)=sd->status.manner; + break; + case SP_STATUSPOINT: + WFIFOL(fd,4)=sd->status.status_point; + break; + case SP_SKILLPOINT: + WFIFOL(fd,4)=sd->status.skill_point; + break; + case SP_HIT: + WFIFOL(fd,4)=sd->battle_status.hit; + break; + case SP_FLEE1: + WFIFOL(fd,4)=sd->battle_status.flee; + break; + case SP_FLEE2: + WFIFOL(fd,4)=sd->battle_status.flee2/10; + break; + case SP_MAXHP: + WFIFOL(fd,4)=sd->battle_status.max_hp; + break; + case SP_MAXSP: + WFIFOL(fd,4)=sd->battle_status.max_sp; + break; + case SP_HP: + WFIFOL(fd,4)=sd->battle_status.hp; + // TODO: Won't these overwrite the current packet? + clif->hpmeter(sd); + if( !battle_config.party_hp_mode && sd->status.party_id ) + clif->party_hp(sd); + if( sd->bg_id ) + clif->bg_hp(sd); + break; + case SP_SP: + WFIFOL(fd,4)=sd->battle_status.sp; + break; + case SP_ASPD: + WFIFOL(fd,4)=sd->battle_status.amotion; + break; + case SP_ATK1: + WFIFOL(fd,4)=pc_leftside_atk(sd); + break; + case SP_DEF1: + WFIFOL(fd,4)=pc_leftside_def(sd); + break; + case SP_MDEF1: + WFIFOL(fd,4)=pc_leftside_mdef(sd); + break; + case SP_ATK2: + WFIFOL(fd,4)=pc_rightside_atk(sd); + break; + case SP_DEF2: + WFIFOL(fd,4)=pc_rightside_def(sd); + break; + case SP_MDEF2: { + //negative check (in case you have something like Berserk active) + int mdef2 = pc_rightside_mdef(sd); - WFIFOL(fd,4)= -#ifndef RENEWAL - ( mdef2 < 0 ) ? 0 : -#endif - mdef2; + WFIFOL(fd,4)= + #ifndef RENEWAL + ( mdef2 < 0 ) ? 0 : + #endif + mdef2; - } - break; - case SP_CRITICAL: - WFIFOL(fd,4)=sd->battle_status.cri/10; - break; - case SP_MATK1: - WFIFOL(fd,4)=pc_rightside_matk(sd); - break; - case SP_MATK2: - WFIFOL(fd,4)=pc_leftside_matk(sd); - break; + } + break; + case SP_CRITICAL: + WFIFOL(fd,4)=sd->battle_status.cri/10; + break; + case SP_MATK1: + WFIFOL(fd,4)=pc_rightside_matk(sd); + break; + case SP_MATK2: + WFIFOL(fd,4)=pc_leftside_matk(sd); + break; - case SP_ZENY: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=sd->status.zeny; - break; - case SP_BASEEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=sd->status.base_exp; - break; - case SP_JOBEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=sd->status.job_exp; - break; - case SP_NEXTBASEEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=pc_nextbaseexp(sd); - break; - case SP_NEXTJOBEXP: - WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=pc_nextjobexp(sd); - break; + case SP_ZENY: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.zeny; + break; + case SP_BASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.base_exp; + break; + case SP_JOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=sd->status.job_exp; + break; + case SP_NEXTBASEEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc_nextbaseexp(sd); + break; + case SP_NEXTJOBEXP: + WFIFOW(fd,0)=0xb1; + WFIFOL(fd,4)=pc_nextjobexp(sd); + break; - /** - * SP_U<STAT> are used to update the amount of points necessary to increase that stat - **/ - case SP_USTR: - case SP_UAGI: - case SP_UVIT: - case SP_UINT: - case SP_UDEX: - case SP_ULUK: - WFIFOW(fd,0)=0xbe; - WFIFOB(fd,4)=pc_need_status_point(sd,type-SP_USTR+SP_STR,1); - len=5; - break; + /** + * SP_U<STAT> are used to update the amount of points necessary to increase that stat + **/ + case SP_USTR: + case SP_UAGI: + case SP_UVIT: + case SP_UINT: + case SP_UDEX: + case SP_ULUK: + WFIFOW(fd,0)=0xbe; + WFIFOB(fd,4)=pc_need_status_point(sd,type-SP_USTR+SP_STR,1); + len=5; + break; - /** - * Tells the client how far it is allowed to attack (weapon range) - **/ - case SP_ATTACKRANGE: - WFIFOW(fd,0)=0x13a; - WFIFOW(fd,2)=sd->battle_status.rhw.range; - len=4; - break; + /** + * Tells the client how far it is allowed to attack (weapon range) + **/ + case SP_ATTACKRANGE: + WFIFOW(fd,0)=0x13a; + WFIFOW(fd,2)=sd->battle_status.rhw.range; + len=4; + break; - case SP_STR: - WFIFOW(fd,0)=0x141; - WFIFOL(fd,2)=type; - WFIFOL(fd,6)=sd->status.str; - WFIFOL(fd,10)=sd->battle_status.str - sd->status.str; - len=14; - break; - case SP_AGI: - WFIFOW(fd,0)=0x141; - WFIFOL(fd,2)=type; - WFIFOL(fd,6)=sd->status.agi; - WFIFOL(fd,10)=sd->battle_status.agi - sd->status.agi; - len=14; - break; - case SP_VIT: - WFIFOW(fd,0)=0x141; - WFIFOL(fd,2)=type; - WFIFOL(fd,6)=sd->status.vit; - WFIFOL(fd,10)=sd->battle_status.vit - sd->status.vit; - len=14; - break; - case SP_INT: - WFIFOW(fd,0)=0x141; - WFIFOL(fd,2)=type; - WFIFOL(fd,6)=sd->status.int_; - WFIFOL(fd,10)=sd->battle_status.int_ - sd->status.int_; - len=14; - break; - case SP_DEX: - WFIFOW(fd,0)=0x141; - WFIFOL(fd,2)=type; - WFIFOL(fd,6)=sd->status.dex; - WFIFOL(fd,10)=sd->battle_status.dex - sd->status.dex; - len=14; - break; - case SP_LUK: - WFIFOW(fd,0)=0x141; - WFIFOL(fd,2)=type; - WFIFOL(fd,6)=sd->status.luk; - WFIFOL(fd,10)=sd->battle_status.luk - sd->status.luk; - len=14; - break; + case SP_STR: + WFIFOW(fd,0)=0x141; + WFIFOL(fd,2)=type; + WFIFOL(fd,6)=sd->status.str; + WFIFOL(fd,10)=sd->battle_status.str - sd->status.str; + len=14; + break; + case SP_AGI: + WFIFOW(fd,0)=0x141; + WFIFOL(fd,2)=type; + WFIFOL(fd,6)=sd->status.agi; + WFIFOL(fd,10)=sd->battle_status.agi - sd->status.agi; + len=14; + break; + case SP_VIT: + WFIFOW(fd,0)=0x141; + WFIFOL(fd,2)=type; + WFIFOL(fd,6)=sd->status.vit; + WFIFOL(fd,10)=sd->battle_status.vit - sd->status.vit; + len=14; + break; + case SP_INT: + WFIFOW(fd,0)=0x141; + WFIFOL(fd,2)=type; + WFIFOL(fd,6)=sd->status.int_; + WFIFOL(fd,10)=sd->battle_status.int_ - sd->status.int_; + len=14; + break; + case SP_DEX: + WFIFOW(fd,0)=0x141; + WFIFOL(fd,2)=type; + WFIFOL(fd,6)=sd->status.dex; + WFIFOL(fd,10)=sd->battle_status.dex - sd->status.dex; + len=14; + break; + case SP_LUK: + WFIFOW(fd,0)=0x141; + WFIFOL(fd,2)=type; + WFIFOL(fd,6)=sd->status.luk; + WFIFOL(fd,10)=sd->battle_status.luk - sd->status.luk; + len=14; + break; - case SP_CARTINFO: - WFIFOW(fd,0)=0x121; - WFIFOW(fd,2)=sd->cart_num; - WFIFOW(fd,4)=MAX_CART; - WFIFOL(fd,6)=sd->cart_weight; - WFIFOL(fd,10)=sd->cart_weight_max; - len=14; - break; + case SP_CARTINFO: + WFIFOW(fd,0)=0x121; + WFIFOW(fd,2)=sd->cart_num; + WFIFOW(fd,4)=MAX_CART; + WFIFOL(fd,6)=sd->cart_weight; + WFIFOL(fd,10)=sd->cart_weight_max; + len=14; + break; - default: - ShowError("clif->updatestatus : unrecognized type %d\n",type); - return; + default: + ShowError("clif->updatestatus : unrecognized type %d\n",type); + return; } WFIFOSET(fd,len); } @@ -2961,85 +3058,84 @@ void clif_changelook(struct block_list *bl,int type,int val) vd = status_get_viewdata(bl); //nullpo_ret(vd); if( vd ) //temp hack to let Warp Portal change appearance - switch(type) - { - case LOOK_WEAPON: - if (sd) - { - clif_get_weapon_view(sd, &vd->weapon, &vd->shield); - val = vd->weapon; - } - else vd->weapon = val; - break; - case LOOK_SHIELD: - if (sd) - { - clif_get_weapon_view(sd, &vd->weapon, &vd->shield); - val = vd->shield; - } - else vd->shield = val; - break; - case LOOK_BASE: - vd->class_ = val; - if (vd->class_ == JOB_WEDDING || vd->class_ == JOB_XMAS || vd->class_ == JOB_SUMMER) - vd->weapon = vd->shield = 0; - if (vd->cloth_color && ( - (vd->class_ == JOB_WEDDING && battle_config.wedding_ignorepalette) || - (vd->class_ == JOB_XMAS && battle_config.xmas_ignorepalette) || - (vd->class_ == JOB_SUMMER && battle_config.summer_ignorepalette) - )) - clif_changelook(bl,LOOK_CLOTHES_COLOR,0); - break; - case LOOK_HAIR: - vd->hair_style = val; - break; - case LOOK_HEAD_BOTTOM: - vd->head_bottom = val; - break; - case LOOK_HEAD_TOP: - vd->head_top = val; - break; - case LOOK_HEAD_MID: - vd->head_mid = val; - break; - case LOOK_HAIR_COLOR: - vd->hair_color = val; - break; - case LOOK_CLOTHES_COLOR: - if (val && ( - (vd->class_ == JOB_WEDDING && battle_config.wedding_ignorepalette) || - (vd->class_ == JOB_XMAS && battle_config.xmas_ignorepalette) || - (vd->class_ == JOB_SUMMER && battle_config.summer_ignorepalette) - )) - val = 0; - vd->cloth_color = val; - break; - case LOOK_SHOES: -#if PACKETVER > 3 - if (sd) { - int n; - if((n = sd->equip_index[2]) >= 0 && sd->inventory_data[n]) { - if(sd->inventory_data[n]->view_id > 0) - val = sd->inventory_data[n]->view_id; - else - val = sd->status.inventory[n].nameid; - } else + switch(type) { + case LOOK_WEAPON: + if (sd) { + clif->get_weapon_view(sd, &vd->weapon, &vd->shield); + val = vd->weapon; + } + else + vd->weapon = val; + break; + case LOOK_SHIELD: + if (sd) { + clif->get_weapon_view(sd, &vd->weapon, &vd->shield); + val = vd->shield; + } + else + vd->shield = val; + break; + case LOOK_BASE: + vd->class_ = val; + if (vd->class_ == JOB_WEDDING || vd->class_ == JOB_XMAS || vd->class_ == JOB_SUMMER) + vd->weapon = vd->shield = 0; + if (vd->cloth_color && ( + (vd->class_ == JOB_WEDDING && battle_config.wedding_ignorepalette) || + (vd->class_ == JOB_XMAS && battle_config.xmas_ignorepalette) || + (vd->class_ == JOB_SUMMER && battle_config.summer_ignorepalette) + )) + clif->changelook(bl,LOOK_CLOTHES_COLOR,0); + break; + case LOOK_HAIR: + vd->hair_style = val; + break; + case LOOK_HEAD_BOTTOM: + vd->head_bottom = val; + break; + case LOOK_HEAD_TOP: + vd->head_top = val; + break; + case LOOK_HEAD_MID: + vd->head_mid = val; + break; + case LOOK_HAIR_COLOR: + vd->hair_color = val; + break; + case LOOK_CLOTHES_COLOR: + if (val && ( + (vd->class_ == JOB_WEDDING && battle_config.wedding_ignorepalette) || + (vd->class_ == JOB_XMAS && battle_config.xmas_ignorepalette) || + (vd->class_ == JOB_SUMMER && battle_config.summer_ignorepalette) + )) val = 0; - } -#endif - //Shoes? No packet uses this.... - break; - case LOOK_BODY: - case LOOK_FLOOR: - // unknown purpose - break; - case LOOK_ROBE: -#if PACKETVER < 20110111 - return; -#else - vd->robe = val; -#endif - break; + vd->cloth_color = val; + break; + case LOOK_SHOES: + #if PACKETVER > 3 + if (sd) { + int n; + if((n = sd->equip_index[2]) >= 0 && sd->inventory_data[n]) { + if(sd->inventory_data[n]->view_id > 0) + val = sd->inventory_data[n]->view_id; + else + val = sd->status.inventory[n].nameid; + } else + val = 0; + } + #endif + //Shoes? No packet uses this.... + break; + case LOOK_BODY: + case LOOK_FLOOR: + // unknown purpose + break; + case LOOK_ROBE: + #if PACKETVER < 20110111 + return; + #else + vd->robe = val; + #endif + break; } // prevent leaking the presence of GM-hidden objects @@ -3113,8 +3209,7 @@ void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_ta /// <int>.B <need int>.B <dex>.B <need dex>.B <luk>.B <need luk>.B <atk>.W <atk2>.W /// <matk min>.W <matk max>.W <def>.W <def2>.W <mdef>.W <mdef2>.W <hit>.W /// <flee>.W <flee2>.W <crit>.W <aspd>.W <aspd2>.W -void clif_initialstatus(struct map_session_data *sd) -{ +void clif_initialstatus(struct map_session_data *sd) { int fd, mdef2; unsigned char *buf; @@ -3469,6 +3564,11 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok) } } +void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data *sd, char *msg) { + char message[150]; + snprintf(message, 150, "[ #%s ] %s : %s",channel->name,sd->status.name, msg); + clif->chsys_msg(channel,sd,message); +} /// Inform client whether chatroom creation was successful or not (ZC_ACK_CREATE_CHATROOM). /// 00d6 <flag>.B @@ -3821,7 +3921,7 @@ void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd WBUFB(buf,8) = sd->status.inventory[index].identify; //identify flag WBUFB(buf,9) = sd->status.inventory[index].attribute; // attribute WBUFB(buf,10)= sd->status.inventory[index].refine; //refine - clif_addcards(WBUFP(buf, 11), &sd->status.inventory[index]); + clif->addcards(WBUFP(buf, 11), &sd->status.inventory[index]); } WFIFOSET(fd,packet_len(cmd)); } @@ -3949,7 +4049,7 @@ void clif_storageitemadded(struct map_session_data* sd, struct item* i, int inde WFIFOB(fd,10) = i->identify; //identify flag WFIFOB(fd,11) = i->attribute; // attribute WFIFOB(fd,12) = i->refine; //refine - clif_addcards(WFIFOP(fd,13), i); + clif->addcards(WFIFOP(fd,13), i); WFIFOSET(fd,packet_len(0xf4)); #else WFIFOHEAD(fd,packet_len(0x1c4)); @@ -3961,7 +4061,7 @@ void clif_storageitemadded(struct map_session_data* sd, struct item* i, int inde WFIFOB(fd,11) = i->identify; //identify flag WFIFOB(fd,12) = i->attribute; // attribute WFIFOB(fd,13) = i->refine; //refine - clif_addcards(WFIFOP(fd,14), i); + clif->addcards(WFIFOP(fd,14), i); WFIFOSET(fd,packet_len(0x1c4)); #endif } @@ -4001,25 +4101,24 @@ void clif_storageclose(struct map_session_data* sd) /*========================================== * Server tells 'sd' player client the abouts of 'dstsd' player *------------------------------------------*/ -static void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) -{ +void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { struct block_list *d_bl; int i; if( dstsd->chatID ) { struct chat_data *cd = NULL; if( (cd = (struct chat_data*)map_id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd) - clif_dispchat(cd,sd->fd); + clif->dispchat(cd,sd->fd); } else if( dstsd->state.vending ) clif->showvendingboard(&dstsd->bl,dstsd->message,sd->fd); else if( dstsd->state.buyingstore ) clif->buyingstore_entry_single(sd, dstsd); if(dstsd->spiritball > 0) - clif_spiritball_single(sd->fd, dstsd); + clif->spiritball_single(sd->fd, dstsd); for(i = 1; i < 5; i++){ if( dstsd->talisman[i] > 0 ) - clif_talisman_single(sd->fd, dstsd, i); + clif->talisman_single(sd->fd, dstsd, i); } if( dstsd->sc.option&OPTION_MOUNTING ) { //New Mounts are not complaint to the original method, so we gotta tell this guy that I'm mounting. @@ -4046,8 +4145,7 @@ static void clif_getareachar_pc(struct map_session_data* sd,struct map_session_d clif->devotion(d_bl, sd); } -void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) -{ +void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { uint8 buf[128]; struct unit_data *ud; struct view_data *vd; @@ -4064,7 +4162,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) return; ud = unit_bl2ud(bl); - len = ( ud && ud->walktimer != INVALID_TIMER ) ? clif_set_unit_walking(bl,ud,buf) : clif_set_unit_idle(bl,buf,false); + len = ( ud && ud->walktimer != INVALID_TIMER ) ? clif->set_unit_walking(bl,ud,buf) : clif->set_unit_idle(bl,buf,false); clif->send(buf,len,&sd->bl,SELF); if (vd->cloth_color) @@ -4074,7 +4172,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) case BL_PC: { TBL_PC* tsd = (TBL_PC*)bl; - clif_getareachar_pc(sd, tsd); + clif->getareachar_pc(sd, tsd); if(tsd->state.size==SZ_BIG) // tiny/big players [Valaris] clif->specialeffect_single(bl,423,sd->fd); else if(tsd->state.size==SZ_MEDIUM) @@ -4095,7 +4193,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { TBL_NPC* nd = (TBL_NPC*)bl; if( nd->chat_id ) - clif_dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd); + clif->dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd); if( nd->size == SZ_BIG ) clif->specialeffect_single(bl,423,sd->fd); else if( nd->size == SZ_MEDIUM ) @@ -4136,8 +4234,7 @@ static inline int clif_calc_delay(int type, int div, int damage, int delay) /*========================================== * Estimates walk delay based on the damage criteria. [Skotlex] *------------------------------------------*/ -static int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, int div_) -{ +int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, int div_) { if (type == 4 || type == 9 || damage <=0) return 0; @@ -4246,7 +4343,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, unsigned int tic unit_setdir(src,unit_getdir(src)); } //Return adjusted can't walk delay for further processing. - return clif_calc_walkdelay(dst,ddelay,type,damage+damage2,div); + return clif->calc_walkdelay(dst,ddelay,type,damage+damage2,div); } /*========================================== @@ -4339,8 +4436,7 @@ void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_targe /// Notifies the client about an item on floor (ZC_ITEM_ENTRY). /// 009d <id>.L <name id>.W <identified>.B <x>.W <y>.W <amount>.W <subX>.B <subY>.B -void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) -{ +void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { int view,fd; fd=sd->fd; @@ -4364,8 +4460,7 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi /// Notifies the client of a skill unit. /// 011f <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B (ZC_SKILL_ENTRY) /// 01c9 <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B <has msg>.B <msg>.80B (ZC_SKILL_ENTRY2) -static void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit *unit) -{ +void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit *unit) { int fd = sd->fd; if( unit->group->state.guildaura ) @@ -4403,15 +4498,14 @@ static void clif_getareachar_skillunit(struct map_session_data *sd, struct skill WFIFOSET(fd,packet_len(0x11f)); if(unit->group->skill_id == WZ_ICEWALL) - clif_changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,5,SELF); + clif->changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,5,SELF); } /*========================================== * Server tells client to remove unit of id 'unit->bl.id' *------------------------------------------*/ -static void clif_clearchar_skillunit(struct skill_unit *unit, int fd) -{ +void clif_clearchar_skillunit(struct skill_unit *unit, int fd) { nullpo_retv(unit); WFIFOHEAD(fd,packet_len(0x120)); @@ -4420,7 +4514,7 @@ static void clif_clearchar_skillunit(struct skill_unit *unit, int fd) WFIFOSET(fd,packet_len(0x120)); if(unit->group && unit->group->skill_id == WZ_ICEWALL) - clif_changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,SELF); + clif->changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,SELF); } @@ -4456,8 +4550,7 @@ void clif_skillunit_update(struct block_list* bl) /*========================================== * *------------------------------------------*/ -static int clif_getareachar(struct block_list* bl,va_list ap) -{ +int clif_getareachar(struct block_list* bl,va_list ap) { struct map_session_data *sd; nullpo_ret(bl); @@ -4468,17 +4561,17 @@ static int clif_getareachar(struct block_list* bl,va_list ap) return 0; switch(bl->type){ - case BL_ITEM: - clif_getareachar_item(sd,(struct flooritem_data*) bl); - break; - case BL_SKILL: - clif_getareachar_skillunit(sd,(TBL_SKILL*)bl); - break; - default: - if(&sd->bl == bl) + case BL_ITEM: + clif->getareachar_item(sd,(struct flooritem_data*) bl); + break; + case BL_SKILL: + clif->getareachar_skillunit(sd,(TBL_SKILL*)bl); + break; + default: + if(&sd->bl == bl) + break; + clif->getareachar_unit(sd,bl); break; - clif_getareachar_unit(sd,bl); - break; } return 0; } @@ -4496,44 +4589,42 @@ int clif_outsight(struct block_list *bl,va_list ap) sd = BL_CAST(BL_PC, bl); tsd = BL_CAST(BL_PC, tbl); - if (tsd && tsd->fd) - { //tsd has lost sight of the bl object. + if (tsd && tsd->fd) { //tsd has lost sight of the bl object. switch(bl->type){ - case BL_PC: - if (sd->vd.class_ != INVISIBLE_CLASS) - clif_clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); - if(sd->chatID){ - struct chat_data *cd; - cd=(struct chat_data*)map_id2bl(sd->chatID); - if(cd->usersd[0]==sd) - clif_dispchat(cd,tsd->fd); + case BL_PC: + if (sd->vd.class_ != INVISIBLE_CLASS) + clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); + if(sd->chatID){ + struct chat_data *cd; + cd=(struct chat_data*)map_id2bl(sd->chatID); + if(cd->usersd[0]==sd) + clif->dispchat(cd,tsd->fd); + } + if( sd->state.vending ) + clif->closevendingboard(bl,tsd->fd); + if( sd->state.buyingstore ) + clif->buyingstore_disappear_entry_single(tsd, sd); + break; + case BL_ITEM: + clif->clearflooritem((struct flooritem_data*)bl,tsd->fd); + break; + case BL_SKILL: + clif->clearchar_skillunit((struct skill_unit *)bl,tsd->fd); + break; + case BL_NPC: + if( !(((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE) ) + clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); + break; + default: + if ((vd=status_get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS) + clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); + break; } - if( sd->state.vending ) - clif->closevendingboard(bl,tsd->fd); - if( sd->state.buyingstore ) - clif->buyingstore_disappear_entry_single(tsd, sd); - break; - case BL_ITEM: - clif->clearflooritem((struct flooritem_data*)bl,tsd->fd); - break; - case BL_SKILL: - clif_clearchar_skillunit((struct skill_unit *)bl,tsd->fd); - break; - case BL_NPC: - if( !(((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE) ) - clif_clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); - break; - default: - if ((vd=status_get_viewdata(bl)) && vd->class_ != INVISIBLE_CLASS) - clif_clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); - break; - } } - if (sd && sd->fd) - { //sd is watching tbl go out of view. + if (sd && sd->fd) { //sd is watching tbl go out of view. if (((vd=status_get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS) && !(tbl->type == BL_NPC && (((TBL_NPC*)tbl)->sc.option&OPTION_INVISIBLE))) - clif_clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); + clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd); } return 0; } @@ -4552,23 +4643,21 @@ int clif_insight(struct block_list *bl,va_list ap) sd = BL_CAST(BL_PC, bl); tsd = BL_CAST(BL_PC, tbl); - if (tsd && tsd->fd) - { //Tell tsd that bl entered into his view + if (tsd && tsd->fd) { //Tell tsd that bl entered into his view switch(bl->type){ - case BL_ITEM: - clif_getareachar_item(tsd,(struct flooritem_data*)bl); - break; - case BL_SKILL: - clif_getareachar_skillunit(tsd,(TBL_SKILL*)bl); - break; - default: - clif_getareachar_unit(tsd,bl); - break; + case BL_ITEM: + clif->getareachar_item(tsd,(struct flooritem_data*)bl); + break; + case BL_SKILL: + clif->getareachar_skillunit(tsd,(TBL_SKILL*)bl); + break; + default: + clif->getareachar_unit(tsd,bl); + break; } } - if (sd && sd->fd) - { //Tell sd that tbl walked into his view - clif_getareachar_unit(sd,tbl); + if (sd && sd->fd) { //Tell sd that tbl walked into his view + clif->getareachar_unit(sd,tbl); } return 0; } @@ -4670,7 +4759,7 @@ void clif_deleteskill(struct map_session_data *sd, int id) WFIFOW(fd,2) = id; WFIFOSET(fd,packet_len(0x441)); #endif - clif_skillinfoblock(sd); + clif->skillinfoblock(sd); } @@ -4933,7 +5022,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int #endif //Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex] - return clif_calc_walkdelay(dst,ddelay,type,damage,div); + return clif->calc_walkdelay(dst,ddelay,type,damage,div); } @@ -5435,28 +5524,6 @@ void clif_GlobalMessage(struct block_list* bl, const char* message) { } -/*========================================== - * Send main chat message [LuzZza] - *------------------------------------------*/ -void clif_MainChatMessage(const char* message) { - uint8 buf[200]; - int len; - - if(!message) - return; - - len = strlen(message)+1; - if (len+8 > sizeof(buf)) { - ShowDebug("clif_MainChatMessage: Received message too long (len %d): %s\n", len, message); - len = sizeof(buf)-8; - } - WBUFW(buf,0)=0x8d; - WBUFW(buf,2)=len+8; - WBUFL(buf,4)=0; - safestrncpy((char *) WBUFP(buf,8),message,len); - clif->send(buf,WBUFW(buf,2),NULL,CHAT_MAINCHAT); -} - /// Send broadcast message with font formatting (ZC_BROADCAST2). /// 01c3 <packet len>.W <fontColor>.L <fontType>.W <fontSize>.W <fontAlign>.W <fontY>.W <message>.?B void clif_broadcast2(struct block_list* bl, const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) @@ -5510,7 +5577,7 @@ void clif_resurrection(struct block_list *bl,int type) clif->send(buf,packet_len(0x148),bl,type==1 ? AREA : AREA_WOS); if (disguised(bl)) - clif_spawn(bl); + clif->spawn(bl); } @@ -5532,8 +5599,7 @@ void clif_map_property(struct map_session_data* sd, enum map_property property) /// Set the map type (ZC_NOTIFY_MAPPROPERTY2). /// 01d6 <type>.W -void clif_map_type(struct map_session_data* sd, enum map_type type) -{ +void clif_map_type(struct map_session_data* sd, enum map_type type) { int fd; nullpo_retv(sd); @@ -5816,7 +5882,7 @@ void clif_item_repair_list(struct map_session_data *sd,struct map_session_data * WFIFOW(fd,c*13+4) = i; WFIFOW(fd,c*13+6) = nameid; WFIFOB(fd,c*13+8) = dstsd->status.inventory[i].refine; - clif_addcards(WFIFOP(fd,c*13+9), &dstsd->status.inventory[i]); + clif->addcards(WFIFOP(fd,c*13+9), &dstsd->status.inventory[i]); c++; } } @@ -5827,7 +5893,7 @@ void clif_item_repair_list(struct map_session_data *sd,struct map_session_data * sd->menuskill_val = dstsd->bl.id; sd->menuskill_val2 = lv; }else - clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); } @@ -5899,7 +5965,7 @@ void clif_item_refine_list(struct map_session_data *sd) WFIFOW(fd,c*13+ 4)=i+2; WFIFOW(fd,c*13+ 6)=sd->status.inventory[i].nameid; WFIFOB(fd,c*13+ 8)=sd->status.inventory[i].refine; - clif_addcards(WFIFOP(fd,c*13+9), &sd->status.inventory[i]); + clif->addcards(WFIFOP(fd,c*13+9), &sd->status.inventory[i]); c++; } } @@ -5962,7 +6028,7 @@ void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) WBUFB(buf,10)=sd->status.cart[n].identify; WBUFB(buf,11)=sd->status.cart[n].attribute; WBUFB(buf,12)=sd->status.cart[n].refine; - clif_addcards(WBUFP(buf,13), &sd->status.cart[n]); + clif->addcards(WBUFP(buf,13), &sd->status.cart[n]); WFIFOSET(fd,packet_len(0x124)); #else WFIFOHEAD(fd,packet_len(0x1c5)); @@ -5978,7 +6044,7 @@ void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) WBUFB(buf,11)=sd->status.cart[n].identify; WBUFB(buf,12)=sd->status.cart[n].attribute; WBUFB(buf,13)=sd->status.cart[n].refine; - clif_addcards(WBUFP(buf,14), &sd->status.cart[n]); + clif->addcards(WBUFP(buf,14), &sd->status.cart[n]); WFIFOSET(fd,packet_len(0x1c5)); #endif } @@ -6105,7 +6171,7 @@ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* ven WFIFOB(fd,offset+11+i*22) = vsd->status.cart[index].identify; WFIFOB(fd,offset+12+i*22) = vsd->status.cart[index].attribute; WFIFOB(fd,offset+13+i*22) = vsd->status.cart[index].refine; - clif_addcards(WFIFOP(fd,offset+14+i*22), &vsd->status.cart[index]); + clif->addcards(WFIFOP(fd,offset+14+i*22), &vsd->status.cart[index]); } WFIFOSET(fd,WFIFOW(fd,2)); } @@ -6153,8 +6219,7 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven WFIFOW(fd,0) = 0x136; WFIFOW(fd,2) = 8+count*22; WFIFOL(fd,4) = id; - for( i = 0; i < count; i++ ) - { + for( i = 0; i < count; i++ ) { int index = vending[i].index; struct item_data* data = itemdb_search(sd->status.cart[index].nameid); WFIFOL(fd, 8+i*22) = vending[i].value; @@ -6165,7 +6230,7 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven WFIFOB(fd,19+i*22) = sd->status.cart[index].identify; WFIFOB(fd,20+i*22) = sd->status.cart[index].attribute; WFIFOB(fd,21+i*22) = sd->status.cart[index].refine; - clif_addcards(WFIFOP(fd,22+i*22), &sd->status.cart[index]); + clif->addcards(WFIFOP(fd,22+i*22), &sd->status.cart[index]); } WFIFOSET(fd,WFIFOW(fd,2)); } @@ -6356,7 +6421,7 @@ void clif_party_inviteack(struct map_session_data* sd, const char* nick, int res #if PACKETVER < 20070904 if( result == 7 ) { - clif_displaymessage(fd, msg_txt(3)); + clif->message(fd, msg_txt(3)); return; } #endif @@ -6608,7 +6673,7 @@ void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) nullpo_retv(sd); fd = sd->fd; - clif_solved_charname(fd, sd->status.char_id, sd->status.name); + clif->solved_charname(fd, sd->status.char_id, sd->status.name); WFIFOHEAD(fd,packet_len(0x18f)); WFIFOW(fd, 0)=0x18f; WFIFOW(fd, 2)=flag; @@ -6662,9 +6727,8 @@ void clif_sendegg(struct map_session_data *sd) nullpo_retv(sd); fd=sd->fd; - if (battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m)) - { //Disable pet hatching in GvG grounds during Guild Wars [Skotlex] - clif_displaymessage(fd, msg_txt(666)); + if (battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m)) { //Disable pet hatching in GvG grounds during Guild Wars [Skotlex] + clif->message(fd, msg_txt(666)); return; } WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4); @@ -7094,7 +7158,7 @@ void clif_guild_send_onlineinfo(struct map_session_data *sd) p_len = packet_len(0x16d); - if(!(g = guild_search(sd->status.guild_id))) + if(!(g = sd->guild)) return; for(i=0; i<g->max_member; i++) { @@ -7148,7 +7212,7 @@ void clif_guild_basicinfo(struct map_session_data *sd) { nullpo_retv(sd); fd = sd->fd; - if( (g = guild_search(sd->status.guild_id)) == NULL ) + if( (g = sd->guild) == NULL ) return; WFIFOHEAD(fd,packet_len(0x1b6)); @@ -7182,7 +7246,7 @@ void clif_guild_allianceinfo(struct map_session_data *sd) struct guild *g; nullpo_retv(sd); - if( (g = guild_search(sd->status.guild_id)) == NULL ) + if( (g = sd->guild) == NULL ) return; fd = sd->fd; @@ -7218,7 +7282,7 @@ void clif_guild_memberlist(struct map_session_data *sd) if( (fd = sd->fd) == 0 ) return; - if( (g = guild_search(sd->status.guild_id)) == NULL ) + if( (g = sd->guild) == NULL ) return; WFIFOHEAD(fd, g->max_member * 104 + 4); @@ -7248,13 +7312,12 @@ void clif_guild_memberlist(struct map_session_data *sd) /// Guild position name information (ZC_POSITION_ID_NAME_INFO). /// 0166 <packet len>.W { <position id>.L <position name>.24B }* -void clif_guild_positionnamelist(struct map_session_data *sd) -{ +void clif_guild_positionnamelist(struct map_session_data *sd) { int i,fd; struct guild *g; nullpo_retv(sd); - if( (g = guild_search(sd->status.guild_id)) == NULL ) + if( (g = sd->guild) == NULL ) return; fd = sd->fd; @@ -7276,13 +7339,12 @@ void clif_guild_positionnamelist(struct map_session_data *sd) /// &0x10 = allow expel /// ranking: /// TODO -void clif_guild_positioninfolist(struct map_session_data *sd) -{ +void clif_guild_positioninfolist(struct map_session_data *sd) { int i,fd; struct guild *g; nullpo_retv(sd); - if( (g = guild_search(sd->status.guild_id)) == NULL ) + if( (g = sd->guild) == NULL ) return; fd = sd->fd; @@ -7404,7 +7466,7 @@ void clif_guild_skillinfo(struct map_session_data* sd) int i,c; nullpo_retv(sd); - if( (g = guild_search(sd->status.guild_id)) == NULL ) + if( (g = sd->guild) == NULL ) return; fd = sd->fd; @@ -7538,8 +7600,7 @@ void clif_guild_expulsion(struct map_session_data* sd, const char* name, const c /// Guild expulsion list (ZC_BAN_LIST). /// 0163 <packet len>.W { <char name>.24B <account name>.24B <reason>.40B }* /// 0163 <packet len>.W { <char name>.24B <reason>.40B }* (PACKETVER >= 20100803) -void clif_guild_expulsionlist(struct map_session_data* sd) -{ +void clif_guild_expulsionlist(struct map_session_data* sd) { #if PACKETVER < 20100803 const int offset = NAME_LENGTH*2+40; #else @@ -7550,7 +7611,7 @@ void clif_guild_expulsionlist(struct map_session_data* sd) nullpo_retv(sd); - if( (g = guild_search(sd->status.guild_id)) == NULL ) + if( (g = sd->guild) == NULL ) return; fd = sd->fd; @@ -7884,12 +7945,9 @@ void clif_disp_message(struct block_list* src, const char* mes, int len, enum se { unsigned char buf[256]; - if( len == 0 ) - { + if( len == 0 ) { return; - } - else if( len > sizeof(buf)-5 ) - { + } else if( len > sizeof(buf)-5 ) { ShowWarning("clif_disp_message: Truncated message '%s' (len=%d, max=%d, aid=%d).\n", mes, len, sizeof(buf)-5, src->id); len = sizeof(buf)-5; } @@ -7926,12 +7984,12 @@ void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) int fd = tsd->fd; if( fd > 0 ) - clif_authfail_fd(fd, 15); + clif->authfail_fd(fd, 15); else map_quit(tsd); if( sd ) - clif_GM_kickack(sd,tsd->status.account_id); + clif->GM_kickack(sd,tsd->status.account_id); } @@ -7986,8 +8044,7 @@ void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, /// 0 = success /// 1 = failure /// 2 = too many blocks -void clif_wisexin(struct map_session_data *sd,int type,int flag) -{ +void clif_wisexin(struct map_session_data *sd,int type,int flag) { int fd; nullpo_retv(sd); @@ -8008,8 +8065,7 @@ void clif_wisexin(struct map_session_data *sd,int type,int flag) /// result: /// 0 = success /// 1 = failure -void clif_wisall(struct map_session_data *sd,int type,int flag) -{ +void clif_wisall(struct map_session_data *sd,int type,int flag) { int fd; nullpo_retv(sd); @@ -8151,7 +8207,7 @@ int clif_colormes(struct map_session_data * sd, enum clif_colors color, const ch WFIFOL(sd->fd,4) = 0; WFIFOL(sd->fd,8) = color_table[color]; safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len); - clif->send(WFIFOP(sd->fd,0), WFIFOW(sd->fd,2), &sd->bl, SELF); + WFIFOSET(sd->fd, msg_len + 12); return 0; } @@ -8165,8 +8221,7 @@ void clif_messagecolor(struct block_list* bl, unsigned long color, const char* m nullpo_retv(bl); - if( msg_len > sizeof(buf)-12 ) - { + if( msg_len > sizeof(buf)-12 ) { ShowWarning("clif_messagecolor: Truncating too long message '%s' (len=%u).\n", msg, msg_len); msg_len = sizeof(buf)-12; } @@ -8206,10 +8261,10 @@ void clif_refresh(struct map_session_data *sd) int i; nullpo_retv(sd); - clif_changemap(sd,sd->mapindex,sd->bl.x,sd->bl.y); - clif_inventorylist(sd); + clif->changemap(sd,sd->mapindex,sd->bl.x,sd->bl.y); + clif->inventorylist(sd); if(pc_iscarton(sd)) { - clif_cartlist(sd); + clif->cartlist(sd); clif->updatestatus(sd,SP_CARTINFO); } clif->updatestatus(sd,SP_WEIGHT); @@ -8221,10 +8276,10 @@ void clif_refresh(struct map_session_data *sd) clif->updatestatus(sd,SP_DEX); clif->updatestatus(sd,SP_LUK); if (sd->spiritball) - clif_spiritball_single(sd->fd, sd); + clif->spiritball_single(sd->fd, sd); for(i = 1; i < 5; i++){ if( sd->talisman[i] > 0 ) - clif_talisman_single(sd->fd, sd, i); + clif->talisman_single(sd->fd, sd, i); } if (sd->vd.cloth_color) clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); @@ -8236,16 +8291,16 @@ void clif_refresh(struct map_session_data *sd) } if( sd->ed ) clif->elemental_info(sd); - map_foreachinrange(clif_getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd); - clif_weather_check(sd); + map_foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd); + clif->weather_check(sd); if( sd->chatID ) chat_leavechat(sd,0); if( sd->state.vending ) - clif_openvending(sd, sd->bl.id, sd->vending); + clif->openvending(sd, sd->bl.id, sd->vending); if( pc_issit(sd) ) - clif_sitting(&sd->bl); // FIXME: just send to self, not area + clif->sitting(&sd->bl); // FIXME: just send to self, not area if( pc_isdead(sd) ) // When you refresh, resend the death packet. - clif_clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); + clif->clearunit_single(sd->bl.id,CLR_DEAD,sd->fd); else clif->changed_dir(&sd->bl, SELF); @@ -8269,122 +8324,116 @@ void clif_charnameack (int fd, struct block_list *bl) WBUFW(buf,0) = cmd; WBUFL(buf,2) = bl->id; - switch( bl->type ) - { - case BL_PC: - { - struct map_session_data *ssd = (struct map_session_data *)bl; - struct party_data *p = NULL; - struct guild *g = NULL; - - //Requesting your own "shadow" name. [Skotlex] - if (ssd->fd == fd && ssd->disguise) - WBUFL(buf,2) = -bl->id; - - if( ssd->fakename[0] ) - { - WBUFW(buf, 0) = cmd = 0x195; - memcpy(WBUFP(buf,6), ssd->fakename, NAME_LENGTH); - WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; - break; - } - memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); - - if( ssd->status.party_id ) - { - p = party_search(ssd->status.party_id); - } - if( ssd->status.guild_id ) + switch( bl->type ) { + case BL_PC: { - if( ( g = guild_search(ssd->status.guild_id) ) != NULL ) - { - ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); - if( i < g->max_member ) ps = g->member[i].position; + struct map_session_data *ssd = (struct map_session_data *)bl; + struct party_data *p = NULL; + struct guild *g = NULL; + + //Requesting your own "shadow" name. [Skotlex] + if (ssd->fd == fd && ssd->disguise) + WBUFL(buf,2) = -bl->id; + + if( ssd->fakename[0] ) { + WBUFW(buf, 0) = cmd = 0x195; + memcpy(WBUFP(buf,6), ssd->fakename, NAME_LENGTH); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; + break; } - } + memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); - if( !battle_config.display_party_name && g == NULL ) - {// do not display party unless the player is also in a guild - p = NULL; - } - - if (p == NULL && g == NULL) - break; + if( ssd->status.party_id ) { + p = party_search(ssd->status.party_id); + } + if( ssd->status.guild_id ) { + if( ( g = ssd->guild ) != NULL ) { + ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); + if( i < g->max_member ) ps = g->member[i].position; + } + } - WBUFW(buf, 0) = cmd = 0x195; - if (p) - memcpy(WBUFP(buf,30), p->party.name, NAME_LENGTH); - else - WBUFB(buf,30) = 0; + if( !battle_config.display_party_name && g == NULL ) {// do not display party unless the player is also in a guild + p = NULL; + } - if (g && ps >= 0 && ps < MAX_GUILDPOSITION) - { - memcpy(WBUFP(buf,54), g->name,NAME_LENGTH); - memcpy(WBUFP(buf,78), g->position[ps].name, NAME_LENGTH); - } else { //Assume no guild. - WBUFB(buf,54) = 0; - WBUFB(buf,78) = 0; - } - } - break; - //[blackhole89] - case BL_HOM: - memcpy(WBUFP(buf,6), ((TBL_HOM*)bl)->homunculus.name, NAME_LENGTH); - break; - case BL_MER: - memcpy(WBUFP(buf,6), ((TBL_MER*)bl)->db->name, NAME_LENGTH); - break; - case BL_PET: - memcpy(WBUFP(buf,6), ((TBL_PET*)bl)->pet.name, NAME_LENGTH); - break; - case BL_NPC: - memcpy(WBUFP(buf,6), ((TBL_NPC*)bl)->name, NAME_LENGTH); - break; - case BL_MOB: - { - struct mob_data *md = (struct mob_data *)bl; - nullpo_retv(md); + if (p == NULL && g == NULL) + break; - memcpy(WBUFP(buf,6), md->name, NAME_LENGTH); - if( md->guardian_data && md->guardian_data->guild_id ) - { - WBUFW(buf, 0) = cmd = 0x195; - WBUFB(buf,30) = 0; - memcpy(WBUFP(buf,54), md->guardian_data->guild_name, NAME_LENGTH); - memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, NAME_LENGTH); - } - else if( battle_config.show_mob_info ) - { - char mobhp[50], *str_p = mobhp; WBUFW(buf, 0) = cmd = 0x195; - if( battle_config.show_mob_info&4 ) - str_p += sprintf(str_p, "Lv. %d | ", md->level); - if( battle_config.show_mob_info&1 ) - str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp); - if( battle_config.show_mob_info&2 ) - str_p += sprintf(str_p, "HP: %d%% | ", get_percentage(md->status.hp, md->status.max_hp)); - //Even thought mobhp ain't a name, we send it as one so the client - //can parse it. [Skotlex] - if( str_p != mobhp ) + if (p) + memcpy(WBUFP(buf,30), p->party.name, NAME_LENGTH); + else + WBUFB(buf,30) = 0; + + if (g && ps >= 0 && ps < MAX_GUILDPOSITION) { - *(str_p-3) = '\0'; //Remove trailing space + pipe. - memcpy(WBUFP(buf,30), mobhp, NAME_LENGTH); + memcpy(WBUFP(buf,54), g->name,NAME_LENGTH); + memcpy(WBUFP(buf,78), g->position[ps].name, NAME_LENGTH); + } else { //Assume no guild. WBUFB(buf,54) = 0; WBUFB(buf,78) = 0; } } - } - break; - case BL_CHAT: //FIXME: Clients DO request this... what should be done about it? The chat's title may not fit... [Skotlex] -// memcpy(WBUFP(buf,6), (struct chat*)->title, NAME_LENGTH); -// break; - return; - case BL_ELEM: - memcpy(WBUFP(buf,6), ((TBL_ELEM*)bl)->db->name, NAME_LENGTH); - break; - default: - ShowError("clif_charnameack: bad type %d(%d)\n", bl->type, bl->id); - return; + break; + //[blackhole89] + case BL_HOM: + memcpy(WBUFP(buf,6), ((TBL_HOM*)bl)->homunculus.name, NAME_LENGTH); + break; + case BL_MER: + memcpy(WBUFP(buf,6), ((TBL_MER*)bl)->db->name, NAME_LENGTH); + break; + case BL_PET: + memcpy(WBUFP(buf,6), ((TBL_PET*)bl)->pet.name, NAME_LENGTH); + break; + case BL_NPC: + memcpy(WBUFP(buf,6), ((TBL_NPC*)bl)->name, NAME_LENGTH); + break; + case BL_MOB: + { + struct mob_data *md = (struct mob_data *)bl; + nullpo_retv(md); + + memcpy(WBUFP(buf,6), md->name, NAME_LENGTH); + if( md->guardian_data && md->guardian_data->guild_id ) + { + WBUFW(buf, 0) = cmd = 0x195; + WBUFB(buf,30) = 0; + memcpy(WBUFP(buf,54), md->guardian_data->guild_name, NAME_LENGTH); + memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, NAME_LENGTH); + } + else if( battle_config.show_mob_info ) + { + char mobhp[50], *str_p = mobhp; + WBUFW(buf, 0) = cmd = 0x195; + if( battle_config.show_mob_info&4 ) + str_p += sprintf(str_p, "Lv. %d | ", md->level); + if( battle_config.show_mob_info&1 ) + str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp); + if( battle_config.show_mob_info&2 ) + str_p += sprintf(str_p, "HP: %d%% | ", get_percentage(md->status.hp, md->status.max_hp)); + //Even thought mobhp ain't a name, we send it as one so the client + //can parse it. [Skotlex] + if( str_p != mobhp ) + { + *(str_p-3) = '\0'; //Remove trailing space + pipe. + memcpy(WBUFP(buf,30), mobhp, NAME_LENGTH); + WBUFB(buf,54) = 0; + WBUFB(buf,78) = 0; + } + } + } + break; + case BL_CHAT: //FIXME: Clients DO request this... what should be done about it? The chat's title may not fit... [Skotlex] + // memcpy(WBUFP(buf,6), (struct chat*)->title, NAME_LENGTH); + // break; + return; + case BL_ELEM: + memcpy(WBUFP(buf,6), ((TBL_ELEM*)bl)->db->name, NAME_LENGTH); + break; + default: + ShowError("clif_charnameack: bad type %d(%d)\n", bl->type, bl->id); + return; } // if no receipient specified just update nearby clients @@ -8418,14 +8467,14 @@ void clif_charnameupdate (struct map_session_data *ssd) memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); if (!battle_config.display_party_name) { - if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL) + if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != NULL) p = party_search(ssd->status.party_id); }else{ if (ssd->status.party_id > 0) p = party_search(ssd->status.party_id); } - if( ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL ) + if( ssd->status.guild_id > 0 && (g = ssd->guild) != NULL ) { int i; ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); @@ -8478,10 +8527,9 @@ void clif_slide(struct block_list *bl, int x, int y) } -/*------------------------------------------ - * @me command by lordalfa, rewritten implementation by Skotlex - *------------------------------------------*/ -void clif_disp_overhead(struct map_session_data *sd, const char* mes) +/// Public chat message (ZC_NOTIFY_CHAT). lordalfa/Skotlex - used by @me as well +/// 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) int len_mes = strlen(mes)+1; //Account for \0 @@ -8493,15 +8541,18 @@ void clif_disp_overhead(struct map_session_data *sd, const char* mes) // send message to others WBUFW(buf,0) = 0x8d; WBUFW(buf,2) = len_mes + 8; // len of message + 8 (command+len+id) - WBUFL(buf,4) = sd->bl.id; + WBUFL(buf,4) = bl->id; safestrncpy((char*)WBUFP(buf,8), mes, len_mes); - clif->send(buf, WBUFW(buf,2), &sd->bl, AREA_CHAT_WOC); + clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); // send back message to the speaker - WBUFW(buf,0) = 0x8e; - WBUFW(buf, 2) = len_mes + 4; - safestrncpy((char*)WBUFP(buf,4), mes, len_mes); - clif->send(buf, WBUFW(buf,2), &sd->bl, SELF); + if( bl->type == BL_PC ) { + WBUFW(buf,0) = 0x8e; + WBUFW(buf, 2) = len_mes + 4; + safestrncpy((char*)WBUFP(buf,4), mes, len_mes); + clif->send(buf, WBUFW(buf,2), bl, SELF); + } + } /*========================== @@ -8596,7 +8647,7 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig char mapname[MAP_NAME_LENGTH_EXT]; mapindex_getmapname_ext(mapindex_id2name(sd->feel_map[feel_level].index), mapname); - clif_starskill(sd, mapname, 0, feel_level, type ? 1 : 0); + clif->starskill(sd, mapname, 0, feel_level, type ? 1 : 0); } /*========================================== @@ -8605,16 +8656,11 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig *------------------------------------------*/ void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) { - if( pcdb_checkid(class_) ) - { - clif_starskill(sd, job_name(class_), class_, hate_level, type ? 10 : 11); - } - else if( mobdb_checkid(class_) ) - { - clif_starskill(sd, mob_db(class_)->jname, class_, hate_level, type ? 10 : 11); - } - else - { + if( pcdb_checkid(class_) ) { + clif->starskill(sd, job_name(class_), class_, hate_level, type ? 10 : 11); + } else if( mobdb_checkid(class_) ) { + clif->starskill(sd, mob_db(class_)->jname, class_, hate_level, type ? 10 : 11); + } else { ShowWarning("clif_hate_info: Received invalid class %d for this packet (char_id=%d, hate_level=%u, type=%u).\n", class_, sd->status.char_id, (unsigned int)hate_level, (unsigned int)type); } } @@ -8624,7 +8670,7 @@ void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int cl *------------------------------------------*/ void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress) { - clif_starskill(sd, mob_db(mob_id)->jname, mob_id, progress, 20); + clif->starskill(sd, mob_db(mob_id)->jname, mob_id, progress, 20); } /*========================================== @@ -8632,7 +8678,7 @@ void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char pr *------------------------------------------*/ void clif_feel_hate_reset(struct map_session_data *sd) { - clif_starskill(sd, "", 0, 0, 30); + clif->starskill(sd, "", 0, 0, 30); } @@ -8726,9 +8772,9 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts // Inventory position WBUFW(buf, n*s+43) = i + 2; // Add refine, identify flag, element, etc. - clif_item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], pc_equippoint(tsd, i)); + clif->item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], pc_equippoint(tsd, i)); // Add cards - clif_addcards(WBUFP(buf, n*s+55), &tsd->status.inventory[i]); + clif->addcards(WBUFP(buf, n*s+55), &tsd->status.inventory[i]); // Expiration date stuff, if all of those are set to 0 then the client doesn't show anything related (6 bytes) WBUFL(buf, n*s+63) = tsd->status.inventory[i].expire_time; WBUFW(buf, n*s+67) = 0; @@ -8803,8 +8849,7 @@ void clif_viewequip_fail(struct map_session_data* sd) /// Returns true if the packet was parsed successfully. /// Formats: 0 - <packet id>.w <packet len>.w (<name> : <message>).?B 00 /// 1 - <packet id>.w <packet len>.w <name>.24B <message>.?B 00 -static bool clif_process_message(struct map_session_data* sd, int format, char** name_, int* namelen_, char** message_, int* messagelen_) -{ +bool clif_process_message(struct map_session_data* sd, int format, char** name_, int* namelen_, char** message_, int* messagelen_) { char *text, *name, *message; unsigned int packetlen, textlen, namelen, messagelen; int fd = sd->fd; @@ -8907,8 +8952,7 @@ static bool clif_process_message(struct map_session_data* sd, int format, char** // 5 - Invalid client_tick (reserved) // 6 - Invalid sex // Only the first 'invalid' error that appears is used. -static int clif_guess_PacketVer(int fd, int get_previous, int *error) -{ +int clif_guess_PacketVer(int fd, int get_previous, int *error) { static int err = 1; static int packet_ver = -1; int cmd, packet_len, value; //Value is used to temporarily store account/char_id/sex @@ -8957,8 +9001,7 @@ static int clif_guess_PacketVer(int fd, int get_previous, int *error) CHECK_PACKET_VER();//Default packet version found. - for (packet_ver = MAX_PACKET_VER; packet_ver > 0; packet_ver--) - { //Start guessing the version, giving priority to the newer ones. [Skotlex] + for (packet_ver = MAX_PACKET_VER; packet_ver > 0; packet_ver--) { //Start guessing the version, giving priority to the newer ones. [Skotlex] CHECK_PACKET_VER(); } if( error ) @@ -8969,6 +9012,31 @@ static int clif_guess_PacketVer(int fd, int get_previous, int *error) #undef CHECK_PACKET_VER } +void clif_hercules_chsys_msg(struct hChSysCh *channel, struct map_session_data *sd, char *msg) { + DBIterator *iter = db_iterator(channel->users); + struct map_session_data *user; + unsigned short msg_len = strlen(msg) + 1; + + WFIFOHEAD(sd->fd,msg_len + 12); + WFIFOW(sd->fd,0) = 0x2C1; + WFIFOW(sd->fd,2) = msg_len + 12; + WFIFOL(sd->fd,4) = 0; + WFIFOL(sd->fd,8) = hChSys.colors[channel->color]; + safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len); + + for( user = dbi_first(iter); dbi_exists(iter); user = dbi_next(iter) ) { + if( user->fd == sd->fd ) + continue; + WFIFOHEAD(user->fd,msg_len + 12); + memcpy(WFIFOP(user->fd,0), WFIFOP(sd->fd,0), msg_len + 12); + WFIFOSET(user->fd, msg_len + 12); + } + + WFIFOSET(sd->fd, msg_len + 12); + + dbi_destroy(iter); +} + // ------------ // clif_parse_* // ------------ @@ -8979,7 +9047,7 @@ static int clif_guess_PacketVer(int fd, int get_previous, int *error) /// 0072 <account id>.L <char id>.L <auth code>.L <client time>.L <gender>.B (CZ_ENTER) /// 0436 <account id>.L <char id>.L <auth code>.L <client time>.L <gender>.B (CZ_ENTER2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_WantToConnection(int fd, TBL_PC* sd) +void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { struct block_list* bl; struct auth_node* node; @@ -8993,7 +9061,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) } // Only valid packet version get here - packet_ver = clif_guess_PacketVer(fd, 1, NULL); + packet_ver = clif->guess_PacketVer(fd, 1, NULL); cmd = RFIFOW(fd,0); account_id = RFIFOL(fd, packet_db[packet_ver][cmd].pos[0]); @@ -9015,9 +9083,8 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) return; } - if( runflag != MAPSERVER_ST_RUNNING ) - {// not allowed - clif_authfail_fd(fd,1);// server closed + if( runflag != MAPSERVER_ST_RUNNING ) { // not allowed + clif->authfail_fd(fd,1);// server closed return; } @@ -9037,7 +9104,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) ((node=chrif_search(account_id)) && //An already existing node is valid only if it is for this login. !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) { - clif_authfail_fd(fd, 8); //Still recognizes last connection + clif->authfail_fd(fd, 8); //Still recognizes last connection return; } @@ -9061,7 +9128,23 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) chrif_authreq(sd); } - +void clif_hercules_chsys_mjoin(struct map_session_data *sd) { + if( !map[sd->bl.m].channel ) { + CREATE(map[sd->bl.m].channel, struct hChSysCh , 1); + safestrncpy(map[sd->bl.m].channel->name, hChSys.local_name, HCHSYS_NAME_LENGTH); + map[sd->bl.m].channel->type = hChSys_MAP; + map[sd->bl.m].channel->m = sd->bl.m; + + clif->chsys_create(map[sd->bl.m].channel,NULL,NULL,hChSys.local_color); + } + clif->chsys_join(map[sd->bl.m].channel,sd); + + if( !( map[sd->bl.m].channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) { + char mout[60]; + sprintf(mout, msg_txt(1435),hChSys.local_name,map[sd->bl.m].name); // You're now in the '#%s' channel for '%s' + clif->message(sd->fd, mout); + } +} /// Notification from the client, that it has finished map loading and is about to display player's character (CZ_NOTIFY_ACTORINIT). /// 007d @@ -9070,17 +9153,15 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(sd->bl.prev != NULL) return; - if (!sd->state.active) - { //Character loading is not complete yet! + if (!sd->state.active) { //Character loading is not complete yet! //Let pc_reg_received reinvoke this when ready. sd->state.connect_new = 0; return; } - if (sd->state.rewarp) - { //Rewarp player. + if (sd->state.rewarp) { //Rewarp player. sd->state.rewarp = 0; - clif_changemap(sd, sd->mapindex, sd->bl.x, sd->bl.y); + clif->changemap(sd, sd->mapindex, sd->bl.x, sd->bl.y); return; } @@ -9088,21 +9169,21 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // look #if PACKETVER < 4 - clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); - clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); + clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); + clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); #else - clif_changelook(&sd->bl,LOOK_WEAPON,0); + clif->changelook(&sd->bl,LOOK_WEAPON,0); #endif if(sd->vd.cloth_color) clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); // item - clif_inventorylist(sd); // inventory list first, otherwise deleted items in pc_checkitem show up as 'unknown item' + clif->inventorylist(sd); // inventory list first, otherwise deleted items in pc_checkitem show up as 'unknown item' pc_checkitem(sd); // cart if(pc_iscarton(sd)) { - clif_cartlist(sd); + clif->cartlist(sd); clif->updatestatus(sd,SP_CARTINFO); } @@ -9124,12 +9205,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if( map[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) map_spawnmobs(sd->bl.m); - if( !(sd->sc.option&OPTION_INVISIBLE) ) - {// increment the number of pvp players on the map + if( !(sd->sc.option&OPTION_INVISIBLE) ) { // increment the number of pvp players on the map map[sd->bl.m].users_pvp++; } - if( map[sd->bl.m].instance_id ) - { + if( map[sd->bl.m].instance_id ) { instance[map[sd->bl.m].instance_id].users++; instance_check_idle(map[sd->bl.m].instance_id); } @@ -9139,13 +9218,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) sd->state.callshop = 0; map_addblock(&sd->bl); - clif_spawn(&sd->bl); + clif->spawn(&sd->bl); // Party // (needs to go after clif_spawn() to show hp bars correctly) if(sd->status.party_id) { party_send_movemap(sd); - clif_party_hp(sd); // Show hp after displacement [LuzZza] + clif->party_hp(sd); // Show hp after displacement [LuzZza] } if( sd->bg_id ) clif->bg_hp(sd); // BattleGround System @@ -9160,34 +9239,30 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) sd->pvp_won = 0; sd->pvp_lost = 0; } - clif_map_property(sd, MAPPROPERTY_FREEPVPZONE); + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); } else // set flag, if it's a duel [LuzZza] if(sd->duel_group) - clif_map_property(sd, MAPPROPERTY_FREEPVPZONE); + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); if (map[sd->bl.m].flag.gvg_dungeon) - clif_map_property(sd, MAPPROPERTY_FREEPVPZONE); //TODO: Figure out the real packet to send here. + clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); //TODO: Figure out the real packet to send here. if( map_flag_gvg(sd->bl.m) ) - clif_map_property(sd, MAPPROPERTY_AGITZONE); + clif->map_property(sd, MAPPROPERTY_AGITZONE); // info about nearby objects // must use foreachinarea (CIRCULAR_AREA interferes with foreachinrange) - map_foreachinarea(clif_getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd); + map_foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd); // pet - if( sd->pd ) - { - if( battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m) ) - { //Return the pet to egg. [Skotlex] - clif_displaymessage(sd->fd, msg_txt(666)); + if( sd->pd ) { + if( battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m) ) { //Return the pet to egg. [Skotlex] + clif->message(sd->fd, msg_txt(666)); pet_menu(sd, 3); //Option 3 is return to egg. - } - else - { + } else { map_addblock(&sd->pd->bl); - clif_spawn(&sd->pd->bl); + clif->spawn(&sd->pd->bl); clif->send_petdata(sd,sd->pd,0,0); clif->send_petstatus(sd); // skill->unit_move(&sd->pd->bl,gettick(),1); @@ -9195,14 +9270,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) } //homunculus [blackhole89] - if( merc_is_hom_active(sd->hd) ) - { + if( merc_is_hom_active(sd->hd) ) { map_addblock(&sd->hd->bl); - clif_spawn(&sd->hd->bl); + clif->spawn(&sd->hd->bl); clif->send_homdata(sd,SP_ACK,0); - clif_hominfo(sd,sd->hd,1); - clif_hominfo(sd,sd->hd,0); //for some reason, at least older clients want this sent twice - clif_homskillinfoblock(sd); + clif->hominfo(sd,sd->hd,1); + clif->hominfo(sd,sd->hd,0); //for some reason, at least older clients want this sent twice + clif->homskillinfoblock(sd); if( battle_config.hom_setting&0x8 ) status_calc_bl(&sd->hd->bl, SCB_SPEED); //Homunc mimic their master's speed on each map change if( !(battle_config.hom_setting&0x2) ) @@ -9237,7 +9311,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif->updatestatus(sd,SP_JOBEXP); clif->updatestatus(sd,SP_NEXTJOBEXP); clif->updatestatus(sd,SP_SKILLPOINT); - clif_initialstatus(sd); + clif->initialstatus(sd); if (sd->sc.option&OPTION_FALCON) clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); @@ -9259,7 +9333,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) } if(sd->pd && sd->pd->pet.intimate > 900) - clif_pet_emotion(sd->pd,(sd->pd->pet.class_ - 100)*100 + 50 + pet_hungry_val(sd->pd)); + clif->pet_emotion(sd->pd,(sd->pd->pet.class_ - 100)*100 + 50 + pet_hungry_val(sd->pd)); if(merc_is_hom_active(sd->hd)) merc_hom_init_timers(sd->hd); @@ -9292,11 +9366,10 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) npc_event_dequeue(sd); } - if( sd->state.changemap ) - {// restore information that gets lost on map-change + if( sd->state.changemap ) {// restore information that gets lost on map-change #if PACKETVER >= 20070918 - clif_partyinvitationstate(sd); - clif_equipcheckbox(sd); + clif->partyinvitationstate(sd); + clif->equipcheckbox(sd); #endif if( (battle_config.bg_flee_penalty != 100 || battle_config.gvg_flee_penalty != 100) && (map_flag_gvg(sd->state.pmap) || map_flag_gvg(sd->bl.m) || map[sd->state.pmap].flag.battleground || map[sd->bl.m].flag.battleground) ) @@ -9313,21 +9386,24 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) } if( map[sd->bl.m].flag.battleground ) { - clif_map_type(sd, MAPTYPE_BATTLEFIELD); // Battleground Mode + clif->map_type(sd, MAPTYPE_BATTLEFIELD); // Battleground Mode if( map[sd->bl.m].flag.battleground == 2 ) clif->bg_updatescore_single(sd); } - if( map[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) ) - { + if( map[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) ) { char output[128]; sprintf(output, "[ Kill Steal Protection Disable. KS is allowed in this map ]"); - clif_broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF); + clif->broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF); } map_iwall_get(sd); // Updates Walls Info on this Map to Client status_calc_pc(sd, false);/* some conditions are map-dependent so we must recalculate */ sd->state.changemap = false; + + if( hChSys.local && hChSys.local_autojoin && !map[sd->bl.m].flag.chsysnolocalaj ) { + clif->chsys_mjoin(sd); + } } mail_clear(sd); @@ -9341,8 +9417,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) } if( sd->state.vending ) { /* show we have a vending */ - clif_openvending(sd,sd->bl.id,sd->vending); - clif_showvendingboard(&sd->bl,sd->message,0); + clif->openvending(sd,sd->bl.id,sd->vending); + clif->showvendingboard(&sd->bl,sd->message,0); } if(map[sd->bl.m].flag.loadevent) // Lance @@ -9352,9 +9428,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif->status_change(&sd->bl, SI_DEVIL, 0, 0, 0, 0, 0); //blindness [Komurka] if (sd->sc.opt2) //Client loses these on warp. - clif_changeoption(&sd->bl); + clif->changeoption(&sd->bl); - clif_weather_check(sd); + clif->weather_check(sd); // For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first) if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) @@ -9368,7 +9444,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // If player is dead, and is spawned (such as @refresh) send death packet. [Valaris] if(pc_isdead(sd)) - clif_clearunit_area(&sd->bl, CLR_DEAD); + clif->clearunit_area(&sd->bl, CLR_DEAD); else { skill->usave_trigger(sd); clif->changed_dir(&sd->bl, SELF); @@ -9382,8 +9458,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) /// Server's tick (ZC_NOTIFY_TIME). /// 007f <time>.L -void clif_notify_time(struct map_session_data* sd, unsigned long time) -{ +void clif_notify_time(struct map_session_data* sd, unsigned long time) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x7f)); @@ -9401,7 +9476,7 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) { sd->client_tick = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); - clif_notify_time(sd, gettick()); + clif->notify_time(sd, gettick()); } @@ -9498,14 +9573,14 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) short x, y; if (pc_isdead(sd)) { - clif_clearunit_area(&sd->bl, CLR_DEAD); + clif->clearunit_area(&sd->bl, CLR_DEAD); return; } if (sd->sc.opt1 && ( sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING )) ; //You CAN walk on this OPT1 value. else if( sd->progressbar.npc_id ) - clif_progressbar_abort(sd); + clif->progressbar_abort(sd); else if (pc_cant_act(sd)) return; @@ -9551,9 +9626,9 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd) (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) { set_eof(fd); - clif_disconnect_ack(sd, 0); + clif->disconnect_ack(sd, 0); } else { - clif_disconnect_ack(sd, 1); + clif->disconnect_ack(sd, 1); } } @@ -9594,7 +9669,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) } */ - clif_charnameack(fd, bl); + clif->charnameack(fd, bl); } @@ -9612,7 +9687,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) bool is_fake; // validate packet and retrieve name and message - if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) return; if( is_atcommand(fd, sd, message, 1) ) @@ -9621,12 +9696,32 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; - if( battle_config.min_chat_delay ) - { //[Skotlex] + if( battle_config.min_chat_delay ) { //[Skotlex] if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0) return; sd->cantalk_tick = gettick() + battle_config.min_chat_delay; } + + if( sd->gcbind ) { + clif->chsys_send(sd->gcbind,sd,message); + return; + } else if ( sd->fontcolor && !sd->chatID ) { + char mout[200]; + unsigned char mylen = 1; + + mylen += snprintf(mout, 200, "%s : %s",sd->fakename[0]?sd->fakename:sd->status.name,message); + + WFIFOHEAD(fd,mylen + 12); + WFIFOW(fd,0) = 0x2C1; + WFIFOW(fd,2) = mylen + 12; + WFIFOL(fd,4) = -sd->bl.id; + WFIFOL(fd,8) = hChSys.colors[sd->fontcolor - 1]; + safestrncpy((char*)WFIFOP(fd,12), mout, mylen); + clif->send(WFIFOP(fd,0), WFIFOW(fd,2), &sd->bl, AREA_WOS); + WFIFOSET(fd, mylen + 12); + return; + } + /** * Fake Name Design by FatalEror (bug report #9) **/ @@ -9728,7 +9823,7 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) dir = RFIFOB(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]); pc_setdir(sd, dir, headdir); - clif_changed_dir(&sd->bl, AREA_WOS); + clif->changed_dir(&sd->bl, AREA_WOS); } @@ -9742,32 +9837,30 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 2) { if (emoticon == E_MUTE) {// prevent use of the mute emote [Valaris] - clif_skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); return; } // fix flood of emotion icon (ro-proxy): flood only the hacker player if (sd->emotionlasttime + 1 >= time(NULL)) { // not more than 1 per second sd->emotionlasttime = time(NULL); - clif_skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); return; } sd->emotionlasttime = time(NULL); - if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) - {// re-roll dice + if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) {// re-roll dice emoticon = rnd()%6+E_DICE1; } - clif_emotion(&sd->bl, emoticon); + clif->emotion(&sd->bl, emoticon); } else - clif_skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); } /// Amount of currently online players, reply to /w /who (ZC_USER_COUNT). /// 00c2 <count>.L -void clif_user_count(struct map_session_data* sd, int count) -{ +void clif_user_count(struct map_session_data* sd, int count) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0xc2)); @@ -9782,14 +9875,14 @@ void clif_user_count(struct map_session_data* sd, int count) /// 00c1 void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { - clif_user_count(sd, map_getusers()); + clif->user_count(sd, map_getusers()); } void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, unsigned int tick) { if (pc_isdead(sd)) { - clif_clearunit_area(&sd->bl, CLR_DEAD); + clif->clearunit_area(&sd->bl, CLR_DEAD); return; } @@ -9808,69 +9901,107 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, if(target_id<0 && -target_id == sd->bl.id) // for disguises [Valaris] target_id = sd->bl.id; - switch(action_type) - { - case 0x00: // once attack - case 0x07: // continuous attack + switch(action_type) { + case 0x00: // once attack + case 0x07: // continuous attack - if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE ) - return; + if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE ) + return; - if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER) ) - return; + if( sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER) ) + return; - if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] ) - return; + if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] ) + 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); + 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); + pc_delinvincibletimer(sd); + sd->idletime = last_tick; + unit_attack(&sd->bl, target_id, action_type != 0); + break; + case 0x02: // sitdown + if (battle_config.basic_skill_check && pc_checkskill(sd, NV_BASIC) < 3) { + clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); + break; + } + + if(pc_issit(sd)) { + //Bugged client? Just refresh them. + clif->sitting(&sd->bl); return; } - } - pc_delinvincibletimer(sd); - sd->idletime = last_tick; - unit_attack(&sd->bl, target_id, action_type != 0); - break; - case 0x02: // sitdown - if (battle_config.basic_skill_check && pc_checkskill(sd, NV_BASIC) < 3) { - clif_skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); - break; - } + if (sd->ud.skilltimer != INVALID_TIMER || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) + break; - if(pc_issit(sd)) { - //Bugged client? Just refresh them. - clif_sitting(&sd->bl); - return; - } + if (sd->sc.count && ( + sd->sc.data[SC_DANCING] || + (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) + )) //No sitting during these states either. + break; - if (sd->ud.skilltimer != INVALID_TIMER || (sd->sc.opt1 && sd->sc.opt1 != OPT1_BURNING )) - break; + pc_setsit(sd); + skill->sit(sd,1); + clif->sitting(&sd->bl); + break; + case 0x03: // standup + if (!pc_issit(sd)) { + //Bugged client? Just refresh them. + clif->standing(&sd->bl); + return; + } + pc_setstand(sd); + skill->sit(sd,0); + clif->standing(&sd->bl); + break; + } +} - if (sd->sc.count && ( - sd->sc.data[SC_DANCING] || - (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) - )) //No sitting during these states either. +void clif_hercules_chsys_left(struct hChSysCh *channel, struct map_session_data *sd) { + unsigned char i; + idb_remove(channel->users,sd->status.char_id); + + if( channel == sd->gcbind ) + sd->gcbind = NULL; + + if( !db_size(channel->users) && channel->type == hChSys_PRIVATE ) { + clif->chsys_delete(channel); + } else if( !hChSys.closing && (channel->opt & hChSys_OPT_ANNOUNCE_JOIN) ) { + char message[60]; + sprintf(message, "#%s '%s' left",channel->name,sd->status.name); + clif->chsys_msg(channel,sd,message); + } + + for( i = 0; i < sd->channel_count; i++ ) { + if( sd->channels[i] == channel ) { + sd->channels[i] = NULL; break; - - pc_setsit(sd); - skill->sit(sd,1); - clif_sitting(&sd->bl); - break; - case 0x03: // standup - if (!pc_issit(sd)) { - //Bugged client? Just refresh them. - clif_standing(&sd->bl); - return; } - pc_setstand(sd); - skill->sit(sd,0); - clif_standing(&sd->bl); - break; } -} + + if( i < sd->channel_count ) { + unsigned char cursor = 0; + for( i = 0; i < sd->channel_count; i++ ) { + if( sd->channels[i] == NULL ) + continue; + if( cursor != i ) { + sd->channels[cursor] = sd->channels[i]; + } + cursor++; + } + if ( !(sd->channel_count = cursor) ) { + aFree(sd->channels); + sd->channels = NULL; + } + } +} /// Request for an action. /// 0089 <target id>.L <action>.B (CZ_REQUEST_ACT) @@ -9885,7 +10016,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, /// 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) { - clif_parse_ActionRequest_sub(sd, + clif->pActionRequest_sub(sd, RFIFOB(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]), RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]), gettick() @@ -9898,22 +10029,21 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) /// type: /// 0 = restart (respawn) /// 1 = char-select (disconnect) -void clif_parse_Restart(int fd, struct map_session_data *sd) -{ +void clif_parse_Restart(int fd, struct map_session_data *sd) { switch(RFIFOB(fd,2)) { - case 0x00: - pc_respawn(sd,CLR_RESPAWN); - break; - case 0x01: - /* Rovert's Prevent logout option - Fixed [Valaris] */ - if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && - (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) - { //Send to char-server for character selection. - chrif_charselectreq(sd, session[fd]->client_addr); - } else { - clif_disconnect_ack(sd, 1); - } - break; + case 0x00: + pc_respawn(sd,CLR_RESPAWN); + break; + case 0x01: + /* Rovert's Prevent logout option - Fixed [Valaris] */ + if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && + (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) + { //Send to char-server for character selection. + chrif_charselectreq(sd, session[fd]->client_addr); + } else { + clif->disconnect_ack(sd, 1); + } + break; } } @@ -9929,7 +10059,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) int namelen, messagelen; // validate packet and retrieve name and message - if( !clif_process_message(sd, 1, &target, &namelen, &message, &messagelen) ) + if( !clif->process_message(sd, 1, &target, &namelen, &message, &messagelen) ) return; if ( is_atcommand(fd, sd, message, 1) ) @@ -9951,8 +10081,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) //-------------------------------------------------------// // Lordalfa - Paperboy - To whisper NPC commands // //-------------------------------------------------------// - if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) - { + if (target[0] && (strncasecmp(target,"NPC:",4) == 0) && (strlen(target) > 4)) { char* str = target+4; //Skip the NPC: string part. struct npc_data* npc; if ((npc = npc_name2id(str))) { @@ -9987,15 +10116,38 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) return; } - } else if(strcmpi(target, main_chat_nick) == 0) { // Main chat [LuzZza] - if(!sd->state.mainchat) - clif_displaymessage(fd, msg_txt(388)); // You should enable main chat with "@main on" command. - else { - // send the main message using inter-server system - intif_main_message( sd, message ); + } else if( target[0] == '#' ) { + struct hChSysCh *channel; + char* chname = target; + + chname++; + + if( hChSys.local && strcmpi(chname, hChSys.local_name) == 0 ) { + if( !map[sd->bl.m].channel ) { + clif->chsys_mjoin(sd); + } + channel = map[sd->bl.m].channel; + } else if( hChSys.ally && sd->status.guild_id && strcmpi(chname, hChSys.ally_name) == 0 ) { + struct guild *g = sd->guild; + if( !g ) return; + channel = (struct hChSysCh *)g->channel; + } + if( channel || (channel = strdb_get(clif->channel_db,chname)) ) { + unsigned char k; + for( k = 0; k < sd->channel_count; k++ ) { + if( sd->channels[k] == channel ) + break; + } + if( k < sd->channel_count ) { + clif->chsys_send(channel,sd,message); + } else if( channel->pass[0] == '\0' ) { + clif->chsys_join(channel,sd); + clif->chsys_send(channel,sd,message); + } else { + clif->message(fd, msg_txt(1402)); + } + return; } - - return; } // searching destination character @@ -10014,9 +10166,9 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) // if player ignores everyone if (dstsd->state.ignoreAll) { if (dstsd->sc.option & OPTION_INVISIBLE && pc_get_group_level(sd) < pc_get_group_level(dstsd)) - clif_wis_end(fd, 1); // 1: target character is not loged in + clif->wis_end(fd, 1); // 1: target character is not loged in else - clif_wis_end(fd, 3); // 3: everyone ignored by target + clif->wis_end(fd, 3); // 3: everyone ignored by target return; } @@ -10024,22 +10176,22 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) if( dstsd->state.autotrade == 1 ) { char output[256]; sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); - clif_wis_message(fd, wisp_server_name, output, strlen(output) + 1); + clif->wis_message(fd, wisp_server_name, output, strlen(output) + 1); return; } // if player ignores the source character ARR_FIND(0, MAX_IGNORE_LIST, i, dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0); if(i < MAX_IGNORE_LIST && dstsd->ignore[i].name[0] != '\0') { // source char present in ignore list - clif_wis_end(fd, 2); // 2: ignored by target + clif->wis_end(fd, 2); // 2: ignored by target return; } // notify sender of success - clif_wis_end(fd, 0); // 0: success to send wisper + clif->wis_end(fd, 0); // 0: success to send wisper // Normal message - clif_wis_message(dstsd->fd, sd->status.name, message, messagelen); + clif->wis_message(dstsd->fd, sd->status.name, message, messagelen); } @@ -10074,7 +10226,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) do { if (pc_isdead(sd)) { - clif_clearunit_area(&sd->bl, CLR_DEAD); + clif->clearunit_area(&sd->bl, CLR_DEAD); break; } @@ -10100,7 +10252,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) return; } while (0); // Client REQUIRES a fail packet or you can no longer pick items. - clif_additem(sd,0,0,6); + clif->additem(sd,0,0,6); } @@ -10134,7 +10286,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) } //Because the client does not like being ignored. - clif_dropitem(sd, item_index,0); + clif->dropitem(sd, item_index,0); } @@ -10147,7 +10299,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) int n; if (pc_isdead(sd)) { - clif_clearunit_area(&sd->bl, CLR_DEAD); + clif->clearunit_area(&sd->bl, CLR_DEAD); return; } @@ -10161,7 +10313,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) if(n <0 || n >= MAX_INVENTORY) return; if (!pc_useitem(sd,n)) - clif_useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck. + clif->useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck. } @@ -10172,7 +10324,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) int index; if(pc_isdead(sd)) { - clif_clearunit_area(&sd->bl,CLR_DEAD); + clif->clearunit_area(&sd->bl,CLR_DEAD); return; } index = RFIFOW(fd,2)-2; @@ -10188,7 +10340,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) return; if(!sd->status.inventory[index].identify) { - clif_equipitemack(sd,index,0,0); // fail + clif->equipitemack(sd,index,0,0); // fail return; } @@ -10207,6 +10359,48 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) pc_equipitem(sd,index,RFIFOW(fd,4)); } +void clif_hercules_chsys_delete(struct hChSysCh *channel) { + if( db_size(channel->users) && !hChSys.closing ) { + DBIterator *iter; + struct map_session_data *sd; + char message[60]; + unsigned char i; + sprintf(message, "#%s channel is being shut down",channel->name); + clif->chsys_msg(channel,sd,message); + iter = db_iterator(channel->users); + for( sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter) ) { + for( i = 0; i < sd->channel_count; i++ ) { + if( sd->channels[i] == channel ) { + sd->channels[i] = NULL; + break; + } + } + if( i < sd->channel_count ) { + unsigned char cursor = 0; + for( i = 0; i < sd->channel_count; i++ ) { + if( sd->channels[i] == NULL ) + continue; + if( cursor != i ) { + sd->channels[cursor] = sd->channels[i]; + } + cursor++; + } + if ( !(sd->channel_count = cursor) ) { + aFree(sd->channels); + sd->channels = NULL; + } + } + } + } + db_destroy(channel->users); + if( channel->m ) { + map[channel->m].channel = NULL; + aFree(channel); + } else if ( channel->type == hChSys_ALLY ) + aFree(channel); + else if( !hChSys.closing ) + strdb_remove(clif->channel_db, channel->name); +} /// Request to take off an equip (CZ_REQ_TAKEOFF_EQUIP). /// 00ab <index>.W @@ -10215,7 +10409,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd) int index; if(pc_isdead(sd)) { - clif_clearunit_area(&sd->bl,CLR_DEAD); + clif->clearunit_area(&sd->bl,CLR_DEAD); return; } @@ -10254,7 +10448,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) switch (bl->type) { case BL_MOB: case BL_PC: - clif_parse_ActionRequest_sub(sd, 0x07, bl->id, gettick()); + clif->pActionRequest_sub(sd, 0x07, bl->id, gettick()); break; case BL_NPC: if( bl->m != -1 )// the user can't click floating npcs directly (hack attempt) @@ -10284,8 +10478,7 @@ void clif_parse_NpcBuySellSelected(int fd,struct map_session_data *sd) /// 1 = "You do not have enough zeny." /// 2 = "You are over your Weight Limit." /// 3 = "Out of the maximum capacity, you have too many items." -void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) -{ +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0xca)); @@ -10310,7 +10503,7 @@ void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) sd->npc_shopid = 0; //Clear shop data. - clif_npc_buy_result(sd, result); + clif->npc_buy_result(sd, result); } @@ -10319,8 +10512,7 @@ void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) /// result: /// 0 = "The deal has successfully completed." /// 1 = "The deal has failed." -void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) -{ +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0xcb)); @@ -10347,7 +10539,7 @@ void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) sd->npc_shopid = 0; //Clear shop data. - clif_npc_sell_result(sd, fail); + clif->npc_sell_result(sd, fail); } @@ -10369,7 +10561,7 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) return; if(battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 4) { - clif_skill_fail(sd,1,USESKILL_FAIL_LEVEL,3); + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,3); return; } if( npc_isnear(&sd->bl) ) { @@ -10377,7 +10569,7 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) //char output[150]; //sprintf(output, msg_txt(662), battle_config.min_npc_vendchat_distance); //clif_displaymessage(sd->fd, output); - clif_skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); + clif->skill_fail(sd,1,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); return; } @@ -10457,16 +10649,15 @@ void clif_parse_ChatLeave(int fd, struct map_session_data* sd) //Handles notifying asker and rejecter of what has just ocurred. //Type is used to determine the correct msg_txt to use: //0: -static void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) -{ +void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { const char* msg; char output[256]; // Your request has been rejected by autoreject option. msg = msg_txt(392); - clif_disp_onlyself(src, msg, strlen(msg)); + clif->disp_onlyself(src, msg, strlen(msg)); //Notice that a request was rejected. snprintf(output, 256, msg_txt(393+type), src->status.name, 256); - clif_disp_onlyself(target, output, strlen(output)); + clif->disp_onlyself(target, output, strlen(output)); } @@ -10483,13 +10674,12 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd) // @noask [LuzZza] if(t_sd && t_sd->state.noask) { - clif_noask_sub(sd, t_sd, 0); + clif->noask_sub(sd, t_sd, 0); return; } - if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 1) - { - clif_skill_fail(sd,1,USESKILL_FAIL_LEVEL,0); + if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 1) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,0); return; } @@ -10644,7 +10834,7 @@ void clif_parse_SkillUp(int fd,struct map_session_data *sd) pc_skillup(sd,RFIFOW(fd,2)); } -static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id) +void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id) { int lv; @@ -10666,7 +10856,7 @@ static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_sess unit_skilluse_id(&hd->bl, target_id, skill_id, skill_lv); } -static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) +void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { int lv; if( !hd ) @@ -10687,7 +10877,7 @@ static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_ses unit_skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); } -static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id) +void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id) { int lv; @@ -10709,7 +10899,7 @@ static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct unit_skilluse_id(&md->bl, target_id, skill_id, skill_lv); } -static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) +void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { int lv; if( !md ) @@ -10719,7 +10909,7 @@ static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct if( md->ud.skilltimer != INVALID_TIMER ) return; if( DIFF_TICK(tick, md->ud.canact_tick) < 0 ) { - clif_skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + clif->skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } @@ -10753,15 +10943,13 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if (tmp&INF_GROUND_SKILL || !tmp) return; //Using a ground/passive skill on a target? WRONG. - if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) - { - clif_parse_UseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); + if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) { + clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); return; } - if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) - { - clif_parse_UseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); + if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) { + clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); return; } @@ -10770,7 +10958,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( sd->npc_id ){ #ifdef RENEWAL - clif_msg(sd, 0x783); // TODO look for the client date that has this message. + clif->msg(sd, 0x783); // TODO look for the client date that has this message. #endif return; } @@ -10788,16 +10976,12 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( target_id < 0 && -target_id == sd->bl.id ) // for disguises [Valaris] target_id = sd->bl.id; - if( sd->ud.skilltimer != INVALID_TIMER ) - { + if( sd->ud.skilltimer != INVALID_TIMER ) { if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) return; - } - else if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) - { - if( sd->skillitem != skill_id ) - { - clif_skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + } else if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) { + if( sd->skillitem != skill_id ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } } @@ -10845,7 +11029,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) /*========================================== * Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location *------------------------------------------*/ -static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) { unsigned int tick = gettick(); @@ -10853,13 +11037,12 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uin return; //Using a target skill on the ground? WRONG. if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) { - clif_parse_UseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + clif->pUseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); return; } - if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) - { - clif_parse_UseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); + if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) { + clif->pUseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo); return; } @@ -10868,11 +11051,9 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uin if( skill->not_ok(skill_id, sd) ) return; - if( skillmoreinfo != -1 ) - { - if( pc_issit(sd) ) - { - clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + if( skillmoreinfo != -1 ) { + if( pc_issit(sd) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); return; } //You can't use Graffiti/TalkieBox AND have a vending open, so this is safe. @@ -10884,7 +11065,7 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uin if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) { if( sd->skillitem != skill_id ) { - clif_skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); + clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0); return; } } @@ -10931,7 +11112,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) if (pc_issit(sd)) return; - clif_parse_UseSkillToPosSub(fd, sd, + clif->pUseSkillToPosSub(fd, sd, RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]), //skill lv RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]), //skill num RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[2]), //pos x @@ -10952,7 +11133,7 @@ void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) if (pc_issit(sd)) return; - clif_parse_UseSkillToPosSub(fd, sd, + clif->pUseSkillToPosSub(fd, sd, RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]), //Skill lv RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]), //Skill num RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[2]), //pos x @@ -11007,7 +11188,7 @@ void clif_parse_ProduceMix(int fd,struct map_session_data *sd) } if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11035,7 +11216,7 @@ void clif_parse_Cooking(int fd,struct map_session_data *sd) { if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11053,7 +11234,7 @@ void clif_parse_RepairItem(int fd, struct map_session_data *sd) return; if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11072,7 +11253,7 @@ void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) return; if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11100,7 +11281,7 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) #endif TBL_NPC* nd = map_id2nd(npc_id); ShowWarning("Invalid menu selection on npc %d:'%s' - got %d, valid range is [%d..%d] (player AID:%d, CID:%d, name:'%s')!\n", npc_id, (nd)?nd->name:"invalid npc id", select, 1, sd->npc_menu, sd->bl.id, sd->status.char_id, sd->status.name); - clif_GM_kick(NULL,sd); + clif->GM_kick(NULL,sd); #if SECURE_NPCTIMEOUT } #endif @@ -11183,7 +11364,7 @@ void clif_parse_SelectArrow(int fd,struct map_session_data *sd) { if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. - clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0); clif_menuskill_clear(sd); return; } @@ -11226,7 +11407,7 @@ void clif_parse_UseCard(int fd,struct map_session_data *sd) { if (sd->state.trading != 0) return; - clif_use_card(sd,RFIFOW(fd,2)-2); + clif->use_card(sd,RFIFOW(fd,2)-2); } @@ -11325,8 +11506,7 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) if (sd->state.storage_flag == 1) storage_storageget(sd, item_index, item_amount); - else - if(sd->state.storage_flag == 2) + else if(sd->state.storage_flag == 2) storage_guild_storageget(sd, item_index, item_amount); } @@ -11371,8 +11551,7 @@ void clif_parse_CloseKafra(int fd, struct map_session_data *sd) { if( sd->state.storage_flag == 1 ) storage_storageclose(sd); - else - if( sd->state.storage_flag == 2 ) + else if( sd->state.storage_flag == 2 ) storage_guild_storageclose(sd); } @@ -11438,14 +11617,12 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd) char* name = (char*)RFIFOP(fd,2); name[NAME_LENGTH-1] = '\0'; - if( map[sd->bl.m].flag.partylock ) - {// Party locked. - clif_displaymessage(fd, msg_txt(227)); + if( map[sd->bl.m].flag.partylock ) { // Party locked. + clif->message(fd, msg_txt(227)); return; } - if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) - { - clif_skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); return; } @@ -11459,14 +11636,12 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd) int item2 = RFIFOB(fd,27); name[NAME_LENGTH-1] = '\0'; - if( map[sd->bl.m].flag.partylock ) - {// Party locked. - clif_displaymessage(fd, msg_txt(227)); + if( map[sd->bl.m].flag.partylock ) {// Party locked. + clif->message(fd, msg_txt(227)); return; } - if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) - { - clif_skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); + if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) { + clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); return; } @@ -11481,17 +11656,15 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { struct map_session_data *t_sd; - if(map[sd->bl.m].flag.partylock) - {// Party locked. - clif_displaymessage(fd, msg_txt(227)); + if(map[sd->bl.m].flag.partylock) {// Party locked. + clif->message(fd, msg_txt(227)); return; } t_sd = map_id2sd(RFIFOL(fd,2)); - if(t_sd && t_sd->state.noask) - {// @noask [LuzZza] - clif_noask_sub(sd, t_sd, 1); + if(t_sd && t_sd->state.noask) {// @noask [LuzZza] + clif->noask_sub(sd, t_sd, 1); return; } @@ -11504,17 +11677,15 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) char *name = (char*)RFIFOP(fd,2); name[NAME_LENGTH-1] = '\0'; - if(map[sd->bl.m].flag.partylock) - {// Party locked. - clif_displaymessage(fd, msg_txt(227)); + if(map[sd->bl.m].flag.partylock) { // Party locked. + clif->message(fd, msg_txt(227)); return; } t_sd = map_nick2sd(name); - if(t_sd && t_sd->state.noask) - {// @noask [LuzZza] - clif_noask_sub(sd, t_sd, 1); + if(t_sd && t_sd->state.noask) { // @noask [LuzZza] + clif->noask_sub(sd, t_sd, 1); return; } @@ -11543,9 +11714,8 @@ void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) /// 0100 void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { - if(map[sd->bl.m].flag.partylock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(227)); + if(map[sd->bl.m].flag.partylock) { //Guild locked. + clif->message(fd, msg_txt(227)); return; } party_leave(sd); @@ -11556,9 +11726,8 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd) /// 0103 <account id>.L <char name>.24B void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { - if(map[sd->bl.m].flag.partylock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(227)); + if(map[sd->bl.m].flag.partylock) { //Guild locked. + clif->message(fd, msg_txt(227)); return; } party_removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6)); @@ -11607,7 +11776,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd) int namelen, messagelen; // validate packet and retrieve name and message - if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) return; if( is_atcommand(fd, sd, message, 1) ) @@ -11819,8 +11988,7 @@ void clif_parse_CloseVending(int fd, struct map_session_data* sd) /// 0130 <account id>.L void clif_parse_VendingListReq(int fd, struct map_session_data* sd) { - if( sd->npc_id ) - {// using an NPC + if( sd->npc_id ) {// using an NPC return; } vending_vendinglistreq(sd,RFIFOL(fd,2)); @@ -11877,11 +12045,11 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd) if( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM ) return; if( map[sd->bl.m].flag.novending ) { - clif_displaymessage (sd->fd, msg_txt(276)); // "You can't open a shop on this map" + clif->message (sd->fd, msg_txt(276)); // "You can't open a shop on this map" return; } if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) { - clif_displaymessage (sd->fd, msg_txt(204)); // "You can't open a shop on this cell." + clif->message (sd->fd, msg_txt(204)); // "You can't open a shop on this cell." return; } @@ -11898,9 +12066,8 @@ void clif_parse_CreateGuild(int fd,struct map_session_data *sd) char* name = (char*)RFIFOP(fd,6); name[NAME_LENGTH-1] = '\0'; - if(map[sd->bl.m].flag.guildlock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if(map[sd->bl.m].flag.guildlock) { //Guild locked. + clif->message(fd, msg_txt(228)); return; } @@ -11912,7 +12079,7 @@ void clif_parse_CreateGuild(int fd,struct map_session_data *sd) /// 014d void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) { - clif_guild_masterormember(sd); + clif->guild_masterormember(sd); } @@ -11931,29 +12098,28 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) if( !sd->status.guild_id && !sd->bg_id ) return; - switch( RFIFOL(fd,2) ) - { - case 0: // Basic Information Guild, hostile alliance information - clif_guild_basicinfo(sd); - clif_guild_allianceinfo(sd); - break; - case 1: // Members list, list job title - clif_guild_positionnamelist(sd); - clif_guild_memberlist(sd); - break; - case 2: // List job title, title information list - clif_guild_positionnamelist(sd); - clif_guild_positioninfolist(sd); - break; - case 3: // Skill list - clif_guild_skillinfo(sd); - break; - case 4: // Expulsion list - clif_guild_expulsionlist(sd); - break; - default: - ShowError("clif: guild request info: unknown type %d\n", RFIFOL(fd,2)); - break; + switch( RFIFOL(fd,2) ) { + case 0: // Basic Information Guild, hostile alliance information + clif->guild_basicinfo(sd); + clif->guild_allianceinfo(sd); + break; + case 1: // Members list, list job title + clif->guild_positionnamelist(sd); + clif->guild_memberlist(sd); + break; + case 2: // List job title, title information list + clif->guild_positionnamelist(sd); + clif->guild_positioninfolist(sd); + break; + case 3: // Skill list + clif->guild_skillinfo(sd); + break; + case 4: // Expulsion list + clif->guild_expulsionlist(sd); + break; + default: + ShowError("clif: guild request info: unknown type %d\n", RFIFOL(fd,2)); + break; } } @@ -11997,13 +12163,12 @@ void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) int guild_id = RFIFOL(fd,2); if( (g = guild_search(guild_id)) != NULL ) - clif_guild_emblem(sd,g); + clif->guild_emblem(sd,g); } /// Validates data of a guild emblem (compressed bitmap) -static bool clif_validate_emblem(const uint8* emblem, unsigned long emblem_len) -{ +bool clif_validate_emblem(const uint8* emblem, unsigned long emblem_len) { bool success; uint8 buf[1800]; // no well-formed emblem bitmap is larger than 1782 (24 bit) / 1654 (8 bit) bytes unsigned long buf_len = sizeof(buf); @@ -12028,8 +12193,7 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) if( !emblem_len || !sd->state.gmaster_flag ) return; - if( !clif_validate_emblem(emblem, emblem_len) ) - { + if( !clif->validate_emblem(emblem, emblem_len) ) { ShowWarning("clif_parse_GuildChangeEmblem: Rejected malformed guild emblem (size=%lu, accound_id=%d, char_id=%d, guild_id=%d).\n", emblem_len, sd->status.account_id, sd->status.char_id, sd->status.guild_id); return; } @@ -12064,9 +12228,8 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { struct map_session_data *t_sd; - if(map[sd->bl.m].flag.guildlock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if(map[sd->bl.m].flag.guildlock) { //Guild locked. + clif->message(fd, msg_txt(228)); return; } @@ -12074,7 +12237,7 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd) // @noask [LuzZza] if(t_sd && t_sd->state.noask) { - clif_noask_sub(sd, t_sd, 2); + clif->noask_sub(sd, t_sd, 2); return; } @@ -12097,14 +12260,12 @@ void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) /// 0159 <guild id>.L <account id>.L <char id>.L <reason>.40B void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { - if(map[sd->bl.m].flag.guildlock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if(map[sd->bl.m].flag.guildlock) { //Guild locked. + clif->message(fd, msg_txt(228)); return; } - if( sd->bg_id ) - { - clif_displaymessage(fd, msg_txt(670)); //"You can't leave battleground guilds." + if( sd->bg_id ) { + clif->message(fd, msg_txt(670)); //"You can't leave battleground guilds." return; } @@ -12116,9 +12277,8 @@ void clif_parse_GuildLeave(int fd,struct map_session_data *sd) /// 015b <guild id>.L <account id>.L <char id>.L <reason>.40B void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { - if( map[sd->bl.m].flag.guildlock || sd->bg_id ) - { // Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if( map[sd->bl.m].flag.guildlock || sd->bg_id ) { // Guild locked. + clif->message(fd, msg_txt(228)); return; } guild_expulsion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14)); @@ -12136,7 +12296,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd) int namelen, messagelen; // validate packet and retrieve name and message - if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) return; if( is_atcommand(fd, sd, message, 1) ) @@ -12168,9 +12328,8 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) if(!sd->state.gmaster_flag) return; - if(map[sd->bl.m].flag.guildlock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if(map[sd->bl.m].flag.guildlock) { //Guild locked. + clif->message(fd, msg_txt(228)); return; } @@ -12178,7 +12337,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) // @noask [LuzZza] if(t_sd && t_sd->state.noask) { - clif_noask_sub(sd, t_sd, 3); + clif->noask_sub(sd, t_sd, 3); return; } @@ -12207,9 +12366,8 @@ void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) if(!sd->state.gmaster_flag) return; - if(map[sd->bl.m].flag.guildlock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if(map[sd->bl.m].flag.guildlock) { //Guild locked. + clif->message(fd, msg_txt(228)); return; } guild_delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); @@ -12225,9 +12383,8 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) if(!sd->state.gmaster_flag) return; - if(map[sd->bl.m].flag.guildlock) - { //Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if(map[sd->bl.m].flag.guildlock) { //Guild locked. + clif->message(fd, msg_txt(228)); return; } @@ -12235,7 +12392,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) // @noask [LuzZza] if(t_sd && t_sd->state.noask) { - clif_noask_sub(sd, t_sd, 4); + clif->noask_sub(sd, t_sd, 4); return; } @@ -12250,9 +12407,8 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) /// field name and size is same as the one in CH_DELETE_CHAR. void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { - if( map[sd->bl.m].flag.guildlock ) - { //Guild locked. - clif_displaymessage(fd, msg_txt(228)); + if( map[sd->bl.m].flag.guildlock ) { //Guild locked. + clif->message(fd, msg_txt(228)); return; } guild_break(sd,(char*)RFIFOP(fd,2)); @@ -12288,10 +12444,9 @@ void clif_parse_CatchPet(int fd, struct map_session_data *sd) /// 01a7 <index>.W void clif_parse_SelectEgg(int fd, struct map_session_data *sd) { - if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) - { + if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { //Forged packet, disconnect them [Kevin] - clif_authfail_fd(fd, 0); + clif->authfail_fd(fd, 0); return; } pet_select_egg(sd,RFIFOW(fd,2)-2); @@ -12326,7 +12481,7 @@ void clif_parse_SelectEgg(int fd, struct map_session_data *sd) void clif_parse_SendEmotion(int fd, struct map_session_data *sd) { if(sd->pd) - clif_pet_emotion(sd->pd,RFIFOL(fd,2)); + clif->pet_emotion(sd->pd,RFIFOL(fd,2)); } @@ -12350,45 +12505,45 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) tid = RFIFOL(fd,2); target = map_id2bl(tid); if (!target) { - clif_GM_kickack(sd, 0); + clif->GM_kickack(sd, 0); return; } switch (target->type) { - case BL_PC: - { - char command[NAME_LENGTH+6]; - sprintf(command, "%ckick %s", atcommand_symbol, status_get_name(target)); - is_atcommand(fd, sd, command, 1); - } - break; + case BL_PC: + { + char command[NAME_LENGTH+6]; + sprintf(command, "%ckick %s", atcommand_symbol, status_get_name(target)); + is_atcommand(fd, sd, command, 1); + } + break; - /** - * This one does not invoke any atcommand, so we need to check for permissions. - */ - case BL_MOB: - { - char command[100]; - if( !pc_can_use_command(sd, "killmonster", COMMAND_ATCOMMAND)) { - clif_GM_kickack(sd, 0); - return; + /** + * This one does not invoke any atcommand, so we need to check for permissions. + */ + case BL_MOB: + { + char command[100]; + if( !pc_can_use_command(sd, "killmonster", COMMAND_ATCOMMAND)) { + clif->GM_kickack(sd, 0); + return; + } + sprintf(command, "/kick %s (%d)", status_get_name(target), status_get_class(target)); + log_atcommand(sd, command); + status_percent_damage(&sd->bl, target, 100, 0, true); // can invalidate 'target' } - sprintf(command, "/kick %s (%d)", status_get_name(target), status_get_class(target)); - log_atcommand(sd, command); - status_percent_damage(&sd->bl, target, 100, 0, true); // can invalidate 'target' - } - break; + break; - case BL_NPC: - { - char command[NAME_LENGTH+11]; - sprintf(command, "%cunloadnpc %s", atcommand_symbol, status_get_name(target)); - is_atcommand(fd, sd, command, 1); - } - break; + case BL_NPC: + { + char command[NAME_LENGTH+11]; + sprintf(command, "%cunloadnpc %s", atcommand_symbol, status_get_name(target)); + is_atcommand(fd, sd, command, 1); + } + break; - default: - clif_GM_kickack(sd, 0); + default: + clif->GM_kickack(sd, 0); } } @@ -12432,8 +12587,7 @@ void clif_parse_GMRemove2(int fd, struct map_session_data* sd) struct map_session_data* pl_sd; account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); - if( (pl_sd = map_id2sd(account_id)) != NULL ) - { + if( (pl_sd = map_id2sd(account_id)) != NULL ) { char command[NAME_LENGTH+8]; sprintf(command, "%cjumpto %s", atcommand_symbol, pl_sd->status.name); is_atcommand(fd, sd, command, 1); @@ -12470,8 +12624,7 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd) struct map_session_data* pl_sd; account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); - if( (pl_sd = map_id2sd(account_id)) != NULL ) - { + if( (pl_sd = map_id2sd(account_id)) != NULL ) { char command[NAME_LENGTH+8]; sprintf(command, "%crecall %s", atcommand_symbol, pl_sd->status.name); is_atcommand(fd, sd, command, 1); @@ -12570,8 +12723,7 @@ void clif_parse_GMRc(int fd, struct map_session_data* sd) /// Result of request to resolve account name (ZC_ACK_ACCOUNTNAME). /// 01e0 <account id>.L <account name>.24B -void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) -{ +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x1e0)); @@ -12589,7 +12741,7 @@ void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) int account_id = RFIFOL(fd,2); //TODO: find out if this works for any player or only for authorized GMs - clif_account_name(sd, account_id, ""); // insert account name here >_< + clif->account_name(sd, account_id, ""); // insert account name here >_< } @@ -12611,7 +12763,7 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) type = RFIFOW(fd,6); map_setgatcell(sd->bl.m,x,y,type); - clif_changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); + clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); //FIXME: once players leave the map, the client 'forgets' this information. } @@ -12632,37 +12784,31 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd) nick[NAME_LENGTH-1] = '\0'; // to be sure that the player name has at most 23 characters type = RFIFOB(fd,26); - if( type == 0 ) - { // Add name to ignore list (block) + if( type == 0 ) { // Add name to ignore list (block) if (strcmp(wisp_server_name, nick) == 0) { - clif_wisexin(sd, type, 1); // fail + clif->wisexin(sd, type, 1); // fail return; } // try to find a free spot, while checking for duplicates at the same time ARR_FIND( 0, MAX_IGNORE_LIST, i, sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0 ); - if( i == MAX_IGNORE_LIST ) - {// no space for new entry - clif_wisexin(sd, type, 2); // too many blocks + if( i == MAX_IGNORE_LIST ) {// no space for new entry + clif->wisexin(sd, type, 2); // too many blocks return; } - if( sd->ignore[i].name[0] != '\0' ) - {// name already exists - clif_wisexin(sd, type, 0); // Aegis reports success. + if( sd->ignore[i].name[0] != '\0' ) { // name already exists + clif->wisexin(sd, type, 0); // Aegis reports success. return; } //Insert in position i safestrncpy(sd->ignore[i].name, nick, NAME_LENGTH); - } - else - { // Remove name from ignore list (unblock) + } else { // Remove name from ignore list (unblock) // find entry ARR_FIND( 0, MAX_IGNORE_LIST, i, sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0 ); - if( i == MAX_IGNORE_LIST || sd->ignore[i].name[i] == '\0' ) - { //Not found - clif_wisexin(sd, type, 1); // fail + if( i == MAX_IGNORE_LIST || sd->ignore[i].name[i] == '\0' ) { //Not found + clif->wisexin(sd, type, 1); // fail return; } // move everything one place down to overwrite removed entry @@ -12671,7 +12817,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd) memset(sd->ignore[MAX_IGNORE_LIST-1].name, 0, sizeof(sd->ignore[0].name)); } - clif_wisexin(sd, type, 0); // success + clif->wisexin(sd, type, 0); // success } @@ -12685,17 +12831,14 @@ void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) { int type = RFIFOB(fd,2), flag; - if( type == 0 ) - {// Deny all + if( type == 0 ) {// Deny all if( sd->state.ignoreAll ) { flag = 1; // fail } else { sd->state.ignoreAll = 1; flag = 0; // success } - } - else - {//Unblock everyone + } else {//Unblock everyone if( sd->state.ignoreAll ) { sd->state.ignoreAll = 0; flag = 0; // success @@ -12710,21 +12853,19 @@ void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) } } - clif_wisall(sd, type, flag); + clif->wisall(sd, type, flag); } /// Whisper ignore list (ZC_WHISPER_LIST). /// 00d4 <packet len>.W { <char name>.24B }* -void clif_PMIgnoreList(struct map_session_data* sd) -{ +void clif_PMIgnoreList(struct map_session_data* sd) { int i, fd = sd->fd; WFIFOHEAD(fd,4+ARRAYLENGTH(sd->ignore)*NAME_LENGTH); WFIFOW(fd,0) = 0xd4; - for( i = 0; i < ARRAYLENGTH(sd->ignore) && sd->ignore[i].name[0]; i++ ) - { + for( i = 0; i < ARRAYLENGTH(sd->ignore) && sd->ignore[i].name[0]; i++ ) { memcpy(WFIFOP(fd,4+i*NAME_LENGTH), sd->ignore[i].name, NAME_LENGTH); } @@ -12737,7 +12878,7 @@ void clif_PMIgnoreList(struct map_session_data* sd) /// 00d3 void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) { - clif_PMIgnoreList(sd); + clif->PMIgnoreList(sd); } @@ -12747,8 +12888,7 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) { if (sd->state.doridori) return; - switch (sd->class_&MAPID_UPPERMASK) - { + switch (sd->class_&MAPID_UPPERMASK) { case MAPID_SOUL_LINKER: case MAPID_STAR_GLADIATOR: case MAPID_TAEKWON: @@ -12771,18 +12911,15 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) /// "Help me out~ Please~ T_T" void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) { - if( ( sd->class_&MAPID_UPPERMASK ) == MAPID_SUPER_NOVICE ) - { + if( ( sd->class_&MAPID_UPPERMASK ) == MAPID_SUPER_NOVICE ) { unsigned int next = pc_nextbaseexp(sd); if( next == 0 ) next = pc_thisbaseexp(sd); - if( next ) - { + if( next ) { int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); - if( percent && ( percent%100 ) == 0 ) - {// 10.0%, 20.0%, ..., 90.0% + if( percent && ( percent%100 ) == 0 ) {// 10.0%, 20.0%, ..., 90.0% sc_start(&sd->bl, status_skill2sc(MO_EXPLOSIONSPIRITS), 100, 17, skill->get_time(MO_EXPLOSIONSPIRITS, 5)); //Lv17-> +50 critical (noted by Poki) [Skotlex] - clif_skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); // prayer always shows successful Lv5 cast and disregards noskill restrictions + clif->skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1); // prayer always shows successful Lv5 cast and disregards noskill restrictions } } } @@ -12797,8 +12934,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) /// state: /// 0 = online /// 1 = offline -void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) -{ +void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { int i, fd = sd->fd; //Seek friend. @@ -12824,7 +12960,7 @@ int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) account_id = va_arg(ap, int); char_id = va_arg(ap, int); online = va_arg(ap, int); - clif_friendslist_toggle(sd, account_id, char_id, online); + clif->friendslist_toggle(sd, account_id, char_id, online); return 0; } @@ -12838,8 +12974,7 @@ void clif_friendslist_send(struct map_session_data *sd) // Send friends list WFIFOHEAD(fd, MAX_FRIENDS * 32 + 4); WFIFOW(fd, 0) = 0x201; - for(i = 0; i < MAX_FRIENDS && sd->status.friends[i].char_id; i++) - { + for(i = 0; i < MAX_FRIENDS && sd->status.friends[i].char_id; i++) { WFIFOL(fd, 4 + 32 * i + 0) = sd->status.friends[i].account_id; WFIFOL(fd, 4 + 32 * i + 4) = sd->status.friends[i].char_id; memcpy(WFIFOP(fd, 4 + 32 * i + 8), &sd->status.friends[i].name, NAME_LENGTH); @@ -12850,10 +12985,9 @@ void clif_friendslist_send(struct map_session_data *sd) WFIFOSET(fd, WFIFOW(fd,2)); } - for (n = 0; n < i; n++) - { //Sending the online players + for (n = 0; n < i; n++) { //Sending the online players if (map_charid2sd(sd->status.friends[n].char_id)) - clif_friendslist_toggle(sd, sd->status.friends[n].account_id, sd->status.friends[n].char_id, 1); + clif->friendslist_toggle(sd, sd->status.friends[n].account_id, sd->status.friends[n].char_id, 1); } } @@ -12874,8 +13008,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat WFIFOHEAD(fd,packet_len(0x209)); WFIFOW(fd,0) = 0x209; WFIFOW(fd,2) = type; - if (f_sd) - { + if (f_sd) { WFIFOL(fd,4) = f_sd->status.account_id; WFIFOL(fd,8) = f_sd->status.char_id; memcpy(WFIFOP(fd, 12), f_sd->status.name,NAME_LENGTH); @@ -12886,8 +13019,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat /// Asks a player for permission to be added as friend (ZC_REQ_ADD_FRIENDS). /// 0207 <req account id>.L <req char id>.L <req char name>.24B -void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) -{ +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x207)); @@ -12912,31 +13044,30 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) ARR_FIND(0, MAX_FRIENDS, i, sd->status.friends[i].char_id == 0); if( i == MAX_FRIENDS ) { - clif_friendslist_reqack(sd, f_sd, 2); + clif->friendslist_reqack(sd, f_sd, 2); return; } // Friend doesn't exist (no player with this name) if (f_sd == NULL) { - clif_displaymessage(fd, msg_txt(3)); + clif->message(fd, msg_txt(3)); return; } - if( sd->bl.id == f_sd->bl.id ) - {// adding oneself as friend + if( sd->bl.id == f_sd->bl.id ) { // adding oneself as friend return; } // @noask [LuzZza] if(f_sd->state.noask) { - clif_noask_sub(sd, f_sd, 5); + clif->noask_sub(sd, f_sd, 5); return; } // Friend already exists for (i = 0; i < MAX_FRIENDS && sd->status.friends[i].char_id != 0; i++) { if (sd->status.friends[i].char_id == f_sd->status.char_id) { - clif_displaymessage(fd, msg_txt(671)); //"Friend already exists." + clif->message(fd, msg_txt(671)); //"Friend already exists." return; } } @@ -12944,7 +13075,7 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) f_sd->friend_req = sd->status.char_id; sd->friend_req = f_sd->status.char_id; - clif_friendlist_req(f_sd, sd->status.account_id, sd->status.char_id, sd->status.name); + clif->friendlist_req(f_sd, sd->status.account_id, sd->status.char_id, sd->status.name); } @@ -12968,8 +13099,7 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) reply = RFIFOL(fd,10); #endif - if( sd->bl.id == account_id ) - {// adding oneself as friend + if( sd->bl.id == account_id ) { // adding oneself as friend return; } @@ -12978,7 +13108,7 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) return; if (reply == 0 || !( sd->friend_req == f_sd->status.char_id && f_sd->friend_req == sd->status.char_id ) ) - clif_friendslist_reqack(f_sd, sd, 1); + clif->friendslist_reqack(f_sd, sd, 1); else { int i; // Find an empty slot @@ -12986,14 +13116,14 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) if (f_sd->status.friends[i].char_id == 0) break; if (i == MAX_FRIENDS) { - clif_friendslist_reqack(f_sd, sd, 2); + clif->friendslist_reqack(f_sd, sd, 2); return; } f_sd->status.friends[i].account_id = sd->status.account_id; f_sd->status.friends[i].char_id = sd->status.char_id; memcpy(f_sd->status.friends[i].name, sd->status.name, NAME_LENGTH); - clif_friendslist_reqack(f_sd, sd, 0); + clif->friendslist_reqack(f_sd, sd, 0); if (battle_config.friend_auto_add) { // Also add f_sd to sd's friendlist. @@ -13004,14 +13134,14 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) break; } if (i == MAX_FRIENDS) { - clif_friendslist_reqack(sd, f_sd, 2); + clif->friendslist_reqack(sd, f_sd, 2); return; } sd->status.friends[i].account_id = f_sd->status.account_id; sd->status.friends[i].char_id = f_sd->status.char_id; memcpy(sd->status.friends[i].name, f_sd->status.name, NAME_LENGTH); - clif_friendslist_reqack(sd, f_sd, 0); + clif->friendslist_reqack(sd, f_sd, 0); } } } @@ -13033,7 +13163,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) (sd->status.friends[i].char_id != char_id || sd->status.friends[i].account_id != account_id); i++); if (i == MAX_FRIENDS) { - clif_displaymessage(fd, msg_txt(672)); //"Name not found in list." + clif->message(fd, msg_txt(672)); //"Name not found in list." return; } @@ -13058,7 +13188,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) } else { //friend not online -- ask char server to delete from his friendlist if(chrif_removefriend(char_id,sd->status.char_id)) { // char-server offline, abort - clif_displaymessage(fd, msg_txt(673)); //"This action can't be performed at the moment. Please try again later." + clif->message(fd, msg_txt(673)); //"This action can't be performed at the moment. Please try again later." return; } } @@ -13071,7 +13201,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) memcpy(&sd->status.friends[j-1], &sd->status.friends[j], sizeof(sd->status.friends[0])); memset(&sd->status.friends[MAX_FRIENDS-1], 0, sizeof(sd->status.friends[MAX_FRIENDS-1])); - clif_displaymessage(fd, msg_txt(674)); //"Friend removed" + clif->message(fd, msg_txt(674)); //"Friend removed" WFIFOHEAD(fd,packet_len(0x20a)); WFIFOW(fd,0) = 0x20a; @@ -13083,8 +13213,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) /// /pvpinfo list (ZC_ACK_PVPPOINT). /// 0210 <char id>.L <account id>.L <win point>.L <lose point>.L <point>.L -void clif_PVPInfo(struct map_session_data* sd) -{ +void clif_PVPInfo(struct map_session_data* sd) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x210)); @@ -13103,7 +13232,7 @@ void clif_PVPInfo(struct map_session_data* sd) void clif_parse_PVPInfo(int fd,struct map_session_data *sd) { // TODO: Is there a way to use this on an another player (char/acc id)? - clif_PVPInfo(sd); + clif->PVPInfo(sd); } @@ -13142,7 +13271,7 @@ void clif_blacksmith(struct map_session_data* sd) /// 0217 void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { - clif_blacksmith(sd); + clif->blacksmith(sd); } @@ -13162,8 +13291,7 @@ void clif_fame_blacksmith(struct map_session_data *sd, int points) /// /alchemist list (ZC_ALCHEMIST_RANK). /// 021a { <name>.24B }*10 { <point>.L }*10 -void clif_alchemist(struct map_session_data* sd) -{ +void clif_alchemist(struct map_session_data* sd) { int i, fd = sd->fd; const char* name; @@ -13195,7 +13323,7 @@ void clif_alchemist(struct map_session_data* sd) /// 0218 void clif_parse_Alchemist(int fd,struct map_session_data *sd) { - clif_alchemist(sd); + clif->alchemist(sd); } @@ -13215,8 +13343,7 @@ void clif_fame_alchemist(struct map_session_data *sd, int points) /// /taekwon list (ZC_TAEKWON_RANK). /// 0226 { <name>.24B }*10 { <point>.L }*10 -void clif_taekwon(struct map_session_data* sd) -{ +void clif_taekwon(struct map_session_data* sd) { int i, fd = sd->fd; const char* name; @@ -13247,7 +13374,7 @@ void clif_taekwon(struct map_session_data* sd) /// 0225 void clif_parse_Taekwon(int fd,struct map_session_data *sd) { - clif_taekwon(sd); + clif->taekwon(sd); } @@ -13267,8 +13394,7 @@ void clif_fame_taekwon(struct map_session_data *sd, int points) /// /pk list (ZC_KILLER_RANK). /// 0238 { <name>.24B }*10 { <point>.L }*10 -void clif_ranking_pk(struct map_session_data* sd) -{ +void clif_ranking_pk(struct map_session_data* sd) { int i, fd = sd->fd; WFIFOHEAD(fd,packet_len(0x238)); @@ -13285,7 +13411,7 @@ void clif_ranking_pk(struct map_session_data* sd) /// 0237 void clif_parse_RankingPk(int fd,struct map_session_data *sd) { - clif_ranking_pk(sd); + clif->ranking_pk(sd); } @@ -13310,7 +13436,7 @@ void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) //Are these really needed? Shouldn't they show up automatically from the feel save packet? // clif_misceffect2(&sd->bl, 0x1b0); // clif_misceffect2(&sd->bl, 0x21f); - clif_feel_info(sd, i, 0); + clif->feel_info(sd, i, 0); clif_menuskill_clear(sd); } @@ -13440,7 +13566,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) if (!status_revive(&sd->bl, 100, 100)) return; - clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); + clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); pc_delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME); } @@ -13452,8 +13578,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) /// <itemdefPower>.W <plusdefPower>.W <mdefPower>.W <plusmdefPower>.W /// <hitSuccessValue>.W <avoidSuccessValue>.W <plusAvoidSuccessValue>.W /// <criticalSuccessValue>.W <ASPD>.W <plusASPD>.W -void clif_check(int fd, struct map_session_data* pl_sd) -{ +void clif_check(int fd, struct map_session_data* pl_sd) { WFIFOHEAD(fd,packet_len(0x214)); WFIFOW(fd, 0) = 0x214; WFIFOB(fd, 2) = min(pl_sd->status.str, UINT8_MAX); @@ -13504,7 +13629,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd) return; } - clif_check(fd, pl_sd); + clif->check(fd, pl_sd); } @@ -13647,11 +13772,10 @@ void clif_Mail_refreshinbox(struct map_session_data *sd) } WFIFOSET(fd,len); - if( md->full ) - {// TODO: is this official? + if( md->full ) {// TODO: is this official? char output[100]; sprintf(output, "Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX); - clif_disp_onlyself(sd, output, strlen(output)); + clif->disp_onlyself(sd, output, strlen(output)); } } @@ -13665,7 +13789,7 @@ void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) if( md->amount < MAIL_MAX_INBOX && (md->full || sd->mail.changed) ) intif_Mail_requestinbox(sd->status.char_id, 1); else - clif_Mail_refreshinbox(sd); + clif->mail_refreshinbox(sd); mail_removeitem(sd, 0); mail_removezeny(sd, 0); @@ -13681,14 +13805,11 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id) int i, fd = sd->fd; ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id); - if( i == MAIL_MAX_INBOX ) - { - clif_Mail_return(sd->fd, mail_id, 1); // Mail doesn't exist + if( i == MAIL_MAX_INBOX ) { + clif->mail_return(sd->fd, mail_id, 1); // Mail doesn't exist ShowWarning("clif_parse_Mail_read: char '%s' trying to read a message not the inbox.\n", sd->status.name); return; - } - else - { + } else { struct mail_message *msg = &sd->mail.inbox.msg[i]; struct item *item = &msg->item; struct item_data *data; @@ -13710,8 +13831,7 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id) WFIFOL(fd,72) = 0; WFIFOL(fd,76) = msg->zeny; - if( item->nameid && (data = itemdb_exists(item->nameid)) != NULL ) - { + if( item->nameid && (data = itemdb_exists(item->nameid)) != NULL ) { WFIFOL(fd,80) = item->amount; WFIFOW(fd,84) = (data->view_id)?data->view_id:item->nameid; WFIFOW(fd,86) = data->type; @@ -13722,8 +13842,7 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id) WFIFOW(fd,93) = item->card[1]; WFIFOW(fd,95) = item->card[2]; WFIFOW(fd,97) = item->card[3]; - } - else // no item, set all to zero + } else // no item, set all to zero memset(WFIFOP(fd,80), 0x00, 19); WFIFOB(fd,99) = (unsigned char)msg_len; @@ -13733,7 +13852,7 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id) if (msg->status == MAIL_UNREAD) { msg->status = MAIL_READ; intif_Mail_read(mail_id); - clif_parse_Mail_refreshinbox(fd, sd); + clif->pMail_refreshinbox(fd, sd); } } } @@ -13750,7 +13869,7 @@ void clif_parse_Mail_read(int fd, struct map_session_data *sd) if( mail_invalid_operation(sd) ) return; - clif_Mail_read(sd, RFIFOL(fd,2)); + clif->mail_read(sd, RFIFOL(fd,2)); } @@ -13776,22 +13895,19 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) if( sd->mail.inbox.msg[i].zeny < 1 && (sd->mail.inbox.msg[i].item.nameid < 1 || sd->mail.inbox.msg[i].item.amount < 1) ) return; - if( sd->mail.inbox.msg[i].zeny + sd->status.zeny > MAX_ZENY ) - { - clif_Mail_getattachment(fd, 1); + if( sd->mail.inbox.msg[i].zeny + sd->status.zeny > MAX_ZENY ) { + clif->mail_getattachment(fd, 1); return; } - if( sd->mail.inbox.msg[i].item.nameid > 0 ) - { + if( sd->mail.inbox.msg[i].item.nameid > 0 ) { struct item_data *data; unsigned int weight; if ((data = itemdb_exists(sd->mail.inbox.msg[i].item.nameid)) == NULL) return; - switch( pc_checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) - { + switch( pc_checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { case ADDITEM_NEW: fail = ( pc_inventoryblank(sd) == 0 ); break; @@ -13799,23 +13915,21 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) fail = true; } - if( fail ) - { - clif_Mail_getattachment(fd, 1); + if( fail ) { + clif->mail_getattachment(fd, 1); return; } weight = data->weight * sd->mail.inbox.msg[i].item.amount; - if( sd->weight + weight > sd->max_weight ) - { - clif_Mail_getattachment(fd, 2); + if( sd->weight + weight > sd->max_weight ) { + clif->mail_getattachment(fd, 2); return; } } sd->mail.inbox.msg[i].zeny = 0; memset(&sd->mail.inbox.msg[i].item, 0, sizeof(struct item)); - clif_Mail_read(sd, mail_id); + clif->mail_read(sd, mail_id); intif_Mail_getattach(sd->status.char_id, mail_id); } @@ -13836,13 +13950,11 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd) return; ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id); - if (i < MAIL_MAX_INBOX) - { + if (i < MAIL_MAX_INBOX) { struct mail_message *msg = &sd->mail.inbox.msg[i]; - if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) - {// can't delete mail without removing attachment first - clif_Mail_delete(sd->fd, mail_id, 1); + if( (msg->item.nameid > 0 && msg->item.amount > 0) || msg->zeny > 0 ) {// can't delete mail without removing attachment first + clif->mail_delete(sd->fd, mail_id, 1); return; } @@ -13867,7 +13979,7 @@ void clif_parse_Mail_return(int fd, struct map_session_data *sd) if( i < MAIL_MAX_INBOX && sd->mail.inbox.msg[i].send_id != 0 ) intif_Mail_return(sd->status.char_id, mail_id); else - clif_Mail_return(sd->fd, mail_id, 1); + clif->mail_return(sd->fd, mail_id, 1); } @@ -13885,7 +13997,7 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) return; flag = mail_setitem(sd, idx, amount); - clif_Mail_setattachment(fd,idx,flag); + clif->mail_setattachment(fd,idx,flag); } @@ -13923,10 +14035,9 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) return; } - if( DIFF_TICK(sd->cansendmail_tick, gettick()) > 0 ) - { - clif_displaymessage(sd->fd,msg_txt(675)); //"Cannot send mails too fast!!." - clif_Mail_send(fd, true); // fail + if( DIFF_TICK(sd->cansendmail_tick, gettick()) > 0 ) { + clif->message(sd->fd,msg_txt(675)); //"Cannot send mails too fast!!." + clif->mail_send(fd, true); // fail return; } @@ -13935,9 +14046,8 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) if (body_len > MAIL_BODY_LENGTH) body_len = MAIL_BODY_LENGTH; - if( !mail_setattachment(sd, &msg) ) - { // Invalid Append condition - clif_Mail_send(sd->fd, true); // fail + if( !mail_setattachment(sd, &msg) ) { // Invalid Append condition + clif->mail_send(sd->fd, true); // fail mail_removeitem(sd,0); mail_removezeny(sd,0); return; @@ -14005,8 +14115,7 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages, WFIFOL(fd,4) = pages; WFIFOL(fd,8) = count; - for( i = 0; i < count; i++ ) - { + for( i = 0; i < count; i++ ) { memcpy(&auction, RBUFP(buf,i * len), len); k = 12 + (i * 83); @@ -14041,8 +14150,7 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages, /// result: /// 0 = success /// 1 = failure -static void clif_Auction_setitem(int fd, int index, bool fail) -{ +void clif_Auction_setitem(int fd, int index, bool fail) { WFIFOHEAD(fd,packet_len(0x256)); WFIFOW(fd,0) = 0x256; WFIFOW(fd,2) = index; @@ -14060,7 +14168,7 @@ static void clif_Auction_setitem(int fd, int index, bool fail) void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) { if( sd->auction.amount > 0 ) - clif_additem(sd, sd->auction.index, sd->auction.amount, 0); + clif->additem(sd, sd->auction.index, sd->auction.amount, 0); sd->auction.amount = 0; } @@ -14077,34 +14185,32 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) if( sd->auction.amount > 0 ) sd->auction.amount = 0; - if( idx < 0 || idx >= MAX_INVENTORY ) - { + if( idx < 0 || idx >= MAX_INVENTORY ) { ShowWarning("Character %s trying to set invalid item index in auctions.\n", sd->status.name); return; } - if( amount != 1 || amount > sd->status.inventory[idx].amount ) - { // By client, amount is always set to 1. Maybe this is a future implementation. + if( amount != 1 || amount > sd->status.inventory[idx].amount ) { // By client, amount is always set to 1. Maybe this is a future implementation. ShowWarning("Character %s trying to set invalid amount in auctions.\n", sd->status.name); return; } if( (item = itemdb_exists(sd->status.inventory[idx].nameid)) != NULL && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) ) { // Consumable or pets are not allowed - clif_Auction_setitem(sd->fd, idx, true); + clif->auction_setitem(sd->fd, idx, true); return; } if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time || !sd->status.inventory[idx].identify || !itemdb_canauction(&sd->status.inventory[idx],pc_get_group_level(sd)) ) { // Quest Item or something else - clif_Auction_setitem(sd->fd, idx, true); + clif->auction_setitem(sd->fd, idx, true); return; } sd->auction.index = idx; sd->auction.amount = amount; - clif_Auction_setitem(fd, idx + 2, false); + clif->auction_setitem(fd, idx + 2, false); } /// Result from an auction action (ZC_AUCTION_RESULT). @@ -14156,28 +14262,24 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) auction.hours = RFIFOW(fd,10); // Invalid Situations... - if( sd->auction.amount < 1 ) - { + if( sd->auction.amount < 1 ) { ShowWarning("Character %s trying to register auction without item.\n", sd->status.name); return; } - if( auction.price >= auction.buynow ) - { + if( auction.price >= auction.buynow ) { ShowWarning("Character %s trying to alter auction prices.\n", sd->status.name); return; } - if( auction.hours < 1 || auction.hours > 48 ) - { + if( auction.hours < 1 || auction.hours > 48 ) { ShowWarning("Character %s trying to enter an invalid time for auction.\n", sd->status.name); return; } // Auction checks... - if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) - { - clif_Auction_message(fd, 5); // You do not have enough zeny to pay the Auction Fee. + if( sd->status.zeny < (auction.hours * battle_config.auction_feeperhour) ) { + clif->auction_message(fd, 5); // You do not have enough zeny to pay the Auction Fee. return; } @@ -14196,13 +14298,13 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount ) { - clif_Auction_message(fd, 2); // The auction has been canceled + clif->auction_message(fd, 2); // The auction has been canceled return; } if( (item = itemdb_exists(sd->status.inventory[sd->auction.index].nameid)) == NULL ) { // Just in case - clif_Auction_message(fd, 2); // The auction has been canceled + clif->auction_message(fd, 2); // The auction has been canceled return; } @@ -14213,7 +14315,7 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) auction.timestamp = 0; if( !intif_Auction_register(&auction) ) - clif_Auction_message(fd, 4); // No Char Server? lets say something to the client + clif->auction_message(fd, 4); // No Char Server? lets say something to the client else { int zeny = auction.hours*battle_config.auction_feeperhour; @@ -14254,16 +14356,16 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd) int bid = RFIFOL(fd,6); if( !pc_can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish] - clif_displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); return; } if( bid <= 0 ) - clif_Auction_message(fd, 0); // You have failed to bid into the auction + clif->auction_message(fd, 0); // You have failed to bid into the auction else if( bid > sd->status.zeny ) - clif_Auction_message(fd, 8); // You do not have enough zeny + clif->auction_message(fd, 8); // You do not have enough zeny else if ( CheckForCharServer() ) // char server is down (bugreport:1138) - clif_Auction_message(fd, 0); // You have failed to bid into the auction + clif->auction_message(fd, 0); // You have failed to bid into the auction else { pc_payzeny(sd, bid, LOG_TYPE_AUCTION, NULL); intif_Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); @@ -14286,7 +14388,7 @@ void clif_parse_Auction_search(int fd, struct map_session_data* sd) short type = RFIFOW(fd,2), page = RFIFOW(fd,32); int price = RFIFOL(fd,4); // FIXME: bug #5071 - clif_parse_Auction_cancelreg(fd, sd); + clif->pAuction_cancelreg(fd, sd); safestrncpy(search_text, (char*)RFIFOP(fd,8), sizeof(search_text)); intif_Auction_requestlist(sd->status.char_id, type, price, search_text, page); @@ -14301,7 +14403,7 @@ void clif_parse_Auction_search(int fd, struct map_session_data* sd) void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) { short type = RFIFOW(fd,2) + 6; - clif_parse_Auction_cancelreg(fd, sd); + clif->pAuction_cancelreg(fd, sd); intif_Auction_requestlist(sd->status.char_id, type, 0, "", 1); } @@ -14335,8 +14437,7 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) WFIFOL(fd,8) = sd->kafraPoints; // Kafra Points #endif - for( i = 0; i < nd->u.shop.count; i++ ) - { + for( i = 0; i < nd->u.shop.count; i++ ) { struct item_data* id = itemdb_search(nd->u.shop.shop_item[i].nameid); WFIFOL(fd,offset+0+i*11) = nd->u.shop.shop_item[i].value; WFIFOL(fd,offset+4+i*11) = nd->u.shop.shop_item[i].value; // Discount Price @@ -14360,8 +14461,7 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) /// 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. -void clif_cashshop_ack(struct map_session_data* sd, int error) -{ +void clif_cashshop_ack(struct map_session_data* sd, int error) { int fd = sd->fd; WFIFOHEAD(fd, packet_len(0x289)); @@ -14388,8 +14488,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) if( sd->state.trading || !sd->npc_shopid ) fail = 1; - else - { + else { #if PACKETVER < 20101116 short nameid = RFIFOW(fd,2); short amount = RFIFOW(fd,4); @@ -14411,7 +14510,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) #endif } - clif_cashshop_ack(sd,fail); + clif->cashshop_ack(sd,fail); } @@ -14437,8 +14536,7 @@ void clif_Adopt_reply(struct map_session_data *sd, int type) /// Adoption confirmation (ZC_REQ_BABY). /// 01f6 <account id>.L <char id>.L <name>.B -void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) -{ +void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { int fd = sd->fd; WFIFOHEAD(fd,34); @@ -14456,10 +14554,9 @@ void clif_parse_Adopt_request(int fd, struct map_session_data *sd) { struct map_session_data *tsd = map_id2sd(RFIFOL(fd,2)), *p_sd = map_charid2sd(sd->status.partner_id); - if( pc_can_Adopt(sd, p_sd, tsd) ) - { + if( pc_can_Adopt(sd, p_sd, tsd) ) { tsd->adopt_invite = sd->status.account_id; - clif_Adopt_request(tsd, sd, p_sd->status.account_id); + clif->adopt_request(tsd, sd, p_sd->status.account_id); } } @@ -14506,21 +14603,15 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag) memset(WFIFOP(fd,0),0,70); WFIFOW(fd,0) = 0x293; - if( md != NULL ) - { - if( md->bl.prev != NULL ) - { // Boss on This Map - if( flag ) - { + if( md != NULL ) { + if( md->bl.prev != NULL ) { // Boss on This Map + if( flag ) { WFIFOB(fd,2) = 1; WFIFOL(fd,3) = md->bl.x; WFIFOL(fd,7) = md->bl.y; - } - else + } else WFIFOB(fd,2) = 2; // First Time - } - else if (md->spawn_timer != INVALID_TIMER) - { // Boss is Dead + } else if (md->spawn_timer != INVALID_TIMER) { // Boss is Dead const struct TimerData * timer_data = get_timer(md->spawn_timer); unsigned int seconds; int hours, minutes; @@ -14552,9 +14643,9 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) return; if( tsd->status.show_equip || pc_has_permission(sd, PC_PERM_VIEW_EQUIPMENT) ) - clif_viewequip_ack(sd, tsd); + clif->viewequip_ack(sd, tsd); else - clif_viewequip_fail(sd); + clif->viewequip_fail(sd); } @@ -14569,7 +14660,7 @@ void clif_parse_EquipTick(int fd, struct map_session_data* sd) { bool flag = (bool)RFIFOL(fd,6); sd->status.show_equip = flag; - clif_equiptickack(sd, flag); + clif->equiptickack(sd, flag); } @@ -14589,8 +14680,7 @@ void clif_quest_send_list(struct map_session_data * sd) WFIFOW(fd, 2) = len; WFIFOL(fd, 4) = sd->avail_quests; - for( i = 0; i < sd->avail_quests; i++ ) - { + for( i = 0; i < sd->avail_quests; i++ ) { WFIFOL(fd, i*5+8) = sd->quest_log[i].quest_id; WFIFOB(fd, i*5+12) = sd->quest_log[i].state; } @@ -14613,8 +14703,7 @@ void clif_quest_send_mission(struct map_session_data * sd) WFIFOW(fd, 2) = len; WFIFOL(fd, 4) = sd->avail_quests; - for( i = 0; i < sd->avail_quests; i++ ) - { + for( i = 0; i < sd->avail_quests; i++ ) { WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; WFIFOL(fd, i*104+12) = sd->quest_log[i].time - quest_db[sd->quest_index[i]].time; WFIFOL(fd, i*104+16) = sd->quest_log[i].time; @@ -14649,8 +14738,7 @@ void clif_quest_add(struct map_session_data * sd, struct quest * qd, int index) WFIFOL(fd, 11) = qd->time; WFIFOW(fd, 15) = quest_db[index].num_objectives; - for( i = 0; i < quest_db[index].num_objectives; i++ ) - { + for( i = 0; i < quest_db[index].num_objectives; i++ ) { WFIFOL(fd, i*30+17) = quest_db[index].mob[i]; WFIFOW(fd, i*30+21) = qd->count[i]; mob = mob_db(quest_db[index].mob[i]); @@ -14687,8 +14775,7 @@ void clif_quest_update_objective(struct map_session_data * sd, struct quest * qd WFIFOW(fd, 2) = len; WFIFOW(fd, 4) = quest_db[index].num_objectives; - for( i = 0; i < quest_db[index].num_objectives; i++ ) - { + for( i = 0; i < quest_db[index].num_objectives; i++ ) { WFIFOL(fd, i*12+6) = qd->quest_id; WFIFOL(fd, i*12+10) = quest_db[index].mob[i]; WFIFOW(fd, i*12+14) = quest_db[index].count[i]; @@ -14767,8 +14854,7 @@ void clif_mercenary_updatestatus(struct map_session_data *sd, int type) WFIFOHEAD(fd,packet_len(0x2a2)); WFIFOW(fd,0) = 0x2a2; WFIFOW(fd,2) = type; - switch( type ) - { + switch( type ) { case SP_ATK1: { int atk = rnd()%(status->rhw.atk2 - status->rhw.atk + 1) + status->rhw.atk; @@ -14920,7 +15006,7 @@ void clif_parse_mercenary_action(int fd, struct map_session_data* sd) /// 3 = Your mercenary soldier has ran away. void clif_mercenary_message(struct map_session_data* sd, int message) { - clif_msg(sd, 1266 + message); + clif->msg(sd, 1266 + message); } @@ -15056,7 +15142,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd) char *name, *message; int namelen, messagelen; - if( !clif_process_message(sd, 0, &name, &namelen, &message, &messagelen) ) + if( !clif->process_message(sd, 0, &name, &namelen, &message, &messagelen) ) return; if( is_atcommand(fd, sd, message, 1) ) @@ -15065,8 +15151,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd) if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; - if( battle_config.min_chat_delay ) - { + if( battle_config.min_chat_delay ) { if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 ) return; sd->cantalk_tick = gettick() + battle_config.min_chat_delay; @@ -15160,79 +15245,73 @@ int clif_instance(int instance_id, int type, int flag) if( (p = party_search(instance[instance_id].party_id)) == NULL || (sd = party_getavailablesd(p)) == NULL ) return 0; - switch( type ) - { - case 1: - // S 0x2cb <Instance name>.61B <Standby Position>.W - // Required to start the instancing information window on Client - // This window re-appear each "refresh" of client automatically until type 4 is send to client. - WBUFW(buf,0) = 0x02CB; - memcpy(WBUFP(buf,2),instance[instance_id].name,INSTANCE_NAME_LENGTH); - WBUFW(buf,63) = flag; - clif->send(buf,packet_len(0x02CB),&sd->bl,PARTY); - break; - case 2: - // S 0x2cc <Standby Position>.W - // To announce Instancing queue creation if no maps available - WBUFW(buf,0) = 0x02CC; - WBUFW(buf,2) = flag; - clif->send(buf,packet_len(0x02CC),&sd->bl,PARTY); - break; - case 3: - case 4: - // S 0x2cd <Instance Name>.61B <Instance Remaining Time>.L <Instance Noplayers close time>.L - WBUFW(buf,0) = 0x02CD; - memcpy(WBUFP(buf,2),instance[instance_id].name,61); - if( type == 3 ) - { - WBUFL(buf,63) = (uint32)instance[instance_id].progress_timeout; - WBUFL(buf,67) = 0; - } - else - { - WBUFL(buf,63) = 0; - WBUFL(buf,67) = (uint32)instance[instance_id].idle_timeout; - } - clif->send(buf,packet_len(0x02CD),&sd->bl,PARTY); - break; - case 5: - // S 0x2ce <Message ID>.L - // 0 = Notification (EnterLimitDate update?) - // 1 = The Memorial Dungeon expired; it has been destroyed - // 2 = The Memorial Dungeon's entry time limit expired; it has been destroyed - // 3 = The Memorial Dungeon has been removed. - // 4 = Create failure (removes the instance window) - WBUFW(buf,0) = 0x02CE; - WBUFL(buf,2) = flag; - //WBUFL(buf,6) = EnterLimitDate; - clif->send(buf,packet_len(0x02CE),&sd->bl,PARTY); - break; + switch( type ) { + case 1: + // S 0x2cb <Instance name>.61B <Standby Position>.W + // Required to start the instancing information window on Client + // This window re-appear each "refresh" of client automatically until type 4 is send to client. + WBUFW(buf,0) = 0x02CB; + memcpy(WBUFP(buf,2),instance[instance_id].name,INSTANCE_NAME_LENGTH); + WBUFW(buf,63) = flag; + clif->send(buf,packet_len(0x02CB),&sd->bl,PARTY); + break; + case 2: + // S 0x2cc <Standby Position>.W + // To announce Instancing queue creation if no maps available + WBUFW(buf,0) = 0x02CC; + WBUFW(buf,2) = flag; + clif->send(buf,packet_len(0x02CC),&sd->bl,PARTY); + break; + case 3: + case 4: + // S 0x2cd <Instance Name>.61B <Instance Remaining Time>.L <Instance Noplayers close time>.L + WBUFW(buf,0) = 0x02CD; + memcpy(WBUFP(buf,2),instance[instance_id].name,61); + if( type == 3 ) + { + WBUFL(buf,63) = (uint32)instance[instance_id].progress_timeout; + WBUFL(buf,67) = 0; + } + else + { + WBUFL(buf,63) = 0; + WBUFL(buf,67) = (uint32)instance[instance_id].idle_timeout; + } + clif->send(buf,packet_len(0x02CD),&sd->bl,PARTY); + break; + case 5: + // S 0x2ce <Message ID>.L + // 0 = Notification (EnterLimitDate update?) + // 1 = The Memorial Dungeon expired; it has been destroyed + // 2 = The Memorial Dungeon's entry time limit expired; it has been destroyed + // 3 = The Memorial Dungeon has been removed. + // 4 = Create failure (removes the instance window) + WBUFW(buf,0) = 0x02CE; + WBUFL(buf,2) = flag; + //WBUFL(buf,6) = EnterLimitDate; + clif->send(buf,packet_len(0x02CE),&sd->bl,PARTY); + break; } return 0; } void clif_instance_join(int fd, int instance_id) { - if( instance[instance_id].idle_timer != INVALID_TIMER ) - { + if( instance[instance_id].idle_timer != INVALID_TIMER ) { WFIFOHEAD(fd,packet_len(0x02CD)); WFIFOW(fd,0) = 0x02CD; memcpy(WFIFOP(fd,2),instance[instance_id].name,61); WFIFOL(fd,63) = 0; WFIFOL(fd,67) = (uint32)instance[instance_id].idle_timeout; WFIFOSET(fd,packet_len(0x02CD)); - } - else if( instance[instance_id].progress_timer != INVALID_TIMER ) - { + } else if( instance[instance_id].progress_timer != INVALID_TIMER ) { WFIFOHEAD(fd,packet_len(0x02CD)); WFIFOW(fd,0) = 0x02CD; memcpy(WFIFOP(fd,2),instance[instance_id].name,61); WFIFOL(fd,63) = (uint32)instance[instance_id].progress_timeout;; WFIFOL(fd,67) = 0; WFIFOSET(fd,packet_len(0x02CD)); - } - else - { + } else { WFIFOHEAD(fd,packet_len(0x02CB)); WFIFOW(fd,0) = 0x02CB; memcpy(WFIFOP(fd,2),instance[instance_id].name,61); @@ -15264,7 +15343,7 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat WBUFB(buf,8) = item_data->identify; WBUFB(buf,9) = item_data->attribute; WBUFB(buf,10) = item_data->refine; - clif_addcards(WBUFP(buf,11), item_data); + clif->addcards(WBUFP(buf,11), item_data); WBUFW(buf,19) = id->equip; // equip location WBUFB(buf,21) = itemtype(id->type); // item type clif->send(buf, packet_len(0x2b8), &sd->bl, PARTY_SAMEMAP_WOS); @@ -15444,8 +15523,7 @@ void clif_buyingstore_open(struct map_session_data* sd) /// result: /// 0 = cancel /// 1 = open -static void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) -{ +void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { const unsigned int blocksize = 8; uint8* itemlist; char storename[MESSAGE_SIZE]; @@ -15552,8 +15630,7 @@ void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_sessi /// Request to close own buying store (CZ_REQ_CLOSE_BUYING_STORE). /// 0815 -static void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) -{ +void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { buyingstore_close(sd); } @@ -15582,7 +15659,7 @@ void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct /// Request to open someone else's buying store (CZ_REQ_CLICK_TO_BUYING_STORE). /// 0817 <account id>.L -static void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) { int account_id; @@ -15620,8 +15697,7 @@ void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_d /// Request to sell items to a buying store (CZ_REQ_TRADE_BUYING_STORE). /// 0819 <packet len>.W <account id>.L <store id>.L { <index>.W <name id>.W <amount>.W }* -static void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) -{ +void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { const unsigned int blocksize = 6; uint8* itemlist; int account_id; @@ -15736,8 +15812,7 @@ void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short res /// NOTE: The client determines the item ids by specifying a name and optionally, /// amount of card slots. If the client does not know about the item it /// cannot be searched. -static void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) -{ +void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { const unsigned int blocksize = 2; const uint8* itemlist; const uint8* cardlist; @@ -15805,8 +15880,7 @@ void clif_search_store_info_ack(struct map_session_data* sd) WFIFOB(fd,5) = searchstore_querynext(sd); WFIFOB(fd,6) = (unsigned char)min(sd->searchstore.uses, UINT8_MAX); - for( i = start; i < end; i++ ) - { + for( i = start; i < end; i++ ) { struct s_search_store_info_item* ssitem = &sd->searchstore.items[i]; struct item it; @@ -15825,7 +15899,7 @@ void clif_search_store_info_ack(struct map_session_data* sd) it.nameid = ssitem->nameid; it.amount = ssitem->amount; - clif_addcards(WFIFOP(fd,i*blocksize+25+MESSAGE_SIZE), &it); + clif->addcards(WFIFOP(fd,i*blocksize+25+MESSAGE_SIZE), &it); } WFIFOSET(fd,WFIFOW(fd,2)); @@ -15853,7 +15927,7 @@ void clif_search_store_info_failed(struct map_session_data* sd, unsigned char re /// Request to display next page of results (CZ_SEARCH_STORE_INFO_NEXT_PAGE). /// 0838 -static void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) { searchstore_next(sd); } @@ -15880,7 +15954,7 @@ void clif_open_search_store_info(struct map_session_data* sd) /// Request to close the store search window (CZ_CLOSE_SEARCH_STORE_INFO). /// 083b -static void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) { searchstore_close(sd); } @@ -15888,7 +15962,7 @@ static void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) /// Request to invoke catalog effect on a store from search results (CZ_SSILIST_ITEM_CLICK). /// 083c <account id>.L <store id>.L <nameid>.W -static void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) { unsigned short nameid; int account_id, store_id; @@ -15917,15 +15991,13 @@ void clif_search_store_info_click_ack(struct map_session_data* sd, short x, shor /// Parse function for packet debugging. -void clif_parse_debug(int fd,struct map_session_data *sd) -{ +void clif_parse_debug(int fd,struct map_session_data *sd) { int cmd, packet_len; // clif_parse ensures, that there is at least 2 bytes of data cmd = RFIFOW(fd,0); - if( sd ) - { + if( sd ) { packet_len = packet_db[sd->packet_ver][cmd].len; if( packet_len == 0 ) @@ -16028,7 +16100,7 @@ int clif_spellbook_list(struct map_session_data *sd) } else{ status_change_end(&sd->bl,SC_STOP,INVALID_TIMER); - clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); + clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0); } return 1; @@ -16063,7 +16135,7 @@ int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, WFIFOW(fd,2) = c * 2 + 4; WFIFOSET(fd, WFIFOW(fd, 2)); } else { - clif_skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); + clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0); return 0; } @@ -16097,7 +16169,7 @@ int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { WFIFOW(fd,2) = c * 2 + 4; WFIFOSET(fd, WFIFOW(fd, 2)); } else { - clif_skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_GUILLONTINE_POISON,0); + clif->skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_GUILLONTINE_POISON,0); return 0; } @@ -16130,7 +16202,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) { sd->menuskill_val = c; } else { status_change_end(&sd->bl,SC_STOP,INVALID_TIMER); - clif_skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); + clif->skill_fail(sd,SC_AUTOSHADOWSPELL,USESKILL_FAIL_IMITATION_SKILL_NONE,0); } return 1; @@ -16228,7 +16300,7 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { return; if( pc_istrading(sd) ) { - clif_skill_fail(sd,sd->ud.skill_id,0,0); + clif->skill_fail(sd,sd->ud.skill_id,0,0); clif_menuskill_clear(sd); return; } @@ -16280,7 +16352,7 @@ void clif_parse_MoveItem(int fd, struct map_session_data *sd) { else return;/* nothing to do. */ - clif_favorite_item(sd, index); + clif->favorite_item(sd, index); #endif } @@ -16324,8 +16396,7 @@ void clif_monster_hp_bar( struct mob_data* md, int fd ) { /*========================================== * Main client packet processing function *------------------------------------------*/ -static int clif_parse(int fd) -{ +int clif_parse(int fd) { int cmd, packet_ver, packet_len, err; TBL_PC* sd; int pnum; @@ -16348,7 +16419,7 @@ static int clif_parse(int fd) if (sd->state.active) { // Player logout display [Valaris] ShowInfo("Character '"CL_WHITE"%s"CL_RESET"' logged off.\n", sd->status.name); - clif_quitsave(fd, sd); + clif->quitsave(fd, sd); } else { //Unusual logout (during log on/off/map-changer procedure) ShowInfo("Player AID:%d/CID:%d logged off.\n", sd->status.account_id, sd->status.char_id); @@ -16371,7 +16442,7 @@ static int clif_parse(int fd) packet_ver = sd->packet_ver; } else { // check authentification packet to know packet version - packet_ver = clif_guess_PacketVer(fd, 0, &err); + packet_ver = clif->guess_PacketVer(fd, 0, &err); if( err ) {// failed to identify packet version ShowInfo("clif_parse: Disconnecting session #%d with unknown packet version%s (p:0x%04x,l:%d).\n", fd, ( err == 1 ? "" : @@ -16427,18 +16498,15 @@ static int clif_parse(int fd) if ((int)RFIFOREST(fd) < packet_len) return 0; // not enough data received to form the packet - if( packet_db[packet_ver][cmd].func == clif_parse_debug ) + if( packet_db[packet_ver][cmd].func == clif->pDebug ) packet_db[packet_ver][cmd].func(fd, sd); else if( packet_db[packet_ver][cmd].func != NULL ) { - if( !sd && packet_db[packet_ver][cmd].func != clif_parse_WantToConnection ) + if( !sd && packet_db[packet_ver][cmd].func != clif->pWantToConnection ) ; //Only valid packet when there is no session else - if( sd && sd->bl.prev == NULL && packet_db[packet_ver][cmd].func != clif_parse_LoadEndAck ) + if( sd && sd->bl.prev == NULL && packet_db[packet_ver][cmd].func != clif->pLoadEndAck ) ; //Only valid packet when player is not on a map else - if( sd && session[sd->fd]->flag.eof ) - ; //No more packets accepted - else packet_db[packet_ver][cmd].func(fd, sd); } #ifdef DUMP_UNKNOWN_PACKET @@ -16727,203 +16795,203 @@ static int packetdb_readdb(void) void (*func)(int, struct map_session_data *); char *name; } clif_parse_func[]={ - {clif_parse_WantToConnection,"wanttoconnection"}, - {clif_parse_LoadEndAck,"loadendack"}, - {clif_parse_TickSend,"ticksend"}, - {clif_parse_WalkToXY,"walktoxy"}, - {clif_parse_QuitGame,"quitgame"}, - {clif_parse_GetCharNameRequest,"getcharnamerequest"}, - {clif_parse_GlobalMessage,"globalmessage"}, - {clif_parse_MapMove,"mapmove"}, - {clif_parse_ChangeDir,"changedir"}, - {clif_parse_Emotion,"emotion"}, - {clif_parse_HowManyConnections,"howmanyconnections"}, - {clif_parse_ActionRequest,"actionrequest"}, - {clif_parse_Restart,"restart"}, - {clif_parse_WisMessage,"wis"}, - {clif_parse_Broadcast,"broadcast"}, - {clif_parse_TakeItem,"takeitem"}, - {clif_parse_DropItem,"dropitem"}, - {clif_parse_UseItem,"useitem"}, - {clif_parse_EquipItem,"equipitem"}, - {clif_parse_UnequipItem,"unequipitem"}, - {clif_parse_NpcClicked,"npcclicked"}, - {clif_parse_NpcBuySellSelected,"npcbuysellselected"}, - {clif_parse_NpcBuyListSend,"npcbuylistsend"}, - {clif_parse_NpcSellListSend,"npcselllistsend"}, - {clif_parse_CreateChatRoom,"createchatroom"}, - {clif_parse_ChatAddMember,"chataddmember"}, - {clif_parse_ChatRoomStatusChange,"chatroomstatuschange"}, - {clif_parse_ChangeChatOwner,"changechatowner"}, - {clif_parse_KickFromChat,"kickfromchat"}, - {clif_parse_ChatLeave,"chatleave"}, - {clif_parse_TradeRequest,"traderequest"}, - {clif_parse_TradeAck,"tradeack"}, - {clif_parse_TradeAddItem,"tradeadditem"}, - {clif_parse_TradeOk,"tradeok"}, - {clif_parse_TradeCancel,"tradecancel"}, - {clif_parse_TradeCommit,"tradecommit"}, - {clif_parse_StopAttack,"stopattack"}, - {clif_parse_PutItemToCart,"putitemtocart"}, - {clif_parse_GetItemFromCart,"getitemfromcart"}, - {clif_parse_RemoveOption,"removeoption"}, - {clif_parse_ChangeCart,"changecart"}, - {clif_parse_StatusUp,"statusup"}, - {clif_parse_SkillUp,"skillup"}, - {clif_parse_UseSkillToId,"useskilltoid"}, - {clif_parse_UseSkillToPos,"useskilltopos"}, - {clif_parse_UseSkillToPosMoreInfo,"useskilltoposinfo"}, - {clif_parse_UseSkillMap,"useskillmap"}, - {clif_parse_RequestMemo,"requestmemo"}, - {clif_parse_ProduceMix,"producemix"}, - {clif_parse_Cooking,"cooking"}, - {clif_parse_NpcSelectMenu,"npcselectmenu"}, - {clif_parse_NpcNextClicked,"npcnextclicked"}, - {clif_parse_NpcAmountInput,"npcamountinput"}, - {clif_parse_NpcStringInput,"npcstringinput"}, - {clif_parse_NpcCloseClicked,"npccloseclicked"}, - {clif_parse_ItemIdentify,"itemidentify"}, - {clif_parse_SelectArrow,"selectarrow"}, - {clif_parse_AutoSpell,"autospell"}, - {clif_parse_UseCard,"usecard"}, - {clif_parse_InsertCard,"insertcard"}, - {clif_parse_RepairItem,"repairitem"}, - {clif_parse_WeaponRefine,"weaponrefine"}, - {clif_parse_SolveCharName,"solvecharname"}, - {clif_parse_ResetChar,"resetchar"}, - {clif_parse_LocalBroadcast,"localbroadcast"}, - {clif_parse_MoveToKafra,"movetokafra"}, - {clif_parse_MoveFromKafra,"movefromkafra"}, - {clif_parse_MoveToKafraFromCart,"movetokafrafromcart"}, - {clif_parse_MoveFromKafraToCart,"movefromkafratocart"}, - {clif_parse_CloseKafra,"closekafra"}, - {clif_parse_CreateParty,"createparty"}, - {clif_parse_CreateParty2,"createparty2"}, - {clif_parse_PartyInvite,"partyinvite"}, - {clif_parse_PartyInvite2,"partyinvite2"}, - {clif_parse_ReplyPartyInvite,"replypartyinvite"}, - {clif_parse_ReplyPartyInvite2,"replypartyinvite2"}, - {clif_parse_LeaveParty,"leaveparty"}, - {clif_parse_RemovePartyMember,"removepartymember"}, - {clif_parse_PartyChangeOption,"partychangeoption"}, - {clif_parse_PartyMessage,"partymessage"}, - {clif_parse_PartyChangeLeader,"partychangeleader"}, - {clif_parse_CloseVending,"closevending"}, - {clif_parse_VendingListReq,"vendinglistreq"}, - {clif_parse_PurchaseReq,"purchasereq"}, - {clif_parse_PurchaseReq2,"purchasereq2"}, - {clif_parse_OpenVending,"openvending"}, - {clif_parse_CreateGuild,"createguild"}, - {clif_parse_GuildCheckMaster,"guildcheckmaster"}, - {clif_parse_GuildRequestInfo,"guildrequestinfo"}, - {clif_parse_GuildChangePositionInfo,"guildchangepositioninfo"}, - {clif_parse_GuildChangeMemberPosition,"guildchangememberposition"}, - {clif_parse_GuildRequestEmblem,"guildrequestemblem"}, - {clif_parse_GuildChangeEmblem,"guildchangeemblem"}, - {clif_parse_GuildChangeNotice,"guildchangenotice"}, - {clif_parse_GuildInvite,"guildinvite"}, - {clif_parse_GuildReplyInvite,"guildreplyinvite"}, - {clif_parse_GuildLeave,"guildleave"}, - {clif_parse_GuildExpulsion,"guildexpulsion"}, - {clif_parse_GuildMessage,"guildmessage"}, - {clif_parse_GuildRequestAlliance,"guildrequestalliance"}, - {clif_parse_GuildReplyAlliance,"guildreplyalliance"}, - {clif_parse_GuildDelAlliance,"guilddelalliance"}, - {clif_parse_GuildOpposition,"guildopposition"}, - {clif_parse_GuildBreak,"guildbreak"}, - {clif_parse_PetMenu,"petmenu"}, - {clif_parse_CatchPet,"catchpet"}, - {clif_parse_SelectEgg,"selectegg"}, - {clif_parse_SendEmotion,"sendemotion"}, - {clif_parse_ChangePetName,"changepetname"}, - {clif_parse_GMKick,"gmkick"}, - {clif_parse_GMHide,"gmhide"}, - {clif_parse_GMReqNoChat,"gmreqnochat"}, - {clif_parse_GMReqAccountName,"gmreqaccname"}, - {clif_parse_GMKickAll,"killall"}, - {clif_parse_GMRecall,"recall"}, - {clif_parse_GMRecall,"summon"}, - {clif_parse_GM_Monster_Item,"itemmonster"}, - {clif_parse_GMShift,"remove"}, - {clif_parse_GMShift,"shift"}, - {clif_parse_GMChangeMapType,"changemaptype"}, - {clif_parse_GMRc,"rc"}, - {clif_parse_GMRecall2,"recall2"}, - {clif_parse_GMRemove2,"remove2"}, - - {clif_parse_NoviceDoriDori,"sndoridori"}, - {clif_parse_NoviceExplosionSpirits,"snexplosionspirits"}, - {clif_parse_PMIgnore,"wisexin"}, - {clif_parse_PMIgnoreList,"wisexlist"}, - {clif_parse_PMIgnoreAll,"wisall"}, - {clif_parse_FriendsListAdd,"friendslistadd"}, - {clif_parse_FriendsListRemove,"friendslistremove"}, - {clif_parse_FriendsListReply,"friendslistreply"}, - {clif_parse_Blacksmith,"blacksmith"}, - {clif_parse_Alchemist,"alchemist"}, - {clif_parse_Taekwon,"taekwon"}, - {clif_parse_RankingPk,"rankingpk"}, - {clif_parse_FeelSaveOk,"feelsaveok"}, - {clif_parse_debug,"debug"}, - {clif_parse_ChangeHomunculusName,"changehomunculusname"}, - {clif_parse_HomMoveToMaster,"hommovetomaster"}, - {clif_parse_HomMoveTo,"hommoveto"}, - {clif_parse_HomAttack,"homattack"}, - {clif_parse_HomMenu,"hommenu"}, - {clif_parse_StoragePassword,"storagepassword"}, - {clif_parse_Hotkey,"hotkey"}, - {clif_parse_AutoRevive,"autorevive"}, - {clif_parse_Check,"check"}, - {clif_parse_Adopt_request,"adoptrequest"}, - {clif_parse_Adopt_reply,"adoptreply"}, + {clif->pWantToConnection,"wanttoconnection"}, + {clif->pLoadEndAck,"loadendack"}, + {clif->pTickSend,"ticksend"}, + {clif->pWalkToXY,"walktoxy"}, + {clif->pQuitGame,"quitgame"}, + {clif->pGetCharNameRequest,"getcharnamerequest"}, + {clif->pGlobalMessage,"globalmessage"}, + {clif->pMapMove,"mapmove"}, + {clif->pChangeDir,"changedir"}, + {clif->pEmotion,"emotion"}, + {clif->pHowManyConnections,"howmanyconnections"}, + {clif->pActionRequest,"actionrequest"}, + {clif->pRestart,"restart"}, + {clif->pWisMessage,"wis"}, + {clif->pBroadcast,"broadcast"}, + {clif->pTakeItem,"takeitem"}, + {clif->pDropItem,"dropitem"}, + {clif->pUseItem,"useitem"}, + {clif->pEquipItem,"equipitem"}, + {clif->pUnequipItem,"unequipitem"}, + {clif->pNpcClicked,"npcclicked"}, + {clif->pNpcBuySellSelected,"npcbuysellselected"}, + {clif->pNpcBuyListSend,"npcbuylistsend"}, + {clif->pNpcSellListSend,"npcselllistsend"}, + {clif->pCreateChatRoom,"createchatroom"}, + {clif->pChatAddMember,"chataddmember"}, + {clif->pChatRoomStatusChange,"chatroomstatuschange"}, + {clif->pChangeChatOwner,"changechatowner"}, + {clif->pKickFromChat,"kickfromchat"}, + {clif->pChatLeave,"chatleave"}, + {clif->pTradeRequest,"traderequest"}, + {clif->pTradeAck,"tradeack"}, + {clif->pTradeAddItem,"tradeadditem"}, + {clif->pTradeOk,"tradeok"}, + {clif->pTradeCancel,"tradecancel"}, + {clif->pTradeCommit,"tradecommit"}, + {clif->pStopAttack,"stopattack"}, + {clif->pPutItemToCart,"putitemtocart"}, + {clif->pGetItemFromCart,"getitemfromcart"}, + {clif->pRemoveOption,"removeoption"}, + {clif->pChangeCart,"changecart"}, + {clif->pStatusUp,"statusup"}, + {clif->pSkillUp,"skillup"}, + {clif->pUseSkillToId,"useskilltoid"}, + {clif->pUseSkillToPos,"useskilltopos"}, + {clif->pUseSkillToPosMoreInfo,"useskilltoposinfo"}, + {clif->pUseSkillMap,"useskillmap"}, + {clif->pRequestMemo,"requestmemo"}, + {clif->pProduceMix,"producemix"}, + {clif->pCooking,"cooking"}, + {clif->pNpcSelectMenu,"npcselectmenu"}, + {clif->pNpcNextClicked,"npcnextclicked"}, + {clif->pNpcAmountInput,"npcamountinput"}, + {clif->pNpcStringInput,"npcstringinput"}, + {clif->pNpcCloseClicked,"npccloseclicked"}, + {clif->pItemIdentify,"itemidentify"}, + {clif->pSelectArrow,"selectarrow"}, + {clif->pAutoSpell,"autospell"}, + {clif->pUseCard,"usecard"}, + {clif->pInsertCard,"insertcard"}, + {clif->pRepairItem,"repairitem"}, + {clif->pWeaponRefine,"weaponrefine"}, + {clif->pSolveCharName,"solvecharname"}, + {clif->pResetChar,"resetchar"}, + {clif->pLocalBroadcast,"localbroadcast"}, + {clif->pMoveToKafra,"movetokafra"}, + {clif->pMoveFromKafra,"movefromkafra"}, + {clif->pMoveToKafraFromCart,"movetokafrafromcart"}, + {clif->pMoveFromKafraToCart,"movefromkafratocart"}, + {clif->pCloseKafra,"closekafra"}, + {clif->pCreateParty,"createparty"}, + {clif->pCreateParty2,"createparty2"}, + {clif->pPartyInvite,"partyinvite"}, + {clif->pPartyInvite2,"partyinvite2"}, + {clif->pReplyPartyInvite,"replypartyinvite"}, + {clif->pReplyPartyInvite2,"replypartyinvite2"}, + {clif->pLeaveParty,"leaveparty"}, + {clif->pRemovePartyMember,"removepartymember"}, + {clif->pPartyChangeOption,"partychangeoption"}, + {clif->pPartyMessage,"partymessage"}, + {clif->pPartyChangeLeader,"partychangeleader"}, + {clif->pCloseVending,"closevending"}, + {clif->pVendingListReq,"vendinglistreq"}, + {clif->pPurchaseReq,"purchasereq"}, + {clif->pPurchaseReq2,"purchasereq2"}, + {clif->pOpenVending,"openvending"}, + {clif->pCreateGuild,"createguild"}, + {clif->pGuildCheckMaster,"guildcheckmaster"}, + {clif->pGuildRequestInfo,"guildrequestinfo"}, + {clif->pGuildChangePositionInfo,"guildchangepositioninfo"}, + {clif->pGuildChangeMemberPosition,"guildchangememberposition"}, + {clif->pGuildRequestEmblem,"guildrequestemblem"}, + {clif->pGuildChangeEmblem,"guildchangeemblem"}, + {clif->pGuildChangeNotice,"guildchangenotice"}, + {clif->pGuildInvite,"guildinvite"}, + {clif->pGuildReplyInvite,"guildreplyinvite"}, + {clif->pGuildLeave,"guildleave"}, + {clif->pGuildExpulsion,"guildexpulsion"}, + {clif->pGuildMessage,"guildmessage"}, + {clif->pGuildRequestAlliance,"guildrequestalliance"}, + {clif->pGuildReplyAlliance,"guildreplyalliance"}, + {clif->pGuildDelAlliance,"guilddelalliance"}, + {clif->pGuildOpposition,"guildopposition"}, + {clif->pGuildBreak,"guildbreak"}, + {clif->pPetMenu,"petmenu"}, + {clif->pCatchPet,"catchpet"}, + {clif->pSelectEgg,"selectegg"}, + {clif->pSendEmotion,"sendemotion"}, + {clif->pChangePetName,"changepetname"}, + {clif->pGMKick,"gmkick"}, + {clif->pGMHide,"gmhide"}, + {clif->pGMReqNoChat,"gmreqnochat"}, + {clif->pGMReqAccountName,"gmreqaccname"}, + {clif->pGMKickAll,"killall"}, + {clif->pGMRecall,"recall"}, + {clif->pGMRecall,"summon"}, + {clif->pGM_Monster_Item,"itemmonster"}, + {clif->pGMShift,"remove"}, + {clif->pGMShift,"shift"}, + {clif->pGMChangeMapType,"changemaptype"}, + {clif->pGMRc,"rc"}, + {clif->pGMRecall2,"recall2"}, + {clif->pGMRemove2,"remove2"}, + + {clif->pNoviceDoriDori,"sndoridori"}, + {clif->pNoviceExplosionSpirits,"snexplosionspirits"}, + {clif->pPMIgnore,"wisexin"}, + {clif->pPMIgnoreList,"wisexlist"}, + {clif->pPMIgnoreAll,"wisall"}, + {clif->pFriendsListAdd,"friendslistadd"}, + {clif->pFriendsListRemove,"friendslistremove"}, + {clif->pFriendsListReply,"friendslistreply"}, + {clif->pBlacksmith,"blacksmith"}, + {clif->pAlchemist,"alchemist"}, + {clif->pTaekwon,"taekwon"}, + {clif->pRankingPk,"rankingpk"}, + {clif->pFeelSaveOk,"feelsaveok"}, + {clif->pDebug,"debug"}, + {clif->pChangeHomunculusName,"changehomunculusname"}, + {clif->pHomMoveToMaster,"hommovetomaster"}, + {clif->pHomMoveTo,"hommoveto"}, + {clif->pHomAttack,"homattack"}, + {clif->pHomMenu,"hommenu"}, + {clif->pStoragePassword,"storagepassword"}, + {clif->pHotkey,"hotkey"}, + {clif->pAutoRevive,"autorevive"}, + {clif->pCheck,"check"}, + {clif->pAdopt_request,"adoptrequest"}, + {clif->pAdopt_reply,"adoptreply"}, // MAIL SYSTEM - {clif_parse_Mail_refreshinbox,"mailrefresh"}, - {clif_parse_Mail_read,"mailread"}, - {clif_parse_Mail_getattach,"mailgetattach"}, - {clif_parse_Mail_delete,"maildelete"}, - {clif_parse_Mail_return,"mailreturn"}, - {clif_parse_Mail_setattach,"mailsetattach"}, - {clif_parse_Mail_winopen,"mailwinopen"}, - {clif_parse_Mail_send,"mailsend"}, + {clif->pMail_refreshinbox,"mailrefresh"}, + {clif->pMail_read,"mailread"}, + {clif->pMail_getattach,"mailgetattach"}, + {clif->pMail_delete,"maildelete"}, + {clif->pMail_return,"mailreturn"}, + {clif->pMail_setattach,"mailsetattach"}, + {clif->pMail_winopen,"mailwinopen"}, + {clif->pMail_send,"mailsend"}, // AUCTION SYSTEM - {clif_parse_Auction_search,"auctionsearch"}, - {clif_parse_Auction_buysell,"auctionbuysell"}, - {clif_parse_Auction_setitem,"auctionsetitem"}, - {clif_parse_Auction_cancelreg,"auctioncancelreg"}, - {clif_parse_Auction_register,"auctionregister"}, - {clif_parse_Auction_cancel,"auctioncancel"}, - {clif_parse_Auction_close,"auctionclose"}, - {clif_parse_Auction_bid,"auctionbid"}, + {clif->pAuction_search,"auctionsearch"}, + {clif->pAuction_buysell,"auctionbuysell"}, + {clif->pAuction_setitem,"auctionsetitem"}, + {clif->pAuction_cancelreg,"auctioncancelreg"}, + {clif->pAuction_register,"auctionregister"}, + {clif->pAuction_cancel,"auctioncancel"}, + {clif->pAuction_close,"auctionclose"}, + {clif->pAuction_bid,"auctionbid"}, // Quest Log System - {clif_parse_questStateAck,"queststate"}, - {clif_parse_cashshop_buy,"cashshopbuy"}, - {clif_parse_ViewPlayerEquip,"viewplayerequip"}, - {clif_parse_EquipTick,"equiptickbox"}, - {clif_parse_BattleChat,"battlechat"}, - {clif_parse_mercenary_action,"mermenu"}, - {clif_parse_progressbar,"progressbar"}, - {clif_parse_SkillSelectMenu,"skillselectmenu"}, - {clif_parse_ItemListWindowSelected,"itemlistwindowselected"}, + {clif->pquestStateAck,"queststate"}, + {clif->pcashshop_buy,"cashshopbuy"}, + {clif->pViewPlayerEquip,"viewplayerequip"}, + {clif->pEquipTick,"equiptickbox"}, + {clif->pBattleChat,"battlechat"}, + {clif->pmercenary_action,"mermenu"}, + {clif->pProgressbar,"progressbar"}, + {clif->pSkillSelectMenu,"skillselectmenu"}, + {clif->pItemListWindowSelected,"itemlistwindowselected"}, #if PACKETVER >= 20091229 - {clif_parse_PartyBookingRegisterReq,"bookingregreq"}, - {clif_parse_PartyBookingSearchReq,"bookingsearchreq"}, - {clif_parse_PartyBookingUpdateReq,"bookingupdatereq"}, - {clif_parse_PartyBookingDeleteReq,"bookingdelreq"}, + {clif->pPartyBookingRegisterReq,"bookingregreq"}, + {clif->pPartyBookingSearchReq,"bookingsearchreq"}, + {clif->pPartyBookingUpdateReq,"bookingupdatereq"}, + {clif->pPartyBookingDeleteReq,"bookingdelreq"}, #endif - {clif_parse_PVPInfo,"pvpinfo"}, - {clif_parse_LessEffect,"lesseffect"}, + {clif->pPVPInfo,"pvpinfo"}, + {clif->pLessEffect,"lesseffect"}, // Buying Store - {clif_parse_ReqOpenBuyingStore,"reqopenbuyingstore"}, - {clif_parse_ReqCloseBuyingStore,"reqclosebuyingstore"}, - {clif_parse_ReqClickBuyingStore,"reqclickbuyingstore"}, - {clif_parse_ReqTradeBuyingStore,"reqtradebuyingstore"}, + {clif->pReqOpenBuyingStore,"reqopenbuyingstore"}, + {clif->pReqCloseBuyingStore,"reqclosebuyingstore"}, + {clif->pReqClickBuyingStore,"reqclickbuyingstore"}, + {clif->pReqTradeBuyingStore,"reqtradebuyingstore"}, // Store Search - {clif_parse_SearchStoreInfo,"searchstoreinfo"}, - {clif_parse_SearchStoreInfoNextPage,"searchstoreinfonextpage"}, - {clif_parse_CloseSearchStoreInfo,"closesearchstoreinfo"}, - {clif_parse_SearchStoreInfoListItemClick,"searchstoreinfolistitemclick"}, + {clif->pSearchStoreInfo,"searchstoreinfo"}, + {clif->pSearchStoreInfoNextPage,"searchstoreinfonextpage"}, + {clif->pCloseSearchStoreInfo,"closesearchstoreinfo"}, + {clif->pSearchStoreInfoListItemClick,"searchstoreinfolistitemclick"}, /* */ - { clif_parse_MoveItem , "moveitem" }, + { clif->pMoveItem , "moveitem" }, {NULL,NULL} }; @@ -17082,29 +17150,53 @@ int do_init_clif(void) { color_table[i] = strtoul(colors[i],NULL,0); color_table[i] = (color_table[i] & 0x0000FF) << 16 | (color_table[i] & 0x00FF00) | (color_table[i] & 0xFF0000) >> 16;//RGB to BGR } - + clif_config.packet_db_ver = -1; // the main packet version of the DB memset(clif_config.connect_cmd, 0, sizeof(clif_config.connect_cmd)); //The default connect command will be determined after reading the packet_db [Skotlex] - + //Using the packet_db file is the only way to set up packets now [Skotlex] packetdb_readdb(); - - set_defaultparse(clif_parse); + + set_defaultparse(clif->parse); if( make_listen_bind(clif->bind_ip,clif->map_port) == -1 ) { ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",clif->map_port); exit(EXIT_FAILURE); } - add_timer_func_list(clif_clearunit_delayed_sub, "clif_clearunit_delayed_sub"); - add_timer_func_list(clif_delayquit, "clif_delayquit"); + add_timer_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + add_timer_func_list(clif->delayquit, "clif_delayquit"); - delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); + clif->channel_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, HCHSYS_NAME_LENGTH); + hChSys.ally = hChSys.local = hChSys.ally_autojoin = hChSys.local_autojoin = false; + clif->chann_config_read(); + return 0; } void do_final_clif(void) { - ers_destroy(delay_clearunit_ers); + DBIterator *iter = db_iterator(clif->channel_db); + struct hChSysCh *channel; + unsigned char i; + + for( channel = dbi_first(iter); dbi_exists(iter); channel = dbi_next(iter) ) { + clif->chsys_delete(channel); + } + + dbi_destroy(iter); + + for(i = 0; i < hChSys.colors_count; i++) { + aFree(hChSys.colors_name[i]); + } + + if( hChSys.colors_count ) { + aFree(hChSys.colors_name); + aFree(hChSys.colors); + } + + db_destroy(clif->channel_db); + ers_destroy(clif->delay_clearunit_ers); } void clif_defaults(void) { clif = &clif_s; @@ -17119,6 +17211,8 @@ void clif_defaults(void) { clif->setport = clif_setport; clif->refresh_ip = clif_refresh_ip; clif->send = clif_send; + clif->send_sub = clif_send_sub; + clif->parse = clif_parse; /* auth */ clif->authok = clif_authok; clif->authrefuse = clif_authrefuse; @@ -17139,12 +17233,16 @@ void clif_defaults(void) { clif->equipitemack = clif_equipitemack; clif->unequipitemack = clif_unequipitemack; clif->useitemack = clif_useitemack; + clif->addcards = clif_addcards; + clif->item_sub = clif_item_sub; + clif->getareachar_item = clif_getareachar_item; /* unit-related */ clif->clearunit_single = clif_clearunit_single; clif->clearunit_area = clif_clearunit_area; clif->clearunit_delayed = clif_clearunit_delayed; clif->walkok = clif_walkok; clif->move = clif_move; + clif->move2 = clif_move2; clif->blown = clif_blown; clif->slide = clif_slide; clif->fixpos = clif_fixpos; @@ -17155,6 +17253,15 @@ void clif_defaults(void) { clif->skill_setunit = clif_skill_setunit; clif->skill_delunit = clif_skill_delunit; clif->skillunit_update = clif_skillunit_update; + clif->clearunit_delayed_sub = clif_clearunit_delayed_sub; + clif->set_unit_idle = clif_set_unit_idle; + clif->setdisguise = clif_setdisguise; + clif->set_unit_walking = clif_set_unit_walking; + clif->calc_walkdelay = clif_calc_walkdelay; + clif->getareachar_skillunit = clif_getareachar_skillunit; + clif->getareachar_unit = clif_getareachar_unit; + clif->clearchar_skillunit = clif_clearchar_skillunit; + clif->getareachar = clif_getareachar; /* main unit spawn */ clif->spawn = clif_spawn; /* map-related */ @@ -17164,6 +17271,7 @@ void clif_defaults(void) { clif->pvpset = clif_pvpset; clif->map_property_mapall = clif_map_property_mapall; clif->bossmapinfo = clif_bossmapinfo; + clif->map_type = clif_map_type; /* multi-map-server */ clif->changemapserver = clif_changemapserver; /* npc-shop-related */ @@ -17171,6 +17279,9 @@ void clif_defaults(void) { clif->buylist = clif_buylist; clif->selllist = clif_selllist; clif->cashshop_show = clif_cashshop_show; + clif->npc_buy_result = clif_npc_buy_result; + clif->npc_sell_result = clif_npc_sell_result; + clif->cashshop_ack = clif_cashshop_ack; /* npc-script-related */ clif->scriptmes = clif_scriptmes; clif->scriptnext = clif_scriptnext; @@ -17207,6 +17318,7 @@ void clif_defaults(void) { clif->inventorylist = clif_inventorylist; clif->equiplist = clif_equiplist; clif->cartlist = clif_cartlist; + clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; clif->item_identified = clif_item_identified; @@ -17221,7 +17333,9 @@ void clif_defaults(void) { clif->changed_dir = clif_changed_dir; clif->charnameack = clif_charnameack; clif->monster_hp_bar = clif_monster_hp_bar; + clif->hpmeter = clif_hpmeter; clif->hpmeter_single = clif_hpmeter_single; + clif->hpmeter_sub = clif_hpmeter_sub; clif->upgrademessage = clif_upgrademessage; clif->get_weapon_view = clif_get_weapon_view; clif->gospel_info = clif_gospel_info; @@ -17248,6 +17362,7 @@ void clif_defaults(void) { clif->skill_itemlistwindow = clif_skill_itemlistwindow; clif->sc_notick = clif_status_load_notick; clif->sc_single = clif_status_load_single; + clif->initialstatus = clif_initialstatus; /* player-unit-specific-related */ clif->updatestatus = clif_updatestatus; clif->changestatus = clif_changestatus; @@ -17255,6 +17370,15 @@ void clif_defaults(void) { clif->movetoattack = clif_movetoattack; clif->solved_charname = clif_solved_charname; clif->charnameupdate = clif_charnameupdate; + clif->delayquit = clif_delayquit; + clif->getareachar_pc = clif_getareachar_pc; + clif->disconnect_ack = clif_disconnect_ack; + clif->PVPInfo = clif_PVPInfo; + clif->blacksmith = clif_blacksmith; + clif->alchemist = clif_alchemist; + clif->taekwon = clif_taekwon; + clif->ranking_pk = clif_ranking_pk; + clif->quitsave = clif_quitsave; /* visual effects client-side */ clif->misceffect = clif_misceffect; clif->changeoption = clif_changeoption; @@ -17273,6 +17397,7 @@ void clif_defaults(void) { clif->produce_effect = clif_produceeffect; clif->devotion = clif_devotion; clif->spiritball = clif_spiritball; + clif->spiritball_single = clif_spiritball_single; clif->bladestop = clif_bladestop; clif->mvp_effect = clif_mvp_effect; clif->heal = clif_heal; @@ -17284,7 +17409,9 @@ void clif_defaults(void) { clif->specialeffect_value = clif_specialeffect_value; clif->millenniumshield = clif_millenniumshield; clif->talisman = clif_talisman; + clif->talisman_single = clif_talisman_single; clif->snap = clif_snap; + clif->weather_check = clif_weather_check; /* sound effects client-side */ clif->playBGM = clif_playBGM; clif->soundeffect = clif_soundeffect; @@ -17302,21 +17429,23 @@ void clif_defaults(void) { clif->changechatstatus = clif_changechatstatus; clif->wis_message = clif_wis_message; clif->wis_end = clif_wis_end; - clif->displaymessage = clif_displaymessage; clif->disp_onlyself = clif_disp_onlyself; clif->disp_message = clif_disp_message; clif->broadcast = clif_broadcast; - clif->MainChatMessage = clif_MainChatMessage; clif->broadcast2 = clif_broadcast2; clif->messagecolor = clif_messagecolor; - clif->message = clif_message; clif->disp_overhead = clif_disp_overhead; clif->msg = clif_msg; clif->msg_value = clif_msg_value; clif->msg_skill = clif_msg_skill; clif->msgtable = clif_msgtable; clif->msgtable_num = clif_msgtable_num; + clif->message = clif_displaymessage; clif->colormes = clif_colormes; + clif->process_message = clif_process_message; + clif->wisexin = clif_wisexin; + clif->wisall = clif_wisall; + clif->PMIgnoreList = clif_PMIgnoreList; /* trade handling */ clif->traderequest = clif_traderequest; clif->tradestart = clif_tradestart; @@ -17360,6 +17489,7 @@ void clif_defaults(void) { clif->party_hp = clif_party_hp; clif->party_xy_remove = clif_party_xy_remove; clif->party_show_picker = clif_party_show_picker; + clif->partyinvitationstate = clif_partyinvitationstate; /* guild-specific */ clif->guild_created = clif_guild_created; clif->guild_belonginfo = clif_guild_belonginfo; @@ -17389,6 +17519,10 @@ void clif_defaults(void) { clif->guild_xy = clif_guild_xy; clif->guild_xy_single = clif_guild_xy_single; clif->guild_xy_remove = clif_guild_xy_remove; + clif->guild_positionnamelist = clif_guild_positionnamelist; + clif->guild_positioninfolist = clif_guild_positioninfolist; + clif->guild_expulsionlist = clif_guild_expulsionlist; + clif->validate_emblem = clif_validate_emblem; /* battleground-specific */ clif->bg_hp = clif_bg_hp; clif->bg_xy = clif_bg_xy; @@ -17414,11 +17548,15 @@ void clif_defaults(void) { clif->friendslist_toggle_sub = clif_friendslist_toggle_sub; clif->friendslist_send = clif_friendslist_send; clif->friendslist_reqack = clif_friendslist_reqack; + clif->friendslist_toggle = clif_friendslist_toggle; + clif->friendlist_req = clif_friendlist_req; /* gm-related */ clif->GM_kickack = clif_GM_kickack; clif->GM_kick = clif_GM_kick; clif->manner_message = clif_manner_message; clif->GM_silence = clif_GM_silence; + clif->account_name = clif_account_name; + clif->check = clif_check; /* hom-related */ clif->hominfo = clif_hominfo; clif->homskillinfoblock = clif_homskillinfoblock; @@ -17442,11 +17580,13 @@ void clif_defaults(void) { clif->mail_new = clif_Mail_new; clif->mail_refreshinbox = clif_Mail_refreshinbox; clif->mail_getattachment = clif_Mail_getattachment; + clif->mail_setattachment = clif_Mail_setattachment; /* auction-related */ clif->auction_openwindow = clif_Auction_openwindow; clif->auction_results = clif_Auction_results; clif->auction_message = clif_Auction_message; clif->auction_close = clif_Auction_close; + clif->auction_setitem = clif_Auction_setitem; /* mercenary-related */ clif->mercenary_info = clif_mercenary_info; clif->mercenary_skillblock = clif_mercenary_skillblock; @@ -17480,16 +17620,218 @@ 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; /* misc-handling */ clif->adopt_reply = clif_Adopt_reply; + clif->adopt_request = clif_Adopt_request; clif->readbook = clif_readbook; - /*------------------------ - *- Parse Incoming Packet + clif->guess_PacketVer = clif_guess_PacketVer; + clif->notify_time = clif_notify_time; + clif->user_count = clif_user_count; + clif->noask_sub = clif_noask_sub; + clif->chsys_create = clif_hercules_chsys_create; + clif->chsys_msg = clif_hercules_chsys_msg; + clif->chsys_send = clif_hercules_chsys_send; + clif->chsys_join = clif_hercules_chsys_join; + clif->chsys_left = clif_hercules_chsys_left; + clif->chsys_delete = clif_hercules_chsys_delete; + clif->chsys_mjoin = clif_hercules_chsys_mjoin; + /*------------------------ + *- Parse Incoming Packet *------------------------*/ - clif->ActionRequest_sub = clif_parse_ActionRequest_sub; - clif->LoadEndAck = clif_parse_LoadEndAck; - clif->Auction_cancelreg = clif_parse_Auction_cancelreg; + clif->pWantToConnection = clif_parse_WantToConnection; + clif->pLoadEndAck = clif_parse_LoadEndAck; + clif->pTickSend = clif_parse_TickSend; + clif->pHotkey = clif_parse_Hotkey; + clif->pProgressbar = clif_parse_progressbar; + clif->pWalkToXY = clif_parse_WalkToXY; + clif->pQuitGame = clif_parse_QuitGame; + clif->pGetCharNameRequest = clif_parse_GetCharNameRequest; + clif->pGlobalMessage = clif_parse_GlobalMessage; + clif->pMapMove = clif_parse_MapMove; + clif->pChangeDir = clif_parse_ChangeDir; + clif->pEmotion = clif_parse_Emotion; + clif->pHowManyConnections = clif_parse_HowManyConnections; + clif->pActionRequest = clif_parse_ActionRequest; + clif->pActionRequest_sub = clif_parse_ActionRequest_sub; + clif->pRestart = clif_parse_Restart; + clif->pWisMessage = clif_parse_WisMessage; + clif->pBroadcast = clif_parse_Broadcast; + clif->pTakeItem = clif_parse_TakeItem; + clif->pDropItem = clif_parse_DropItem; + clif->pUseItem = clif_parse_UseItem; + clif->pEquipItem = clif_parse_EquipItem; + clif->pUnequipItem = clif_parse_UnequipItem; + clif->pNpcClicked = clif_parse_NpcClicked; + clif->pNpcBuySellSelected = clif_parse_NpcBuySellSelected; + clif->pNpcBuyListSend = clif_parse_NpcBuyListSend; + clif->pNpcSellListSend = clif_parse_NpcSellListSend; + clif->pCreateChatRoom = clif_parse_CreateChatRoom; + clif->pChatAddMember = clif_parse_ChatAddMember; + clif->pChatRoomStatusChange = clif_parse_ChatRoomStatusChange; + clif->pChangeChatOwner = clif_parse_ChangeChatOwner; + clif->pKickFromChat = clif_parse_KickFromChat; + clif->pChatLeave = clif_parse_ChatLeave; + clif->pTradeRequest = clif_parse_TradeRequest; + clif->pTradeAck = clif_parse_TradeAck; + clif->pTradeAddItem = clif_parse_TradeAddItem; + clif->pTradeOk = clif_parse_TradeOk; + clif->pTradeCancel = clif_parse_TradeCancel; + clif->pTradeCommit = clif_parse_TradeCommit; + clif->pStopAttack = clif_parse_StopAttack; + clif->pPutItemToCart = clif_parse_PutItemToCart; + clif->pGetItemFromCart = clif_parse_GetItemFromCart; + clif->pRemoveOption = clif_parse_RemoveOption; + clif->pChangeCart = clif_parse_ChangeCart; + clif->pStatusUp = clif_parse_StatusUp; + clif->pSkillUp = clif_parse_SkillUp; + clif->pUseSkillToId = clif_parse_UseSkillToId; + clif->pUseSkillToId_homun = clif_parse_UseSkillToId_homun; + clif->pUseSkillToId_mercenary = clif_parse_UseSkillToId_mercenary; + 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->pUseSkillToPosMoreInfo = clif_parse_UseSkillToPosMoreInfo; + clif->pUseSkillMap = clif_parse_UseSkillMap; + clif->pRequestMemo = clif_parse_RequestMemo; + clif->pProduceMix = clif_parse_ProduceMix; + clif->pCooking = clif_parse_Cooking; + clif->pRepairItem = clif_parse_RepairItem; + clif->pWeaponRefine = clif_parse_WeaponRefine; + clif->pNpcSelectMenu = clif_parse_NpcSelectMenu; + clif->pNpcNextClicked = clif_parse_NpcNextClicked; + clif->pNpcAmountInput = clif_parse_NpcAmountInput; + clif->pNpcStringInput = clif_parse_NpcStringInput; + clif->pNpcCloseClicked = clif_parse_NpcCloseClicked; + clif->pItemIdentify = clif_parse_ItemIdentify; + clif->pSelectArrow = clif_parse_SelectArrow; + clif->pAutoSpell = clif_parse_AutoSpell; + clif->pUseCard = clif_parse_UseCard; + clif->pInsertCard = clif_parse_InsertCard; + clif->pSolveCharName = clif_parse_SolveCharName; + clif->pResetChar = clif_parse_ResetChar; + clif->pLocalBroadcast = clif_parse_LocalBroadcast; + clif->pMoveToKafra = clif_parse_MoveToKafra; + clif->pMoveFromKafra = clif_parse_MoveFromKafra; + clif->pMoveToKafraFromCart = clif_parse_MoveToKafraFromCart; + clif->pMoveFromKafraToCart = clif_parse_MoveFromKafraToCart; + clif->pCloseKafra = clif_parse_CloseKafra; + clif->pStoragePassword = clif_parse_StoragePassword; + clif->pCreateParty = clif_parse_CreateParty; + clif->pCreateParty2 = clif_parse_CreateParty2; + clif->pPartyInvite = clif_parse_PartyInvite; + clif->pPartyInvite2 = clif_parse_PartyInvite2; + clif->pReplyPartyInvite = clif_parse_ReplyPartyInvite; + clif->pReplyPartyInvite2 = clif_parse_ReplyPartyInvite2; + clif->pLeaveParty = clif_parse_LeaveParty; + clif->pRemovePartyMember = clif_parse_RemovePartyMember; + clif->pPartyChangeOption = clif_parse_PartyChangeOption; + clif->chann_config_read = read_channels_config; + clif->pPartyMessage = clif_parse_PartyMessage; + clif->pPartyChangeLeader = clif_parse_PartyChangeLeader; + clif->pPartyBookingRegisterReq = clif_parse_PartyBookingRegisterReq; + clif->pPartyBookingSearchReq = clif_parse_PartyBookingSearchReq; + clif->pPartyBookingDeleteReq = clif_parse_PartyBookingDeleteReq; + clif->pPartyBookingUpdateReq = clif_parse_PartyBookingUpdateReq; + clif->pCloseVending = clif_parse_CloseVending; + clif->pVendingListReq = clif_parse_VendingListReq; + clif->pPurchaseReq = clif_parse_PurchaseReq; + clif->pPurchaseReq2 = clif_parse_PurchaseReq2; + clif->pOpenVending = clif_parse_OpenVending; + clif->pCreateGuild = clif_parse_CreateGuild; + clif->pGuildCheckMaster = clif_parse_GuildCheckMaster; + clif->pGuildRequestInfo = clif_parse_GuildRequestInfo; + clif->pGuildChangePositionInfo = clif_parse_GuildChangePositionInfo; + clif->pGuildChangeMemberPosition = clif_parse_GuildChangeMemberPosition; + clif->pGuildRequestEmblem = clif_parse_GuildRequestEmblem; + clif->pGuildChangeEmblem = clif_parse_GuildChangeEmblem; + clif->pGuildChangeNotice = clif_parse_GuildChangeNotice; + clif->pGuildInvite = clif_parse_GuildInvite; + clif->pGuildReplyInvite = clif_parse_GuildReplyInvite; + clif->pGuildLeave = clif_parse_GuildLeave; + clif->pGuildExpulsion = clif_parse_GuildExpulsion; + clif->pGuildMessage = clif_parse_GuildMessage; + clif->pGuildRequestAlliance = clif_parse_GuildRequestAlliance; + clif->pGuildReplyAlliance = clif_parse_GuildReplyAlliance; + clif->pGuildDelAlliance = clif_parse_GuildDelAlliance; + clif->pGuildOpposition = clif_parse_GuildOpposition; + clif->pGuildBreak = clif_parse_GuildBreak; + clif->pPetMenu = clif_parse_PetMenu; + clif->pCatchPet = clif_parse_CatchPet; + clif->pSelectEgg = clif_parse_SelectEgg; + clif->pSendEmotion = clif_parse_SendEmotion; + clif->pChangePetName = clif_parse_ChangePetName; + clif->pGMKick = clif_parse_GMKick; + clif->pGMKickAll = clif_parse_GMKickAll; + clif->pGMShift = clif_parse_GMShift; + clif->pGMRemove2 = clif_parse_GMRemove2; + clif->pGMRecall = clif_parse_GMRecall; + clif->pGMRecall2 = clif_parse_GMRecall2; + clif->pGM_Monster_Item = clif_parse_GM_Monster_Item; + clif->pGMHide = clif_parse_GMHide; + clif->pGMReqNoChat = clif_parse_GMReqNoChat; + clif->pGMRc = clif_parse_GMRc; + clif->pGMReqAccountName = clif_parse_GMReqAccountName; + clif->pGMChangeMapType = clif_parse_GMChangeMapType; + clif->pPMIgnore = clif_parse_PMIgnore; + clif->pPMIgnoreAll = clif_parse_PMIgnoreAll; + clif->pPMIgnoreList = clif_parse_PMIgnoreList; + clif->pNoviceDoriDori = clif_parse_NoviceDoriDori; + clif->pNoviceExplosionSpirits = clif_parse_NoviceExplosionSpirits; + clif->pFriendsListAdd = clif_parse_FriendsListAdd; + clif->pFriendsListReply = clif_parse_FriendsListReply; + clif->pFriendsListRemove = clif_parse_FriendsListRemove; + clif->pPVPInfo = clif_parse_PVPInfo; + clif->pBlacksmith = clif_parse_Blacksmith; + clif->pAlchemist = clif_parse_Alchemist; + clif->pTaekwon = clif_parse_Taekwon; + clif->pRankingPk = clif_parse_RankingPk; + clif->pFeelSaveOk = clif_parse_FeelSaveOk; + clif->pChangeHomunculusName = clif_parse_ChangeHomunculusName; + clif->pHomMoveToMaster = clif_parse_HomMoveToMaster; + clif->pHomMoveTo = clif_parse_HomMoveTo; + clif->pHomAttack = clif_parse_HomAttack; + clif->pHomMenu = clif_parse_HomMenu; + clif->pAutoRevive = clif_parse_AutoRevive; + clif->pCheck = clif_parse_Check; + clif->pMail_refreshinbox = clif_parse_Mail_refreshinbox; + clif->pMail_read = clif_parse_Mail_read; + clif->pMail_getattach = clif_parse_Mail_getattach; + clif->pMail_delete = clif_parse_Mail_delete; + clif->pMail_return = clif_parse_Mail_return; + clif->pMail_setattach = clif_parse_Mail_setattach; + clif->pMail_winopen = clif_parse_Mail_winopen; + clif->pMail_send = clif_parse_Mail_send; + clif->pAuction_cancelreg = clif_parse_Auction_cancelreg; + clif->pAuction_setitem = clif_parse_Auction_setitem; + clif->pAuction_register = clif_parse_Auction_register; + clif->pAuction_cancel = clif_parse_Auction_cancel; + clif->pAuction_close = clif_parse_Auction_close; + clif->pAuction_bid = clif_parse_Auction_bid; + clif->pAuction_search = clif_parse_Auction_search; + clif->pAuction_buysell = clif_parse_Auction_buysell; + clif->pcashshop_buy = clif_parse_cashshop_buy; + clif->pAdopt_request = clif_parse_Adopt_request; + clif->pAdopt_reply = clif_parse_Adopt_reply; + clif->pViewPlayerEquip = clif_parse_ViewPlayerEquip; + clif->pEquipTick = clif_parse_EquipTick; + clif->pquestStateAck = clif_parse_questStateAck; + clif->pmercenary_action = clif_parse_mercenary_action; + clif->pBattleChat = clif_parse_BattleChat; + clif->pLessEffect = clif_parse_LessEffect; + clif->pItemListWindowSelected = clif_parse_ItemListWindowSelected; + clif->pReqOpenBuyingStore = clif_parse_ReqOpenBuyingStore; + clif->pReqCloseBuyingStore = clif_parse_ReqCloseBuyingStore; + clif->pReqClickBuyingStore = clif_parse_ReqClickBuyingStore; + clif->pReqTradeBuyingStore = clif_parse_ReqTradeBuyingStore; + clif->pSearchStoreInfo = clif_parse_SearchStoreInfo; + clif->pSearchStoreInfoNextPage = clif_parse_SearchStoreInfoNextPage; + clif->pCloseSearchStoreInfo = clif_parse_CloseSearchStoreInfo; + clif->pSearchStoreInfoListItemClick = clif_parse_SearchStoreInfoListItemClick; + clif->pDebug = clif_parse_debug; + clif->pSkillSelectMenu = clif_parse_SkillSelectMenu; + clif->pMoveItem = clif_parse_MoveItem; } diff --git a/src/map/clif.h b/src/map/clif.h index c93169a77..8989cbd96 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -6,18 +6,21 @@ #define _CLIF_H_ #include "../common/cbasetypes.h" +#include "../common/db.h" #include <stdarg.h> /** * Declarations **/ struct item; +struct item_data; struct storage_data; struct guild_storage; struct block_list; struct unit_data; struct map_session_data; struct homun_data; +struct mercenary_data; struct pet_data; struct mob_data; struct npc_data; @@ -31,6 +34,8 @@ struct guild; struct battleground_data; struct quest; struct party_booking_ad_info; +struct view_data; +struct eri; /** * Defines @@ -38,6 +43,7 @@ struct party_booking_ad_info; #define SERVER 0 /* reserved for server use */ #define packet_len(cmd) packet_db[SERVER][cmd].len #define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0; +#define HCHSYS_NAME_LENGTH 20 /** * Enumerations @@ -73,8 +79,8 @@ typedef enum send_target { GUILD_NOBG, DUEL, DUEL_WOS, - CHAT_MAINCHAT, // everyone on main chat SELF, + BG, // BattleGround System BG_WOS, BG_SAMEMAP, @@ -322,6 +328,19 @@ enum clif_colors { COLOR_MAX }; +enum hChSysChOpt { + hChSys_OPT_BASE = 0, + hChSys_OPT_ANNOUNCE_JOIN = 1, +}; + +enum hChSysChType { + hChSys_PUBLIC = 0, + hChSys_PRIVATE = 1, + hChSys_MAP = 2, + hChSys_ALLY = 3, +}; + + /** * Structures **/ @@ -331,10 +350,33 @@ struct s_packet_db { short pos[MAX_PACKET_POS]; }; +struct { + unsigned long *colors; + char **colors_name; + unsigned char colors_count; + bool local, ally; + bool local_autojoin, ally_autojoin; + char local_name[HCHSYS_NAME_LENGTH], ally_name[HCHSYS_NAME_LENGTH]; + unsigned char local_color, ally_color; + bool closing; + bool allow_user_channel_creation; +} hChSys; + +struct hChSysCh { + char name[HCHSYS_NAME_LENGTH]; + char pass[HCHSYS_NAME_LENGTH]; + unsigned char color; + DBMap *users; + unsigned int opt; + unsigned int owner; + enum hChSysChType type; + uint16 m; +}; + /** * Vars **/ -extern struct s_packet_db packet_db[MAX_PACKET_VER+1][MAX_PACKET_DB+1]; +struct s_packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB + 1]; unsigned long color_table[COLOR_MAX]; /** @@ -347,6 +389,9 @@ struct clif_interface { uint16 map_port; char map_ip_str[128]; int map_fd; + DBMap* channel_db; + /* for clif_clearunit_delayed */ + struct eri *delay_clearunit_ers; /* core */ int (*init) (void); void (*final) (void); @@ -355,6 +400,8 @@ struct clif_interface { void (*setport) (uint16 port); uint32 (*refresh_ip) (void); int (*send) (const uint8* buf, int len, struct block_list* bl, enum send_target type); + int (*send_sub) (struct block_list *bl, va_list ap); + int (*parse) (int fd); /* auth */ void (*authok) (struct map_session_data *sd); void (*authrefuse) (int fd, uint8 error_code); @@ -375,12 +422,16 @@ struct clif_interface { void (*equipitemack) (struct map_session_data *sd,int n,int pos,int ok); void (*unequipitemack) (struct map_session_data *sd,int n,int pos,int ok); void (*useitemack) (struct map_session_data *sd,int index,int amount,bool ok); + void (*addcards) (unsigned char* buf, struct item* item); + void (*item_sub) (unsigned char *buf, int n, struct item *i, struct item_data *id, int equip); + void (*getareachar_item) (struct map_session_data* sd,struct flooritem_data* fitem); /* unit-related */ void (*clearunit_single) (int id, clr_type type, int fd); void (*clearunit_area) (struct block_list* bl, clr_type type); void (*clearunit_delayed) (struct block_list* bl, clr_type type, unsigned int tick); void (*walkok) (struct map_session_data *sd); void (*move) (struct unit_data *ud); + void (*move2) (struct block_list *bl, struct view_data *vd, struct unit_data *ud); void (*blown) (struct block_list *bl); void (*slide) (struct block_list *bl, int x, int y); void (*fixpos) (struct block_list *bl); @@ -391,6 +442,15 @@ struct clif_interface { void (*skill_setunit) (struct skill_unit *unit); void (*skill_delunit) (struct skill_unit *unit); void (*skillunit_update) (struct block_list* bl); + int (*clearunit_delayed_sub) (int tid, unsigned int tick, int id, intptr_t data); + int (*set_unit_idle) (struct block_list* bl, unsigned char* buffer, bool spawn); + void (*setdisguise) (struct block_list *bl, unsigned char *buf,int len); + int (*set_unit_walking) (struct block_list* bl, struct unit_data* ud, unsigned char* buffer); + int (*calc_walkdelay) (struct block_list *bl,int delay, int type, int damage, int div_); + void (*getareachar_skillunit) (struct map_session_data *sd, struct skill_unit *unit); + void (*getareachar_unit) (struct map_session_data* sd,struct block_list *bl); + void (*clearchar_skillunit) (struct skill_unit *unit, int fd); + int (*getareachar) (struct block_list* bl,va_list ap); /* main unit spawn */ int (*spawn) (struct block_list *bl); /* map-related */ @@ -400,6 +460,7 @@ struct clif_interface { void (*pvpset) (struct map_session_data *sd, int pvprank, int pvpnum,int type); void (*map_property_mapall) (int map, enum map_property property); void (*bossmapinfo) (int fd, struct mob_data *md, short flag); + void (*map_type) (struct map_session_data* sd, enum map_type type); /* multi-map-server */ void (*changemapserver) (struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port); /* npc-shop-related */ @@ -407,6 +468,9 @@ struct clif_interface { void (*buylist) (struct map_session_data *sd, struct npc_data *nd); void (*selllist) (struct map_session_data *sd); void (*cashshop_show) (struct map_session_data *sd, struct npc_data *nd); + void (*npc_buy_result) (struct map_session_data* sd, unsigned char result); + void (*npc_sell_result) (struct map_session_data* sd, unsigned char result); + void (*cashshop_ack) (struct map_session_data* sd, int error); /* npc-script-related */ void (*scriptmes) (struct map_session_data *sd, int npcid, const char *mes); void (*scriptnext) (struct map_session_data *sd,int npcid); @@ -443,6 +507,7 @@ struct clif_interface { void (*inventorylist) (struct map_session_data *sd); void (*equiplist) (struct map_session_data *sd); void (*cartlist) (struct map_session_data *sd); + void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); void (*item_identified) (struct map_session_data *sd,int idx,int flag); @@ -457,7 +522,9 @@ struct clif_interface { void (*changed_dir) (struct block_list *bl, enum send_target target); void (*charnameack) (int fd, struct block_list *bl); void (*monster_hp_bar) ( struct mob_data* md, int fd ); + int (*hpmeter) (struct map_session_data *sd); void (*hpmeter_single) (int fd, int id, unsigned int hp, unsigned int maxhp); + int (*hpmeter_sub) (struct block_list *bl, va_list ap); void (*upgrademessage) (int fd, int result, int item_id); void (*get_weapon_view) (struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand); void (*gospel_info) (struct map_session_data *sd, int type); @@ -484,6 +551,7 @@ struct clif_interface { int (*skill_itemlistwindow) ( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ); int (*sc_notick) (struct block_list *bl,int type,int flag,int val1, int val2, int val3); int (*sc_single) (int fd, int id,int type,int flag,int val1, int val2, int val3); + void (*initialstatus) (struct map_session_data *sd); /* player-unit-specific-related */ void (*updatestatus) (struct map_session_data *sd,int type); void (*changestatus) (struct map_session_data* sd,int type,int val); @@ -491,6 +559,15 @@ struct clif_interface { void (*movetoattack) (struct map_session_data *sd,struct block_list *bl); void (*solved_charname) (int fd, int charid, const char* name); void (*charnameupdate) (struct map_session_data *ssd); + int (*delayquit) (int tid, unsigned int tick, int id, intptr_t data); + void (*getareachar_pc) (struct map_session_data* sd,struct map_session_data* dstsd); + void (*disconnect_ack) (struct map_session_data* sd, short result); + void (*PVPInfo) (struct map_session_data* sd); + void (*blacksmith) (struct map_session_data* sd); + void (*alchemist) (struct map_session_data* sd); + void (*taekwon) (struct map_session_data* sd); + void (*ranking_pk) (struct map_session_data* sd); + void (*quitsave) (int fd,struct map_session_data *sd); /* visual effects client-side */ void (*misceffect) (struct block_list* bl,int type); void (*changeoption) (struct block_list* bl); @@ -509,6 +586,7 @@ struct clif_interface { void (*produce_effect) (struct map_session_data* sd,int flag,int nameid); void (*devotion) (struct block_list *src, struct map_session_data *tsd); void (*spiritball) (struct block_list *bl); + void (*spiritball_single) (int fd, struct map_session_data *sd); void (*bladestop) (struct block_list *src, int dst_id, int active); void (*mvp_effect) (struct map_session_data *sd); void (*heal) (int fd,int type,int val); @@ -520,7 +598,9 @@ struct clif_interface { void (*specialeffect_value) (struct block_list* bl, int effect_id, int num, send_target target); void (*millenniumshield) (struct map_session_data *sd, short shields ); void (*talisman) (struct map_session_data *sd, short type); + void (*talisman_single) (int fd, struct map_session_data *sd, short type); void (*snap) ( struct block_list *bl, short x, short y ); + void (*weather_check) (struct map_session_data *sd); /* sound effects client-side */ void (*playBGM) (struct map_session_data* sd, const char* name); void (*soundeffect) (struct map_session_data* sd, struct block_list* bl, const char* name, int type); @@ -538,21 +618,23 @@ struct clif_interface { void (*changechatstatus) (struct chat_data* cd); void (*wis_message) (int fd, const char* nick, const char* mes, int mes_len); void (*wis_end) (int fd, int flag); - void (*displaymessage) (const int fd, const char* mes); void (*disp_onlyself) (struct map_session_data *sd, const char *mes, int len); void (*disp_message) (struct block_list* src, const char* mes, int len, enum send_target target); void (*broadcast) (struct block_list* bl, const char* mes, int len, int type, enum send_target target); - void (*MainChatMessage) (const char* message); void (*broadcast2) (struct block_list* bl, const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target); void (*messagecolor) (struct block_list* bl, unsigned long color, const char* msg); - void (*message) (struct block_list* bl, const char* msg); - void (*disp_overhead) (struct map_session_data *sd, const char* mes); + void (*disp_overhead) (struct block_list *bl, const char* mes); void (*msg) (struct map_session_data* sd, unsigned short id); void (*msg_value) (struct map_session_data* sd, unsigned short id, int value); void (*msg_skill) (struct map_session_data* sd, uint16 skill_id, int msg_id); void (*msgtable) (int fd, int line); void (*msgtable_num) (int fd, int line, int num); + void (*message) (const int fd, const char* mes); int (*colormes) (struct map_session_data * sd, enum clif_colors color, const char* msg); + bool (*process_message) (struct map_session_data* sd, int format, char** name_, int* namelen_, char** message_, int* messagelen_); + void (*wisexin) (struct map_session_data *sd,int type,int flag); + void (*wisall) (struct map_session_data *sd,int type,int flag); + void (*PMIgnoreList) (struct map_session_data* sd); /* trade handling */ void (*traderequest) (struct map_session_data* sd, const char* name); void (*tradestart) (struct map_session_data* sd, uint8 type); @@ -596,6 +678,7 @@ struct clif_interface { void (*party_hp) (struct map_session_data *sd); void (*party_xy_remove) (struct map_session_data *sd); void (*party_show_picker) (struct map_session_data * sd, struct item * item_data); + void (*partyinvitationstate) (struct map_session_data* sd); /* guild-specific */ void (*guild_created) (struct map_session_data *sd,int flag); void (*guild_belonginfo) (struct map_session_data *sd, struct guild *g); @@ -625,6 +708,10 @@ struct clif_interface { void (*guild_xy) (struct map_session_data *sd); void (*guild_xy_single) (int fd, struct map_session_data *sd); void (*guild_xy_remove) (struct map_session_data *sd); + void (*guild_positionnamelist) (struct map_session_data *sd); + void (*guild_positioninfolist) (struct map_session_data *sd); + void (*guild_expulsionlist) (struct map_session_data* sd); + bool (*validate_emblem) (const uint8* emblem, unsigned long emblem_len); /* battleground-specific */ void (*bg_hp) (struct map_session_data *sd); void (*bg_xy) (struct map_session_data *sd); @@ -650,11 +737,15 @@ struct clif_interface { int (*friendslist_toggle_sub) (struct map_session_data *sd,va_list ap); void (*friendslist_send) (struct map_session_data *sd); void (*friendslist_reqack) (struct map_session_data *sd, struct map_session_data *f_sd, int type); + void (*friendslist_toggle) (struct map_session_data *sd,int account_id, int char_id, int online); + void (*friendlist_req) (struct map_session_data* sd, int account_id, int char_id, const char* name); /* gm-related */ void (*GM_kickack) (struct map_session_data *sd, int id); void (*GM_kick) (struct map_session_data *sd,struct map_session_data *tsd); void (*manner_message) (struct map_session_data* sd, uint32 type); void (*GM_silence) (struct map_session_data* sd, struct map_session_data* tsd, uint8 type); + void (*account_name) (struct map_session_data* sd, int account_id, const char* accname); + void (*check) (int fd, struct map_session_data* pl_sd); /* hom-related */ void (*hominfo) (struct map_session_data *sd, struct homun_data *hd, int flag); int (*homskillinfoblock) (struct map_session_data *sd); @@ -678,11 +769,13 @@ struct clif_interface { void (*mail_new) (int fd, int mail_id, const char *sender, const char *title); void (*mail_refreshinbox) (struct map_session_data *sd); void (*mail_getattachment) (int fd, uint8 flag); + void (*mail_setattachment) (int fd, int index, uint8 flag); /* auction-related */ void (*auction_openwindow) (struct map_session_data *sd); void (*auction_results) (struct map_session_data *sd, short count, short pages, uint8 *buf); void (*auction_message) (int fd, unsigned char flag); void (*auction_close) (int fd, unsigned char flag); + void (*auction_setitem) (int fd, int index, bool fail); /* mercenary-related */ void (*mercenary_info) (struct map_session_data *sd); void (*mercenary_skillblock) (struct map_session_data *sd); @@ -721,13 +814,215 @@ struct clif_interface { void (*elemental_updatestatus) (struct map_session_data *sd, int type); /* misc-handling */ void (*adopt_reply) (struct map_session_data *sd, int type); + void (*adopt_request) (struct map_session_data *sd, struct map_session_data *src, int p_id); void (*readbook) (int fd, int book_id, int page); + int (*guess_PacketVer) (int fd, int get_previous, int *error); + void (*notify_time) (struct map_session_data* sd, unsigned long time); + void (*user_count) (struct map_session_data* sd, int count); + void (*noask_sub) (struct map_session_data *src, struct map_session_data *target, int type); + void (*chsys_create) (struct hChSysCh *channel, char *name, char *pass, unsigned char color); + void (*chsys_msg) (struct hChSysCh *channel, struct map_session_data *sd, char *msg); + void (*chsys_send) (struct hChSysCh *channel, struct map_session_data *sd, char *msg); + void (*chsys_join) (struct hChSysCh *channel, struct map_session_data *sd); + void (*chsys_left) (struct hChSysCh *channel, struct map_session_data *sd); + void (*chsys_delete) (struct hChSysCh *channel); + void (*chsys_mjoin) (struct map_session_data *sd); /*------------------------ *- Parse Incoming Packet *------------------------*/ - void (*ActionRequest_sub) (struct map_session_data *sd, int action_type, int target_id, unsigned int tick); - void (*LoadEndAck) (int fd,struct map_session_data *sd); - void (*Auction_cancelreg) (int fd, struct map_session_data *sd); + void (*pWantToConnection) (int fd, struct map_session_data *sd); + void (*pLoadEndAck) (int fd,struct map_session_data *sd); + void (*pTickSend) (int fd, struct map_session_data *sd); + void (*pHotkey) (int fd, struct map_session_data *sd); + void (*pProgressbar) (int fd, struct map_session_data * sd); + void (*pWalkToXY) (int fd, struct map_session_data *sd); + void (*pQuitGame) (int fd, struct map_session_data *sd); + void (*pGetCharNameRequest) (int fd, struct map_session_data *sd); + void (*pGlobalMessage) (int fd, struct map_session_data* sd); + void (*pMapMove) (int fd, struct map_session_data *sd); + void (*pChangeDir) (int fd, struct map_session_data *sd); + void (*pEmotion) (int fd, struct map_session_data *sd); + void (*pHowManyConnections) (int fd, struct map_session_data *sd); + void (*pActionRequest) (int fd, struct map_session_data *sd); + void (*pActionRequest_sub) (struct map_session_data *sd, int action_type, int target_id, unsigned int tick); + void (*pRestart) (int fd, struct map_session_data *sd); + void (*pWisMessage) (int fd, struct map_session_data* sd); + void (*pBroadcast) (int fd, struct map_session_data* sd); + void (*pTakeItem) (int fd, struct map_session_data *sd); + void (*pDropItem) (int fd, struct map_session_data *sd); + void (*pUseItem) (int fd, struct map_session_data *sd); + void (*pEquipItem) (int fd,struct map_session_data *sd); + void (*pUnequipItem) (int fd,struct map_session_data *sd); + void (*pNpcClicked) (int fd,struct map_session_data *sd); + void (*pNpcBuySellSelected) (int fd,struct map_session_data *sd); + void (*pNpcBuyListSend) (int fd, struct map_session_data* sd); + void (*pNpcSellListSend) (int fd,struct map_session_data *sd); + void (*pCreateChatRoom) (int fd, struct map_session_data* sd); + void (*pChatAddMember) (int fd, struct map_session_data* sd); + void (*pChatRoomStatusChange) (int fd, struct map_session_data* sd); + void (*pChangeChatOwner) (int fd, struct map_session_data* sd); + void (*pKickFromChat) (int fd,struct map_session_data *sd); + void (*pChatLeave) (int fd, struct map_session_data* sd); + void (*pTradeRequest) (int fd,struct map_session_data *sd); + void (*chann_config_read) (void); + void (*pTradeAck) (int fd,struct map_session_data *sd); + void (*pTradeAddItem) (int fd,struct map_session_data *sd); + void (*pTradeOk) (int fd,struct map_session_data *sd); + void (*pTradeCancel) (int fd,struct map_session_data *sd); + void (*pTradeCommit) (int fd,struct map_session_data *sd); + void (*pStopAttack) (int fd,struct map_session_data *sd); + void (*pPutItemToCart) (int fd,struct map_session_data *sd); + void (*pGetItemFromCart) (int fd,struct map_session_data *sd); + void (*pRemoveOption) (int fd,struct map_session_data *sd); + void (*pChangeCart) (int fd,struct map_session_data *sd); + void (*pStatusUp) (int fd,struct map_session_data *sd); + void (*pSkillUp) (int fd,struct map_session_data *sd); + void (*pUseSkillToId) (int fd, struct map_session_data *sd); + void (*pUseSkillToId_homun) (struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id); + void (*pUseSkillToId_mercenary) (struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id); + void (*pUseSkillToPos) (int fd, struct map_session_data *sd); + void (*pUseSkillToPosSub) (int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo); + void (*pUseSkillToPos_homun) (struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo); + void (*pUseSkillToPos_mercenary) (struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo); + void (*pUseSkillToPosMoreInfo) (int fd, struct map_session_data *sd); + void (*pUseSkillMap) (int fd, struct map_session_data* sd); + void (*pRequestMemo) (int fd,struct map_session_data *sd); + void (*pProduceMix) (int fd,struct map_session_data *sd); + void (*pCooking) (int fd,struct map_session_data *sd); + void (*pRepairItem) (int fd, struct map_session_data *sd); + void (*pWeaponRefine) (int fd, struct map_session_data *sd); + void (*pNpcSelectMenu) (int fd,struct map_session_data *sd); + void (*pNpcNextClicked) (int fd,struct map_session_data *sd); + void (*pNpcAmountInput) (int fd,struct map_session_data *sd); + void (*pNpcStringInput) (int fd, struct map_session_data* sd); + void (*pNpcCloseClicked) (int fd,struct map_session_data *sd); + void (*pItemIdentify) (int fd,struct map_session_data *sd); + void (*pSelectArrow) (int fd,struct map_session_data *sd); + void (*pAutoSpell) (int fd,struct map_session_data *sd); + void (*pUseCard) (int fd,struct map_session_data *sd); + void (*pInsertCard) (int fd,struct map_session_data *sd); + void (*pSolveCharName) (int fd, struct map_session_data *sd); + void (*pResetChar) (int fd, struct map_session_data *sd); + void (*pLocalBroadcast) (int fd, struct map_session_data* sd); + void (*pMoveToKafra) (int fd, struct map_session_data *sd); + void (*pMoveFromKafra) (int fd,struct map_session_data *sd); + void (*pMoveToKafraFromCart) (int fd, struct map_session_data *sd); + void (*pMoveFromKafraToCart) (int fd, struct map_session_data *sd); + void (*pCloseKafra) (int fd, struct map_session_data *sd); + void (*pStoragePassword) (int fd, struct map_session_data *sd); + void (*pCreateParty) (int fd, struct map_session_data *sd); + void (*pCreateParty2) (int fd, struct map_session_data *sd); + void (*pPartyInvite) (int fd, struct map_session_data *sd); + void (*pPartyInvite2) (int fd, struct map_session_data *sd); + void (*pReplyPartyInvite) (int fd,struct map_session_data *sd); + void (*pReplyPartyInvite2) (int fd,struct map_session_data *sd); + void (*pLeaveParty) (int fd, struct map_session_data *sd); + void (*pRemovePartyMember) (int fd, struct map_session_data *sd); + void (*pPartyChangeOption) (int fd, struct map_session_data *sd); + void (*pPartyMessage) (int fd, struct map_session_data* sd); + void (*pPartyChangeLeader) (int fd, struct map_session_data* sd); + void (*pPartyBookingRegisterReq) (int fd, struct map_session_data* sd); + void (*pPartyBookingSearchReq) (int fd, struct map_session_data* sd); + void (*pPartyBookingDeleteReq) (int fd, struct map_session_data* sd); + void (*pPartyBookingUpdateReq) (int fd, struct map_session_data* sd); + void (*pCloseVending) (int fd, struct map_session_data* sd); + void (*pVendingListReq) (int fd, struct map_session_data* sd); + void (*pPurchaseReq) (int fd, struct map_session_data* sd); + void (*pPurchaseReq2) (int fd, struct map_session_data* sd); + void (*pOpenVending) (int fd, struct map_session_data* sd); + void (*pCreateGuild) (int fd,struct map_session_data *sd); + void (*pGuildCheckMaster) (int fd, struct map_session_data *sd); + void (*pGuildRequestInfo) (int fd, struct map_session_data *sd); + void (*pGuildChangePositionInfo) (int fd, struct map_session_data *sd); + void (*pGuildChangeMemberPosition) (int fd, struct map_session_data *sd); + void (*pGuildRequestEmblem) (int fd,struct map_session_data *sd); + void (*pGuildChangeEmblem) (int fd,struct map_session_data *sd); + void (*pGuildChangeNotice) (int fd, struct map_session_data* sd); + void (*pGuildInvite) (int fd,struct map_session_data *sd); + void (*pGuildReplyInvite) (int fd,struct map_session_data *sd); + void (*pGuildLeave) (int fd,struct map_session_data *sd); + void (*pGuildExpulsion) (int fd,struct map_session_data *sd); + void (*pGuildMessage) (int fd, struct map_session_data* sd); + void (*pGuildRequestAlliance) (int fd, struct map_session_data *sd); + void (*pGuildReplyAlliance) (int fd, struct map_session_data *sd); + void (*pGuildDelAlliance) (int fd, struct map_session_data *sd); + void (*pGuildOpposition) (int fd, struct map_session_data *sd); + void (*pGuildBreak) (int fd, struct map_session_data *sd); + void (*pPetMenu) (int fd, struct map_session_data *sd); + void (*pCatchPet) (int fd, struct map_session_data *sd); + void (*pSelectEgg) (int fd, struct map_session_data *sd); + void (*pSendEmotion) (int fd, struct map_session_data *sd); + void (*pChangePetName) (int fd, struct map_session_data *sd); + void (*pGMKick) (int fd, struct map_session_data *sd); + void (*pGMKickAll) (int fd, struct map_session_data* sd); + void (*pGMShift) (int fd, struct map_session_data *sd); + void (*pGMRemove2) (int fd, struct map_session_data* sd); + void (*pGMRecall) (int fd, struct map_session_data *sd); + void (*pGMRecall2) (int fd, struct map_session_data* sd); + void (*pGM_Monster_Item) (int fd, struct map_session_data *sd); + void (*pGMHide) (int fd, struct map_session_data *sd); + void (*pGMReqNoChat) (int fd,struct map_session_data *sd); + void (*pGMRc) (int fd, struct map_session_data* sd); + void (*pGMReqAccountName) (int fd, struct map_session_data *sd); + void (*pGMChangeMapType) (int fd, struct map_session_data *sd); + void (*pPMIgnore) (int fd, struct map_session_data* sd); + void (*pPMIgnoreAll) (int fd, struct map_session_data *sd); + void (*pPMIgnoreList) (int fd,struct map_session_data *sd); + void (*pNoviceDoriDori) (int fd, struct map_session_data *sd); + void (*pNoviceExplosionSpirits) (int fd, struct map_session_data *sd); + void (*pFriendsListAdd) (int fd, struct map_session_data *sd); + void (*pFriendsListReply) (int fd, struct map_session_data *sd); + void (*pFriendsListRemove) (int fd, struct map_session_data *sd); + void (*pPVPInfo) (int fd,struct map_session_data *sd); + void (*pBlacksmith) (int fd,struct map_session_data *sd); + void (*pAlchemist) (int fd,struct map_session_data *sd); + void (*pTaekwon) (int fd,struct map_session_data *sd); + void (*pRankingPk) (int fd,struct map_session_data *sd); + void (*pFeelSaveOk) (int fd,struct map_session_data *sd); + void (*pChangeHomunculusName) (int fd, struct map_session_data *sd); + void (*pHomMoveToMaster) (int fd, struct map_session_data *sd); + void (*pHomMoveTo) (int fd, struct map_session_data *sd); + void (*pHomAttack) (int fd,struct map_session_data *sd); + void (*pHomMenu) (int fd, struct map_session_data *sd); + void (*pAutoRevive) (int fd, struct map_session_data *sd); + void (*pCheck) (int fd, struct map_session_data *sd); + void (*pMail_refreshinbox) (int fd, struct map_session_data *sd); + void (*pMail_read) (int fd, struct map_session_data *sd); + void (*pMail_getattach) (int fd, struct map_session_data *sd); + void (*pMail_delete) (int fd, struct map_session_data *sd); + void (*pMail_return) (int fd, struct map_session_data *sd); + void (*pMail_setattach) (int fd, struct map_session_data *sd); + void (*pMail_winopen) (int fd, struct map_session_data *sd); + void (*pMail_send) (int fd, struct map_session_data *sd); + void (*pAuction_cancelreg) (int fd, struct map_session_data *sd); + void (*pAuction_setitem) (int fd, struct map_session_data *sd); + void (*pAuction_register) (int fd, struct map_session_data *sd); + void (*pAuction_cancel) (int fd, struct map_session_data *sd); + void (*pAuction_close) (int fd, struct map_session_data *sd); + void (*pAuction_bid) (int fd, struct map_session_data *sd); + void (*pAuction_search) (int fd, struct map_session_data* sd); + void (*pAuction_buysell) (int fd, struct map_session_data* sd); + void (*pcashshop_buy) (int fd, struct map_session_data *sd); + void (*pAdopt_request) (int fd, struct map_session_data *sd); + void (*pAdopt_reply) (int fd, struct map_session_data *sd); + void (*pViewPlayerEquip) (int fd, struct map_session_data* sd); + void (*pEquipTick) (int fd, struct map_session_data* sd); + void (*pquestStateAck) (int fd, struct map_session_data * sd); + void (*pmercenary_action) (int fd, struct map_session_data* sd); + void (*pBattleChat) (int fd, struct map_session_data* sd); + void (*pLessEffect) (int fd, struct map_session_data* sd); + void (*pItemListWindowSelected) (int fd, struct map_session_data* sd); + void (*pReqOpenBuyingStore) (int fd, struct map_session_data* sd); + void (*pReqCloseBuyingStore) (int fd, struct map_session_data* sd); + void (*pReqClickBuyingStore) (int fd, struct map_session_data* sd); + void (*pReqTradeBuyingStore) (int fd, struct map_session_data* sd); + void (*pSearchStoreInfo) (int fd, struct map_session_data* sd); + void (*pSearchStoreInfoNextPage) (int fd, struct map_session_data* sd); + void (*pCloseSearchStoreInfo) (int fd, struct map_session_data* sd); + void (*pSearchStoreInfoListItemClick) (int fd, struct map_session_data* sd); + void (*pDebug) (int fd,struct map_session_data *sd); + void (*pSkillSelectMenu) (int fd, struct map_session_data *sd); + void (*pMoveItem) (int fd, struct map_session_data *sd); } clif_s; struct clif_interface *clif; diff --git a/src/map/guild.c b/src/map/guild.c index fa06f7f4c..ec5b42af2 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -259,7 +259,7 @@ int guild_getposition(struct guild* g, struct map_session_data* sd) { int i; - if( g == NULL && (g=guild_search(sd->status.guild_id)) == NULL ) + if( g == NULL && (g=sd->guild) == NULL ) return -1; ARR_FIND( 0, g->max_member, i, g->member[i].account_id == sd->status.account_id && g->member[i].char_id == sd->status.char_id ); @@ -481,8 +481,7 @@ int guild_recv_noinfo(int guild_id) struct s_mapiterator* iter; iter = mapit_getallusers(); - for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) - { + for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) { if( sd->status.guild_id == guild_id ) sd->status.guild_id = 0; // erase guild } @@ -492,27 +491,58 @@ int guild_recv_noinfo(int guild_id) } //Get and display information for all member -int guild_recv_info(struct guild *sg) -{ +int guild_recv_info(struct guild *sg) { struct guild *g,before; int i,bm,m; DBData data; struct map_session_data *sd; bool guild_new = false; + void *aChSysSave = NULL; nullpo_ret(sg); - if((g = (struct guild*)idb_get(guild_db,sg->guild_id))==NULL) - { + if((g = (struct guild*)idb_get(guild_db,sg->guild_id))==NULL) { guild_new = true; g=(struct guild *)aCalloc(1,sizeof(struct guild)); idb_put(guild_db,sg->guild_id,g); - before=*sg; + if( hChSys.ally ) { + struct hChSysCh *channel; + + CREATE(channel, struct hChSysCh , 1); + safestrncpy(channel->name, hChSys.ally_name, HCHSYS_NAME_LENGTH); + channel->type = hChSys_ALLY; + + clif->chsys_create(channel,NULL,NULL,hChSys.ally_color); + if( hChSys.ally_autojoin ) { + struct s_mapiterator* iter = mapit_getallusers(); + + for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) { + if( sd->status.guild_id ) { + if( sd->status.guild_id == sg->guild_id ) { + clif->chsys_join(channel,sd); + sd->guild = g; + continue; + } + + for (i = 0; i < MAX_GUILDALLIANCE; i++) { + if( sg->alliance[i].guild_id == sd->status.guild_id ) { + clif->chsys_join(channel,sd); + break; + } + } + } + } + + mapit_free(iter); + } + + aChSysSave = (void*)channel; + } + before=*sg; //Perform the check on the user because the first load guild_check_member(sg); - if ((sd = map_nick2sd(sg->master)) != NULL) - { + if ((sd = map_nick2sd(sg->master)) != NULL) { //If the guild master is online the first time the guild_info is received, //that means he was the first to join, so apply guild skill blocking here. if( battle_config.guild_skill_relog_delay ) @@ -523,12 +553,16 @@ int guild_recv_info(struct guild *sg) clif->charnameupdate(sd); // [LuzZza] clif->guild_masterormember(sd); } - }else + } else { before=*g; + if( g->channel ) + aChSysSave = g->channel; + } memcpy(g,sg,sizeof(struct guild)); - - if(g->max_member > MAX_GUILD) - { + + g->channel = aChSysSave; + + if(g->max_member > MAX_GUILD) { ShowError("guild_recv_info: Received guild with %d members, but MAX_GUILD is only %d. Extra guild-members have been lost!\n", g->max_member, MAX_GUILD); g->max_member = MAX_GUILD; } @@ -570,10 +604,9 @@ int guild_recv_info(struct guild *sg) } //Occurrence of an event - if (guild_infoevent_db->remove(guild_infoevent_db, db_i2key(sg->guild_id), &data)) - { + if (guild_infoevent_db->remove(guild_infoevent_db, db_i2key(sg->guild_id), &data)) { struct eventlist *ev = db_data2ptr(&data), *ev2; - while(ev){ + while(ev) { npc_event_do(ev->name); ev2=ev->next; aFree(ev); @@ -593,7 +626,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) { nullpo_ret(sd); - g=guild_search(sd->status.guild_id); + g=sd->guild; if(tsd==NULL || g==NULL) return 0; @@ -705,8 +738,7 @@ void guild_member_joined(struct map_session_data *sd) guild_request_info(sd->status.guild_id); return; } - if (strcmp(sd->status.name,g->master) == 0) - { // set the Guild Master flag + if (strcmp(sd->status.name,g->master) == 0) { // set the Guild Master flag sd->state.gmaster_flag = g; // prevent Guild Skills from being used directly after relog if( battle_config.guild_skill_relog_delay ) @@ -715,8 +747,24 @@ void guild_member_joined(struct map_session_data *sd) i = guild_getindex(g, sd->status.account_id, sd->status.char_id); if (i == -1) sd->status.guild_id = 0; - else + else { + g->member[i].sd = sd; + sd->guild = g; + + if( hChSys.ally && hChSys.ally_autojoin ) { + struct guild* sg = NULL; + clif->chsys_join((struct hChSysCh*)g->channel,sd); + + for (i = 0; i < MAX_GUILDALLIANCE; i++) { + if( g->alliance[i].guild_id && (sg = guild_search(g->alliance[i].guild_id) ) ) { + clif->chsys_join((struct hChSysCh*)sg->channel,sd); + break; + } + } + } + + } } /*========================================== @@ -775,7 +823,7 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c nullpo_ret(sd); - g = guild_search(sd->status.guild_id); + g = sd->guild; if(g==NULL) return 0; @@ -800,7 +848,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i nullpo_ret(sd); - g = guild_search(sd->status.guild_id); + g = sd->guild; if(g==NULL) return 0; @@ -859,8 +907,14 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c if (sd->state.storage_flag == 2) //Close the guild storage. storage_guild_storageclose(sd); guild_send_dot_remove(sd); - + if( hChSys.ally ) { + for (i = 0; i < sd->channel_count; i++) { + if( sd->channels[i] && sd->channels[i]->type == hChSys_ALLY ) + clif->chsys_left(sd->channels[i],sd); + } + } sd->status.guild_id = 0; + sd->guild = NULL; sd->guild_emblem_id = 0; clif->charnameupdate(sd); //Update display name [Skotlex] @@ -878,7 +932,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online) if(sd->status.guild_id <= 0) return 0; - if(!(g = guild_search(sd->status.guild_id))) + if(!(g = sd->guild)) return 0; intif_guild_memberinfoshort(g->guild_id, @@ -1097,7 +1151,7 @@ int guild_change_emblem(struct map_session_data *sd,int len,const char *data) nullpo_ret(sd); if (battle_config.require_glory_guild && - !((g = guild_search(sd->status.guild_id)) && guild_checkskill(g, GD_GLORYGUILD)>0)) { + !((g = sd->guild) && guild_checkskill(g, GD_GLORYGUILD)>0)) { clif->skill_fail(sd,GD_GLORYGUILD,USESKILL_FAIL_LEVEL,0); return 0; } @@ -1196,7 +1250,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) if (!exp) return 0; if (sd->status.guild_id == 0 || - (g = guild_search(sd->status.guild_id)) == NULL || + (g = sd->guild) == NULL || (per = guild_getposition(g,sd)) < 0 || (per = g->position[per].exp_mode) < 1) return 0; @@ -1226,7 +1280,7 @@ int guild_getexp(struct map_session_data *sd,int exp) struct guild_expcache *c; nullpo_ret(sd); - if (sd->status.guild_id == 0 || guild_search(sd->status.guild_id) == NULL) + if (sd->status.guild_id == 0 || sd->guild == NULL) return 0; c = db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd)); @@ -1249,7 +1303,7 @@ int guild_skillup(TBL_PC* sd, uint16 skill_id) nullpo_ret(sd); if( idx < 0 || idx >= MAX_GUILDSKILL || // not a guild skill - sd->status.guild_id == 0 || (g=guild_search(sd->status.guild_id)) == NULL || // no guild + sd->status.guild_id == 0 || (g=sd->guild) == NULL || // no guild strcmp(sd->status.name, g->master) ) // not the guild master return 0; @@ -1370,7 +1424,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) int i; if(agit_flag || agit2_flag) { // Disable alliance creation during woe [Valaris] - clif->displaymessage(sd->fd,msg_txt(676)); //"Alliances cannot be made during Guild Wars!" + clif->message(sd->fd,msg_txt(676)); //"Alliances cannot be made during Guild Wars!" return 0; } // end addition [Valaris] @@ -1380,8 +1434,8 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) if(tsd==NULL || tsd->status.guild_id<=0) return 0; - g[0]=guild_search(sd->status.guild_id); - g[1]=guild_search(tsd->status.guild_id); + g[0]=sd->guild; + g[1]=tsd->guild; if(g[0]==NULL || g[1]==NULL) return 0; @@ -1440,8 +1494,8 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) int i; struct guild *g, *tg; // Reconfirm the number of alliance - g=guild_search(sd->status.guild_id); - tg=guild_search(tsd->status.guild_id); + g=sd->guild; + tg=tsd->guild; if(g==NULL || guild_get_alliance_count(g,0) >= battle_config.max_guild_alliance){ clif->guild_allianceack(sd,4); @@ -1488,7 +1542,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) nullpo_ret(sd); if(agit_flag || agit2_flag) { // Disable alliance breaking during woe [Valaris] - clif->displaymessage(sd->fd,msg_txt(677)); //"Alliances cannot be broken during Guild Wars!" + clif->message(sd->fd,msg_txt(677)); //"Alliances cannot be broken during Guild Wars!" return 0; } // end addition [Valaris] @@ -1506,7 +1560,7 @@ int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd) nullpo_ret(sd); - g=guild_search(sd->status.guild_id); + g=sd->guild; if(g==NULL || tsd==NULL) return 0; @@ -1683,6 +1737,7 @@ int guild_broken(int guild_id,int flag) if(sd->state.storage_flag == 2) storage_guild_storage_quit(sd,1); sd->status.guild_id=0; + sd->guild = NULL; clif->guild_broken(g->member[i].sd,0); clif->charnameupdate(sd); // [LuzZza] } @@ -1691,6 +1746,11 @@ int guild_broken(int guild_id,int flag) guild_db->foreach(guild_db,guild_broken_sub,guild_id); castle_db->foreach(castle_db,castle_guild_broken_sub,guild_id); guild_storage_delete(guild_id); + if( hChSys.ally ) { + if( g->channel != NULL ) { + clif->chsys_delete(( struct hChSysCh * )g->channel); + } + } idb_remove(guild_db,guild_id); return 0; } @@ -1743,15 +1803,13 @@ int guild_gm_changed(int guild_id, int account_id, int char_id) g->member[0].position = 0; //Position 0: guild Master. strcpy(g->master, g->member[0].name); - if (g->member[pos].sd && g->member[pos].sd->fd) - { - clif->displaymessage(g->member[pos].sd->fd, msg_txt(678)); //"You no longer are the Guild Master." + if (g->member[pos].sd && g->member[pos].sd->fd) { + clif->message(g->member[pos].sd->fd, msg_txt(678)); //"You no longer are the Guild Master." g->member[pos].sd->state.gmaster_flag = 0; } - if (g->member[0].sd && g->member[0].sd->fd) - { - clif->displaymessage(g->member[0].sd->fd, msg_txt(679)); //"You have become the Guild Master!" + if (g->member[0].sd && g->member[0].sd->fd) { + clif->message(g->member[0].sd->fd, msg_txt(679)); //"You have become the Guild Master!" g->member[0].sd->state.gmaster_flag = g; //Block his skills for 5 minutes to prevent abuse. guild_block_skill(g->member[0].sd, 300000); @@ -1780,7 +1838,7 @@ int guild_break(struct map_session_data *sd,char *name) nullpo_ret(sd); - if( (g=guild_search(sd->status.guild_id))==NULL ) + if( (g=sd->guild)==NULL ) return 0; if(strcmp(g->name,name)!=0) return 0; @@ -2136,6 +2194,15 @@ void do_init_guild(void) { } void do_final_guild(void) { + DBIterator *iter = db_iterator(guild_db); + struct guild *g; + + for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) { + if( g->channel != NULL ) + clif->chsys_delete((struct hChSysCh *)g->channel); + } + + dbi_destroy(iter); db_destroy(guild_db); castle_db->destroy(castle_db,guild_castle_db_final); diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 9462ab0d2..904b773eb 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -703,7 +703,7 @@ int merc_hom_change_name_ack(struct map_session_data *sd, char* name, int flag) normalize_name(name," ");//bugreport:3032 if ( !flag || !strlen(name) ) { - clif->displaymessage(sd->fd, msg_txt(280)); // You cannot use this name + clif->message(sd->fd, msg_txt(280)); // You cannot use this name return 0; } safestrncpy(hd->homunculus.name,name,NAME_LENGTH); diff --git a/src/map/intif.c b/src/map/intif.c index ba14ad6f3..73b828f00 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -170,10 +170,7 @@ int intif_broadcast(const char* mes, int len, int type) int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY) { // Send to the local players - if (fontColor == 0xFE000000) // This is main chat message [LuzZza] - clif->MainChatMessage(mes); - else - clif->broadcast2(NULL, mes, len, fontColor, fontType, fontSize, fontAlign, fontY, ALL_CLIENT); + clif->broadcast2(NULL, mes, len, fontColor, fontType, fontSize, fontAlign, fontY, ALL_CLIENT); if (CheckForCharServer()) return 0; @@ -1888,7 +1885,7 @@ static void intif_parse_Auction_close(int fd) if( result == 0 ) { // FIXME: Leeching off a parse function - clif->Auction_cancelreg(fd, sd); + clif->pAuction_cancelreg(fd, sd); intif_Auction_requestlist(sd->status.char_id, 6, 0, "", 1); } } @@ -1926,7 +1923,7 @@ static void intif_parse_Auction_bid(int fd) pc_getzeny(sd, bid, LOG_TYPE_AUCTION,NULL); } if( result == 1 ) { // To update the list, display your buy list - clif->Auction_cancelreg(fd, sd); + clif->pAuction_cancelreg(fd, sd); intif_Auction_requestlist(sd->status.char_id, 7, 0, "", 1); } } @@ -2145,7 +2142,7 @@ void intif_parse_MessageToFD(int fd) { if( sd->bl.id == aid ) { char msg[512]; safestrncpy(msg, (char*)RFIFOP(fd,12), RFIFOW(fd,2) - 12); - clif->displaymessage(u_fd,msg); + clif->message(u_fd,msg); } } @@ -2181,8 +2178,6 @@ int intif_parse(int fd) case 0x3800: if (RFIFOL(fd,4) == 0xFF000000) //Normal announce. clif->broadcast(NULL, (char *) RFIFOP(fd,16), packet_len-16, 0, ALL_CLIENT); - else if (RFIFOL(fd,4) == 0xFE000000) //Main chat message [LuzZza] - clif->MainChatMessage((char *)RFIFOP(fd,16)); else //Color announce. clif->broadcast2(NULL, (char *) RFIFOP(fd,16), packet_len-16, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), ALL_CLIENT); break; diff --git a/src/map/map.c b/src/map/map.c index 25bc331fa..db933c2dd 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -83,10 +83,6 @@ char log_db_pw[32] = "ragnarok"; char log_db_db[32] = "log"; Sql* logmysql_handle; -// This param using for sending mainchat -// messages like whispers to this nick. [LuzZza] -char main_chat_nick[16] = "Main"; - char *INTER_CONF_NAME; char *LOG_CONF_NAME; char *MAP_CONF_NAME; @@ -1701,10 +1697,33 @@ int map_quit(struct map_session_data *sd) { unit_remove_map(&sd->ed->bl,CLR_TELEPORT); } + if( hChSys.ally && sd->status.guild_id ) { + struct guild *g = sd->guild, *sg; + if( g ) { + if( idb_exists(((struct hChSysCh *)g->channel)->users, sd->status.char_id) ) + clif->chsys_left((struct hChSysCh *)g->channel,sd); + for (i = 0; i < MAX_GUILDALLIANCE; i++) { + if( g->alliance[i].guild_id && (sg = guild_search(g->alliance[i].guild_id) ) ) { + if( idb_exists(((struct hChSysCh *)sg->channel)->users, sd->status.char_id) ) + clif->chsys_left((struct hChSysCh *)sg->channel,sd); + break; + } + } + } + } + + if( sd->channel_count ) { + for( i = 0; i < sd->channel_count; i++ ) { + if( sd->channels[i] != NULL ) + clif->chsys_left(sd->channels[i],sd); + } + if( hChSys.closing ) + aFree(sd->channels); + } + unit_remove_map_pc(sd,CLR_TELEPORT); - if( map[sd->bl.m].instance_id ) - { // Avoid map conflicts and warnings on next login + if( map[sd->bl.m].instance_id ) { // Avoid map conflicts and warnings on next login int16 m; struct point *pt; if( map[sd->bl.m].save.map ) @@ -2950,7 +2969,8 @@ void do_final_maps(void) { } map[i].skill_count = 0; } - + if( map[i].channel ) + clif->chsys_delete(map[i].channel); } map_zone_db_clear(); @@ -3435,9 +3455,6 @@ int inter_config_read(char *cfgName) if( sscanf(line,"%[^:]: %[^\r\n]",w1,w2) < 2 ) continue; - if(strcmpi(w1, "main_chat_nick")==0) - safestrncpy(main_chat_nick, w2, sizeof(main_chat_nick)); - else if(strcmpi(w1,"item_db_db")==0) strcpy(item_db_db,w2); else @@ -3924,6 +3941,7 @@ void do_final(void) struct s_mapiterator* iter; ShowStatus("Terminating...\n"); + hChSys.closing = true; //Ladies and babies first. iter = mapit_getallusers(); diff --git a/src/map/map.h b/src/map/map.h index cd5983686..7892cbfdc 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -17,6 +17,7 @@ struct npc_data; struct item_data; +struct hChSysCh; enum E_MAPSERVER_ST { MAPSERVER_ST_RUNNING = CORE_ST_LAST, @@ -585,6 +586,7 @@ struct map_data { unsigned guildlock :1; unsigned src4instance : 1; // To flag this map when it's used as a src map for instances unsigned reset :1; // [Daegaladh] + unsigned chsysnolocalaj : 1; } flag; struct point save; struct npc_data *npc[MAX_NPC_PER_MAP]; @@ -619,6 +621,9 @@ struct map_data { /* Hercules nocast db overhaul */ struct map_zone_data *zone; + + /* Hercules Local Chat */ + struct hChSysCh *channel; }; /// Stores information about a remote map (for multi-mapserver setups). @@ -796,8 +801,6 @@ typedef struct elemental_data TBL_ELEM; ( ((bl) == (struct block_list*)NULL || (bl)->type != (type_)) ? (T ## type_ *)NULL : (T ## type_ *)(bl) ) -extern char main_chat_nick[16]; - #ifdef BETA_THREAD_TEST extern char default_codepage[32]; diff --git a/src/map/npc.c b/src/map/npc.c index eab38886c..fe2e769db 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3461,6 +3461,8 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char } else if( map[m].zone != zone ) { /* we do not override :P would mess everything */ map_zone_apply(m,zone,w1,start,buffer,filepath); } + } else if ( !strcmpi(w3,"nomapchannelautojoin") ) { + map[m].flag.chsysnolocalaj = state; } else ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').\n", w3, filepath, strline(buffer,start-buffer)); diff --git a/src/map/party.c b/src/map/party.c index baf680df3..f69a843fc 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -345,7 +345,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd) ARR_FIND(0, MAX_PARTY, i, p->data[i].sd == sd); if( i == MAX_PARTY || !p->party.member[i].leader ) { - clif->displaymessage(sd->fd, msg_txt(282)); + clif->message(sd->fd, msg_txt(282)); return 0; } @@ -359,7 +359,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd) // confirm whether the account has the ability to invite before checking the player if( !pc_has_permission(sd, PC_PERM_PARTY) || (tsd && !pc_has_permission(tsd, PC_PERM_PARTY)) ) { - clif->displaymessage(sd->fd, msg_txt(81)); // "Your GM level doesn't authorize you to preform this action on the specified player." + clif->message(sd->fd, msg_txt(81)); // "Your GM level doesn't authorize you to preform this action on the specified player." return 0; } @@ -644,13 +644,13 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts return false; if (!tsd || tsd->status.party_id != sd->status.party_id) { - clif->displaymessage(sd->fd, msg_txt(283)); + clif->message(sd->fd, msg_txt(283)); return false; } if( map[sd->bl.m].flag.partylock ) { - clif->displaymessage(sd->fd, msg_txt(287)); + clif->message(sd->fd, msg_txt(287)); return false; } @@ -663,7 +663,7 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts if (!p->party.member[mi].leader) { //Need to be a party leader. - clif->displaymessage(sd->fd, msg_txt(282)); + clif->message(sd->fd, msg_txt(282)); return false; } @@ -674,11 +674,11 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts //Change leadership. p->party.member[mi].leader = 0; if (p->data[mi].sd->fd) - clif->displaymessage(p->data[mi].sd->fd, msg_txt(284)); + clif->message(p->data[mi].sd->fd, msg_txt(284)); p->party.member[tmi].leader = 1; if (p->data[tmi].sd->fd) - clif->displaymessage(p->data[tmi].sd->fd, msg_txt(285)); + clif->message(p->data[tmi].sd->fd, msg_txt(285)); //Update info. intif_party_leaderchange(p->party.party_id,p->party.member[tmi].account_id,p->party.member[tmi].char_id); diff --git a/src/map/pc.c b/src/map/pc.c index aac605d45..6fb45bcfe 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1068,7 +1068,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim sprintf(buf,"SVN Revision: %s", svn); else sprintf(buf,"Unknown Version"); - clif->displaymessage(sd->fd, buf); + clif->message(sd->fd, buf); } // Message of the Day [Valaris] @@ -1076,7 +1076,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim if (battle_config.motd_type) clif->disp_onlyself(sd,motd_text[i],strlen(motd_text[i])); else - clif->displaymessage(sd->fd, motd_text[i]); + clif->message(sd->fd, motd_text[i]); } // message of the limited time of the account @@ -1234,10 +1234,9 @@ int pc_reg_received(struct map_session_data *sd) intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox intif_request_questlog(sd); - if (sd->state.connect_new == 0 && sd->fd) - { //Character already loaded map! Gotta trigger LoadEndAck manually. + if (sd->state.connect_new == 0 && sd->fd) { //Character already loaded map! Gotta trigger LoadEndAck manually. sd->state.connect_new = 1; - clif->LoadEndAck(sd->fd, sd); + clif->pLoadEndAck(sd->fd, sd); } pc_inventory_rentals(sd); @@ -3974,13 +3973,13 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) if( map[sd->bl.m].flag.nodrop ) { - clif->displaymessage (sd->fd, msg_txt(271)); + clif->message (sd->fd, msg_txt(271)); return 0; //Can't drop items in nodrop mapflag maps. } if( !pc_candrop(sd,&sd->status.inventory[n]) ) { - clif->displaymessage (sd->fd, msg_txt(263)); + clif->message (sd->fd, msg_txt(263)); return 0; } @@ -4113,7 +4112,7 @@ int pc_isUseitem(struct map_session_data *sd,int n) case 14591: // Siege Teleport Scroll if( sd->duel_group && !battle_config.duel_allow_teleport ) { - clif->displaymessage(sd->fd, msg_txt(663)); + clif->message(sd->fd, msg_txt(663)); return 0; } if( nameid != 601 && nameid != 12212 && map[sd->bl.m].flag.noreturn ) @@ -4392,7 +4391,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun if( !itemdb_cancartstore(item_data, pc_get_group_level(sd)) ) { // Check item trade restrictions [Skotlex] - clif->displaymessage (sd->fd, msg_txt(264)); + clif->message (sd->fd, msg_txt(264)); return 1; } @@ -4556,7 +4555,7 @@ int pc_show_steal(struct block_list *bl,va_list ap) sprintf(output,"%s stole an Unknown Item (id: %i).",sd->status.name, itemid); else sprintf(output,"%s stole %s.",sd->status.name,item->jname); - clif->displaymessage( ((struct map_session_data *)bl)->fd, output); + clif->message( ((struct map_session_data *)bl)->fd, output); return 0; } @@ -4754,9 +4753,14 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y sd->regen.state.gc = 0; // make sure vending is allowed here if (sd->state.vending && map[m].flag.novending) { - clif->displaymessage (sd->fd, msg_txt(276)); // "You can't open a shop on this map" + clif->message (sd->fd, msg_txt(276)); // "You can't open a shop on this map" vending_closevending(sd); } + + if( hChSys.local && map[sd->bl.m].channel && idb_exists(map[sd->bl.m].channel->users, sd->status.char_id) ) { + clif->chsys_left(map[sd->bl.m].channel,sd); + } + } if( m < 0 ) @@ -4800,7 +4804,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y } if (sd->state.vending && map_getcell(m,x,y,CELL_CHKNOVENDING)) { - clif->displaymessage (sd->fd, msg_txt(204)); // "You can't open a shop on this cell." + clif->message (sd->fd, msg_txt(204)); // "You can't open a shop on this cell." vending_closevending(sd); } @@ -4938,16 +4942,13 @@ int pc_memo(struct map_session_data* sd, int pos) int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { if(sd == NULL) return 0; - if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX ) - { + if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX ) { struct guild *g; - if( sd->status.guild_id>0 && (g=guild_search(sd->status.guild_id))!=NULL) + if( sd->status.guild_id>0 && (g=sd->guild)!=NULL) return guild_checkskill(g,skill_id); return 0; - } - else if(skill_id >= ARRAYLENGTH(sd->status.skill) ) - { + } else if(skill_id >= ARRAYLENGTH(sd->status.skill) ) { ShowError("pc_checkskill: Invalid skill id %d (char_id=%d).\n", skill_id, sd->status.char_id); return 0; } @@ -8555,7 +8556,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) if(pos & EQP_SHOES) clif->changelook(&sd->bl,LOOK_SHOES,0); - if( pos&EQP_GARMENT ) { + if( pos&EQP_GARMENT && pc_checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) { sd->status.robe = id ? id->look : 0; clif->changelook(&sd->bl, LOOK_ROBE, sd->status.robe); } diff --git a/src/map/pc.h b/src/map/pc.h index f7afdd223..af61b97e9 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -137,7 +137,6 @@ struct map_session_data { unsigned int showdelay :1; unsigned int showexp :1; unsigned int showzeny :1; - unsigned int mainchat :1; //[LuzZza] unsigned int noask :1; // [LuzZza] unsigned int trading :1; //[Skotlex] is 1 only after a trade has started. unsigned int deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE @@ -386,7 +385,7 @@ struct map_session_data { bool party_joining; // whether the char is accepting party invitation int party_invite, party_invite_account; // for handling party invitation (holds party id and account id) int adopt_invite; // Adoption - + struct guild *guild;/* [Ind/Hercules] speed everything up */ int guild_invite,guild_invite_account; int guild_emblem_id,guild_alliance,guild_alliance_account; short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo] @@ -496,7 +495,14 @@ struct map_session_data { int friend_req; int shadowform_id; - + + /* [Ind/Hercules] */ + struct hChSysCh **channels; + unsigned char channel_count; + struct hChSysCh *gcbind; + bool stealth; + unsigned char fontcolor; /* debug-only */ + // temporary debugging of bug #3504 const char* delunit_prevfile; int delunit_prevline; diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index 65c48935a..dea689ebd 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -43,6 +43,7 @@ enum e_pc_permission { PC_PERM_DISABLE_PVM = 0x040000, PC_PERM_DISABLE_PVP = 0x080000, PC_PERM_DISABLE_CMD_DEAD = 0x100000, + PC_PERM_HCHSYS_ADMIN = 0x200000, }; static const struct { @@ -70,6 +71,7 @@ static const struct { { "disable_pvm", PC_PERM_DISABLE_PVM }, { "disable_pvp", PC_PERM_DISABLE_PVP }, { "disable_commands_when_dead", PC_PERM_DISABLE_CMD_DEAD }, + { "hchsys_admin", PC_PERM_HCHSYS_ADMIN }, }; #endif // _PC_GROUPS_H_ diff --git a/src/map/pet.c b/src/map/pet.c index 3edf3367c..28f841809 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -636,7 +636,7 @@ int pet_change_name_ack(struct map_session_data *sd, char* name, int flag) normalize_name(name," ");//bugreport:3032 if ( !flag || !strlen(name) ) { - clif->displaymessage(sd->fd, msg_txt(280)); // You cannot use this name for your pet. + clif->message(sd->fd, msg_txt(280)); // You cannot use this name for your pet. clif->send_petstatus(sd); //Send status so client knows oet name change got rejected. return 0; } diff --git a/src/map/script.c b/src/map/script.c index a6bbdb0bd..e852a6e1e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7262,22 +7262,16 @@ BUILDIN_FUNC(strcharinfo) script_pushstrcopy(st,sd->status.name); break; case 1: - if( ( p = party_search(sd->status.party_id) ) != NULL ) - { + if( ( p = party_search(sd->status.party_id) ) != NULL ) { script_pushstrcopy(st,p->party.name); - } - else - { + } else { script_pushconststr(st,""); } break; case 2: - if( ( g = guild_search(sd->status.guild_id) ) != NULL ) - { + if( ( g = sd->guild ) != NULL ) { script_pushstrcopy(st,g->name); - } - else - { + } else { script_pushconststr(st,""); } break; @@ -12683,7 +12677,7 @@ BUILDIN_FUNC(recovery) status_revive(&sd->bl, 100, 100); else status_percent_heal(&sd->bl, 100, 100); - clif->displaymessage(sd->fd,msg_txt(680)); + clif->message(sd->fd,msg_txt(680)); } mapit_free(iter); return 0; @@ -12898,7 +12892,7 @@ BUILDIN_FUNC(message) if((pl_sd=map_nick2sd((char *) player)) == NULL) return 0; - clif->displaymessage(pl_sd->fd, msg); + clif->message(pl_sd->fd, msg); return 0; } @@ -12919,7 +12913,7 @@ BUILDIN_FUNC(npctalk) safestrncpy(name, nd->name, sizeof(name)); strtok(name, "#"); // discard extra name identifier if present safesnprintf(message, sizeof(message), "%s : %s", name, str); - clif->message(&nd->bl, message); + clif->disp_overhead(&nd->bl, message); } return 0; @@ -15346,7 +15340,7 @@ BUILDIN_FUNC(unitattack) switch( unit_bl->type ) { case BL_PC: - clif->ActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick()); + clif->pActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick()); script_pushint(st, 1); return 0; case BL_MOB: @@ -15404,9 +15398,9 @@ BUILDIN_FUNC(unittalk) struct StringBuf sbuf; StringBuf_Init(&sbuf); StringBuf_Printf(&sbuf, "%s : %s", status_get_name(bl), message); - clif->message(bl, StringBuf_Value(&sbuf)); + clif->disp_overhead(bl, StringBuf_Value(&sbuf)); if( bl->type == BL_PC ) - clif->displaymessage(((TBL_PC*)bl)->fd, StringBuf_Value(&sbuf)); + clif->message(((TBL_PC*)bl)->fd, StringBuf_Value(&sbuf)); StringBuf_Destroy(&sbuf); } diff --git a/src/map/skill.c b/src/map/skill.c index ea70e2fe2..d6b06256e 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -554,7 +554,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) // uncomment for more verbose message. //char output[150]; //sprintf(output, msg_txt(662), battle_config.min_npc_vendchat_distance); - //clif->displaymessage(sd->fd, output); + //clif->message(sd->fd, output); clif->skill_fail(sd,skill_id,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); return 1; } @@ -5069,7 +5069,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); if (skill->break_equip(bl, EQP_WEAPON, 10000, BCT_PARTY) && sd && sd != dstsd) - clif->displaymessage(sd->fd, msg_txt(669)); + clif->message(sd->fd, msg_txt(669)); } break; @@ -5747,7 +5747,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui //NOTE: mobs don't have the sprite animation that is used when performing this skill (will cause glitches) char temp[70]; snprintf(temp, sizeof(temp), "%s : %s !!",md->name,skill_db[skill_id].desc); - clif->message(&md->bl,temp); + clif->disp_overhead(&md->bl,temp); } break; @@ -5972,7 +5972,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } if(!battle_config.duel_allow_teleport && sd->duel_group && skill_lv <= 2) { // duel restriction [LuzZza] char output[128]; sprintf(output, msg_txt(365), skill->get_name(AL_TELEPORT)); - clif->displaymessage(sd->fd, output); //"Duel: Can't use %s in duel." + clif->message(sd->fd, output); //"Duel: Can't use %s in duel." break; } @@ -12426,7 +12426,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case AL_WARP: if(!battle_config.duel_allow_teleport && sd->duel_group) { // duel restriction [LuzZza] char output[128]; sprintf(output, msg_txt(365), skill->get_name(AL_WARP)); - clif->displaymessage(sd->fd, output); //"Duel: Can't use %s in duel." + clif->message(sd->fd, output); //"Duel: Can't use %s in duel." return 0; } break; diff --git a/src/map/storage.c b/src/map/storage.c index 53058f9af..f9c343f09 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -100,7 +100,7 @@ int storage_storageopen(struct map_session_data *sd) if( !pc_can_give_items(sd) ) { //check is this GM level is allowed to put items to storage - clif->displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); return 1; } @@ -150,7 +150,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data, if( !itemdb_canstore(item_data, pc_get_group_level(sd)) ) { //Check if item is storable. [Skotlex] - clif->displaymessage (sd->fd, msg_txt(264)); + clif->message (sd->fd, msg_txt(264)); return 1; } @@ -395,7 +395,7 @@ int storage_guild_storageopen(struct map_session_data* sd) return 1; //Can't open both storages at a time. if( !pc_can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus] - clif->displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); return 1; } @@ -444,7 +444,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto if( !itemdb_canguildstore(item_data, pc_get_group_level(sd)) || item_data->expire_time ) { //Check if item is storable. [Skotlex] - clif->displaymessage (sd->fd, msg_txt(264)); + clif->message (sd->fd, msg_txt(264)); return 1; } diff --git a/src/map/trade.c b/src/map/trade.c index a8174be97..0b9609322 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -32,7 +32,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta nullpo_retv(sd); if (map[sd->bl.m].flag.notrade) { - clif->displaymessage (sd->fd, msg_txt(272)); + clif->message (sd->fd, msg_txt(272)); return; //Can't trade in notrade mapflag maps. } @@ -71,7 +71,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta if (!pc_can_give_items(sd) || !pc_can_give_items(target_sd)) //check if both GMs are allowed to trade { - clif->displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); clif->tradestart(sd, 2); // GM is not allowed to trade return; } @@ -356,14 +356,14 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) if( !itemdb_cantrade(item, src_lv, dst_lv) && //Can't trade (pc_get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade { - clif->displaymessage (sd->fd, msg_txt(260)); + clif->message (sd->fd, msg_txt(260)); clif->tradeitemok(sd, index+2, 1); return; } if( item->expire_time ) { // Rental System - clif->displaymessage (sd->fd, msg_txt(260)); + clif->message (sd->fd, msg_txt(260)); clif->tradeitemok(sd, index+2, 1); return; } diff --git a/src/map/vending.c b/src/map/vending.c index ea0c5fe2a..1f96672f4 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -57,7 +57,7 @@ void vending_vendinglistreq(struct map_session_data* sd, int id) if (!pc_can_give_items(sd) || !pc_can_give_items(vsd)) //check if both GMs are allowed to trade { // GM is not allowed to trade - clif->displaymessage(sd->fd, msg_txt(246)); + clif->message(sd->fd, msg_txt(246)); return; } @@ -286,7 +286,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const } if( i != j ) - clif->displaymessage (sd->fd, msg_txt(266)); //"Some of your items cannot be vended and were removed from the shop." + clif->message (sd->fd, msg_txt(266)); //"Some of your items cannot be vended and were removed from the shop." if( i == 0 ) { // no valid item found |